diff options
author | Tim Potter <tpot@samba.org> | 2005-01-26 04:50:04 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:13 -0500 |
commit | bc9e00c7c4c75953d234dc2b63ec3948e6c351e5 (patch) | |
tree | f0a6492ffb8f15b86bf55a2ea5ed04371a21117a /source4 | |
parent | 9eea1eb94fff7b36f695de8c4f86d990e4ed22a9 (diff) | |
download | samba-bc9e00c7c4c75953d234dc2b63ec3948e6c351e5.tar.gz samba-bc9e00c7c4c75953d234dc2b63ec3948e6c351e5.tar.bz2 samba-bc9e00c7c4c75953d234dc2b63ec3948e6c351e5.zip |
r5006: Implement parsing of pidl bitmaps in ethereal parsers. This works
well but needs to be stuck in a subtree.
(This used to be commit a34212247b5dfb87d87c1ce12aab1835c88a0651)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/eparser.pm | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index b334a5c467..cf2f6a4d54 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -10,6 +10,7 @@ use strict; # the list of needed functions my %needed; +my %bitmaps; my $module; my $if_uuid; @@ -210,6 +211,17 @@ sub NeededFunction($) }; } +sub bitmapbase($) +{ + my $e = shift; + + return "32", if util::has_property($e->{DATA}, "bitmap32bit"); + return "16", if util::has_property($e->{DATA}, "bitmap16bit"); + return "8", if util::has_property($e->{DATA}, "bitmap8bit"); + + die("can't calculate bitmap size for $e->{NAME}"); +} + sub NeededTypedef($) { my $t = shift; @@ -296,12 +308,15 @@ sub NeededTypedef($) } if ($t->{DATA}->{TYPE} eq "BITMAP") { + + $bitmaps{$t->{NAME}} = $t; + foreach my $e (@{$t->{DATA}{ELEMENTS}}) { $e =~ /^(.*?) \( (.*?) \)$/; $needed{"hf_$t->{NAME}_$1"} = { - 'name' => "$t->{NAME} $1", + 'name' => "$1", 'ft' => "FT_BOOLEAN", - 'base' => "32", + 'base' => bitmapbase($t), 'bitmask' => "$2" }; } @@ -615,9 +630,6 @@ sub RewriteC($$$) s/(^static\ NTSTATUS\ ndr_pull_(.+?),\ (enum\ .+?)\)) /static NTSTATUS ndr_pull_$2, pidl_tree *tree, int hf, $3)/smgx; s/uint(8|16|32) v;/uint$1_t v;/smg; - s/(ndr_pull_([^\)]*?)\(ndr,\ &v\);) - /ndr_pull_$2(ndr, tree, hf, &v);/smgx; - s/(ndr_pull_([^\(]+?)\(ndr,\ &_level\);) /ndr_pull_$2(ndr, tree, hf_${cur_fn}_level, &_level);/smgx; @@ -626,6 +638,23 @@ sub RewriteC($$$) s/(^(static\ )?NTSTATUS\ ndr_pull_(.+?),\ uint(8|16|32)\ \*r\)) /NTSTATUS ndr_pull_$3, pidl_tree *tree, int hf, uint$4_t *r)/smgx; + if (/ndr_pull_([^\)]*?)\(ndr, &v\);/) { + + s/(ndr_pull_([^\)]*?)\(ndr,\ &v\);) + /ndr_pull_$2(ndr, tree, hf, &v);/smgx; + + pidl $_; + + if (defined($bitmaps{$cur_fn})) { + foreach my $e (@{$bitmaps{$cur_fn}->{DATA}{ELEMENTS}}) { + $e =~ /^(.*?) \( (.*?) \)$/; + pidl "\tproto_tree_add_boolean(tree->proto_tree, hf_${cur_fn}_$1, ndr->tvb, ndr->offset - sizeof(v), sizeof(v), v);\n"; + } + } + + next; + } + # Call ethereal wrappers for pull of scalar values in # structures and functions, e.g # |