aboutsummaryrefslogtreecommitdiffstats
path: root/capinfos.c
diff options
context:
space:
mode:
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 /capinfos.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 'capinfos.c')
-rw-r--r--capinfos.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/capinfos.c b/capinfos.c
index 5a3e2b3f56..b3b88c8d79 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -80,6 +80,8 @@
#include <wsutil/privileges.h>
#include <wsutil/ws_diag_control.h>
#include <wsutil/ws_version_info.h>
+#include <wiretap/wtap_opttypes.h>
+#include <wiretap/pcapng.h>
#ifdef HAVE_PLUGINS
#include <wsutil/plugins.h>
@@ -1039,9 +1041,10 @@ process_cap_file(wtap *wth, const char *filename)
nstime_t prev_time;
gboolean know_order = FALSE;
order_t order = IN_ORDER;
- const wtapng_section_t *shb_inf;
+ wtap_optionblock_t shb_inf;
guint i;
wtapng_iface_descriptions_t *idb_info;
+ char *shb_str;
g_assert(wth != NULL);
g_assert(filename != NULL);
@@ -1072,7 +1075,7 @@ process_cap_file(wtap *wth, const char *filename)
/* get IDB info strings */
for (i = 0; i < cf_info.num_interfaces; i++) {
- const wtapng_if_descr_t *if_descr = &g_array_index(idb_info->interface_data, wtapng_if_descr_t, i);
+ const wtap_optionblock_t if_descr = g_array_index(idb_info->interface_data, wtap_optionblock_t, i);
gchar *s = wtap_get_debug_if_descr(if_descr, 21, "\n");
g_array_append_val(cf_info.idb_info_strings, s);
}
@@ -1246,10 +1249,14 @@ process_cap_file(wtap *wth, const char *filename)
shb_inf = wtap_file_get_shb(wth);
if (shb_inf) {
/* opt_comment is always 0-terminated by pcapng_read_section_header_block */
- cf_info.comment = g_strdup(shb_inf->opt_comment);
- cf_info.hardware = g_strdup(shb_inf->shb_hardware);
- cf_info.os = g_strdup(shb_inf->shb_os);
- cf_info.usr_appl = g_strdup(shb_inf->shb_user_appl);
+ wtap_optionblock_get_option_string(shb_inf, OPT_COMMENT, &shb_str);
+ cf_info.comment = g_strdup(shb_str);
+ wtap_optionblock_get_option_string(shb_inf, OPT_SHB_HARDWARE, &shb_str);
+ cf_info.hardware = g_strdup(shb_str);
+ wtap_optionblock_get_option_string(shb_inf, OPT_SHB_OS, &shb_str);
+ cf_info.os = g_strdup(shb_str);
+ wtap_optionblock_get_option_string(shb_inf, OPT_SHB_USERAPPL, &shb_str);
+ cf_info.usr_appl = g_strdup(shb_str);
}
string_replace_newlines(cf_info.comment);