diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-03-25 13:40:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:11:16 -0500 |
commit | 5a9ceee7a524293c67d4c32edde9da32a877ecce (patch) | |
tree | 54a0bb998f5d8409cf173d3d2559520e65d7f383 /source4/build/pidl | |
parent | 2fa732c6251f6dd23c3c8ef1facf638c9c531bdd (diff) | |
download | samba-5a9ceee7a524293c67d4c32edde9da32a877ecce.tar.gz samba-5a9ceee7a524293c67d4c32edde9da32a877ecce.tar.bz2 samba-5a9ceee7a524293c67d4c32edde9da32a877ecce.zip |
r6061: add start of compression support in our rpc code
this is not complete cuurently...
but I want other people to test it and help me on finishing it.
(try to change the #if 0 in torture/rpc/drsuapi.c into #if 1)
metze
(This used to be commit 335adef37082a78e0426decb715629bd778e6582)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r-- | source4/build/pidl/ndr_parser.pm | 138 |
1 files changed, 134 insertions, 4 deletions
diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm index a689a8a849..6f8029d338 100644 --- a/source4/build/pidl/ndr_parser.pm +++ b/source4/build/pidl/ndr_parser.pm @@ -470,6 +470,92 @@ sub ParseArrayPull($$$$) } } +sub compression_alg($) +{ + my $e = shift; + my $compression = util::has_property($e, "compression"); + my ($alg, $clen, $dlen) = split(/ /, $compression); + + return $alg; +} + +sub compression_clen($) +{ + my $e = shift; + my $compression = util::has_property($e, "compression"); + my ($alg, $clen, $dlen) = split(/ /, $compression); + + return ParseExpr($e, $clen, "r->"); +} + +sub compression_dlen($) +{ + my $e = shift; + my $compression = util::has_property($e, "compression"); + my ($alg, $clen, $dlen) = split(/ /, $compression); + + return ParseExpr($e, $dlen, "r->"); +} + +sub ParseCompressionPushStart($$$) +{ + my $e = shift; + my $subndr = shift; + my $ndr_flags = shift; + my $comndr = $subndr."_compressed"; + + pidl "{"; + indent; + pidl "struct ndr_push *$comndr;"; + pidl ""; + pidl "$comndr = ndr_push_init_ctx($subndr);"; + pidl "if (!$comndr) return NT_STATUS_NO_MEMORY;"; + pidl "$comndr->flags = $subndr->flags;"; + pidl ""; + + return $comndr; +} + +sub ParseCompressionPushEnd($$) +{ + my $e = shift; + my $subndr = shift; + my $comndr = $subndr."_compressed"; + my $alg = compression_alg($e); + + pidl "NDR_CHECK(ndr_push_compression($subndr, $comndr, $alg));"; + deindent; + pidl "}"; +} + +sub ParseCompressionPullStart($$$) +{ + my $e = shift; + my $subndr = shift; + my $ndr_flags = shift; + my $comndr = $subndr."_compressed"; + my $alg = compression_alg($e); + my $dlen = compression_dlen($e); + + pidl "{"; + indent; + pidl "struct ndr_pull *$comndr;"; + pidl "NDR_ALLOC($subndr, $comndr);"; + pidl "NDR_CHECK(ndr_pull_compression($subndr, $comndr, $alg, $dlen));"; + + return $comndr; +} + +sub ParseCompressionPullEnd($$) +{ + my $e = shift; + my $subndr = shift; + my $comndr = $subndr."_compressed"; + + deindent; + pidl "}"; +} + sub ParseSubcontextPushStart($$) { my $e = shift; @@ -551,7 +637,10 @@ sub ParseElementPushScalar($$$) my $cprefix = c_push_prefix($e); my $ptr_prefix = c_ptr_prefix($e); my $sub_size = util::has_property($e, "subcontext"); + my $compression = util::has_property($e, "compression"); my $ndr = "ndr"; + my $subndr = undef; + my $comndr = undef; start_flags($e); @@ -560,7 +649,12 @@ sub ParseElementPushScalar($$$) } if (defined $sub_size and $e->{POINTERS} == 0) { - $ndr = ParseSubcontextPushStart($e, "NDR_SCALARS"); + $subndr = ParseSubcontextPushStart($e, "NDR_SCALARS"); + $ndr = $subndr; + if (defined $compression) { + $comndr = ParseCompressionPushStart($e, $subndr, "NDR_SCALARS"); + $ndr = $comndr; + } } if (Ndr::need_wire_pointer($e)) { @@ -578,6 +672,9 @@ sub ParseElementPushScalar($$$) } if (defined $sub_size and $e->{POINTERS} == 0) { + if (defined $compression) { + ParseCompressionPushEnd($e, $subndr); + } ParseSubcontextPushEnd($e); } @@ -698,13 +795,21 @@ sub ParseElementPullScalar($$$) my $cprefix = c_pull_prefix($e); my $ptr_prefix = c_ptr_prefix($e); my $sub_size = util::has_property($e, "subcontext"); + my $compression = util::has_property($e, "compression"); my $ndr = "ndr"; + my $subndr = undef; + my $comndr = undef; start_flags($e); if (defined $sub_size && $e->{POINTERS} == 0) { - $ndr = ParseSubcontextPullStart($e, $ndr_flags); + $subndr = ParseSubcontextPullStart($e, $ndr_flags); + $ndr = $subndr; $ndr_flags = "NDR_SCALARS|NDR_BUFFERS"; + if (defined $compression) { + $comndr = ParseCompressionPullStart($e, $subndr, $ndr_flags); + $ndr = $comndr; + } } if (Ndr::is_inline_array($e)) { @@ -728,6 +833,9 @@ sub ParseElementPullScalar($$$) } if (defined $sub_size && $e->{POINTERS} == 0) { + if (defined $compression) { + ParseCompressionPullEnd($e, $subndr); + } ParseSubcontextPullEnd($e); } @@ -766,7 +874,10 @@ sub ParseElementPushBuffer($$) my($var_prefix) = shift; my $cprefix = c_push_prefix($e); my $sub_size = util::has_property($e, "subcontext"); + my $compression = util::has_property($e, "compression"); my $ndr = "ndr"; + my $subndr = undef; + my $comndr = undef; return unless (need_buffers_section($e)); @@ -793,8 +904,13 @@ sub ParseElementPushBuffer($$) } if (defined $sub_size) { - $ndr = ParseSubcontextPushStart($e, $ndr_flags); + $subndr = ParseSubcontextPushStart($e, $ndr_flags); + $ndr = $subndr; $ndr_flags = "NDR_SCALARS|NDR_BUFFERS"; + if (defined $compression) { + $comndr = ParseCompressionPushStart($e, $subndr, $ndr_flags); + $ndr = $comndr; + } } if (util::array_size($e)) { @@ -808,6 +924,9 @@ sub ParseElementPushBuffer($$) } if (defined $sub_size) { + if (defined $compression) { + ParseCompressionPushEnd($e, $subndr); + } ParseSubcontextPushEnd($e); } @@ -827,7 +946,10 @@ sub ParseElementPullBuffer($$) my($var_prefix) = shift; my $cprefix = c_pull_prefix($e); my $sub_size = util::has_property($e, "subcontext"); + my $compression = util::has_property($e, "compression"); my $ndr = "ndr"; + my $subndr = undef; + my $comndr = undef; return unless (need_buffers_section($e)); @@ -856,8 +978,13 @@ sub ParseElementPullBuffer($$) } if (defined $sub_size) { - $ndr = ParseSubcontextPullStart($e, $ndr_flags); + $subndr = ParseSubcontextPullStart($e, $ndr_flags); + $ndr = $subndr; $ndr_flags = "NDR_SCALARS|NDR_BUFFERS"; + if (defined $compression) { + $comndr = ParseCompressionPullStart($e, $subndr, $ndr_flags); + $ndr = $comndr; + } } if (util::array_size($e)) { @@ -871,6 +998,9 @@ sub ParseElementPullBuffer($$) } if (defined $sub_size) { + if (defined $compression) { + ParseCompressionPullEnd($e, $subndr); + } ParseSubcontextPullEnd($e); } |