From ba33beec050bdc4bf0452761c481ea41985b831f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 28 Nov 2003 05:20:11 +0000 Subject: * added a bunch of placeholder IDL files * allow for an interface to list its endpoints in the IDL file, so we can automatically make the server listen on the right pipes, and can scan pipes more easily (I don't take advantage of this yet, just putting the infrastructure in place) (This used to be commit c8b8480244b4ab6204403dc65e92e4317b410a84) --- source4/build/pidl/idl.gram | 2 +- source4/build/pidl/parser.pm | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) (limited to 'source4/build/pidl') diff --git a/source4/build/pidl/idl.gram b/source4/build/pidl/idl.gram index b354b9772a..adabbe41a6 100644 --- a/source4/build/pidl/idl.gram +++ b/source4/build/pidl/idl.gram @@ -17,7 +17,7 @@ module_header: '[' module_param(s? /,/) ']' }} | -module_param: identifier '(' text ')' +module_param: identifier '(' text ')' {{ "$item{identifier}" => "$item{text}" }} | diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm index a10058a160..5bf5e4220f 100644 --- a/source4/build/pidl/parser.pm +++ b/source4/build/pidl/parser.pm @@ -14,6 +14,10 @@ use client; my %needed; my %structs; +my $if_uuid; +my $if_version; +my $if_endpoints; + sub pidl($) { print OUT shift; @@ -1281,7 +1285,31 @@ sub FunctionTable($) } pidl "\t{ NULL, 0, NULL, NULL }\n};\n\n"; - pidl "\nconst struct dcerpc_interface_table dcerpc_table_$interface->{NAME} = {\"$interface->{NAME}\", DCERPC_$uname\_UUID, DCERPC_$uname\_VERSION, $count, $interface->{NAME}\_calls};\n\n"; + my $endpoints; + + if (! defined $if_endpoints) { + $if_endpoints = $interface->{NAME}; + } + + pidl "static const struct dcerpc_endpoint_list $interface->{NAME}\_endpoints = {\n"; + my @e = split / /, $if_endpoints; + my $endpoint_count = $#e + 1; + pidl "\t$endpoint_count,\n"; + pidl "\t{ "; + for (my $i=0; $i < $#e; $i++) { + pidl "\"$e[$i]\", "; + } + pidl "\"$e[$#e]\" }\n"; + pidl "};\n\n"; + + pidl "\nconst struct dcerpc_interface_table dcerpc_table_$interface->{NAME} = {\n"; + pidl "\t\"$interface->{NAME}\",\n"; + pidl "\tDCERPC_$uname\_UUID,\n"; + pidl "\tDCERPC_$uname\_VERSION,\n"; + pidl "\t$count,\n"; + pidl "\t$interface->{NAME}\_calls,\n"; + pidl "\t&$interface->{NAME}\_endpoints\n"; + pidl "};\n\n"; } @@ -1388,6 +1416,17 @@ sub BuildNeeded($) } } +##################################################################### +# parse the interface definitions +sub ModuleHeader($) +{ + my($h) = shift; + + $if_uuid = $h->{PROPERTIES}->{uuid}; + $if_version = $h->{PROPERTIES}->{version}; + $if_endpoints = $h->{PROPERTIES}->{endpoints}; +} + ##################################################################### # parse a parsed IDL structure back into an IDL file sub Parse($$) @@ -1400,6 +1439,9 @@ sub Parse($$) pidl "/* parser auto-generated by pidl */\n\n"; pidl "#include \"includes.h\"\n\n"; foreach my $x (@{$idl}) { + ($x->{TYPE} eq "MODULEHEADER") && + ModuleHeader($x); + if ($x->{TYPE} eq "INTERFACE") { BuildNeeded($x); ParseInterface($x); -- cgit