diff options
author | Michael Mann <mmann78@netscape.net> | 2016-05-30 23:42:41 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-06-01 14:33:23 +0000 |
commit | 6fa77a6acb7955c804ec73a571177163ad022623 (patch) | |
tree | 29ca6bfacc3ad843a6a81615bd593c4cab872d0b /tshark.c | |
parent | bd932bb2e11f90c3f95b135ccaeaab7d57623963 (diff) |
Add data structures necessary to support multiple Section Header blocks.
This doesn't try to use any data from multiple Section Header blocks, it
just converts single Section Header block usage into a GArray, so the
potential is there to then use/support multiple Section Header blocks
within a file format (like pcapng)
Change-Id: I6ad1f7b8daf4b1ad7ba0eb1ecf2e170421505486
Reviewed-on: https://code.wireshark.org/review/15636
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 'tshark.c')
-rw-r--r-- | tshark.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -3233,7 +3233,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, char *save_file_string = NULL; gboolean filtering_tap_listeners; guint tap_flags; - wtap_optionblock_t shb_hdr = NULL; + GArray *shb_hdrs = NULL; wtapng_iface_descriptions_t *idb_inf = NULL; wtap_optionblock_t nrb_hdr = NULL; struct wtap_pkthdr phdr; @@ -3265,14 +3265,14 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, } tshark_debug("tshark: snapshot_length = %d", snapshot_length); - shb_hdr = wtap_file_get_shb_for_new_file(cf->wth); + shb_hdrs = wtap_file_get_shb_for_new_file(cf->wth); nrb_hdr = wtap_file_get_nrb_for_new_file(cf->wth); /* If we don't have an application name add Tshark */ - wtap_optionblock_get_option_string(shb_hdr, OPT_SHB_USERAPPL, &shb_user_appl); + wtap_optionblock_get_option_string(g_array_index(shb_hdrs, wtap_optionblock_t, 0), OPT_SHB_USERAPPL, &shb_user_appl); if (shb_user_appl == NULL) { /* this is free'd by wtap_optionblock_free() later */ - wtap_optionblock_set_option_string_format(shb_hdr, OPT_SHB_USERAPPL, "TShark (Wireshark) %s", get_ws_vcs_version_info()); + wtap_optionblock_set_option_string_format(g_array_index(shb_hdrs, wtap_optionblock_t, 0), OPT_SHB_USERAPPL, "TShark (Wireshark) %s", get_ws_vcs_version_info()); } if (linktype != WTAP_ENCAP_PER_PACKET && @@ -3292,10 +3292,10 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, if (strcmp(save_file, "-") == 0) { /* Write to the standard output. */ pdh = wtap_dump_open_stdout_ng(out_file_type, linktype, - snapshot_length, FALSE /* compressed */, shb_hdr, idb_inf, nrb_hdr, &err); + snapshot_length, FALSE /* compressed */, shb_hdrs, idb_inf, nrb_hdr, &err); } else { pdh = wtap_dump_open_ng(save_file, out_file_type, linktype, - snapshot_length, FALSE /* compressed */, shb_hdr, idb_inf, nrb_hdr, &err); + snapshot_length, FALSE /* compressed */, shb_hdrs, idb_inf, nrb_hdr, &err); } } @@ -3513,7 +3513,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, break; } wtap_dump_close(pdh, &err); - wtap_optionblock_free(shb_hdr); + wtap_optionblock_array_free(shb_hdrs); wtap_optionblock_free(nrb_hdr); exit(2); } @@ -3628,7 +3628,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, break; } wtap_dump_close(pdh, &err); - wtap_optionblock_free(shb_hdr); + wtap_optionblock_array_free(shb_hdrs); wtap_optionblock_free(nrb_hdr); exit(2); } @@ -3745,7 +3745,7 @@ out: cf->wth = NULL; g_free(save_file_string); - wtap_optionblock_free(shb_hdr); + wtap_optionblock_array_free(shb_hdrs); wtap_optionblock_free(nrb_hdr); return err; |