summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/libwireshark0.symbols1
-rw-r--r--epan/decode_as.c35
-rw-r--r--epan/decode_as.h8
3 files changed, 44 insertions, 0 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols
index 0c703b8507..614d9adfca 100644
--- a/debian/libwireshark0.symbols
+++ b/debian/libwireshark0.symbols
@@ -1266,6 +1266,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
register_custom_dissector_table@Base 1.99.8
register_custom_dissector_table@Base 1.99.8
register_decode_as@Base 1.12.0~rc1
+ register_decode_as_next_proto@Base 2.5.0
register_depend_dissector@Base 2.1.0
register_dissector@Base 2.1.0
register_dissector_table@Base 1.9.1
diff --git a/epan/decode_as.c b/epan/decode_as.c
index 1d222deb13..19e6d360b1 100644
--- a/epan/decode_as.c
+++ b/epan/decode_as.c
@@ -55,6 +55,41 @@ void register_decode_as(decode_as_t* reg)
decode_as_list = g_list_append(decode_as_list, reg);
}
+static void next_proto_prompt(packet_info *pinfo _U_, gchar *result)
+{
+ g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Next level protocol as");
+}
+
+static gpointer next_proto_value(packet_info *pinfo _U_)
+{
+ return 0;
+}
+
+static build_valid_func next_proto_values[] = { next_proto_value };
+static decode_as_value_t next_proto_da_values =
+ { next_proto_prompt, 1, next_proto_values };
+
+void register_decode_as_next_proto(
+ const char *name, const gchar *title, const gchar *table_name)
+{
+ decode_as_t *da;
+ dissector_table_t dt;
+
+ dt = find_dissector_table(table_name);
+ DISSECTOR_ASSERT(IS_FT_UINT(dissector_table_get_type(dt)));
+
+ da = wmem_new0(wmem_epan_scope(), decode_as_t);
+ da->name = wmem_strdup(wmem_epan_scope(), name);
+ da->title = wmem_strdup(wmem_epan_scope(), title);
+ da->table_name = wmem_strdup(wmem_epan_scope(), table_name);
+ da->num_items = 1;
+ da->values = &next_proto_da_values;
+ da->populate_list = decode_as_default_populate_list;
+ da->reset_value = decode_as_default_reset;
+ da->change_value = decode_as_default_change;
+
+ register_decode_as(da);
+}
struct decode_as_default_populate
{
diff --git a/epan/decode_as.h b/epan/decode_as.h
index 931d782d28..63398efdf4 100644
--- a/epan/decode_as.h
+++ b/epan/decode_as.h
@@ -85,6 +85,14 @@ typedef struct decode_as_s {
/** register a "Decode As". A copy of the decode_as_t will be maintained by the decode_as module */
WS_DLL_PUBLIC void register_decode_as(decode_as_t* reg);
+/** Register a "Decode As" entry for the special case where there is no
+ indication for the next protocol (such as port number etc.).
+ For now, this will use a uint32 dissector table internally and
+ assign all registered protocols to 0. The framework to do this can
+ be kept internal to epan. */
+WS_DLL_PUBLIC void register_decode_as_next_proto(
+ const char *name, const gchar *title, const gchar *table_name);
+
/* Walk though the dissector table and provide dissector_handle_t for each item in the table */
WS_DLL_PUBLIC void decode_as_default_populate_list(const gchar *table_name, decode_as_add_to_list_func add_to_list, gpointer ui_element);
/* Clear a FT_UINT32 value from dissector table list */