summaryrefslogtreecommitdiff
path: root/tools/pidl
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2006-01-01 23:14:44 +0000
committerJörg Mayer <jmayer@loplof.de>2006-01-01 23:14:44 +0000
commit6cbffe23a93804aaf9e5ac869aa01279ea59bf00 (patch)
tree263d368fb5c57a3fe1fb20511eaab8a51ee4efa4 /tools/pidl
parentb4471e0195b08a3e17f82980722d1a41d79148f6 (diff)
downloadwireshark-6cbffe23a93804aaf9e5ac869aa01279ea59bf00.tar.gz
Update from samba tree revision 12488 to 12669
============================ Samba log start ============ ------------------------------------------------------------------------ r12488 | jelmer | 2005-12-26 02:37:18 +0100 (Mon, 26 Dec 2005) | 2 lines Fix MANIFEST to match recent changes ------------------------------------------------------------------------ r12490 | jelmer | 2005-12-26 03:14:18 +0100 (Mon, 26 Dec 2005) | 2 lines Fix --warn-compat ------------------------------------------------------------------------ r12501 | jelmer | 2005-12-26 23:47:40 +0100 (Mon, 26 Dec 2005) | 4 lines Merge EJSHeader.pm into EJS.pm and simplify smbcalls_rpc.c a bit, now that it is guaranteed that the smbcalls modules are always initialized after the EJS subsystem itself. ------------------------------------------------------------------------ r12512 | jelmer | 2005-12-27 17:22:35 +0100 (Tue, 27 Dec 2005) | 3 lines Use GUID structs in API functions everywhere rather then converting back and forth between GUID structs and strings in several places. ------------------------------------------------------------------------ r12515 | jelmer | 2005-12-27 18:50:53 +0100 (Tue, 27 Dec 2005) | 2 lines Use UUID directly rather then string containing UUID ------------------------------------------------------------------------ r12517 | jelmer | 2005-12-27 20:13:18 +0100 (Tue, 27 Dec 2005) | 2 lines Don't generate empty init functions ------------------------------------------------------------------------ r12528 | jelmer | 2005-12-27 23:51:30 +0100 (Tue, 27 Dec 2005) | 2 lines Add seperate proto headers for ntvfs, tdr, smb_server and nbt_server. ------------------------------------------------------------------------ r12539 | metze | 2005-12-28 10:31:43 +0100 (Wed, 28 Dec 2005) | 3 lines fix the pidl tests metze ------------------------------------------------------------------------ r12572 | jelmer | 2005-12-29 17:03:03 +0100 (Thu, 29 Dec 2005) | 2 lines No longer parse coclasses as interfaces ------------------------------------------------------------------------ r12573 | jelmer | 2005-12-29 17:03:47 +0100 (Thu, 29 Dec 2005) | 2 lines Update README to recent changes in pidls namespace ------------------------------------------------------------------------ r12574 | jelmer | 2005-12-29 17:04:34 +0100 (Thu, 29 Dec 2005) | 3 lines Bring tables.pl back to life and move registration of interfaces now completely to a new subsystem. ------------------------------------------------------------------------ r12651 | jelmer | 2005-12-31 15:57:43 +0100 (Sat, 31 Dec 2005) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/librpc/idl/idl_types.h M /branches/SAMBA_4_0/source/librpc/ndr/libndr.h M /branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c Remove STR_LARGE_SIZE as it's no longer used ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=16927
Diffstat (limited to 'tools/pidl')
-rw-r--r--tools/pidl/MANIFEST1
-rw-r--r--tools/pidl/README24
-rw-r--r--tools/pidl/TODO1
-rw-r--r--tools/pidl/lib/Parse/Pidl.pm2
-rw-r--r--tools/pidl/lib/Parse/Pidl/Compat.pm52
-rw-r--r--tools/pidl/lib/Parse/Pidl/NDR.pm4
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm17
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm4
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm78
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm77
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm44
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm9
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm1
-rw-r--r--tools/pidl/lib/Parse/Pidl/Util.pm16
-rwxr-xr-xtools/pidl/pidl7
-rw-r--r--tools/pidl/tests/Util.pm2
16 files changed, 123 insertions, 216 deletions
diff --git a/tools/pidl/MANIFEST b/tools/pidl/MANIFEST
index e0619d41f0..1d6cfc98dc 100644
--- a/tools/pidl/MANIFEST
+++ b/tools/pidl/MANIFEST
@@ -13,7 +13,6 @@ lib/Parse/Pidl/Samba4/NDR/Client.pm
lib/Parse/Pidl/Samba4/COM/Header.pm
lib/Parse/Pidl/Samba4/COM/Stub.pm
lib/Parse/Pidl/Samba4/COM/Proxy.pm
-lib/Parse/Pidl/Samba4/EJSHeader.pm
lib/Parse/Pidl/Samba4/Header.pm
lib/Parse/Pidl/Samba4/SWIG.pm
lib/Parse/Pidl/Samba4/TDR.pm
diff --git a/tools/pidl/README b/tools/pidl/README
index c90105a0ef..ddd5fdf319 100644
--- a/tools/pidl/README
+++ b/tools/pidl/README
@@ -27,26 +27,24 @@ Internals overview:
-- Generic --
Parse::Pidl::Dump - Converts the parse tree back to an IDL file
-Parse::Pidl::Samba::Header - Generates header file with data structures defined in IDL file
+Parse::Pidl::Samba4::Header - Generates header file with data structures defined in IDL file
Parse::Pidl::NDR - Generates intermediate datastructures for use by NDR parses/generators
Parse::Pidl::ODL - Generates IDL structures from ODL structures for use in the NDR parser generator
Parse::Pidl::Test - Utility functions for use in pidl's testsuite
-- Samba NDR --
-Parse::Pidl::Samba::NDR::Client - Generates client call functions in C using the NDR parser
-Parse::Pidl::Samba::SWIG - Generates SWIG interface files (.i)
-Parse::Pidl::Samba::NDR::Header - Generates a header file with NDR-parser specific data
-Parse::Pidl::Samba::NDR::Parser - Generates pull/push functions for parsing NDR
-Parse::Pidl::Samba::NDR::Server - Generates server side implementation in C
-Parse::Pidl::Samba::TDR - Parser generator for the "Trivial Data Representation"
-Parse::Pidl::Samba::Template - Generates stubs in C for server implementation
-Parse::Pidl::Samba::EJS - Generates bindings for Embedded JavaScript (EJS)
-Parse::Pidl::Samba::EJSHeader - Generates headers for the EJS bindings
+Parse::Pidl::Samba4::NDR::Client - Generates client call functions in C using the NDR parser
+Parse::Pidl::Samba4::SWIG - Generates SWIG interface files (.i)
+Parse::Pidl::Samba4::NDR::Parser - Generates pull/push functions for parsing NDR
+Parse::Pidl::Samba4::NDR::Server - Generates server side implementation in C
+Parse::Pidl::Samba4::TDR - Parser generator for the "Trivial Data Representation"
+Parse::Pidl::Samba4::Template - Generates stubs in C for server implementation
+Parse::Pidl::Samba4::EJS - Generates bindings for Embedded JavaScript (EJS)
-- Samba COM / DCOM --
-Parse::Pidl::Samba::COM::Proxy - Generates proxy object for DCOM (client-side)
-Parse::Pidl::Samba::COM::Stub - Generates stub call handler for DCOM (server-side)
-Parse::Pidl::Samba::COM::Header - Generates header file for COM interface(s)
+Parse::Pidl::Samba4::COM::Proxy - Generates proxy object for DCOM (client-side)
+Parse::Pidl::Samba4::COM::Stub - Generates stub call handler for DCOM (server-side)
+Parse::Pidl::Samba4::COM::Header - Generates headers for COM
-- Ethereal --
Parse::Pidl::Ethereal::NDR - Generates a parser for the ethereal network sniffer
diff --git a/tools/pidl/TODO b/tools/pidl/TODO
index f48af8c38c..a99a4f3f5f 100644
--- a/tools/pidl/TODO
+++ b/tools/pidl/TODO
@@ -7,6 +7,7 @@
a (regular) remote error occurs
- support nested elements
+ - generate names for anonymous tagged types
- auto-alloc [ref] pointers for Samba4 during pull if they were NULL
diff --git a/tools/pidl/lib/Parse/Pidl.pm b/tools/pidl/lib/Parse/Pidl.pm
index 465f3409ad..c60fc59aba 100644
--- a/tools/pidl/lib/Parse/Pidl.pm
+++ b/tools/pidl/lib/Parse/Pidl.pm
@@ -11,6 +11,6 @@ use strict;
use vars qw ( $VERSION );
-$VERSION = '0.01';
+$VERSION = '0.02';
1;
diff --git a/tools/pidl/lib/Parse/Pidl/Compat.pm b/tools/pidl/lib/Parse/Pidl/Compat.pm
index 2e7d686249..f0b8cc7b0b 100644
--- a/tools/pidl/lib/Parse/Pidl/Compat.pm
+++ b/tools/pidl/lib/Parse/Pidl/Compat.pm
@@ -74,29 +74,19 @@ my %supported_properties = (
"length_is" => ["ELEMENT"],
);
-
-my($res);
-
sub warning($$)
{
- my $l = shift;
- my $m = shift;
-
- print "$l->{FILE}:$l->{LINE}:Warning:$m\n";
-}
-
-sub error($$)
-{
my ($l,$m) = @_;
- print "$l->{FILE}:$l->{LINE}:$m\n";
+
+ print STDERR "$l->{FILE}:$l->{LINE}:warning:$m\n";
}
sub CheckTypedef($)
{
- my $td = shift;
+ my ($td) = @_;
if (has_property($td, "nodiscriminant")) {
- error($td, "nodiscriminant property not supported");
+ warning($td, "nodiscriminant property not supported");
}
if ($td->{TYPE} eq "BITMAP") {
@@ -121,7 +111,7 @@ sub CheckElement($)
my $e = shift;
if (has_property($e, "noheader")) {
- error($e, "noheader property not supported");
+ warning($e, "noheader property not supported");
return;
}
@@ -131,30 +121,28 @@ sub CheckElement($)
}
if (has_property($e, "compression")) {
- error($e, "compression() property not supported");
+ warning($e, "compression() property not supported");
}
if (has_property($e, "obfuscation")) {
- error($e, "obfuscation() property not supported");
+ warning($e, "obfuscation() property not supported");
}
if (has_property($e, "sptr")) {
- error($e, "sptr() pointer property not supported");
+ warning($e, "sptr() pointer property not supported");
}
if (has_property($e, "relative")) {
- error($e, "relative() pointer property not supported");
+ warning($e, "relative() pointer property not supported");
}
- if (has_property($td, "flag")) {
+ if (has_property($e, "flag")) {
warning($e, "ignoring flag() property");
}
- if (has_property($td, "value")) {
+ if (has_property($e, "value")) {
warning($e, "ignoring value() property");
}
-
- StripProperties($e);
}
sub CheckFunction($)
@@ -162,12 +150,8 @@ sub CheckFunction($)
my $fn = shift;
if (has_property($fn, "noopnum")) {
- error($fn, "noopnum not converted. Opcodes will be out of sync.");
+ warning($fn, "noopnum not converted. Opcodes will be out of sync.");
}
-
- StripProperties($fn);
-
-
}
sub CheckInterface($)
@@ -176,11 +160,9 @@ sub CheckInterface($)
if (has_property($if, "pointer_default_top") and
$if->{PROPERTIES}->{pointer_default_top} ne "ref") {
- error($if, "pointer_default_top() is pidl-specific");
+ warning($if, "pointer_default_top() is pidl-specific");
}
- StripProperties($if);
-
foreach my $x (@{$if->{DATA}}) {
if ($x->{TYPE} eq "DECLARE") {
warning($if, "the declare keyword is pidl-specific");
@@ -193,14 +175,10 @@ sub Check($)
{
my $pidl = shift;
my $nidl = [];
- my $res = "";
- foreach my $x (@{$pidl}) {
- push (@$nidl, CheckInterface($x))
- if ($x->{TYPE} eq "INTERFACE");
+ foreach (@{$pidl}) {
+ push (@$nidl, CheckInterface($_)) if ($_->{TYPE} eq "INTERFACE");
}
-
- return $res;
}
1;
diff --git a/tools/pidl/lib/Parse/Pidl/NDR.pm b/tools/pidl/lib/Parse/Pidl/NDR.pm
index 0dd1ab4dd2..179d2ecb12 100644
--- a/tools/pidl/lib/Parse/Pidl/NDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/NDR.pm
@@ -642,7 +642,9 @@ sub Parse($)
my @ndr = ();
- push(@ndr, ParseInterface($_)) foreach (@{$idl});
+ foreach (@{$idl}) {
+ ($_->{TYPE} eq "INTERFACE") && push(@ndr, ParseInterface($_));
+ }
return \@ndr;
}
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm
index b9044078ea..83df9afe88 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm
@@ -3,8 +3,8 @@
package Parse::Pidl::Samba4::COM::Header;
-use Parse::Pidl::Typelist;
-use Parse::Pidl::Util qw(has_property);
+use Parse::Pidl::Typelist qw(mapType);
+use Parse::Pidl::Util qw(has_property is_constant);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -18,7 +18,7 @@ sub GetArgumentProtoList($)
foreach my $a (@{$f->{ELEMENTS}}) {
- $res .= ", " . Parse::Pidl::Typelist::mapType($a->{TYPE}) . " ";
+ $res .= ", " . mapType($a->{TYPE}) . " ";
my $l = $a->{POINTERS};
$l-- if (Parse::Pidl::Typelist::scalar_is_reference($a->{TYPE}));
@@ -26,13 +26,12 @@ sub GetArgumentProtoList($)
$res .= "*";
}
- if (defined $a->{ARRAY_LEN}[0] &&
- !Parse::Pidl::Util::is_constant($a->{ARRAY_LEN}[0]) &&
+ if (defined $a->{ARRAY_LEN}[0] && !is_constant($a->{ARRAY_LEN}[0]) &&
!$a->{POINTERS}) {
$res .= "*";
}
$res .= $a->{NAME};
- if (defined $a->{ARRAY_LEN}[0] && Parse::Pidl::Util::is_constant($a->{ARRAY_LEN}[0])) {
+ if (defined $a->{ARRAY_LEN}[0] && is_constant($a->{ARRAY_LEN}[0])) {
$res .= "[$a->{ARRAY_LEN}[0]]";
}
}
@@ -45,9 +44,7 @@ sub GetArgumentList($)
my $f = shift;
my $res = "";
- foreach my $a (@{$f->{ELEMENTS}}) {
- $res .= ", $a->{NAME}";
- }
+ foreach (@{$f->{ELEMENTS}}) { $res .= ", $_->{NAME}"; }
return $res;
}
@@ -65,7 +62,7 @@ sub HeaderVTable($)
my $data = $interface->{DATA};
foreach my $d (@{$data}) {
- $res .= "\t" . Parse::Pidl::Typelist::mapType($d->{RETURN_TYPE}) . " (*$d->{NAME}) (struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d) . ");\\\n" if ($d->{TYPE} eq "FUNCTION");
+ $res .= "\t" . mapType($d->{RETURN_TYPE}) . " (*$d->{NAME}) (struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d) . ");\\\n" if ($d->{TYPE} eq "FUNCTION");
}
$res .= "\n";
$res .= "struct $interface->{NAME}_vtable {\n";
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
index 26a1225590..c0d460fe09 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
@@ -54,7 +54,7 @@ sub ParseRegFunc($)
$res.= "
const void *base_vtable;
- GUID_from_string(DCERPC_" . (uc $interface->{BASE}) . "_UUID, &base_iid);
+ base_iid = dcerpc_table_$interface->{BASE}.uuid;
base_vtable = dcom_proxy_vtable_by_iid(&base_iid);
if (base_vtable == NULL) {
@@ -73,7 +73,7 @@ sub ParseRegFunc($)
}
$res.= "
- GUID_from_string(DCERPC_" . (uc $interface->{NAME}) . "_UUID, &proxy_vtable.iid);
+ proxy_vtable.iid = dcerpc_table_$interface->{NAME}.uuid;
return dcom_register_proxy(&proxy_vtable);
}\n\n";
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index 8c576c44f9..d5e1405c30 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -13,10 +13,18 @@ use Parse::Pidl::Util qw(has_property);
use vars qw($VERSION);
$VERSION = '0.01';
-my($res);
+my $res;
+my $res_hdr;
+
my %constants;
my $tabs = "";
+
+sub pidl_hdr ($)
+{
+ $res_hdr .= shift;
+}
+
sub pidl($)
{
my $d = shift;
@@ -110,12 +118,16 @@ sub get_value_of($)
#####################################################################
# work out is a parse function should be declared static or not
-sub fn_prefix($)
+sub fn_declare($$)
{
- my $fn = shift;
+ my ($fn,$decl) = @_;
- return "" if (has_property($fn, "public"));
- return "static ";
+ if (has_property($fn, "public")) {
+ pidl_hdr "$decl;\n";
+ pidl "$decl";
+ } else {
+ pidl "static $decl";
+ }
}
###########################
@@ -251,8 +263,8 @@ sub EjsStructPull($$)
my $name = shift;
my $d = shift;
my $env = GenerateStructEnv($d);
- pidl fn_prefix($d);
- pidl "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, struct $name *r)\n{";
+ fn_declare($d, "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, struct $name *r)");
+ pidl "{";
indent;
pidl "NDR_CHECK(ejs_pull_struct_start(ejs, &v, name));";
foreach my $e (@{$d->{ELEMENTS}}) {
@@ -271,8 +283,8 @@ sub EjsUnionPull($$)
my $d = shift;
my $have_default = 0;
my $env = GenerateStructEnv($d);
- pidl fn_prefix($d);
- pidl "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, union $name *r)\n{";
+ fn_declare($d, "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, union $name *r)");
+ pidl "{";
indent;
pidl "NDR_CHECK(ejs_pull_struct_start(ejs, &v, name));";
pidl "switch (ejs->switch_var) {";
@@ -327,8 +339,8 @@ sub EjsEnumPull($$)
my $name = shift;
my $d = shift;
EjsEnumConstant($d);
- pidl fn_prefix($d);
- pidl "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, enum $name *r)\n{";
+ fn_declare($d, "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, enum $name *r)");
+ pidl "{";
indent;
pidl "unsigned e;";
pidl "NDR_CHECK(ejs_pull_enum(ejs, v, name, &e));";
@@ -346,8 +358,8 @@ sub EjsBitmapPull($$)
my $d = shift;
my $type_fn = $d->{BASE_TYPE};
my($type_decl) = Parse::Pidl::Typelist::mapType($d->{BASE_TYPE});
- pidl fn_prefix($d);
- pidl "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, $type_decl *r)\n{";
+ fn_declare($d, "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, $type_decl *r)");
+ pidl "{";
indent;
pidl "return ejs_pull_$type_fn(ejs, v, name, r);";
deindent;
@@ -529,8 +541,8 @@ sub EjsStructPush($$)
my $name = shift;
my $d = shift;
my $env = GenerateStructEnv($d);
- pidl fn_prefix($d);
- pidl "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const struct $name *r)\n{";
+ fn_declare($d, "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const struct $name *r)");
+ pidl "{";
indent;
pidl "NDR_CHECK(ejs_push_struct_start(ejs, &v, name));";
foreach my $e (@{$d->{ELEMENTS}}) {
@@ -549,8 +561,8 @@ sub EjsUnionPush($$)
my $d = shift;
my $have_default = 0;
my $env = GenerateStructEnv($d);
- pidl fn_prefix($d);
- pidl "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const union $name *r)\n{";
+ fn_declare($d, "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const union $name *r)");
+ pidl "{";
indent;
pidl "NDR_CHECK(ejs_push_struct_start(ejs, &v, name));";
pidl "switch (ejs->switch_var) {";
@@ -587,8 +599,8 @@ sub EjsEnumPush($$)
my $name = shift;
my $d = shift;
EjsEnumConstant($d);
- pidl fn_prefix($d);
- pidl "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const enum $name *r)\n{";
+ fn_declare($d, "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const enum $name *r)");
+ pidl "{";
indent;
pidl "unsigned e = *r;";
pidl "NDR_CHECK(ejs_push_enum(ejs, v, name, &e));";
@@ -613,8 +625,8 @@ sub EjsBitmapPush($$)
$constants{$bname} = $v;
}
}
- pidl fn_prefix($d);
- pidl "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const $type_decl *r)\n{";
+ fn_declare($d, "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const $type_decl *r)");
+ pidl "{";
indent;
pidl "return ejs_push_$type_fn(ejs, v, name, r);";
deindent;
@@ -628,6 +640,7 @@ sub EjsTypedefPush($)
{
my $d = shift;
return if (has_property($d, "noejs"));
+
if ($d->{DATA}->{TYPE} eq 'STRUCT') {
EjsStructPush($d->{NAME}, $d->{DATA});
} elsif ($d->{DATA}->{TYPE} eq 'UNION') {
@@ -706,6 +719,17 @@ sub EjsInterface($$)
%constants = ();
+ pidl_hdr "#ifndef _HEADER_EJS_$interface->{NAME}\n";
+ pidl_hdr "#define _HEADER_EJS_$interface->{NAME}\n\n";
+
+ if (has_property($interface, "depends")) {
+ foreach (split / /, $interface->{PROPERTIES}->{depends}) {
+ pidl_hdr "#include \"librpc/gen_ndr/ndr_$_\_ejs\.h\"\n";
+ }
+ }
+
+ pidl_hdr "\n";
+
foreach my $d (@{$interface->{TYPES}}) {
($needed->{"push_$d->{NAME}"}) && EjsTypedefPush($d);
($needed->{"pull_$d->{NAME}"}) && EjsTypedefPull($d);
@@ -748,9 +772,13 @@ sub EjsInterface($$)
pidl "NTSTATUS ejs_init_$name(void)";
pidl "{";
indent;
- pidl "return smbcalls_register_ejs(\"$name\_init\", ejs_$name\_init);";
+ pidl "ejsDefineCFunction(-1, \"$name\_init\", ejs_$name\_init, NULL, MPR_VAR_SCRIPT_HANDLE);";
+ pidl "return NT_STATUS_OK;";
deindent;
pidl "}";
+
+ pidl_hdr "\n";
+ pidl_hdr "#endif /* _HEADER_EJS_$interface->{NAME} */\n";
}
#####################################################################
@@ -762,6 +790,10 @@ sub Parse($$)
my $ejs_hdr = $hdr;
$ejs_hdr =~ s/.h$/_ejs.h/;
$res = "";
+ $res_hdr = "";
+
+ pidl_hdr "/* header auto-generated by pidl */\n\n";
+
pidl "
/* EJS wrapper functions auto-generated by pidl */
#include \"includes.h\"
@@ -784,7 +816,7 @@ sub Parse($$)
($x->{TYPE} eq "INTERFACE") && EjsInterface($x, \%needed);
}
- return $res;
+ return ($res_hdr, $res);
}
sub NeededFunction($$)
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm b/tools/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm
deleted file mode 100644
index eae7ddce5f..0000000000
--- a/tools/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm
+++ /dev/null
@@ -1,77 +0,0 @@
-###################################################
-# create C header files for an EJS mapping functions
-# Copyright tridge@samba.org 2005
-# released under the GNU GPL
-
-package Parse::Pidl::Samba4::EJSHeader;
-
-use strict;
-use Parse::Pidl::Typelist;
-use Parse::Pidl::Util qw(has_property);
-
-use vars qw($VERSION);
-$VERSION = '0.01';
-
-my($res);
-
-sub pidl ($)
-{
- $res .= shift;
-}
-
-#####################################################################
-# prototype a typedef
-sub HeaderTypedefProto($)
-{
- my $d = shift;
- my $name = $d->{NAME};
-
- return unless has_property($d, "public");
-
- my $type_decl = Parse::Pidl::Typelist::mapType($name);
-
- pidl "NTSTATUS ejs_push_$d->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, const $type_decl *);\n";
- pidl "NTSTATUS ejs_pull_$d->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, $type_decl *);\n";
-}
-
-#####################################################################
-# parse the interface definitions
-sub HeaderInterface($)
-{
- my($interface) = shift;
-
- my $count = 0;
-
- pidl "#ifndef _HEADER_EJS_$interface->{NAME}\n";
- pidl "#define _HEADER_EJS_$interface->{NAME}\n\n";
-
- if (defined $interface->{PROPERTIES}->{depends}) {
- my @d = split / /, $interface->{PROPERTIES}->{depends};
- foreach my $i (@d) {
- pidl "#include \"librpc/gen_ndr/ndr_$i\_ejs\.h\"\n";
- }
- }
-
- pidl "\n";
-
- HeaderTypedefProto($_) foreach (@{$interface->{TYPES}});
-
- pidl "\n";
- pidl "#endif /* _HEADER_EJS_$interface->{NAME} */\n";
-}
-
-#####################################################################
-# parse a parsed IDL into a C header
-sub Parse($)
-{
- my($idl) = shift;
-
- $res = "";
- pidl "/* header auto-generated by pidl */\n\n";
- foreach my $x (@{$idl}) {
- ($x->{TYPE} eq "INTERFACE") && HeaderInterface($x);
- }
- return $res;
-}
-
-1;
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index bb9d32487a..5d01531eb7 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -9,7 +9,7 @@ package Parse::Pidl::Samba4::NDR::Parser;
use strict;
use Parse::Pidl::Typelist qw(hasType getType mapType);
-use Parse::Pidl::Util qw(has_property ParseExpr);
+use Parse::Pidl::Util qw(has_property ParseExpr print_uuid);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
use vars qw($VERSION);
@@ -2158,13 +2158,10 @@ sub FunctionTable($)
my $count = 0;
my $uname = uc $interface->{NAME};
- $count = $#{$interface->{FUNCTIONS}}+1;
-
- return if ($count == 0);
+ return if ($#{$interface->{FUNCTIONS}}+1 == 0);
return unless defined ($interface->{PROPERTIES}->{uuid});
pidl "static const struct dcerpc_interface_call $interface->{NAME}\_calls[] = {";
- $count = 0;
foreach my $d (@{$interface->{FUNCTIONS}}) {
next if not defined($d->{OPNUM});
pidl "\t{";
@@ -2218,7 +2215,7 @@ sub FunctionTable($)
pidl "\nconst struct dcerpc_interface_table dcerpc_table_$interface->{NAME} = {";
pidl "\t.name\t\t= \"$interface->{NAME}\",";
- pidl "\t.uuid\t\t= DCERPC_$uname\_UUID,";
+ pidl "\t.uuid\t\t= ". print_uuid($interface->{UUID}) .",";
pidl "\t.if_version\t= DCERPC_$uname\_VERSION,";
pidl "\t.helpstring\t= DCERPC_$uname\_HELPSTRING,";
pidl "\t.num_calls\t= $count,";
@@ -2228,11 +2225,6 @@ sub FunctionTable($)
pidl "};";
pidl "";
- pidl "static NTSTATUS dcerpc_ndr_$interface->{NAME}_init(void)";
- pidl "{";
- pidl "\treturn librpc_register_interface(&dcerpc_table_$interface->{NAME});";
- pidl "}";
- pidl "";
}
#####################################################################
@@ -2339,34 +2331,6 @@ sub ParseInterface($$)
FunctionTable($interface);
}
-sub RegistrationFunction($$)
-{
- my ($idl,$basename) = @_;
-
- pidl "NTSTATUS dcerpc_$basename\_init(void)";
- pidl "{";
- indent;
- pidl "NTSTATUS status = NT_STATUS_OK;";
- foreach my $interface (@{$idl}) {
- next if $interface->{TYPE} ne "INTERFACE";
-
- my $count = ($#{$interface->{FUNCTIONS}}+1);
-
- next if ($count == 0);
- next unless defined ($interface->{PROPERTIES}->{uuid});
-
- pidl "status = dcerpc_ndr_$interface->{NAME}_init();";
- pidl "if (NT_STATUS_IS_ERR(status)) {";
- pidl "\treturn status;";
- pidl "}";
- pidl "";
- }
- pidl "return status;";
- deindent;
- pidl "}";
- pidl "";
-}
-
#####################################################################
# parse a parsed IDL structure back into an IDL file
sub Parse($$)
@@ -2393,8 +2357,6 @@ sub Parse($$)
($_->{TYPE} eq "INTERFACE") && ParseInterface($_, \%needed);
}
- RegistrationFunction($ndr, $basename);
-
return ($res_hdr, $res);
}
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
index 585209b733..8710f08cc7 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
@@ -7,6 +7,7 @@
package Parse::Pidl::Samba4::NDR::Server;
use strict;
+use Parse::Pidl::Util;
use vars qw($VERSION);
$VERSION = '0.01';
@@ -76,7 +77,7 @@ sub Boilerplate_Iface($)
my($interface) = shift;
my $name = $interface->{NAME};
my $uname = uc $name;
- my $uuid = Parse::Pidl::Util::make_str(lc($interface->{PROPERTIES}->{uuid}));
+ my $uuid = lc($interface->{PROPERTIES}->{uuid});
my $if_version = $interface->{PROPERTIES}->{version};
pidl "
@@ -187,7 +188,7 @@ static NTSTATUS $name\__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_C
static const struct dcesrv_interface $name\_interface = {
.name = \"$name\",
- .uuid = $uuid,
+ .uuid = ".print_uuid($uuid).",
.if_version = $if_version,
.bind = $name\__op_bind,
.unbind = $name\__op_unbind,
@@ -227,10 +228,10 @@ static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const str
return NT_STATUS_OK;
}
-static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32_t if_version)
+static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
{
if ($name\_interface.if_version == if_version &&
- strcmp($name\_interface.uuid, uuid)==0) {
+ GUID_equal(\&$name\_interface.uuid, uuid)) {
memcpy(iface,&$name\_interface, sizeof(*iface));
return True;
}
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm
index 789fb7adbe..3bdb701526 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm
@@ -242,6 +242,7 @@ sub Parser($$$)
pidl "";
pidl_hdr "/* autogenerated by pidl */";
pidl_hdr "#include \"$baseheader\"";
+ pidl_hdr "#include \"tdr/tdr.h\"";
pidl_hdr "";
foreach (@$idl) { ParserInterface($_) if ($_->{TYPE} eq "INTERFACE"); }
diff --git a/tools/pidl/lib/Parse/Pidl/Util.pm b/tools/pidl/lib/Parse/Pidl/Util.pm
index ec6a1420ab..ff615a21ba 100644
--- a/tools/pidl/lib/Parse/Pidl/Util.pm
+++ b/tools/pidl/lib/Parse/Pidl/Util.pm
@@ -6,7 +6,7 @@ package Parse::Pidl::Util;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str);
+@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str print_uuid);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -75,6 +75,20 @@ sub make_str($)
return "\"" . $str . "\"";
}
+sub print_uuid($)
+{
+ my ($uuid) = @_;
+ $uuid =~ s/"//g;
+ my ($time_low,$time_mid,$time_hi,$clock_seq,$node) = split /-/, $uuid;
+
+ my @clock_seq = $clock_seq =~ /(..)/g;
+ my @node = $node =~ /(..)/g;
+
+ return "{0x$time_low,0x$time_mid,0x$time_hi," .
+ "{".join(',', map {"0x$_"} @clock_seq)."}," .
+ "{".join(',', map {"0x$_"} @node)."}}";
+}
+
# a hack to build on platforms that don't like negative enum values
my $useUintEnums = 0;
sub setUseUintEnums($)
diff --git a/tools/pidl/pidl b/tools/pidl/pidl
index d1b8c4480b..dcf5850774 100755
--- a/tools/pidl/pidl
+++ b/tools/pidl/pidl
@@ -675,10 +675,9 @@ sub process_file($)
if (defined($opt_ejs)) {
require Parse::Pidl::Samba4::EJS;
- require Parse::Pidl::Samba4::EJSHeader;
- FileSave("$outputdir/ndr_$basename\_ejs.c", Parse::Pidl::Samba4::EJS::Parse($ndr, $h_filename));
-
- FileSave("$outputdir/ndr_$basename\_ejs.h", Parse::Pidl::Samba4::EJSHeader::Parse($ndr));
+ my ($hdr,$prsr) = Parse::Pidl::Samba4::EJS::Parse($ndr, $h_filename);
+ FileSave("$outputdir/ndr_$basename\_ejs.c", $prsr);
+ FileSave("$outputdir/ndr_$basename\_ejs.h", $hdr);
}
if (defined($opt_server)) {
diff --git a/tools/pidl/tests/Util.pm b/tools/pidl/tests/Util.pm
index 52fde11bf5..c85ef72d0a 100644
--- a/tools/pidl/tests/Util.pm
+++ b/tools/pidl/tests/Util.pm
@@ -48,7 +48,7 @@ SKIP: {
my $outfile = "test-$name";
#my $cflags = $ENV{CFLAGS};
- my $cflags = "-Iinclude -I.";
+ my $cflags = "-Iinclude -Ilib -I.";
if ($insamba and $link) {
open CC, "|cc -x c -o $outfile $cflags -";