diff options
Diffstat (limited to 'ui/gtk/file_import_dlg.c')
-rw-r--r-- | ui/gtk/file_import_dlg.c | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c index 86248d73fa..3378d1beaf 100644 --- a/ui/gtk/file_import_dlg.c +++ b/ui/gtk/file_import_dlg.c @@ -48,6 +48,8 @@ #include "wsutil/tempfile.h" #include "wsutil/os_version_info.h" #include "wsutil/ws_version_info.h" +#include "wiretap/wtap_opttypes.h" +#include "wiretap/pcapng.h" #define INPUT_FRM_KEY "input_frame" @@ -456,57 +458,49 @@ file_import_open(text_import_info_t *info) int err; /* pcapng defs */ - wtapng_section_t *shb_hdr; + wtap_optionblock_t shb_hdr; wtapng_iface_descriptions_t *idb_inf; - wtapng_if_descr_t int_data; + wtap_optionblock_t int_data; + wtapng_if_descr_mandatory_t *int_data_mand; GString *os_info_str; + gchar *opt_comment, *wireshark_ver; /* Create data for SHB */ os_info_str = g_string_new(""); get_os_version_info(os_info_str); - shb_hdr = g_new(wtapng_section_t,1); - shb_hdr->section_length = -1; + shb_hdr = wtap_optionblock_create(WTAP_OPTION_BLOCK_NG_SECTION); + /* options */ - shb_hdr->opt_comment = g_strdup_printf("File created by File->Import of file %s", info->import_text_filename); - /* - * UTF-8 string containing the description of the hardware used to create - * this section. - */ - shb_hdr->shb_hardware = NULL; + opt_comment = g_strdup_printf("File created by File->Import of file %s", info->import_text_filename); + wtap_optionblock_set_option_string(shb_hdr, OPT_COMMENT, opt_comment); + g_free(opt_comment); + /* * UTF-8 string containing the name of the operating system used to create * this section. */ - shb_hdr->shb_os = g_string_free(os_info_str, FALSE); + wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE)); /* * UTF-8 string containing the name of the application used to create * this section. */ - shb_hdr->shb_user_appl = g_strdup_printf("Wireshark %s", get_ws_vcs_version_info()); - + wireshark_ver = g_strdup_printf("Wireshark %s", get_ws_vcs_version_info()); + wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_USERAPPL, wireshark_ver); + g_free(wireshark_ver); /* Create fake IDB info */ idb_inf = g_new(wtapng_iface_descriptions_t,1); - idb_inf->interface_data = g_array_new(FALSE, FALSE, sizeof(wtapng_if_descr_t)); + idb_inf->interface_data = g_array_new(FALSE, FALSE, sizeof(wtap_optionblock_t)); /* create the fake interface data */ - int_data.wtap_encap = info->encapsulation; - int_data.time_units_per_second = 1000000; /* default microsecond resolution */ - int_data.link_type = wtap_wtap_encap_to_pcap_encap(info->encapsulation); - int_data.snap_len = WTAP_MAX_PACKET_SIZE; - int_data.if_name = g_strdup("Fake IF File->Import"); - int_data.opt_comment = NULL; - int_data.if_description = NULL; - int_data.if_speed = 0; - int_data.if_tsresol = 6; - int_data.if_filter_str = NULL; - int_data.bpf_filter_len = 0; - int_data.if_filter_bpf_bytes = NULL; - int_data.if_os = NULL; - int_data.if_fcslen = -1; - int_data.num_stat_entries = 0; /* Number of ISB:s */ - int_data.interface_statistics = NULL; + int_data = wtap_optionblock_create(WTAP_OPTION_BLOCK_IF_DESCR); + int_data_mand = (wtapng_if_descr_mandatory_t*)wtap_optionblock_get_mandatory_data(int_data); + int_data_mand->wtap_encap = info->encapsulation; + int_data_mand->time_units_per_second = 1000000; /* default microsecond resolution */ + int_data_mand->link_type = wtap_wtap_encap_to_pcap_encap(info->encapsulation); + int_data_mand->snap_len = WTAP_MAX_PACKET_SIZE; + wtap_optionblock_set_option_string(int_data, OPT_IDB_NAME, "Fake IF File->Import"); g_array_append_val(idb_inf->interface_data, int_data); @@ -565,7 +559,7 @@ end: g_free(info->date_timestamp_format); g_free(info); g_free(capfile_name); - wtap_free_shb(shb_hdr); + wtap_optionblock_free(shb_hdr); wtap_free_idb_info(idb_inf); window_destroy(file_import_dlg_w); } |