summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-06 11:44:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:38 -0500
commita3f2ed12b9cde474a8d5ec96eb0bd0b6211c45a9 (patch)
treec4e9fb9f4815ebc7850458f70c94a507564c91f0 /source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
parentce8dad9396646fed1fa29c048d6ecc4dbde0a8ec (diff)
downloadsamba-a3f2ed12b9cde474a8d5ec96eb0bd0b6211c45a9.tar.gz
samba-a3f2ed12b9cde474a8d5ec96eb0bd0b6211c45a9.tar.bz2
samba-a3f2ed12b9cde474a8d5ec96eb0bd0b6211c45a9.zip
r15470: Write header file with prototypes for Samba3-Client-With-Samba4-NDR code.
(This used to be commit a2bb0b6012b14787825a9cd5f33e2c0e989b65a7)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm22
1 files changed, 14 insertions, 8 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index ec3287ffb0..92bb440e7c 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -15,13 +15,16 @@ use Parse::Pidl::Samba3::Types qw(DeclLong);
use vars qw($VERSION);
$VERSION = '0.01';
-my $res = "";
+my $res;
+my $res_hdr;
my $tabs = "";
sub indent() { $tabs.="\t"; }
sub deindent() { $tabs = substr($tabs, 1); }
sub pidl($) { $res .= $tabs.(shift)."\n"; }
+sub pidl_hdr($) { $res_hdr .= (shift)."\n"; }
sub fatal($$) { my ($e,$s) = @_; die("$e->{ORIGINAL}->{FILE}:$e->{ORIGINAL}->{LINE}: $s\n"); }
sub warning($$) { my ($e,$s) = @_; warn("$e->{ORIGINAL}->{FILE}:$e->{ORIGINAL}->{LINE}: $s\n"); }
+sub fn_declare($) { my ($n) = @_; pidl $n; pidl_hdr "$n;"; }
sub CopyLevel($$$$)
{
@@ -51,12 +54,12 @@ sub ParseFunction($$)
my $inargs = "";
my $defargs = "";
my $uif = uc($if->{NAME});
- my $ufn = uc($fn->{NAME});
+ my $ufn = "DCERPC_".uc($fn->{NAME});
foreach (@{$fn->{ELEMENTS}}) {
$defargs .= ", " . DeclLong($_);
}
- pidl "NTSTATUS rpccli_$fn->{NAME}(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx$defargs)";
+ fn_declare "NTSTATUS rpccli_$fn->{NAME}(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx$defargs)";
pidl "{";
indent;
pidl "struct $fn->{NAME} r;";
@@ -79,10 +82,7 @@ sub ParseFunction($$)
foreach my $e (@{$fn->{ELEMENTS}}) {
next unless (grep(/out/, @{$e->{DIRECTION}}));
- if ($e->{LEVELS}[0]->{TYPE} ne "POINTER") {
- warning($e, "First element not a pointer for [out] argument");
- next;
- }
+ fatal($e, "[out] argument is not a pointer") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER");
CopyLevel($e, $e->{LEVELS}[1], $e->{NAME}, "r.out.$e->{NAME}");
}
@@ -109,7 +109,12 @@ sub ParseInterface($)
{
my $if = shift;
+ my $uif = uc($if->{NAME});
+
+ pidl_hdr "#ifndef __CLI_$uif\__";
+ pidl_hdr "#define __CLI_$uif\__";
ParseFunction($if, $_) foreach (@{$if->{FUNCTIONS}});
+ pidl_hdr "#endif /* __CLI_$uif\__ */";
}
sub Parse($$)
@@ -117,6 +122,7 @@ sub Parse($$)
my($ndr,$filename) = @_;
$res = "";
+ $res_hdr = "";
pidl "/*";
pidl " * Unix SMB/CIFS implementation.";
@@ -130,7 +136,7 @@ sub Parse($$)
ParseInterface($_) if ($_->{TYPE} eq "INTERFACE");
}
- return $res;
+ return ($res, $res_hdr);
}
1;