diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-08-10 13:27:12 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-08-12 14:31:20 +0200 |
commit | 51fb4c386040c9fdc44f4473025c9d83e628b5e6 (patch) | |
tree | e7977ed22505bb1468e6d4f048562b695a104cf3 /pidl | |
parent | 719981adfdd6d828ec0a78ca2be2776502751674 (diff) | |
download | samba-51fb4c386040c9fdc44f4473025c9d83e628b5e6.tar.gz samba-51fb4c386040c9fdc44f4473025c9d83e628b5e6.tar.bz2 samba-51fb4c386040c9fdc44f4473025c9d83e628b5e6.zip |
pidl:Samba4/NDR/Client: add sync dcerpc_pipe based stubs as compat for OpenChange
This will activate the compat wrappers for all functions of an interface:
#define DCERPC_IFACE_MYPROTO_COMPAT 1
#include <ndr_myproto_c.h>
This will activates the compat wrappers just for specific functions:
#define DCERPC_CALL_MYFN1_COMPAT 1
#define DCERPC_CALL_MYFN2_COMPAT 1
#include <ndr_myproto_c.h>
metze
Diffstat (limited to 'pidl')
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm index 4805934346..299dfaed0c 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm @@ -222,6 +222,50 @@ sub ParseFunction_r_Sync($$$$) $self->pidl(""); } +sub ParseFunction_Compat_Sync($$$$) +{ + my ($if, $fn, $name) = @_; + my ($self, $if, $fn, $name) = @_; + my $uname = uc $name; + + my $proto = "NTSTATUS dcerpc_$name\_compat(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)"; + + $self->pidl_hdr("#ifdef DCERPC_CALL_$uname\_COMPAT"); + $self->pidl_hdr("#define dcerpc_$name(p, m, r) dcerpc_$name\_compat(p, m, r)"); + $self->pidl_hdr("#endif /* DCERPC_CALL_$uname\_COMPAT */"); + + $self->fn_declare($proto); + $self->pidl("{"); + $self->indent; + $self->pidl("NTSTATUS status;"); + $self->pidl(""); + + $self->pidl("status = dcerpc_$name\_r(p->binding_handle, mem_ctx, r);"); + $self->pidl(""); + + $self->pidl("if (NT_STATUS_IS_RPC(status)) {"); + $self->indent; + $self->pidl("status = NT_STATUS_NET_WRITE_FAULT;"); + $self->deindent; + $self->pidl("}"); + $self->pidl(""); + + if (defined($fn->{RETURN_TYPE}) and $fn->{RETURN_TYPE} eq "NTSTATUS") { + $self->pidl("if (NT_STATUS_IS_OK(status)) {"); + $self->indent; + $self->pidl("status = r->out.result;"); + $self->deindent; + $self->pidl("}"); + $self->pidl(""); + } + + $self->pidl("return status;"); + + $self->deindent; + $self->pidl("}"); + $self->pidl(""); +} + sub ElementDirection($) { my ($e) = @_; @@ -570,6 +614,7 @@ sub ParseFunction_Sync($$$$) { my ($self, $if, $fn, $name) = @_; + my $uname = uc $name; my $fn_args = ""; my $fn_str = "NTSTATUS dcerpc_$name"; my $pad = genpad($fn_str); @@ -586,7 +631,9 @@ sub ParseFunction_Sync($$$$) $fn_args .= ",\n" . $pad . mapTypeName($fn->{RETURN_TYPE}). " *result"; } + $self->pidl_hdr("#ifndef DCERPC_CALL_$uname\_COMPAT"); $self->fn_declare("$fn_str($fn_args)"); + $self->pidl_hdr("#endif /* DCERPC_CALL_$uname\_COMPAT */"); $self->pidl("{"); $self->indent; $self->pidl("struct $name r;"); @@ -642,6 +689,8 @@ sub ParseFunction($$$) $self->ParseFunction_r_Recv($if, $fn, $fn->{NAME}); $self->ParseFunction_r_Sync($if, $fn, $fn->{NAME}); + $self->ParseFunction_Compat_Sync($if, $fn, $fn->{NAME}); + foreach my $e (@{$fn->{ELEMENTS}}) { next unless (grep(/out/, @{$e->{DIRECTION}})); @@ -697,6 +746,7 @@ my %done; sub ParseInterface($$) { my ($self, $if) = @_; + my $ifu = uc($if->{NAME}); $self->pidl_hdr("#ifndef _HEADER_RPC_$if->{NAME}"); $self->pidl_hdr("#define _HEADER_RPC_$if->{NAME}"); @@ -707,6 +757,16 @@ sub ParseInterface($$) $self->pidl_hdr(""); } + $self->pidl_hdr("#ifdef DCERPC_IFACE_$ifu\_COMPAT"); + foreach my $fn (@{$if->{FUNCTIONS}}) { + next if has_property($fn, "noopnum"); + next if has_property($fn, "todo"); + my $fnu = uc($fn->{NAME}); + $self->pidl_hdr("#define DCERPC_CALL_$fnu\_COMPAT 1"); + } + $self->pidl_hdr("#endif /* DCERPC_IFACE_$ifu\_COMPAT */"); + $self->pidl_hdr(""); + $self->pidl("/* $if->{NAME} - client functions generated by pidl */"); $self->pidl(""); |