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 /cfile.c | |
parent | 42e72d529cdbab62d52a26332985ecf28b997a87 (diff) |
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 'cfile.c')
-rw-r--r-- | cfile.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -35,22 +35,22 @@ cap_file_get_interface_name(void *data, guint32 interface_id) { capture_file *cf = (capture_file *) data; wtapng_iface_descriptions_t *idb_info; - wtap_optionblock_t wtapng_if_descr = NULL; + wtap_block_t wtapng_if_descr = NULL; char* interface_name; idb_info = wtap_file_get_idb_info(cf->wth); if (interface_id < idb_info->interface_data->len) - wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_optionblock_t, interface_id); + wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id); g_free(idb_info); if (wtapng_if_descr) { - wtap_optionblock_get_option_string(wtapng_if_descr, OPT_IDB_NAME, &interface_name); - if (interface_name) + if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &interface_name) == WTAP_OPTTYPE_SUCCESS && + interface_name) return interface_name; - wtap_optionblock_get_option_string(wtapng_if_descr, OPT_IDB_DESCR, &interface_name); - if (interface_name) + if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS && + interface_name) return interface_name; } return "unknown"; |