aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
diff options
context:
space:
mode:
Diffstat (limited to 'tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm')
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm73
1 files changed, 53 insertions, 20 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
index e9c158e933..9d3ccaf8c8 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
@@ -7,6 +7,7 @@
package Parse::Pidl::Samba4::NDR::Client;
use Parse::Pidl::Samba4 qw(choose_header is_intree);
+use Parse::Pidl::Util qw(has_property);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -15,37 +16,55 @@ use strict;
my($res,$res_hdr);
-#####################################################################
-# parse a function
-sub ParseFunction($$)
+sub ParseFunctionSend($$$)
{
- my ($interface, $fn) = @_;
- my $name = $fn->{NAME};
+ my ($interface, $fn, $name) = @_;
my $uname = uc $name;
- $res_hdr .= "\nstruct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r);
-NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r);
-";
+ my $proto = "struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)";
- $res .= "
-struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)
-{
+ $res_hdr .= "\n$proto;\n";
+
+ $res .= "$proto\n{\n";
+
+ if (has_property($fn, "todo")) {
+ $res .= "\treturn NULL;\n";
+ } else {
+ $res .= "
if (p->conn->flags & DCERPC_DEBUG_PRINT_IN) {
NDR_PRINT_IN_DEBUG($name, r);
}
-
- return dcerpc_ndr_request_send(p, NULL, &ndr_table_$interface->{NAME}, NDR_$uname, mem_ctx, r);
+
+ return dcerpc_ndr_request_send(p, NULL, &ndr_table_$interface->{NAME},
+ NDR_$uname, true, mem_ctx, r);
+";
+ }
+
+ $res .= "}\n\n";
}
-NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)
+sub ParseFunctionSync($$$)
{
- struct rpc_request *req;
+ my ($interface, $fn, $name) = @_;
+ my $uname = uc $name;
+
+ my $proto = "NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)";
+
+ $res_hdr .= "\n$proto;\n";
+ $res .= "$proto\n{\n";
+
+ if (has_property($fn, "todo")) {
+ $res .= "\treturn NT_STATUS_NOT_IMPLEMENTED;\n";
+ } else {
+ $res .= "
NTSTATUS status;
-
- req = dcerpc_$name\_send(p, mem_ctx, r);
- if (req == NULL) return NT_STATUS_NO_MEMORY;
- status = dcerpc_ndr_request_recv(req);
+ if (p->conn->flags & DCERPC_DEBUG_PRINT_IN) {
+ NDR_PRINT_IN_DEBUG($name, r);
+ }
+
+ status = dcerpc_ndr_request(p, NULL, &ndr_table_$interface->{NAME},
+ NDR_$uname, mem_ctx, r);
if (NT_STATUS_IS_OK(status) && (p->conn->flags & DCERPC_DEBUG_PRINT_OUT)) {
NDR_PRINT_OUT_DEBUG($name, r);
@@ -58,8 +77,20 @@ NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *
$res .=
"
return status;
-}
";
+ }
+
+ $res .= "}\n\n";
+}
+
+#####################################################################
+# parse a function
+sub ParseFunction($$)
+{
+ my ($interface, $fn) = @_;
+
+ ParseFunctionSend($interface, $fn, $fn->{NAME});
+ ParseFunctionSync($interface, $fn, $fn->{NAME});
}
my %done;
@@ -103,7 +134,9 @@ sub Parse($$$$)
if (is_intree()) {
$res .= "#include \"includes.h\"\n";
} else {
+ $res .= "#ifndef _GNU_SOURCE\n";
$res .= "#define _GNU_SOURCE\n";
+ $res .= "#endif\n";
$res .= "#include <stdio.h>\n";
$res .= "#include <stdbool.h>\n";
$res .= "#include <stdlib.h>\n";