diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-07-14 16:01:57 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-07-14 23:02:39 +0000 |
commit | 1f8999bb96018446e48529e75e56bf17dd3c77cf (patch) | |
tree | 0103d875702fa1a7c64816e21e079d7ceee190c2 /wiretap/wtap.h | |
parent | 42e72d529cdbab62d52a26332985ecf28b997a87 (diff) | |
download | wireshark-1f8999bb96018446e48529e75e56bf17dd3c77cf.tar.gz |
Redo the block options APIs.
A block can have zero or more instances of a given option. We
distinguish between "one instance only" options, where a block can have
zero or one instance, and "multiple instances allowed" options, where a
block can have zero or more instances.
For "one instance only" options:
"add" routines add an instance if there isn't one already
and fail if there is;
"set" routines add an instance if there isn't one already
and change the value of the existing instance if there is one;
"set nth" routines fail;
"get" routines return the value of the instance if there is one
and fail if there isn't;
"get nth" routines fail.
For "multiple instances allowed" options:
"add" routines add an instance;
"set" routines fail;
"set nth" routines set the value of the nth instance if there is
one and fail otherwise;
"get" routines fail;
"get nth" routines get the value if the nth instance if there is
one and fail otherwise.
Rename "optionblock" to just "block"; it describes the contents of a
block, including both mandatory items and options.
Add some support for NRB options, including IPv4 and IPv6 option types.
Change-Id: Iad184f668626c3d1498b2ed00c7f1672e4abf52e
Reviewed-on: https://code.wireshark.org/review/16444
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/wtap.h')
-rw-r--r-- | wiretap/wtap.h | 59 |
1 files changed, 21 insertions, 38 deletions
diff --git a/wiretap/wtap.h b/wiretap/wtap.h index b89701f24c..566ec50a75 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1268,7 +1268,7 @@ typedef struct wtapng_section_mandatory_s { } wtapng_mandatory_section_t; /** struct holding the information to build IDB:s - * the interface_data array holds an array of wtap_optionblock_t + * the interface_data array holds an array of wtap_block_t * represending IDB of one per interface. */ typedef struct wtapng_iface_descriptions_s { @@ -1592,13 +1592,15 @@ int wtap_file_tsprec(wtap *wth); * * @param wth The wiretap session. * @return The existing section header, which must NOT be g_free'd. + * + * XXX - need to be updated to handle multiple SHBs. */ WS_DLL_PUBLIC -wtap_optionblock_t wtap_file_get_shb(wtap *wth); +wtap_block_t wtap_file_get_shb(wtap *wth); /** * @brief Gets new section header block for new file, based on existing info. - * @details Creates a new wtap_optionblock_t section header block and only + * @details Creates a new wtap_block_t section header block and only * copies appropriate members of the SHB for a new file. In * particular, the comment string is copied, and any custom options * which should be copied are copied. The os, hardware, and @@ -1613,16 +1615,6 @@ WS_DLL_PUBLIC GArray* wtap_file_get_shb_for_new_file(wtap *wth); /** - * @brief Gets the section header comment string. - * @details This gets the pointer, without duplicating the string. - * - * @param wth The wtap session. - * @return The comment string. - */ -WS_DLL_PUBLIC -const gchar* wtap_file_get_shb_comment(wtap *wth); - -/** * @brief Sets or replaces the section header comment. * @details The passed-in comment string is set to be the comment * for the section header block. The passed-in string's @@ -1675,46 +1667,37 @@ void wtap_free_idb_info(wtapng_iface_descriptions_t *idb_info); * @return A newly allocated gcahr array string, which must be g_free'd. */ WS_DLL_PUBLIC -gchar *wtap_get_debug_if_descr(const wtap_optionblock_t if_descr, +gchar *wtap_get_debug_if_descr(const wtap_block_t if_descr, const int indent, const char* line_end); /** - * @brief Gets new name resolution info for new file, based on existing info. - * @details Creates a new wtap_optionblock_t of name resolution info and only - * copies appropriate members for a new file. - * - * @note Use wtap_free_nrb() to free the returned pointer. + * @brief Gets existing name resolution block, not for new file. + * @details Returns the pointer to the existing NRB, without creating a + * new one. This should only be used for accessing info, not + * for creating a new file based on existing NRB info. Use + * wtap_file_get_nrb_for_new_file() for that. * * @param wth The wiretap session. - * @return The new name resolution info, which must be freed. - */ -WS_DLL_PUBLIC -GArray* wtap_file_get_nrb_for_new_file(wtap *wth); - -/** - * @brief Gets the name resolution comment, if any. - * @details This retrieves the name resolution comment string pointer, - * possibly NULL. + * @return The existing section header, which must NOT be g_free'd. * - * @param wth The wiretap session. - * @return The comment string. + * XXX - need to be updated to handle multiple NRBs. */ WS_DLL_PUBLIC -const gchar* wtap_get_nrb_comment(wtap *wth); +wtap_block_t wtap_file_get_nrb(wtap *wth); /** - * @brief Sets or replaces the name resolution comment. - * @details The passed-in comment string is set to be the comment - * for the name resolution block. The passed-in string's - * ownership will be owned by the block, so it should be - * duplicated before passing into this function. + * @brief Gets new name resolution info for new file, based on existing info. + * @details Creates a new wtap_block_t of name resolution info and only + * copies appropriate members for a new file. + * + * @note Use wtap_free_nrb() to free the returned pointer. * * @param wth The wiretap session. - * @param comment The comment string. + * @return The new name resolution info, which must be freed. */ WS_DLL_PUBLIC -void wtap_write_nrb_comment(wtap *wth, gchar *comment); +GArray* wtap_file_get_nrb_for_new_file(wtap *wth); /*** close the file descriptors for the current file ***/ WS_DLL_PUBLIC |