aboutsummaryrefslogtreecommitdiffstats
path: root/epan/exported_pdu.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/exported_pdu.c')
-rw-r--r--epan/exported_pdu.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/epan/exported_pdu.c b/epan/exported_pdu.c
index 0fe97ed31e..9efcb2dfe1 100644
--- a/epan/exported_pdu.c
+++ b/epan/exported_pdu.c
@@ -17,10 +17,12 @@
#include <epan/exported_pdu.h>
#include <epan/address_types.h>
#include <epan/tap.h>
+#include <wiretap/wtap.h>
#include <wsutil/pint.h>
static GSList *export_pdu_tap_name_list = NULL;
+static wmem_map_t *export_pdu_encap_table = NULL;
static int exp_pdu_data_ip_size(const address* addr)
{
@@ -112,6 +114,8 @@ static guint exp_pdu_ws_port_type_to_exp_pdu_port_type(port_type pt)
return EXP_PDU_PT_BLUETOOTH;
case PT_IWARP_MPA:
return EXP_PDU_PT_IWARP_MPA;
+ case PT_MCTP:
+ return EXP_PDU_PT_MCTP;
}
DISSECTOR_ASSERT(FALSE);
@@ -222,7 +226,7 @@ export_pdu_create_tags(packet_info *pinfo, const char* proto_name, guint16 tag_t
guint8* buffer_data;
DISSECTOR_ASSERT(proto_name != NULL);
- DISSECTOR_ASSERT((tag_type == EXP_PDU_TAG_PROTO_NAME) || (tag_type == EXP_PDU_TAG_HEUR_PROTO_NAME) || (tag_type == EXP_PDU_TAG_DISSECTOR_TABLE_NAME));
+ DISSECTOR_ASSERT((tag_type == EXP_PDU_TAG_DISSECTOR_NAME) || (tag_type == EXP_PDU_TAG_HEUR_DISSECTOR_NAME) || (tag_type == EXP_PDU_TAG_DISSECTOR_TABLE_NAME));
exp_pdu_data = wmem_new(pinfo->pool, exp_pdu_data_t);
@@ -270,8 +274,24 @@ export_pdu_create_tags(packet_info *pinfo, const char* proto_name, guint16 tag_t
}
gint
+register_export_pdu_tap_with_encap(const char *name, gint encap)
+{
+ gchar *tap_name = g_strdup(name);
+ export_pdu_tap_name_list = g_slist_prepend(export_pdu_tap_name_list, tap_name);
+ wmem_map_insert(export_pdu_encap_table, tap_name, GINT_TO_POINTER(encap));
+ return register_tap(tap_name);
+}
+
+gint
register_export_pdu_tap(const char *name)
{
+#if 0
+ /* XXX: We could register it like this, but don't have to, since
+ * export_pdu_tap_get_encap() returns WTAP_ENCAP_WIRESHARK_UPPER_PDU
+ * if it's not in the encap hash table anyway.
+ */
+ return register_export_pdu_tap_with_encap(name, WTAP_ENCAP_WIRESHARK_UPPER_PDU);
+#endif
gchar *tap_name = g_strdup(name);
export_pdu_tap_name_list = g_slist_prepend(export_pdu_tap_name_list, tap_name);
return register_tap(tap_name);
@@ -290,8 +310,20 @@ get_export_pdu_tap_list(void)
return export_pdu_tap_name_list;
}
+gint
+export_pdu_tap_get_encap(const char* name)
+{
+ gpointer value;
+ if (wmem_map_lookup_extended(export_pdu_encap_table, name, NULL, &value)) {
+ return GPOINTER_TO_INT(value);
+ }
+
+ return WTAP_ENCAP_WIRESHARK_UPPER_PDU;
+}
+
void export_pdu_init(void)
{
+ export_pdu_encap_table = wmem_map_new(wmem_epan_scope(), wmem_str_hash, g_str_equal);
}
void export_pdu_cleanup(void)