path: root/cfile.c
diff options
authorMichael Mann <mmann78@netscape.net>2016-01-25 20:17:21 -0500
committerMichael Mann <mmann78@netscape.net>2016-02-23 00:39:38 +0000
commit08d49ff2e06cb35dc9084735aa60c83686afdd9c (patch)
tree93d55773a42d4a1cf64b6544c6e2f3ec03ef4f4e /cfile.c
parent37acf433dbb2ef1d443c9ee09a315b0b4ce136d8 (diff)
Making wiretap option blocks more generic.
This was inspired by https://code.wireshark.org/review/9729/, but takes it in a different direction where all options are put into an array, regardless of whether they are "standard" or "custom". It should be easier to add "custom" options in this design. Some, but not all blocks have been converted. Descriptions of some of the block options have been moved from wtap.h to pcapng.h as it seems to be the one that implements the description of the blocks. Also what could be added/refactored is registering block behavior. Change-Id: I3dffa38f0bb088f98749a4f97a3b7655baa4aa6a Reviewed-on: https://code.wireshark.org/review/13667 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'cfile.c')
1 files changed, 10 insertions, 6 deletions
diff --git a/cfile.c b/cfile.c
index 139e4e8221..e2dafe569c 100644
--- a/cfile.c
+++ b/cfile.c
@@ -26,6 +26,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <wiretap/pcapng.h>
#include "cfile.h"
@@ -34,20 +35,23 @@ cap_file_get_interface_name(void *data, guint32 interface_id)
capture_file *cf = (capture_file *) data;
wtapng_iface_descriptions_t *idb_info;
- const wtapng_if_descr_t *wtapng_if_descr = NULL;
+ wtap_optionblock_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, wtapng_if_descr_t, interface_id);
+ wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_optionblock_t, interface_id);
if (wtapng_if_descr) {
- if (wtapng_if_descr->if_name)
- return wtapng_if_descr->if_name;
- else if (wtapng_if_descr->if_description)
- return wtapng_if_descr->if_description;
+ wtap_optionblock_get_option_string(wtapng_if_descr, OPT_IDB_NAME, &interface_name);
+ if (interface_name)
+ return interface_name;
+ wtap_optionblock_get_option_string(wtapng_if_descr, OPT_IDB_DESCR, &interface_name);
+ if (interface_name)
+ return interface_name;
return "unknown";