aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/file_import_dlg.c24
-rw-r--r--ui/gtk/summary_dlg.c45
-rw-r--r--ui/qt/capture_file_properties_dialog.cpp23
-rw-r--r--ui/qt/resolved_addresses_dialog.cpp17
-rw-r--r--ui/tap_export_pdu.c24
5 files changed, 74 insertions, 59 deletions
diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c
index 338c312ad4..dc6a97a4f5 100644
--- a/ui/gtk/file_import_dlg.c
+++ b/ui/gtk/file_import_dlg.c
@@ -458,10 +458,10 @@ file_import_open(text_import_info_t *info)
int err;
/* pcapng defs */
- wtap_optionblock_t shb_hdr;
- GArray *shb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_optionblock_t));
+ wtap_block_t shb_hdr;
+ GArray *shb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_block_t));
wtapng_iface_descriptions_t *idb_inf;
- wtap_optionblock_t int_data;
+ wtap_block_t int_data;
wtapng_if_descr_mandatory_t *int_data_mand;
GString *os_info_str;
gsize opt_len;
@@ -470,35 +470,35 @@ file_import_open(text_import_info_t *info)
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
- shb_hdr = wtap_optionblock_create(WTAP_OPTION_BLOCK_NG_SECTION);
+ shb_hdr = wtap_block_create(WTAP_BLOCK_NG_SECTION);
/* options */
- wtap_optionblock_set_option_string_format(shb_hdr, OPT_COMMENT, "File created by File->Import of file %s", info->import_text_filename);
+ wtap_block_add_string_option_format(shb_hdr, OPT_COMMENT, "File created by File->Import of file %s", info->import_text_filename);
/*
* UTF-8 string containing the name of the operating system used to create
* this section.
*/
opt_len = os_info_str->len;
- wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE), opt_len);
+ wtap_block_add_string_option(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE), opt_len);
/*
* UTF-8 string containing the name of the application used to create
* this section.
*/
- wtap_optionblock_set_option_string_format(shb_hdr, OPT_SHB_USERAPPL, "Wireshark %s", get_ws_vcs_version_info());
+ wtap_block_add_string_option_format(shb_hdr, OPT_SHB_USERAPPL, "Wireshark %s", get_ws_vcs_version_info());
/* Create fake IDB info */
idb_inf = g_new(wtapng_iface_descriptions_t,1);
- idb_inf->interface_data = g_array_new(FALSE, FALSE, sizeof(wtap_optionblock_t));
+ idb_inf->interface_data = g_array_new(FALSE, FALSE, sizeof(wtap_block_t));
/* create the fake interface data */
- 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 = wtap_block_create(WTAP_BLOCK_IF_DESCR);
+ int_data_mand = (wtapng_if_descr_mandatory_t*)wtap_block_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", strlen("Fake IF File->Import"));
+ wtap_block_add_string_option(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);
@@ -557,7 +557,7 @@ end:
g_free(info->date_timestamp_format);
g_free(info);
g_free(capfile_name);
- wtap_optionblock_array_free(shb_hdrs);
+ wtap_block_array_free(shb_hdrs);
wtap_free_idb_info(idb_inf);
window_destroy(file_import_dlg_w);
}
diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c
index 8bb85774ab..78f596c49e 100644
--- a/ui/gtk/summary_dlg.c
+++ b/ui/gtk/summary_dlg.c
@@ -188,9 +188,8 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
unsigned int elapsed_time;
iface_options iface;
- wtap_optionblock_t shb_inf;
+ wtap_block_t shb_inf;
unsigned int i;
- GArray *opts;
if (summary_dlg != NULL) {
/* There's already a Summary dialog box; reactivate it. */
@@ -293,14 +292,13 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (comment_view));
gtk_text_buffer_set_text (buffer, "", -1);
if (shb_inf != NULL) {
- wtap_optionblock_get_string_options(shb_inf, OPT_COMMENT, &opts);
- for (i = 0; i < opts->len; i++) {
- /* XXX - this only shows the last comment */
- char *opt_comment = g_array_index(opts, char *, i);
+ char *opt_comment;
+
+ /* XXX - this only shows the last comment */
+ for (i = 0; wtap_block_get_nth_string_option_value(shb_inf, OPT_COMMENT, i, &opt_comment) == WTAP_OPTTYPE_SUCCESS; i++) {
if (opt_comment != NULL && opt_comment[0] != '\0')
gtk_text_buffer_set_text (buffer, opt_comment, -1);
}
- g_array_free(opts, TRUE);
}
gtk_box_pack_start(GTK_BOX(comment_vbox), comment_view, TRUE, TRUE, 0);
gtk_widget_show (comment_view);
@@ -350,21 +348,21 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
if (shb_inf != NULL) {
char *str;
- wtap_optionblock_get_option_string(shb_inf, OPT_SHB_HARDWARE, &str);
- if (str != NULL && str[0] != '\0') {
+ if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS &&
+ str != NULL && str[0] != '\0') {
g_snprintf(string_buff, SHB_STR_SNIP_LEN, "%s", str);
add_string_to_grid(grid, &row, "Capture HW:",string_buff);
}
- wtap_optionblock_get_option_string(shb_inf, OPT_SHB_OS, &str);
- if (str != NULL && str[0] != '\0') {
+ if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS &&
+ str != NULL && str[0] != '\0') {
/* truncate the strings to a reasonable length */
g_snprintf(string_buff, SHB_STR_SNIP_LEN, "%s", str);
add_string_to_grid(grid, &row, "OS:", string_buff);
}
- wtap_optionblock_get_option_string(shb_inf, OPT_SHB_USERAPPL, &str);
- if (str != NULL && str[0] != '\0') {
+ if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS &&
+ str != NULL && str[0] != '\0') {
/* truncate the strings to a reasonable length */
g_snprintf(string_buff, SHB_STR_SNIP_LEN, "%s", str);
add_string_to_grid(grid, &row, "Capture application:", string_buff);
@@ -664,8 +662,7 @@ summary_to_texbuff(GtkTextBuffer *buffer)
summary_tally summary;
gchar string_buff[SUM_STR_MAX];
gchar tmp_buff[SUM_STR_MAX];
- wtap_optionblock_t shb_inf;
- GArray *opts;
+ wtap_block_t shb_inf;
unsigned int i;
unsigned int elapsed_time;
iface_options iface;
@@ -768,20 +765,20 @@ summary_to_texbuff(GtkTextBuffer *buffer)
if (shb_inf != NULL) {
char *str;
- wtap_optionblock_get_option_string(shb_inf, OPT_SHB_HARDWARE, &str);
- if (str != NULL && str[0] != '\0') {
+ if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS &&
+ str != NULL && str[0] != '\0') {
/* truncate the string to a reasonable length */
g_snprintf(string_buff, SUM_STR_MAX, INDENT "Capture HW: %s\n", str);
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
}
- wtap_optionblock_get_option_string(shb_inf, OPT_SHB_OS, &str);
- if (str != NULL && str[0] != '\0') {
+ if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS &&
+ str != NULL && str[0] != '\0') {
/* truncate the strings to a reasonable length */
g_snprintf(string_buff, SUM_STR_MAX, INDENT "OS: %s\n", str);
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
}
- wtap_optionblock_get_option_string(shb_inf, OPT_SHB_USERAPPL, &str);
- if (str != NULL && str[0] != '\0') {
+ if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS &&
+ str != NULL && str[0] != '\0') {
/* truncate the string to a reasonable length */
g_snprintf(string_buff, SUM_STR_MAX, INDENT "Capture application: %s\n", str);
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
@@ -901,10 +898,10 @@ summary_to_texbuff(GtkTextBuffer *buffer)
/* Trace file comments from SHB */
shb_inf = wtap_file_get_shb(cfile.wth);
if (shb_inf != NULL) {
- wtap_optionblock_get_string_options(shb_inf, OPT_COMMENT, &opts);
- for (i = 0; i < opts->len; i++) {
+ char *opt_comment;
+
+ for (i = 0; wtap_block_get_nth_string_option_value(shb_inf, OPT_COMMENT, i, &opt_comment) == WTAP_OPTTYPE_SUCCESS; i++) {
/* XXX - separator between comments? */
- char *opt_comment = g_array_index(opts, char *, i);
if (opt_comment != NULL && opt_comment[0] != '\0')
gtk_text_buffer_insert_at_cursor(buffer, opt_comment, -1);
}
diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp
index 59c5bcf6d2..60ce9ddcb1 100644
--- a/ui/qt/capture_file_properties_dialog.cpp
+++ b/ui/qt/capture_file_properties_dialog.cpp
@@ -242,14 +242,15 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
out << section_tmpl_.arg(tr("Capture"));
out << table_begin;
- wtap_optionblock_t shb_inf = wtap_file_get_shb(cap_file_.capFile()->wth);
+ wtap_block_t shb_inf = wtap_file_get_shb(cap_file_.capFile()->wth);
char *str;
if (shb_inf != NULL) {
QString capture_hardware(unknown);
- wtap_optionblock_get_option_string(shb_inf, OPT_SHB_HARDWARE, &str);
- if (str != NULL && str[0] != '\0') {
- capture_hardware = str;
+ if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS) {
+ if (str != NULL && str[0] != '\0') {
+ capture_hardware = str;
+ }
}
// capture HW
out << table_row_begin
@@ -258,9 +259,10 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
<< table_row_end;
QString capture_os(unknown);
- wtap_optionblock_get_option_string(shb_inf, OPT_SHB_OS, &str);
- if (str != NULL && str[0] != '\0') {
- capture_os = str;
+ if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS) {
+ if (str != NULL && str[0] != '\0') {
+ capture_os = str;
+ }
}
out << table_row_begin
<< table_vheader_tmpl.arg(tr("OS"))
@@ -268,9 +270,10 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
<< table_row_end;
QString capture_app(unknown);
- wtap_optionblock_get_option_string(shb_inf, OPT_SHB_USERAPPL, &str);
- if (str != NULL && str[0] != '\0') {
- capture_app = str;
+ if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS) {
+ if (str != NULL && str[0] != '\0') {
+ capture_app = str;
+ }
}
out << table_row_begin
<< table_vheader_tmpl.arg(tr("Application"))
diff --git a/ui/qt/resolved_addresses_dialog.cpp b/ui/qt/resolved_addresses_dialog.cpp
index 791f6d1ca7..2e8b45cd0b 100644
--- a/ui/qt/resolved_addresses_dialog.cpp
+++ b/ui/qt/resolved_addresses_dialog.cpp
@@ -197,7 +197,22 @@ ResolvedAddressesDialog::ResolvedAddressesDialog(QWidget *parent, CaptureFile *c
wtap* wth = capture_file->capFile()->wth;
if (wth) {
// might return null
- comment_ = wtap_get_nrb_comment(wth);
+ wtap_block_t nrb_hdr;
+
+ /*
+ * XXX - support multiple NRBs.
+ */
+ nrb_hdr = wtap_file_get_nrb(wth);
+ if (nrb_hdr != NULL) {
+ char *str;
+
+ /*
+ * XXX - support multiple comments.
+ */
+ if (wtap_block_get_nth_string_option_value(nrb_hdr, OPT_COMMENT, 0, &str) == WTAP_OPTTYPE_SUCCESS) {
+ comment_ = str;
+ }
+ }
}
}
diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c
index a151e72567..02cd3df33f 100644
--- a/ui/tap_export_pdu.c
+++ b/ui/tap_export_pdu.c
@@ -102,10 +102,10 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment)
int err;
/* pcapng defs */
- wtap_optionblock_t shb_hdr;
- GArray *shb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_optionblock_t));
+ wtap_block_t shb_hdr;
+ GArray *shb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_block_t));
wtapng_iface_descriptions_t *idb_inf;
- wtap_optionblock_t int_data;
+ wtap_block_t int_data;
wtapng_if_descr_mandatory_t *int_data_mand;
GString *os_info_str;
gsize opt_len;
@@ -114,10 +114,10 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment)
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
- shb_hdr = wtap_optionblock_create(WTAP_OPTION_BLOCK_NG_SECTION);
+ shb_hdr = wtap_block_create(WTAP_BLOCK_NG_SECTION);
/* options */
- wtap_optionblock_set_option_string(shb_hdr, OPT_COMMENT, comment, strlen(comment));
+ wtap_block_add_string_option(shb_hdr, OPT_COMMENT, comment, strlen(comment));
g_free(comment);
/*
@@ -125,27 +125,27 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment)
* this section.
*/
opt_len = os_info_str->len;
- wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE), opt_len);
+ wtap_block_add_string_option(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE), opt_len);
/*
* UTF-8 string containing the name of the application used to create
* this section.
*/
- wtap_optionblock_set_option_string_format(shb_hdr, OPT_SHB_USERAPPL, "Wireshark %s", get_ws_vcs_version_info());
+ wtap_block_add_string_option_format(shb_hdr, OPT_SHB_USERAPPL, "Wireshark %s", get_ws_vcs_version_info());
/* Create fake IDB info */
idb_inf = g_new(wtapng_iface_descriptions_t,1);
- idb_inf->interface_data = g_array_new(FALSE, FALSE, sizeof(wtap_optionblock_t));
+ idb_inf->interface_data = g_array_new(FALSE, FALSE, sizeof(wtap_block_t));
/* create the fake interface data */
- 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 = wtap_block_create(WTAP_BLOCK_IF_DESCR);
+ int_data_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(int_data);
int_data_mand->wtap_encap = WTAP_ENCAP_WIRESHARK_UPPER_PDU;
int_data_mand->time_units_per_second = 1000000000; /* default nanosecond resolution */
int_data_mand->link_type = wtap_wtap_encap_to_pcap_encap(WTAP_ENCAP_WIRESHARK_UPPER_PDU);
int_data_mand->snap_len = WTAP_MAX_PACKET_SIZE;
- wtap_optionblock_set_option_string(int_data, OPT_IDB_NAME, "Fake IF, PDU->Export", strlen("Fake IF, PDU->Export"));
- wtap_optionblock_set_option_uint8(int_data, OPT_IDB_TSRESOL, 9);
+ wtap_block_add_string_option(int_data, OPT_IDB_NAME, "Fake IF, PDU->Export", strlen("Fake IF, PDU->Export"));
+ wtap_block_add_uint8_option(int_data, OPT_IDB_TSRESOL, 9);
g_array_append_val(idb_inf->interface_data, int_data);