summaryrefslogtreecommitdiff
path: root/source4/build/pidl/header.pm
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/pidl/header.pm')
-rw-r--r--source4/build/pidl/header.pm52
1 files changed, 50 insertions, 2 deletions
diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm
index f9acc5e222..58707a90a5 100644
--- a/source4/build/pidl/header.pm
+++ b/source4/build/pidl/header.pm
@@ -6,6 +6,7 @@
package IdlHeader;
use strict;
+use needed;
my($res);
my($tab_depth);
@@ -178,6 +179,35 @@ sub HeaderTypedef($)
}
#####################################################################
+# prototype a typedef
+sub HeaderTypedefProto($)
+{
+ my($d) = shift;
+ if (!util::has_property($d->{DATA}, "public")) {
+ return;
+ }
+
+ if ($d->{DATA}{TYPE} eq "STRUCT") {
+ $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *, int , struct $d->{NAME} *);\n";
+ $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *, int , struct $d->{NAME} *);\n";
+ if (!util::has_property($d->{DATA}, "noprint")) {
+ $res .= "void ndr_print_$d->{NAME}(struct ndr_print *, const char *, struct $d->{NAME} *);\n";
+ }
+
+ if (needed::is_needed("ndr_size_$d->{NAME}")) {
+ $res .= "size_t ndr_size_$d->{NAME}(int , struct $d->{NAME} *, int );\n";
+ }
+ }
+ if ($d->{DATA}{TYPE} eq "UNION") {
+ $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *, int, int, union $d->{NAME} *);\n";
+ $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *, int, int, union $d->{NAME} *);\n";
+ if (!util::has_property($d->{DATA}, "noprint")) {
+ $res .= "void ndr_print_$d->{NAME}(struct ndr_print *, const char *, int, union $d->{NAME} *);\n";
+ }
+ }
+}
+
+#####################################################################
# parse a typedef
sub HeaderConst($)
{
@@ -267,6 +297,18 @@ sub HeaderFunction($)
}
#####################################################################
+# output prototypes for a IDL function
+sub HeaderFnProto($)
+{
+ my $fn = shift;
+ my $name = $fn->{NAME};
+ $res .= "void ndr_print_$name(struct ndr_print *, const char *, int, struct $name *);\n";
+ $res .= "struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *, TALLOC_CTX *, struct $name *);\n";
+ $res .= "NTSTATUS dcerpc_$name(struct dcerpc_pipe *, TALLOC_CTX *, struct $name *);\n";
+ $res .= "\n";
+}
+
+#####################################################################
# parse the interface definitions
sub HeaderInterface($)
{
@@ -310,8 +352,12 @@ sub HeaderInterface($)
HeaderConst($d);
($d->{TYPE} eq "TYPEDEF") &&
HeaderTypedef($d);
+ ($d->{TYPE} eq "TYPEDEF") &&
+ HeaderTypedefProto($d);
($d->{TYPE} eq "FUNCTION") &&
HeaderFunction($d);
+ ($d->{TYPE} eq "FUNCTION") &&
+ HeaderFnProto($d);
}
$res .= "#endif /* _HEADER_NDR_$interface->{NAME} */\n";
@@ -326,8 +372,10 @@ sub Parse($)
$res = "/* header auto-generated by pidl */\n\n";
foreach my $x (@{$idl}) {
- ($x->{TYPE} eq "INTERFACE") &&
- HeaderInterface($x);
+ if ($x->{TYPE} eq "INTERFACE") {
+ needed::BuildNeeded($x);
+ HeaderInterface($x);
+ }
}
return $res;
}