diff --git a/debian/libwiretap0.symbols b/debian/libwiretap0.symbols index da7dcc1381..16a622d8a4 100644 --- a/debian/libwiretap0.symbols +++ b/debian/libwiretap0.symbols @@ -21,7 +21,7 @@ libwiretap.so.0 libwiretap0 #MINVER# register_pcapng_option_handler@Base 1.99.2 wtap_add_generated_idb@Base 3.3.0 wtap_addrinfo_list_empty@Base 2.5.0 - wtap_block_add_custom_option@Base 2.1.2 + wtap_block_add_structured_option@Base 3.5.0 wtap_block_add_ipv4_option@Base 2.1.2 wtap_block_add_ipv6_option@Base 2.1.2 wtap_block_add_string_option@Base 2.1.2 @@ -33,7 +33,7 @@ libwiretap.so.0 libwiretap0 #MINVER# wtap_block_create@Base 2.1.2 wtap_block_foreach_option@Base 2.1.2 wtap_block_free@Base 2.1.2 - wtap_block_get_custom_option_value@Base 2.1.2 + wtap_block_get_structured_option_value@Base 3.5.0 wtap_block_get_ipv4_option_value@Base 2.1.2 wtap_block_get_ipv6_option_value@Base 2.1.2 wtap_block_get_mandatory_data@Base 2.1.2 @@ -44,7 +44,7 @@ libwiretap.so.0 libwiretap0 #MINVER# wtap_block_make_copy@Base 3.3.2 wtap_block_remove_nth_option_instance@Base 2.2.0 wtap_block_remove_option@Base 2.2.0 - wtap_block_set_custom_option_value@Base 2.1.2 + wtap_block_set_structured_option_value@Base 3.5.0 wtap_block_set_ipv4_option_value@Base 2.1.2 wtap_block_set_ipv6_option_value@Base 2.1.2 wtap_block_set_nth_string_option_value@Base 2.1.2 diff --git a/ui/summary.c b/ui/summary.c index 868528583a..565bb86307 100644 --- a/ui/summary.c +++ b/ui/summary.c @@ -171,7 +171,7 @@ summary_fill_in(capture_file *cf, summary_tally *st) for (i = 0; i < idb_info->interface_data->len; i++) { wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, i); wtapng_if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(wtapng_if_descr); - if (wtap_block_get_custom_option_value(wtapng_if_descr, OPT_IDB_FILTER, (void**)&if_filter) == WTAP_OPTTYPE_SUCCESS) { + if (wtap_block_get_structured_option_value(wtapng_if_descr, OPT_IDB_FILTER, (void**)&if_filter) == WTAP_OPTTYPE_SUCCESS) { iface.cfilter = g_strdup(if_filter->if_filter_str); } else { iface.cfilter = NULL; diff --git a/wiretap/erf.c b/wiretap/erf.c index b391a2d1f5..8804f450f8 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -1109,7 +1109,7 @@ static void erf_write_wtap_option_to_interface_tag(wtap_block_t block _U_, { wtapng_if_descr_filter_t *filter; tag_ptr->type = 0xF800; - filter = (wtapng_if_descr_filter_t*)&optval->customval; + filter = (wtapng_if_descr_filter_t*)&optval->structuredval; if(filter->if_filter_str) { tag_ptr->type = ERF_META_TAG_filter; tag_ptr->value = (guint8*)g_strdup(filter->if_filter_str); @@ -2841,7 +2841,7 @@ static int populate_interface_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo break; case ERF_META_TAG_filter: if_filter.if_filter_str = g_strndup((gchar*) tag.value, tag.length); - wtap_block_add_custom_option(int_data, OPT_IDB_FILTER, &if_filter, sizeof if_filter); + wtap_block_add_structured_option(int_data, OPT_IDB_FILTER, &if_filter, sizeof if_filter); g_free(if_filter.if_filter_str); if_info->set_flags.filter = 1; break; @@ -2867,7 +2867,7 @@ static int populate_interface_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo if (state->if_map->module_filter_str) { /* Duplicate because might use with multiple interfaces */ if_filter.if_filter_str = state->if_map->module_filter_str; - wtap_block_add_custom_option(int_data, OPT_IDB_FILTER, &if_filter, sizeof if_filter); + wtap_block_add_structured_option(int_data, OPT_IDB_FILTER, &if_filter, sizeof if_filter); /* * Don't set flag because stream is more specific than module. */ @@ -2875,7 +2875,7 @@ static int populate_interface_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo /* TODO: display separately? Note that we could have multiple captures * from multiple hosts in the file */ if_filter.if_filter_str = state->if_map->capture_filter_str; - wtap_block_add_custom_option(int_data, OPT_IDB_FILTER, &if_filter, sizeof if_filter); + wtap_block_add_structured_option(int_data, OPT_IDB_FILTER, &if_filter, sizeof if_filter); } } @@ -3012,7 +3012,7 @@ static int populate_stream_info(erf_t *erf_priv _U_, wtap *wth, union wtap_pseud /* Override only if not set */ if (!if_info->set_flags.filter) { if_filter.if_filter_str = g_strndup((gchar*) tag.value, tag.length); - wtap_block_add_custom_option(int_data, OPT_IDB_FILTER, &if_filter, sizeof if_filter); + wtap_block_add_structured_option(int_data, OPT_IDB_FILTER, &if_filter, sizeof if_filter); g_free(if_filter.if_filter_str); if_info->set_flags.filter = 1; } diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index b19f625ae4..019bf17084 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -950,7 +950,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh, if_filter.if_filter_bpf_bytes = option_content+1; } /* Fails with multiple options; we silently ignore the failure */ - wtap_block_add_custom_option(wblock->block, oh.option_code, &if_filter, sizeof if_filter); + wtap_block_add_structured_option(wblock->block, oh.option_code, &if_filter, sizeof if_filter); g_free(if_filter.if_filter_str); } else { pcapng_debug("pcapng_read_if_descr_block: if_filter length %u seems strange", oh.option_length); @@ -4541,7 +4541,7 @@ static void compute_idb_option_size(wtap_block_t block _U_, guint option_id, wta break; case OPT_IDB_FILTER: { - wtapng_if_descr_filter_t* filter = (wtapng_if_descr_filter_t*)optval->customval.data; + wtapng_if_descr_filter_t* filter = (wtapng_if_descr_filter_t*)optval->structuredval.data; guint32 pad; if (filter->if_filter_str != NULL) { size = (guint32)(strlen(filter->if_filter_str) + 1) & 0xffff; @@ -4631,7 +4631,7 @@ static void write_wtap_idb_option(wtap_block_t block _U_, guint option_id, wtap_ break; case OPT_IDB_FILTER: { - wtapng_if_descr_filter_t* filter = (wtapng_if_descr_filter_t*)optval->customval.data; + wtapng_if_descr_filter_t* filter = (wtapng_if_descr_filter_t*)optval->structuredval.data; guint32 size, pad; if (filter->if_filter_str != NULL) { size = (guint32)(strlen(filter->if_filter_str) + 1) & 0xffff; diff --git a/wiretap/wtap.c b/wiretap/wtap.c index b5427d34e3..ff4479f68a 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -365,7 +365,7 @@ wtap_get_debug_if_descr(const wtap_block_t if_descr, line_end); } - if (wtap_block_get_custom_option_value(if_descr, OPT_IDB_FILTER, (void**)&if_filter) == WTAP_OPTTYPE_SUCCESS) { + if (wtap_block_get_structured_option_value(if_descr, OPT_IDB_FILTER, (void**)&if_filter) == WTAP_OPTTYPE_SUCCESS) { g_string_append_printf(info, "%*cFilter string = %s%s", indent, ' ', if_filter->if_filter_str ? if_filter->if_filter_str : "NONE", diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c index 9a5f66d9e3..a86a93a804 100644 --- a/wiretap/wtap_opttypes.c +++ b/wiretap/wtap_opttypes.c @@ -36,19 +36,19 @@ typedef struct { GArray *options; /**< array of known options */ } wtap_blocktype_t; -typedef void *(*wtap_opttype_dup_custom_func)(void* src); -typedef void (*wtap_opttype_free_custom_func)(void* data); +typedef void *(*wtap_opttype_dup_structured_func)(void* src); +typedef void (*wtap_opttype_free_structured_func)(void* data); /* * Structure describing a type of option. */ typedef struct { - const char *name; /**< name of option */ - const char *description; /**< human-readable description of option */ - wtap_opttype_e data_type; /**< data type of that option */ - guint flags; /**< flags for the option */ - wtap_opttype_dup_custom_func dup_func; /**< function to duplicate custom option data */ - wtap_opttype_free_custom_func free_func; /**< function to free custom option data */ + const char *name; /**< name of option */ + const char *description; /**< human-readable description of option */ + wtap_opttype_e data_type; /**< data type of that option */ + guint flags; /**< flags for the option */ + wtap_opttype_dup_structured_func dup_func; /**< function to duplicate structured option data */ + wtap_opttype_free_structured_func free_func; /**< function to free structured option data */ } wtap_opttype_t; /* Flags */ @@ -204,9 +204,9 @@ static void wtap_block_free_option(wtap_block_t block, wtap_option_t *opt) g_free(opt->value.stringval); break; - case WTAP_OPTTYPE_CUSTOM: - opttype->free_func(opt->value.customval.data); - g_free(opt->value.customval.data); + case WTAP_OPTTYPE_STRUCTURED: + opttype->free_func(opt->value.structuredval.data); + g_free(opt->value.structuredval.data); break; default: @@ -298,8 +298,8 @@ wtap_block_copy(wtap_block_t dest_block, wtap_block_t src_block) wtap_block_add_string_option(dest_block, src_opt->option_id, src_opt->value.stringval, strlen(src_opt->value.stringval)); break; - case WTAP_OPTTYPE_CUSTOM: - wtap_block_add_custom_option(dest_block, src_opt->option_id, src_opt->value.customval.data, src_opt->value.customval.size); + case WTAP_OPTTYPE_STRUCTURED: + wtap_block_add_structured_option(dest_block, src_opt->option_id, src_opt->value.structuredval.data, src_opt->value.structuredval.size); break; } } @@ -753,50 +753,50 @@ wtap_block_get_nth_string_option_value(wtap_block_t block, guint option_id, guin } wtap_opttype_return_val -wtap_block_add_custom_option(wtap_block_t block, guint option_id, void *value, size_t value_size) +wtap_block_add_structured_option(wtap_block_t block, guint option_id, void *value, size_t value_size) { wtap_opttype_return_val ret; wtap_option_t *opt; wtap_opttype_t *opttype; - ret = wtap_block_add_option_common(block, option_id, WTAP_OPTTYPE_CUSTOM, &opt); + ret = wtap_block_add_option_common(block, option_id, WTAP_OPTTYPE_STRUCTURED, &opt); if (ret != WTAP_OPTTYPE_SUCCESS) return ret; opttype = &g_array_index(block->info->options, wtap_opttype_t, opt->option_id); - opt->value.customval.size = (guint)value_size; - opt->value.customval.data = opttype->dup_func(value); + opt->value.structuredval.size = (guint)value_size; + opt->value.structuredval.data = opttype->dup_func(value); return WTAP_OPTTYPE_SUCCESS; } wtap_opttype_return_val -wtap_block_get_custom_option_value(wtap_block_t block, guint option_id, void** value) +wtap_block_get_structured_option_value(wtap_block_t block, guint option_id, void** value) { wtap_opttype_return_val ret; wtap_optval_t *optval; - ret = wtap_block_get_option_common(block, option_id, WTAP_OPTTYPE_CUSTOM, &optval); + ret = wtap_block_get_option_common(block, option_id, WTAP_OPTTYPE_STRUCTURED, &optval); if (ret != WTAP_OPTTYPE_SUCCESS) return ret; - *value = optval->customval.data; + *value = optval->structuredval.data; return WTAP_OPTTYPE_SUCCESS; } wtap_opttype_return_val -wtap_block_set_custom_option_value(wtap_block_t block, guint option_id, void *value) +wtap_block_set_structured_option_value(wtap_block_t block, guint option_id, void *value) { wtap_opttype_return_val ret; wtap_optval_t *optval; void *prev_value; - ret = wtap_block_get_option_common(block, option_id, WTAP_OPTTYPE_CUSTOM, &optval); + ret = wtap_block_get_option_common(block, option_id, WTAP_OPTTYPE_STRUCTURED, &optval); if (ret != WTAP_OPTTYPE_SUCCESS) return ret; - prev_value = optval->customval.data; + prev_value = optval->structuredval.data; /* * XXX - a custom value can be a structure that points to other data, * but we're doing a shallow copy here. */ - optval->customval.data = g_memdup(value, optval->customval.size); + optval->structuredval.data = g_memdup(value, optval->structuredval.size); /* Free after memory is duplicated in case structure was manipulated with a "get then set" */ g_free(prev_value); @@ -1081,7 +1081,7 @@ void wtap_opttypes_initialize(void) static wtap_opttype_t if_filter = { "filter", "IDB Filter", - WTAP_OPTTYPE_CUSTOM, + WTAP_OPTTYPE_STRUCTURED, 0, idb_filter_dup, idb_filter_free diff --git a/wiretap/wtap_opttypes.h b/wiretap/wtap_opttypes.h index ab246dfc6f..c5d7112c68 100644 --- a/wiretap/wtap_opttypes.h +++ b/wiretap/wtap_opttypes.h @@ -144,7 +144,7 @@ typedef enum { WTAP_OPTTYPE_STRING, WTAP_OPTTYPE_IPv4, WTAP_OPTTYPE_IPv6, - WTAP_OPTTYPE_CUSTOM + WTAP_OPTTYPE_STRUCTURED } wtap_opttype_e; typedef enum { @@ -156,7 +156,7 @@ typedef enum { WTAP_OPTTYPE_ALREADY_EXISTS = -5 } wtap_opttype_return_val; -struct wtap_opttype_custom +struct wtap_opttype_structured { void* data; guint size; @@ -171,7 +171,7 @@ typedef union { guint32 ipv4val; /* network byte order */ ws_in6_addr ipv6val; char *stringval; - struct wtap_opttype_custom customval; + struct wtap_opttype_structured structuredval; } wtap_optval_t; /* @@ -456,7 +456,7 @@ wtap_block_get_nth_string_option_value(wtap_block_t block, guint option_id, guin * error code otherwise */ WS_DLL_PUBLIC wtap_opttype_return_val -wtap_block_add_custom_option(wtap_block_t block, guint option_id, void* value, size_t value_size); +wtap_block_add_structured_option(wtap_block_t block, guint option_id, void* value, size_t value_size); /** Set a "custom" option value in a block * @@ -467,7 +467,7 @@ wtap_block_add_custom_option(wtap_block_t block, guint option_id, void* value, s * error code otherwise */ WS_DLL_PUBLIC wtap_opttype_return_val -wtap_block_set_custom_option_value(wtap_block_t block, guint option_id, void* value); +wtap_block_set_structured_option_value(wtap_block_t block, guint option_id, void* value); /** Get a "custom" option value from a block * @@ -478,7 +478,7 @@ wtap_block_set_custom_option_value(wtap_block_t block, guint option_id, void* va * error code otherwise */ WS_DLL_PUBLIC wtap_opttype_return_val -wtap_block_get_custom_option_value(wtap_block_t block, guint option_id, void** value) G_GNUC_WARN_UNUSED_RESULT; +wtap_block_get_structured_option_value(wtap_block_t block, guint option_id, void** value) G_GNUC_WARN_UNUSED_RESULT; /** Remove an option from a block *