diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-12-16 22:39:41 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-12-16 22:39:41 +0000 |
commit | 068008f04f9c31a47197564b1de2f6f2ddd9b3ab (patch) | |
tree | 626069aac3c295f0612e774fd09ccee255d19397 /epan/dissectors/packet-pnrp.c | |
parent | 54c272466f362a169421c9d8f7571c4c0459d117 (diff) |
Use proto_tree_add_item() in preference to fetching the string and
adding it with proto_tree_add_string(). Use tvb_get_string_enc() rather
than tvb_get_unicode_string() to fetch strings.
We assume a UTF-16 encoding for all "Unicode" strings.
Use tvb_strsize() and tvb_unicode_strsize() to get the lengths of
null-terminated strings.
Get rid of unused ett_nt_unicode_string variable.
svn path=/trunk/; revision=54158
Diffstat (limited to 'epan/dissectors/packet-pnrp.c')
-rw-r--r-- | epan/dissectors/packet-pnrp.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/epan/dissectors/packet-pnrp.c b/epan/dissectors/packet-pnrp.c index ebc8b5f9c6..9de9d3eb48 100644 --- a/epan/dissectors/packet-pnrp.c +++ b/epan/dissectors/packet-pnrp.c @@ -9,7 +9,6 @@ * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -25,9 +24,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* The official Dokumentation for the Peer Name Resolution Protocol can be found at - http://msdn.microsoft.com/en-us/library/cc239047(PROT.13).aspx - This dissector is based on Revision 6.1.2 +/* The official Documentation for the Peer Name Resolution Protocol + * ([MS-PNRP]) can be found at + * + * http://msdn.microsoft.com/en-us/library/cc239047.aspx + * + * This dissector is based on Revision 6.1.2 */ #include "config.h" @@ -221,6 +223,7 @@ static const int *inquire_flags[] = { static gint hf_pnrp_message_classifier_unicodeCount = -1; static gint hf_pnrp_message_classifier_arrayLength = -1; static gint hf_pnrp_message_classifier_entryLength = -1; +static gint hf_pnrp_message_classifier_string = -1; /* ACK Message Flags */ static gint hf_pnrp_message_ack_flags_reserved = -1; static gint hf_pnrp_message_ack_flags_Nbit = -1; @@ -685,7 +688,7 @@ static int dissect_pnrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi /* Entry Length: Must be 0x0002 */ proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_classifier_entryLength, tvb, offset + 10, 2, ENC_BIG_ENDIAN); /* The actual classifier String */ - proto_tree_add_text(pnrp_message_tree, tvb, offset + 12, tvb_get_ntohs(tvb,offset+6)-8, "Classifier: %s",tvb_get_unicode_string(wmem_packet_scope(), tvb, offset + 12, tvb_get_ntohs(tvb,offset+6)-8, ENC_BIG_ENDIAN)); + proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_classifier_string, tvb, offset + 12, tvb_get_ntohs(tvb,offset+6)-8, ENC_UTF_16|ENC_BIG_ENDIAN); } /* There might be padding, so fill up to the next byte */ @@ -1153,6 +1156,9 @@ void proto_register_pnrp(void) { &hf_pnrp_message_classifier_entryLength, { "Entry Length", "pnrp.segment.classifier.entryLength", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_message_classifier_string, + { "Classifier", "pnrp.segment.classifier.string", FT_STRING, STR_UNICODE, NULL, 0x0, + NULL, HFILL }}, /* Ack Flags */ { &hf_pnrp_message_ack_flags_reserved, { "Reserved", "pnrp.segment.ack.flags.reserved", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |