aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-07-13 23:48:19 -0700
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-07-14 06:55:12 +0000
commit7b0c4950a53beeb2d42d72cf683b1862a99f63ea (patch)
tree36093e5201eda4cbd70250922a3a45bc7d54c3e8 /wiretap
parentb531a6aa61041647b7ba727b49d3622bee9e01e9 (diff)
wiretap: clean up option definitions a bit.
Spell out "DESCRIPTION" for the IDB description option, as it's spelled out in the pcapng spec. Put the #defines for various options in the same order as the block types for them are in the pcapng spec.
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/erf.c14
-rw-r--r--wiretap/merge.c4
-rw-r--r--wiretap/pcapng.c8
-rw-r--r--wiretap/wtap.c2
-rw-r--r--wiretap/wtap_opttypes.c2
-rw-r--r--wiretap/wtap_opttypes.h21
6 files changed, 25 insertions, 26 deletions
diff --git a/wiretap/erf.c b/wiretap/erf.c
index fde4f20289..9493b05818 100644
--- a/wiretap/erf.c
+++ b/wiretap/erf.c
@@ -1084,7 +1084,7 @@ static gboolean erf_write_wtap_option_to_interface_tag(wtap_block_t block _U_,
tag_ptr->value = (guint8*)g_strdup(optval->stringval);
tag_ptr->length = (guint16)strlen((char*)tag_ptr->value);
break;
- case OPT_IDB_DESCR:
+ case OPT_IDB_DESCRIPTION:
tag_ptr->type = ERF_META_TAG_descr;
tag_ptr->value = (guint8*)g_strdup(optval->stringval);
tag_ptr->length = (guint16)strlen((char*)tag_ptr->value);
@@ -2345,7 +2345,7 @@ static int erf_update_implicit_host_id(erf_t *erf_priv, wtap *wth, guint64 impli
g_free(oldstr);
erf_set_interface_descr(int_data, OPT_IDB_NAME, implicit_host_id, if_map->source_id, (guint8) i, if_info->name);
- erf_set_interface_descr(int_data, OPT_IDB_DESCR, implicit_host_id, if_map->source_id, (guint8) i, if_info->descr);
+ erf_set_interface_descr(int_data, OPT_IDB_DESCRIPTION, implicit_host_id, if_map->source_id, (guint8) i, if_info->descr);
}
}
}
@@ -2365,7 +2365,7 @@ static int erf_update_implicit_host_id(erf_t *erf_priv, wtap *wth, guint64 impli
/* XXX: this is a pointer! */
int_data = g_array_index(wth->interface_data, wtap_block_t, if_info->if_index);
erf_set_interface_descr(int_data, OPT_IDB_NAME, implicit_host_id, if_map->source_id, (guint8) i, if_info->name);
- erf_set_interface_descr(int_data, OPT_IDB_DESCR, implicit_host_id, if_map->source_id, (guint8) i, if_info->descr);
+ erf_set_interface_descr(int_data, OPT_IDB_DESCRIPTION, implicit_host_id, if_map->source_id, (guint8) i, if_info->descr);
}
}
@@ -2505,7 +2505,7 @@ static int erf_populate_interface(erf_t *erf_priv, wtap *wth, union wtap_pseudo_
int_data_mand->interface_statistics = NULL;
erf_set_interface_descr(int_data, OPT_IDB_NAME, host_id, source_id, if_num, NULL);
- erf_set_interface_descr(int_data, OPT_IDB_DESCR, host_id, source_id, if_num, NULL);
+ erf_set_interface_descr(int_data, OPT_IDB_DESCRIPTION, host_id, source_id, if_num, NULL);
if_map->interfaces[if_num].if_index = (int) wth->interface_data->len;
wtap_add_idb(wth, int_data);
@@ -2880,14 +2880,14 @@ static int populate_interface_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo
/* If we have no description, also copy to wtap if_description */
if (!if_info->descr) {
- erf_set_interface_descr(int_data, OPT_IDB_DESCR, state->if_map->host_id, state->if_map->source_id, (guint8) if_num, if_info->name);
+ erf_set_interface_descr(int_data, OPT_IDB_DESCRIPTION, state->if_map->host_id, state->if_map->source_id, (guint8) if_num, if_info->name);
}
}
break;
case ERF_META_TAG_descr:
if (!if_info->descr) {
if_info->descr = g_strndup((gchar*) tag.value, tag.length);
- erf_set_interface_descr(int_data, OPT_IDB_DESCR, state->if_map->host_id, state->if_map->source_id, (guint8) if_num, if_info->descr);
+ erf_set_interface_descr(int_data, OPT_IDB_DESCRIPTION, state->if_map->host_id, state->if_map->source_id, (guint8) if_num, if_info->descr);
/* If we have no name, also copy to wtap if_name */
if (!if_info->name) {
@@ -3563,7 +3563,7 @@ static const struct supported_option_type section_block_options_supported[] = {
static const struct supported_option_type interface_block_options_supported[] = {
{ OPT_COMMENT, ONE_OPTION_SUPPORTED }, /* XXX - multiple? */
{ OPT_IDB_NAME, ONE_OPTION_SUPPORTED },
- { OPT_IDB_DESCR, ONE_OPTION_SUPPORTED },
+ { OPT_IDB_DESCRIPTION, ONE_OPTION_SUPPORTED },
{ OPT_IDB_OS, ONE_OPTION_SUPPORTED },
{ OPT_IDB_TSOFFSET, ONE_OPTION_SUPPORTED },
{ OPT_IDB_SPEED, ONE_OPTION_SUPPORTED },
diff --git a/wiretap/merge.c b/wiretap/merge.c
index 824c7cf6b2..fb9638055c 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -576,8 +576,8 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
}
/* XXX - what do to if we have only one value? */
- have_idb1_value = (wtap_block_get_string_option_value(idb1, OPT_IDB_DESCR, &idb1_if_description) == WTAP_OPTTYPE_SUCCESS);
- have_idb2_value = (wtap_block_get_string_option_value(idb2, OPT_IDB_DESCR, &idb2_if_description) == WTAP_OPTTYPE_SUCCESS);
+ have_idb1_value = (wtap_block_get_string_option_value(idb1, OPT_IDB_DESCRIPTION, &idb1_if_description) == WTAP_OPTTYPE_SUCCESS);
+ have_idb2_value = (wtap_block_get_string_option_value(idb2, OPT_IDB_DESCRIPTION, &idb2_if_description) == WTAP_OPTTYPE_SUCCESS);
if (have_idb1_value && have_idb2_value) {
ws_debug("g_strcmp0(idb1_if_description, idb2_if_description) == 0: %s",
(g_strcmp0(idb1_if_description, idb2_if_description) == 0) ? "TRUE":"FALSE");
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index 320b54fd40..6ff7c70f00 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -1038,7 +1038,7 @@ pcapng_process_if_descr_block_option(wtapng_block_t *wblock,
pcapng_process_string_option(wblock, option_code, option_length,
option_content);
break;
- case(OPT_IDB_DESCR): /* if_description */
+ case(OPT_IDB_DESCRIPTION): /* if_description */
pcapng_process_string_option(wblock, option_code, option_length,
option_content);
break;
@@ -5258,7 +5258,7 @@ static guint32 compute_idb_option_size(wtap_block_t block _U_, guint option_id,
switch(option_id)
{
case OPT_IDB_NAME:
- case OPT_IDB_DESCR:
+ case OPT_IDB_DESCRIPTION:
case OPT_IDB_OS:
case OPT_IDB_HARDWARE:
size = pcapng_compute_string_option_size(optval);
@@ -5288,7 +5288,7 @@ static gboolean write_wtap_idb_option(wtap_dumper *wdh, wtap_block_t block _U_,
switch(option_id)
{
case OPT_IDB_NAME:
- case OPT_IDB_DESCR:
+ case OPT_IDB_DESCRIPTION:
case OPT_IDB_OS:
case OPT_IDB_HARDWARE:
if (!pcapng_write_string_option(wdh, option_id, optval, err))
@@ -5633,7 +5633,7 @@ static const struct supported_option_type interface_block_options_supported[] =
{ OPT_CUSTOM_STR_NO_COPY, MULTIPLE_OPTIONS_SUPPORTED },
{ OPT_CUSTOM_BIN_NO_COPY, MULTIPLE_OPTIONS_SUPPORTED },
{ OPT_IDB_NAME, ONE_OPTION_SUPPORTED },
- { OPT_IDB_DESCR, ONE_OPTION_SUPPORTED },
+ { OPT_IDB_DESCRIPTION, ONE_OPTION_SUPPORTED },
{ OPT_IDB_IP4ADDR, MULTIPLE_OPTIONS_SUPPORTED },
{ OPT_IDB_IP6ADDR, MULTIPLE_OPTIONS_SUPPORTED },
{ OPT_IDB_MACADDR, ONE_OPTION_SUPPORTED },
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index c652cbc7ad..281dd2f192 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -328,7 +328,7 @@ wtap_get_debug_if_descr(const wtap_block_t if_descr,
line_end);
}
- if (wtap_block_get_string_option_value(if_descr, OPT_IDB_DESCR, &tmp_content) == WTAP_OPTTYPE_SUCCESS) {
+ if (wtap_block_get_string_option_value(if_descr, OPT_IDB_DESCRIPTION, &tmp_content) == WTAP_OPTTYPE_SUCCESS) {
g_string_append_printf(info,
"%*cDescription = %s%s", indent, ' ',
tmp_content ? tmp_content : "NONE",
diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c
index 2f7694c223..476fc1b69b 100644
--- a/wiretap/wtap_opttypes.c
+++ b/wiretap/wtap_opttypes.c
@@ -1655,7 +1655,7 @@ void wtap_opttypes_initialize(void)
*/
wtap_opttype_block_register(&idb_block);
wtap_opttype_option_register(&idb_block, OPT_IDB_NAME, &if_name);
- wtap_opttype_option_register(&idb_block, OPT_IDB_DESCR, &if_description);
+ wtap_opttype_option_register(&idb_block, OPT_IDB_DESCRIPTION, &if_description);
wtap_opttype_option_register(&idb_block, OPT_IDB_SPEED, &if_speed);
wtap_opttype_option_register(&idb_block, OPT_IDB_TSRESOL, &if_tsresol);
wtap_opttype_option_register(&idb_block, OPT_IDB_FILTER, &if_filter);
diff --git a/wiretap/wtap_opttypes.h b/wiretap/wtap_opttypes.h
index 249f6482ab..87a71e27ba 100644
--- a/wiretap/wtap_opttypes.h
+++ b/wiretap/wtap_opttypes.h
@@ -47,7 +47,7 @@ extern "C" {
* of the device used to capture data.
* "eth0" / "\Device\NPF_{AD1CE675-96D0-47C5-ADD0-2504B9126B68}"
*/
-#define OPT_IDB_DESCR 3 /**< A UTF-8 string containing the description
+#define OPT_IDB_DESCRIPTION 3 /**< A UTF-8 string containing the description
* of the device used to capture data.
* "Wi-Fi" / "Local Area Connection" /
* "Wireless Network Connection" /
@@ -114,6 +114,15 @@ extern "C" {
* "NETGEAR WNA1000Mv2 N150 Wireless USB Micro Adapter"
*/
+/*
+ * These are the flags for an EPB, but we use them for all WTAP_BLOCK_PACKET
+ */
+#define OPT_PKT_FLAGS 2
+#define OPT_PKT_HASH 3
+#define OPT_PKT_DROPCOUNT 4
+#define OPT_PKT_PACKETID 5
+#define OPT_PKT_QUEUE 6
+#define OPT_PKT_VERDICT 7
/* Name Resolution Block (NRB) */
#define OPT_NS_DNSNAME 2
@@ -129,16 +138,6 @@ extern "C" {
#define OPT_ISB_OSDROP 7
#define OPT_ISB_USRDELIV 8
-/*
- * These are the flags for an EPB, but we use them for all WTAP_BLOCK_PACKET
- */
-#define OPT_PKT_FLAGS 2
-#define OPT_PKT_HASH 3
-#define OPT_PKT_DROPCOUNT 4
-#define OPT_PKT_PACKETID 5
-#define OPT_PKT_QUEUE 6
-#define OPT_PKT_VERDICT 7
-
struct wtap_block;
typedef struct wtap_block *wtap_block_t;