summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-08-24 00:04:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:28 -0500
commit2cd71e51018835d04968c239eb8539d0f2f6ee71 (patch)
tree107f31ce159f6e58068945c362a017afe7d53d24 /source4/pidl/lib/Parse/Pidl
parentc1b6fd5c4bce4035d99b03eb8f9f66db590fee3d (diff)
downloadsamba-2cd71e51018835d04968c239eb8539d0f2f6ee71.tar.gz
samba-2cd71e51018835d04968c239eb8539d0f2f6ee71.tar.bz2
samba-2cd71e51018835d04968c239eb8539d0f2f6ee71.zip
r9553: Some cosmetic things to make the atsvc dissector output look prettier
and be more usable: - nicer formatting for summary of set fields in bitmap. - say "Pointer to Foo" in proto_tree instead of just "Foo" when dissecting pointers. - append string value to proto_tree when dissecting pointers to strings. - strip librpc/gen_ndr prefix from includes so generated files can live in the ethereal epan/dissectors directory. Now to work on getting the winreg dissector compiling... (This used to be commit ab00976699a2deeb3ddca510864520fcb46714bc)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm24
1 files changed, 18 insertions, 6 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm b/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm
index 73dd34096e..7a7db4280e 100644
--- a/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm
@@ -1,7 +1,7 @@
##################################################
# Samba4 NDR parser generator for IDL structures
# Copyright tridge@samba.org 2000-2003
-# Copyright tpot@samba.org 2001
+# Copyright tpot@samba.org 2001,2005
# Copyright jelmer@samba.org 2004-2005
# Portions based on idl2eth.c by Ronnie Sahlberg
# released under the GNU GPL
@@ -180,6 +180,10 @@ sub Bitmap($$$)
pidl_code "offset=dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, NULL, drep, -1, &flags);";
+ pidl_code "proto_item_append_text(item, \": \");\n";
+ pidl_code "if (!flags)";
+ pidl_code "\tproto_item_append_text(item, \"(No values set)\");\n";
+
foreach (@{$e->{ELEMENTS}}) {
next unless (/([^ ]*) (.*)/);
my ($en,$ev) = ($1,$2);
@@ -195,14 +199,16 @@ sub Bitmap($$$)
pidl_code "proto_tree_add_boolean(tree, $hf_bitname, tvb, offset-$e->{ALIGN}, $e->{ALIGN}, flags);";
pidl_code "if (flags&$ev){";
- pidl_code "\tproto_item_append_text(item,\"$en \");";
+ pidl_code "\tproto_item_append_text(item,\"$en\");";
+ pidl_code "\tif (flags & (~$ev))";
+ pidl_code "\t\tproto_item_append_text(item, \", \");";
pidl_code "}";
pidl_code "flags&=(~$ev);";
pidl_code "";
}
pidl_code "if(flags){";
- pidl_code "\tproto_item_append_text(item, \"UNKNOWN-FLAGS\");";
+ pidl_code "\tproto_item_append_text(item, \"Unknown bitmap value 0x%x\", flags);";
pidl_code "}\n";
pidl_code "return offset;";
deindent;
@@ -230,7 +236,7 @@ sub ElementLevel($$$$$)
} elsif ($l->{LEVEL} eq "EMBEDDED") {
$type = "embedded";
}
- pidl_code "offset=dissect_ndr_$type\_pointer(tvb,offset,pinfo,tree,drep,$myname\_,$ptrtype_mappings{$l->{POINTER_TYPE}},\"".field2name(StripPrefixes($e->{NAME})) . " (".StripPrefixes($e->{TYPE}).")\",$hf);";
+ pidl_code "offset=dissect_ndr_$type\_pointer(tvb,offset,pinfo,tree,drep,$myname\_,$ptrtype_mappings{$l->{POINTER_TYPE}},\"Pointer to ".field2name(StripPrefixes($e->{NAME})) . " ($e->{TYPE})\",$hf);";
} elsif ($l->{TYPE} eq "ARRAY") {
if ($l->{IS_INLINE}) {
@@ -256,7 +262,9 @@ sub ElementLevel($$$$$)
($bs = 1) if (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_ASCII.*"));
if (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_SIZE4.*") and property_matches($e, "flag", ".*LIBNDR_FLAG_STR_LEN4.*")) {
- pidl_code "offset=dissect_ndr_cvstring(tvb,offset,pinfo,tree,drep,$bs,$hf,FALSE,NULL);";
+ pidl_code "char *data;\n";
+ pidl_code "offset=dissect_ndr_cvstring(tvb,offset,pinfo,tree,drep,$bs,$hf,FALSE,&data);";
+ pidl_code "proto_item_append_text(tree, \": %s\", data);";
} elsif (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_SIZE4.*")) {
pidl_code "offset=dissect_ndr_vstring(tvb,offset,pinfo,tree,drep,$bs,$hf,FALSE,NULL);";
} else {
@@ -708,7 +716,11 @@ sub Parse($$)
$res{headers} .= "#include \"packet-dcerpc.h\"\n";
$res{headers} .= "#include \"packet-dcerpc-nt.h\"\n";
$res{headers} .= "#include \"packet-windows-common.h\"\n";
- $res{headers} .= "#include \"$h_filename\"\n";
+
+ use File::Basename;
+ my $h_basename = basename($h_filename);
+
+ $res{headers} .= "#include \"$h_basename\"\n";
pidl_code "";
# Ethereal protocol registration