aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-12-03 05:07:18 +0000
committerGuy Harris <guy@alum.mit.edu>2001-12-03 05:07:18 +0000
commit21b9a88b2942558536c9b0f5191261a874b8034a (patch)
tree9f1b2b33fa6322b2481df30e43dc0405a2d34242 /epan
parentd304535254ee7b9b21c5c26e9ae40afca29d1fe5 (diff)
Add a routine tro look for a given port in a given dissector table and,
if found, return the dissector handle for that port. Use that routine in the X.25 dissector; revert to attaching a dissector handle to an X.25 virtual circuit. svn path=/trunk/; revision=4310
Diffstat (limited to 'epan')
-rw-r--r--epan/packet.c22
-rw-r--r--epan/packet.h7
2 files changed, 23 insertions, 6 deletions
diff --git a/epan/packet.c b/epan/packet.c
index 1b04a0db03..bee5f2a43e 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.48 2001/12/03 04:00:14 guy Exp $
+ * $Id: packet.c,v 1.49 2001/12/03 05:07:17 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -348,10 +348,7 @@ dissector_reset(const char *name, guint32 pattern)
/* Look for a given port in a given dissector table and, if found, call
the dissector with the arguments supplied, and return TRUE, otherwise
- return FALSE.
-
- If the arguments supplied don't match the arguments to the dissector,
- do the appropriate translation. */
+ return FALSE. */
gboolean
dissector_try_port(dissector_table_t sub_dissectors, guint32 port,
tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -419,6 +416,21 @@ dissector_try_port(dissector_table_t sub_dissectors, guint32 port,
return FALSE;
}
+/* Look for a given port in a given dissector table and, if found, return
+ the dissector handle for that port. */
+dissector_handle_t
+dissector_get_port_handle(dissector_table_t sub_dissectors, guint32 port)
+{
+ dtbl_entry_t *dtbl_entry;
+
+ dtbl_entry = g_hash_table_lookup(sub_dissectors,
+ GUINT_TO_POINTER(port));
+ if (dtbl_entry != NULL)
+ return dtbl_entry->current;
+ else
+ return NULL;
+}
+
dissector_handle_t
dtbl_entry_get_handle (dtbl_entry_t *dtbl_entry)
{
diff --git a/epan/packet.h b/epan/packet.h
index 83f69c2ee2..c4235eecf9 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.43 2001/12/03 04:00:14 guy Exp $
+ * $Id: packet.h,v 1.44 2001/12/03 05:07:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -131,6 +131,11 @@ extern void dissector_reset(const char *name, guint32 pattern);
extern gboolean dissector_try_port(dissector_table_t sub_dissectors,
guint32 port, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+/* Look for a given port in a given dissector table and, if found, return
+ the dissector handle for that port. */
+extern dissector_handle_t dissector_get_port_handle(
+ dissector_table_t sub_dissectors, guint32 port);
+
/* List of "heuristic" dissectors (which get handed a packet, look at it,
and either recognize it as being for their protocol, dissect it, and
return TRUE, or don't recognize it and return FALSE) to be called