svn commit: lorikeet r40 - in trunk/ethereal/plugins/pidl: .
tpot at samba.org
tpot at samba.org
Sat Sep 4 01:54:58 GMT 2004
Author: tpot
Date: 2004-09-04 01:54:58 +0000 (Sat, 04 Sep 2004)
New Revision: 40
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=lorikeet&path=/trunk/ethereal/plugins/pidl&rev=40&nolog=1
Log:
Start to prettify strings. Place decoded string in higher level proto_tree
so the user doesn't have to expand the string tree in order to see its value.
Modified:
trunk/ethereal/plugins/pidl/eparser.c
Changeset:
Modified: trunk/ethereal/plugins/pidl/eparser.c
===================================================================
--- trunk/ethereal/plugins/pidl/eparser.c 2004-09-02 11:42:20 UTC (rev 39)
+++ trunk/ethereal/plugins/pidl/eparser.c 2004-09-04 01:54:58 UTC (rev 40)
@@ -67,6 +67,9 @@
switch (ndr->flags & LIBNDR_STRING_FLAGS) {
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
+ {
+ proto_item *item;
+ char *s;
ndr_pull_uint32(ndr, tree, hf_string4_len, &len1);
ndr_pull_uint32(ndr, tree, hf_string4_offset, &ofs);
@@ -77,14 +80,26 @@
data = g_malloc(len2*2);
- proto_tree_add_bytes(tree, hf_string_data, ndr->tvb,
- ndr->offset, len2 * 2, data);
+ item = proto_tree_add_none_format(
+ tree, hf_string_data, ndr->tvb,
+ ndr->offset, len2 * 2, "Data");
+ s = tvb_fake_unicode(ndr->tvb, ndr->offset, len2, TRUE);
+
+ if (strlen(s) > 0) {
+ proto_item_append_text(item, ": %s", s);
+ if (item && item->parent)
+ proto_item_append_text(
+ item->parent, ": %s", s);
+ }
+
+ g_free(s);
g_free(data);
ndr->offset += len2 * 2;
break;
+ }
case LIBNDR_FLAG_STR_SIZE4:
@@ -549,11 +564,11 @@
void proto_register_eparser(void)
{
static hf_register_info hf[] = {
- { &hf_string4_len, { "String4 length", "eparser.string4_length", FT_UINT32, BASE_DEC, NULL, 0x0, "String4 length", HFILL }},
- { &hf_string4_offset, { "String4 offset", "eparser.string4_offset", FT_UINT32, BASE_DEC, NULL, 0x0, "String4 offset", HFILL }},
- { &hf_string4_len2, { "String4 length2", "eparser.string4_length2", FT_UINT32, BASE_DEC, NULL, 0x0, "String4 length2", HFILL }},
+ { &hf_string4_len, { "Length", "eparser.string4_length", FT_UINT32, BASE_DEC, NULL, 0x0, "String4 length", HFILL }},
+ { &hf_string4_offset, { "Offset", "eparser.string4_offset", FT_UINT32, BASE_DEC, NULL, 0x0, "String4 offset", HFILL }},
+ { &hf_string4_len2, { "Length2", "eparser.string4_length2", FT_UINT32, BASE_DEC, NULL, 0x0, "String4 length2", HFILL }},
{ &hf_num_auths, { "Num auths", "eparser.num_auths", FT_UINT32, BASE_DEC, NULL, 0x0, "Num auths", HFILL }},
- { &hf_string_data, { "String data", "eparser.string_data", FT_BYTES, BASE_NONE, NULL, 0x0, "String data", HFILL }},
+ { &hf_string_data, { "Data", "eparser.string_data", FT_NONE, BASE_NONE, NULL, 0x0, "String data", HFILL }},
{ &hf_subcontext_size_2, { "Subcontext size2", "eparser.subcontext_size2", FT_UINT16, BASE_DEC, NULL, 0x0, "Subcontext size2", HFILL }},
{ &hf_subcontext_size_4, { "Subcontext size4", "eparser.subcontext_size4", FT_UINT16, BASE_DEC, NULL, 0x0, "Subcontext size4", HFILL }},
{ &hf_relative_ofs, { "Relative offset", "eparser.relative_offset", FT_UINT32, BASE_DEC, NULL, 0x0, "Relative offset", HFILL }},
More information about the samba-cvs
mailing list