diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-07-14 16:01:57 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-07-14 23:02:39 +0000 |
commit | 1f8999bb96018446e48529e75e56bf17dd3c77cf (patch) | |
tree | 0103d875702fa1a7c64816e21e079d7ceee190c2 /ui/qt/capture_file_properties_dialog.cpp | |
parent | 42e72d529cdbab62d52a26332985ecf28b997a87 (diff) |
Redo the block options APIs.
A block can have zero or more instances of a given option. We
distinguish between "one instance only" options, where a block can have
zero or one instance, and "multiple instances allowed" options, where a
block can have zero or more instances.
For "one instance only" options:
"add" routines add an instance if there isn't one already
and fail if there is;
"set" routines add an instance if there isn't one already
and change the value of the existing instance if there is one;
"set nth" routines fail;
"get" routines return the value of the instance if there is one
and fail if there isn't;
"get nth" routines fail.
For "multiple instances allowed" options:
"add" routines add an instance;
"set" routines fail;
"set nth" routines set the value of the nth instance if there is
one and fail otherwise;
"get" routines fail;
"get nth" routines get the value if the nth instance if there is
one and fail otherwise.
Rename "optionblock" to just "block"; it describes the contents of a
block, including both mandatory items and options.
Add some support for NRB options, including IPv4 and IPv6 option types.
Change-Id: Iad184f668626c3d1498b2ed00c7f1672e4abf52e
Reviewed-on: https://code.wireshark.org/review/16444
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt/capture_file_properties_dialog.cpp')
-rw-r--r-- | ui/qt/capture_file_properties_dialog.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
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")) |