summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-18 01:17:10 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-18 01:17:10 +0000
commit7b185ccb32d685c00ddca9495fafe34bec59ceb3 (patch)
tree6eed457ca0e51ac89d0721df3969f6288725f3b6 /source4
parentf1462caf612c7e89fd1ae58142108122d07d67fa (diff)
downloadsamba-7b185ccb32d685c00ddca9495fafe34bec59ceb3.tar.gz
samba-7b185ccb32d685c00ddca9495fafe34bec59ceb3.tar.bz2
samba-7b185ccb32d685c00ddca9495fafe34bec59ceb3.zip
auto-generate top-level debug print functions when a flag is set on
the dcerpc pipe. This saves lots of code in each test suite. (This used to be commit db74a03d15d96d7f8bd751b8f857cc5b2be7d4c2)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/pidl/client.pm37
-rw-r--r--source4/build/pidl/parser.pm3
2 files changed, 22 insertions, 18 deletions
diff --git a/source4/build/pidl/client.pm b/source4/build/pidl/client.pm
index 6944b26747..7eb3b397b3 100644
--- a/source4/build/pidl/client.pm
+++ b/source4/build/pidl/client.pm
@@ -17,35 +17,36 @@ sub ParseFunction($)
my $name = $fn->{NAME};
my $uname = uc $name;
- if ($fn->{RETURN_TYPE} ne "NTSTATUS") {
- $res .= "
-NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)
-{
- return dcerpc_ndr_request(p, DCERPC_$uname, mem_ctx,
- (ndr_push_fn_t) ndr_push_$name,
- (ndr_pull_fn_t) ndr_pull_$name,
- r);
-}
-";
- } else {
- $res .= "
+ $res .=
+"
NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)
{
NTSTATUS status;
+
+ if (p->flags & DCERPC_DEBUG_PRINT_IN) {
+ NDR_PRINT_IN_DEBUG($name, r);
+ }
+
status = dcerpc_ndr_request(p, DCERPC_$uname, mem_ctx,
(ndr_push_fn_t) ndr_push_$name,
(ndr_pull_fn_t) ndr_pull_$name,
r);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+
+ if (NT_STATUS_IS_OK(status) && (p->flags & DCERPC_DEBUG_PRINT_OUT)) {
+ NDR_PRINT_OUT_DEBUG($name, r);
}
-
- return r->out.result;
-}
";
+ if ($fn->{RETURN_TYPE} eq "NTSTATUS") {
+ $res .= "\tif (NT_STATUS_IS_OK(status)) status = r->out.result;\n";
+ }
+ $res .=
+"
+ return status;
}
+";
}
+
#####################################################################
# parse the interface definitions
sub ParseInterface($)
@@ -64,7 +65,7 @@ sub ParseInterface($)
sub Parse($)
{
my($idl) = shift;
- $res = "/* dcerpc client calls auto-generated by pidl */\n\n";
+ $res = "/* dcerpc client calls generated by pidl */\n\n";
$res .= "#include \"includes.h\"\n\n";
foreach my $x (@{$idl}) {
($x->{TYPE} eq "INTERFACE") &&
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm
index 050ebdda02..1d3e772298 100644
--- a/source4/build/pidl/parser.pm
+++ b/source4/build/pidl/parser.pm
@@ -825,6 +825,9 @@ sub ParseFunctionPrint($)
ParseElementPrintScalar($e, "r->out.");
}
}
+ if ($fn->{RETURN_TYPE} && $fn->{RETURN_TYPE} ne "void") {
+ $res .= "\tndr_print_$fn->{RETURN_TYPE}(ndr, \"result\", &r->out.result);\n";
+ }
$res .= "\tndr->depth--;\n";
$res .= "\t}\n";