Add "dissector_get_string_handle()" for string dissector tables, similar

to "dissector_get_port_handle()" for uint dissector tables.

svn path=/trunk/; revision=8434
This commit is contained in:
Guy Harris 2003-09-09 18:09:42 +00:00
parent 24bf25d652
commit 92fbca527d
2 changed files with 22 additions and 2 deletions

View File

@ -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)
{

View File

@ -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);