From 1c512cc373255b45fb999d331329111cc8d0a9c7 Mon Sep 17 00:00:00 2001 From: Jaap Keuter Date: Tue, 22 Jan 2008 07:36:33 +0000 Subject: From Bill Florac: The displaying of attribute-lists in an "Attribute Reply" (ATTRRPLY) seems to be written to display some special non-conforming attributes. Conforming attributes are either displayed wrong or not displayed at all. When displaying an attributes-list in a "Service Registration" (SRVREG), the attribute list is only displayed as a single string (and usually truncated). While this is not wrong, it should be broken up into the comma separated attributes as "Attribute Requests" tries to do. svn path=/trunk/; revision=24163 --- epan/dissectors/packet-srvloc.c | 55 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) (limited to 'epan/dissectors/packet-srvloc.c') diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c index c400458a03..7616b1ff11 100644 --- a/epan/dissectors/packet-srvloc.c +++ b/epan/dissectors/packet-srvloc.c @@ -156,6 +156,7 @@ static int hf_srvloc_srvrply_svcname = -1; static gint ett_srvloc = -1; +static gint ett_srvloc_attr = -1; static gint ett_srvloc_flags = -1; @@ -567,7 +568,7 @@ attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, for (foffset = offset; foffset~ and 0x00-1F, 0x7f are reserved and must be escaped in the form \HH + */ + + /* create a sub tree for attributes */ + ti = proto_tree_add_item(tree, hf, tvb, offset, length, TRUE); + attr_tree = proto_item_add_subtree(ti, ett_srvloc_attr); + + /* this will ensure there is a terminating null */ + start = tvb_get_ephemeral_string(tvb, offset, length); + + cnt = 0; + x = 0; + c = start[x]; + while (c) { + if (c == ',') { + cnt++; /* Attribute count */ + start[x] = 0; + proto_tree_add_text(attr_tree, tvb, offset, x, "Item %d: %s", cnt, start); + offset += x+1; + start += x+1; + /* reset string length */ + x = 0; + c = start[x]; + } else { + /* increment and get next */ + x++; + c = start[x]; + } + } + /* display anything remaining */ + if (x) { + cnt++; + proto_tree_add_text(attr_tree, tvb, offset, x, "Item %d: %s", cnt, start); + } +} + static int dissect_url_entry_v1(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 encoding, guint16 flags) @@ -1178,7 +1226,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(srvloc_tree, hf_srvloc_attrrply_attrlistlen, tvb, offset, 2, length); if (length > 0) { offset += 2; - attr_list(srvloc_tree, hf_srvloc_attrrply_attrlist, tvb, offset, length, CHARSET_UTF_8); + attr_list2(srvloc_tree, hf_srvloc_attrrply_attrlist, tvb, offset, length, CHARSET_UTF_8); offset += length; count = tvb_get_guint8(tvb, offset); proto_tree_add_uint(srvloc_tree, hf_srvloc_attrrply_attrauthcount, tvb, offset, 1, count); @@ -1788,6 +1836,7 @@ proto_register_srvloc(void) static gint *ett[] = { &ett_srvloc, + &ett_srvloc_attr, &ett_srvloc_flags, }; module_t *srvloc_module; -- cgit v1.2.3