diff options
author | Anders Broman <anders.broman@ericsson.com> | 2004-11-09 06:49:35 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2004-11-09 06:49:35 +0000 |
commit | f1b50652733688725b2a281e0446be8b1c3a218d (patch) | |
tree | bac6eeb02935d604163422cedb87d9d3eb5ede24 | |
parent | 4bd439e2c46a27d1a5dcafb6c26cf4d83a19ff70 (diff) | |
download | wireshark-f1b50652733688725b2a281e0446be8b1c3a218d.tar.gz wireshark-f1b50652733688725b2a281e0446be8b1c3a218d.tar.bz2 wireshark-f1b50652733688725b2a281e0446be8b1c3a218d.zip |
Make it possible to print name of OID strings for PER coded OID:s as well.
svn path=/trunk/; revision=12496
-rw-r--r-- | epan/dissectors/packet-ber.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-ber.h | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-per.c | 13 |
3 files changed, 21 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index fee26c22b6..c199baa7b8 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -134,12 +134,20 @@ register_ber_oid_dissector(char *oid, dissector_t dissector, int proto, char *na dissector_add_string("ber.oid", oid, dissector_handle); g_hash_table_insert(oid_table, oid, name); } -/* Register the oid name to get a nice translation in proto dissection */ +/* Register the oid name to get translation in proto dissection */ void register_ber_oid_name(char *oid, char *name) { g_hash_table_insert(oid_table, oid, name); } + +/* Get oid name fom has table to get translation in proto dissection(packet-per.c) */ +char * +get_ber_oid_name(char *oid) +{ + return g_hash_table_lookup(oid_table, oid); +} + int call_ber_oid_callback(char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { diff --git a/epan/dissectors/packet-ber.h b/epan/dissectors/packet-ber.h index 12c6bdfa7a..8f0c2e4a93 100644 --- a/epan/dissectors/packet-ber.h +++ b/epan/dissectors/packet-ber.h @@ -162,5 +162,6 @@ int call_ber_oid_callback(char *oid, tvbuff_t *tvb, int offset, packet_info *pin void register_ber_oid_dissector(char *oid, dissector_t dissector, int proto, char *name); void register_ber_oid_name(char *oid, char *name); void dissect_ber_oid_NULL_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +char * get_ber_oid_name(char *str); #endif /* __PACKET_BER_H__ */ diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 3c6baa4938..cb8b47d528 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -40,6 +40,7 @@ proper helper routines #include <epan/prefs.h> #include "packet-per.h" +#include "packet-ber.h" static int proto_per = -1; @@ -539,10 +540,11 @@ guint32 dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index, char *value_string) { int i,count; - char str[256],*strp; + char str[256],*strp,*name; guint8 byte; guint32 value; proto_tree *etr=NULL; + proto_item *item; DEBUG_ENTRY("dissect_per_object_identifier"); @@ -591,7 +593,14 @@ PER_NOT_DECODED_YET("too long octet_string"); } *strp=0; - proto_tree_add_string(tree, hf_index, tvb, (offset>>3)-count, count, str); + item=proto_tree_add_string(tree, hf_index, tvb, (offset>>3)-count, count, str); + /* see if we know the name of this oid */ + if(item){ + name = get_ber_oid_name(str); + if(name){ + proto_item_append_text(item, " (%s)", name); + } + } if (value_string) { strcpy(value_string, str); |