summaryrefslogtreecommitdiff
path: root/source4/build/pidl/ndr_client.pm
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/pidl/ndr_client.pm')
-rw-r--r--source4/build/pidl/ndr_client.pm44
1 files changed, 35 insertions, 9 deletions
diff --git a/source4/build/pidl/ndr_client.pm b/source4/build/pidl/ndr_client.pm
index ca6fc22465..eb7d73b991 100644
--- a/source4/build/pidl/ndr_client.pm
+++ b/source4/build/pidl/ndr_client.pm
@@ -42,7 +42,8 @@ NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *
NDR_PRINT_OUT_DEBUG($name, r);
}
";
- if ($fn->{RETURN_TYPE} eq "NTSTATUS") {
+
+ if (defined($fn->{RETURN_TYPE}) and $fn->{RETURN_TYPE} eq "NTSTATUS") {
$res .= "\tif (NT_STATUS_IS_OK(status)) status = r->out.result;\n";
}
$res .=
@@ -59,15 +60,40 @@ my %done;
sub ParseInterface($)
{
my($interface) = shift;
- my($data) = $interface->{DATA};
- $res = "/* Client functions generated by pidl */\n\n";
-
- foreach my $d (@{$data}) {
- if (($d->{TYPE} eq "FUNCTION") and not $done{$d->{NAME}}) {
- ParseFunction($interface, $d);
- }
- $done{$d->{NAME}} = 1;
+ $res .= "/* $interface->{NAME} - client functions generated by pidl */\n\n";
+
+ foreach my $fn (@{$interface->{FUNCTIONS}}) {
+ next if not defined($fn->{OPNUM});
+ next if defined($done{$fn->{NAME}});
+ ParseFunction($interface, $fn);
+ $done{$fn->{NAME}} = 1;
+ }
+
+ return $res;
+}
+
+sub Parse($$)
+{
+ my($ndr) = shift;
+ my($filename) = shift;
+
+ my $h_filename = $filename;
+ $res = "";
+
+ if ($h_filename =~ /(.*)\.c/) {
+ $h_filename = "$1.h";
}
+
+ $res .= "/* client functions auto-generated by pidl */\n";
+ $res .= "\n";
+ $res .= "#include \"includes.h\"\n";
+ $res .= "#include \"$h_filename\"\n";
+ $res .= "\n";
+
+ foreach my $x (@{$ndr}) {
+ ($x->{TYPE} eq "INTERFACE") && ParseInterface($x);
+ }
+
return $res;
}