summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/pidl/eparser.pm36
-rwxr-xr-xsource4/build/pidl/pidl.pl28
-rwxr-xr-xsource4/script/build_idl.sh2
3 files changed, 42 insertions, 24 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index 0549bdfdef..73f2275b98 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -228,6 +228,17 @@ sub NeededTypedef($)
$needed{"ett_$t->{NAME}"} = 1;
}
+
+ if ($t->{DATA}->{TYPE} eq "ENUM") {
+ use Data::Dumper;
+ print Dumper($t);
+
+ $needed{"hf_$t->{NAME}"} = {
+ 'name' => $t->{NAME},
+ 'ft' => 'FT_UINT32',
+ 'base' => 'BASE_HEX'
+ };
+ }
}
#####################################################################
@@ -342,6 +353,10 @@ sub RewriteHeader($$$)
s/(struct pidl_pull \*ndr, int ndr_flags)/$1, pidl_tree *tree/smg;
+ # Bitmaps
+
+ s/(uint32_t \*r\);)/pidl_tree *tree, int hf, $1/smg;
+
pidl $_;
}
@@ -405,10 +420,11 @@ sub RewriteC($$$)
s/NDR_CHECK\((.*)\)/$1/g;
- # We're not interested in ndr_print or ndr_push functions.
+ # We're not interested in ndr_print, ndr_push or ndr_size functions.
s/^(static )?NTSTATUS (ndr_push[^\(]+).*?^\}\n\n//smg;
s/^void (ndr_print[^\(]+).*?^\}\n\n//smg;
+ s/^size_t (ndr_size[^\(]+).*?^\}\n\n//smg;
# Get rid of dcerpc interface structures and functions
@@ -435,7 +451,9 @@ sub RewriteC($$$)
# Add tree argument to ndr_pull_array()
- s/(ndr_pull_array\(ndr, ([^,]*?), ([^\)].*?)\);)/ndr_pull_array( ndr, $2, tree, $3);/smg;
+#get_subtree(tree, \"$2\", ndr, ett_$2)
+#ndr_pull_array( ndr, NDR_SCALARS, tree, (void **)r->aces, sizeof(r->aces[0]), r->num_aces, (ndr_pull_flags_fn_t)ndr_pull_security_ace);
+ s/(ndr_pull_array\(ndr, ([^,]*?), ([^,]*?), ([^\)].*?)\);)/ndr_pull_array( ndr, $2, tree, $3, $4);/smg;
s/(ndr_pull_array_([^\(]*?)\(ndr, ([^,]*?), (r->((in|out).)?([^,]*?)), (.*?)\);)/ndr_pull_array_$2( ndr, $3, tree, hf_$7_$2_array, $4, $8);/smg;
@@ -491,7 +509,19 @@ sub RewriteC($$$)
s/uint(16|32) _level/uint$1_t _level/smg;
s/ndr_pull_([^\(]*)\(ndr, tree, hf_level, &_level\);/ndr_pull_$1(ndr, tree, hf_level_$1, &_level);/smg;
-
+
+ # Enums
+
+ s/(^static NTSTATUS ndr_pull_(.+?), (enum .+?)\))/static NTSTATUS ndr_pull_$2, pidl_tree *tree, int hf, $3)/smg;
+ s/uint(8|16|32) v;/uint$1_t v;/smg;
+ s/(ndr_pull_([^\)]*?)\(ndr, &v\);)/ndr_pull_$2(ndr, tree, hf, &v);/smg;
+
+ s/(ndr_pull_([^\(]+?)\(ndr, &_level\);)/ndr_pull_$2(ndr, tree, hf_$2, &_level);/smg;
+
+ # Bitmaps
+
+ s/(^NTSTATUS ndr_pull_(.+?), uint32 \*r\))/NTSTATUS ndr_pull_$2, pidl_tree *tree, int hf, uint32_t *r)/smg;
+
pidl $_;
}
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index 6d0ff69081..5c09ca1842 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -141,6 +141,10 @@ sub process_file($)
if ($opt_header) {
my($header) = util::ChangeExtension($output, ".h");
util::FileSave($header, IdlHeader::Parse($pidl));
+ if ($opt_eparser) {
+ my($eparserhdr) = dirname($output) . "/packet-dcerpc-$basename.h";
+ IdlEParser::RewriteHeader($pidl, $header, $eparserhdr);
+ }
}
if ($opt_client) {
@@ -202,26 +206,10 @@ $dcom
if ($opt_parser) {
my($parser) = util::ChangeExtension($output, ".c");
IdlParser::Parse($pidl, $parser);
- }
-
- if ($opt_eparser) {
-
- # Generate regular .c and .h files for marshaling and
- # unmarshaling.
-
- my($parser) = util::ChangeExtension($output, ".c");
- IdlParser::Parse($pidl, $parser);
-
- my($header) = util::ChangeExtension($output, ".h");
- util::FileSave($header, IdlHeader::Parse($pidl));
-
- # Postprocess to produce ethereal parsers.
-
- my($eparser) = dirname($output) . "/packet-dcerpc-$basename.c";
- IdlEParser::RewriteC($pidl, $parser, $eparser);
-
- my($eparserhdr) = dirname($output) . "/packet-dcerpc-$basename.h";
- IdlEParser::RewriteHeader($pidl, $header, $eparserhdr);
+ if($opt_eparser) {
+ my($eparser) = dirname($output) . "/packet-dcerpc-$basename.c";
+ IdlEParser::RewriteC($pidl, $parser, $eparser);
+ }
}
if ($opt_swig) {
diff --git a/source4/script/build_idl.sh b/source4/script/build_idl.sh
index 6c02828308..a4d0dfea8b 100755
--- a/source4/script/build_idl.sh
+++ b/source4/script/build_idl.sh
@@ -5,7 +5,7 @@ FULLBUILD=$1
[ -d librpc/gen_ndr ] || mkdir -p librpc/gen_ndr || exit 1
PIDL="$PERL ./build/pidl/pidl.pl --output librpc/gen_ndr/ndr_ --parse --header --parser --server --client"
-EPARSERPIDL="$PERL ./build/pidl/pidl.pl --output $EPARSERPREFIX/ndr_ --parse --eparser"
+EPARSERPIDL="$PERL ./build/pidl/pidl.pl --output $EPARSERPREFIX/ndr_ --parse --header --parser --eparser"
if [ x$FULLBUILD = xFULL ]; then
echo Rebuilding all idl files in librpc/idl