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 /ui | |
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 'ui')
-rw-r--r-- | ui/gtk/file_import_dlg.c | 6 | ||||
-rw-r--r-- | ui/tap_export_pdu.c | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c index b39b38fa0a..338c312ad4 100644 --- a/ui/gtk/file_import_dlg.c +++ b/ui/gtk/file_import_dlg.c @@ -459,6 +459,7 @@ file_import_open(text_import_info_t *info) /* pcapng defs */ wtap_optionblock_t shb_hdr; + GArray *shb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_optionblock_t)); wtapng_iface_descriptions_t *idb_inf; wtap_optionblock_t int_data; wtapng_if_descr_mandatory_t *int_data_mand; @@ -500,13 +501,14 @@ file_import_open(text_import_info_t *info) wtap_optionblock_set_option_string(int_data, OPT_IDB_NAME, "Fake IF File->Import", strlen("Fake IF File->Import")); g_array_append_val(idb_inf->interface_data, int_data); + g_array_append_val(shb_hdrs, shb_hdr); /* Use a random name for the temporary import buffer */ info->wdh = wtap_dump_open_tempfile_ng(&tmpname, "import", WTAP_FILE_TYPE_SUBTYPE_PCAPNG, info->encapsulation, info->max_frame_length, FALSE, - shb_hdr, idb_inf, NULL, &err); + shb_hdrs, idb_inf, NULL, &err); capfile_name = g_strdup(tmpname); if (info->wdh == NULL) { open_failure_alert_box(tmpname ? tmpname : "temporary file", err, TRUE); @@ -555,7 +557,7 @@ end: g_free(info->date_timestamp_format); g_free(info); g_free(capfile_name); - wtap_optionblock_free(shb_hdr); + wtap_optionblock_array_free(shb_hdrs); wtap_free_idb_info(idb_inf); window_destroy(file_import_dlg_w); } diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c index 37706ba718..a151e72567 100644 --- a/ui/tap_export_pdu.c +++ b/ui/tap_export_pdu.c @@ -103,6 +103,7 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment) /* pcapng defs */ wtap_optionblock_t shb_hdr; + GArray *shb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_optionblock_t)); wtapng_iface_descriptions_t *idb_inf; wtap_optionblock_t int_data; wtapng_if_descr_mandatory_t *int_data_mand; @@ -148,9 +149,11 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment) g_array_append_val(idb_inf->interface_data, int_data); + g_array_append_val(shb_hdrs, shb_hdr); + /* Use a random name for the temporary import buffer */ exp_pdu_tap_data->wdh = wtap_dump_fdopen_ng(fd, WTAP_FILE_TYPE_SUBTYPE_PCAPNG, WTAP_ENCAP_WIRESHARK_UPPER_PDU, WTAP_MAX_PACKET_SIZE, FALSE, - shb_hdr, idb_inf, NULL, &err); + shb_hdrs, idb_inf, NULL, &err); if (exp_pdu_tap_data->wdh == NULL) { g_assert(err != 0); return err; |