diff options
-rw-r--r-- | epan/packet.c | 17 | ||||
-rw-r--r-- | epan/packet.h | 7 |
2 files changed, 22 insertions, 2 deletions
diff --git a/epan/packet.c b/epan/packet.c index 56577bf6de..bc15ec865f 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.96 2003/09/07 00:47:56 guy Exp $ + * $Id: packet.c,v 1.97 2003/09/09 18:09:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1023,6 +1023,21 @@ dissector_try_string(dissector_table_t sub_dissectors, const gchar *string, return FALSE; } +/* Look for a given value in a given string dissector table and, if found, + return the dissector handle for that value. */ +dissector_handle_t +dissector_get_string_handle(dissector_table_t sub_dissectors, + const gchar *string) +{ + dtbl_entry_t *dtbl_entry; + + dtbl_entry = find_string_dtbl_entry(sub_dissectors, string); + 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 9c5478821b..0ccc23a655 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.70 2003/09/07 00:47:56 guy Exp $ + * $Id: packet.h,v 1.71 2003/09/09 18:09:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -205,6 +205,11 @@ extern void dissector_reset_string(const char *name, const gchar *pattern); extern gboolean dissector_try_string(dissector_table_t sub_dissectors, const gchar *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +/* Look for a given value in a given string dissector table and, if found, + return the dissector handle for that value. */ +extern dissector_handle_t dissector_get_string_handle( + dissector_table_t sub_dissectors, const gchar *string); + /* Add a handle to the list of handles that *could* be used with this table. That list is used by code in the UI. */ extern void dissector_add_handle(const char *name, dissector_handle_t handle); |