diff options
Diffstat (limited to 'source4/build/pidl')
-rw-r--r-- | source4/build/pidl/parser.pm | 48 | ||||
-rw-r--r-- | source4/build/pidl/proxy.pm | 2 | ||||
-rwxr-xr-x | source4/build/pidl/tables.pl | 111 |
3 files changed, 45 insertions, 116 deletions
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm index e55e5ecd9c..5be538b2cf 100644 --- a/source4/build/pidl/parser.pm +++ b/source4/build/pidl/parser.pm @@ -1480,9 +1480,7 @@ sub FunctionTable($) if ($d->{TYPE} eq "FUNCTION") { $count++; } } - if ($count == 0) { - return; - } + return if ($count == 0); pidl "static const struct dcerpc_interface_call $interface->{NAME}\_calls[] = {\n"; foreach my $d (@{$data}) { @@ -1525,8 +1523,12 @@ sub FunctionTable($) pidl "\t$interface->{NAME}\_calls,\n"; pidl "\t&$interface->{NAME}\_endpoints\n"; pidl "};\n\n"; -} + pidl "static NTSTATUS dcerpc_ndr_$interface->{NAME}_init(void)\n"; + pidl "{\n"; + pidl "\treturn librpc_register_interface(&dcerpc_table_$interface->{NAME});\n"; + pidl "}\n\n"; +} ##################################################################### # parse the interface definitions @@ -1570,7 +1572,43 @@ sub ParseInterface($) } FunctionTable($interface); +} + +sub RegistrationFunction($$) +{ + my $idl = shift; + my $filename = shift; + $filename =~ /.*\/ndr_(.*).c/; + my $basename = $1; + pidl "NTSTATUS dcerpc_$basename\_init(void)\n"; + pidl "{\n"; + pidl "\tNTSTATUS status = NT_STATUS_OK;\n"; + foreach my $interface (@{$idl}) { + next if $interface->{TYPE} ne "INTERFACE"; + + my $data = $interface->{INHERITED_DATA}; + my $count = 0; + foreach my $d (@{$data}) { + if ($d->{TYPE} eq "FUNCTION") { $count++; } + } + + next if ($count == 0); + + pidl "\tstatus = dcerpc_ndr_$interface->{NAME}_init();\n"; + pidl "\tif (NT_STATUS_IS_ERR(status)) {\n"; + pidl "\t\treturn status;\n"; + pidl "\t}\n\n"; + + if (util::has_property($interface, "object")) { + pidl "\tstatus = dcom_$interface->{NAME}_init();\n"; + pidl "\tif (NT_STATUS_IS_ERR(status)) {\n"; + pidl "\t\treturn status;\n"; + pidl "\t}\n\n"; + } + } + pidl "\treturn status;\n"; + pidl "}\n\n"; } ##################################################################### @@ -1604,6 +1642,8 @@ sub Parse($$) } } + RegistrationFunction($idl, $filename); + close(OUT); } diff --git a/source4/build/pidl/proxy.pm b/source4/build/pidl/proxy.pm index fabf7cc97e..f8991ce9fe 100644 --- a/source4/build/pidl/proxy.pm +++ b/source4/build/pidl/proxy.pm @@ -37,7 +37,7 @@ sub ParseRegFunc($) { my $interface = shift; - $res .= "NTSTATUS dcom_$interface->{NAME}_init(void) + $res .= "static NTSTATUS dcom_$interface->{NAME}_init(void) { struct dcom_interface iface; "; diff --git a/source4/build/pidl/tables.pl b/source4/build/pidl/tables.pl deleted file mode 100755 index 8d43dff146..0000000000 --- a/source4/build/pidl/tables.pl +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/perl -w - -################################################### -# package to produce a table of all idl parsers -# Copyright tridge@samba.org 2003 -# released under the GNU GPL - -use strict; - -use Getopt::Long; -use File::Basename; - -my($opt_output); -my($opt_help) = 0; - - -######################################### -# display help text -sub ShowHelp() -{ - print " - perl IDL table generator - Copyright (C) tridge\@samba.org - - Usage: tables.pl [options] <idlfile> - - Options: - --output OUTNAME put output in OUTNAME.* - \n"; - exit(0); -} - -# main program -GetOptions ( - 'help|h|?' => \$opt_help, - 'output=s' => \$opt_output, - ); - -if ($opt_help) { - ShowHelp(); - exit(0); -} - - -################################### -# add include lines to tables.c -sub process_include($) -{ - my $name = shift; - print TABLEC "#include \"$name\"\n"; -} - -################################### -# extract table entries from 1 file -sub process_file($) -{ - my $filename = shift; - open(FILE, $filename) || die "unable to open $filename\n"; - - while (my $line = <FILE>) { - if ($line =~ /extern const struct dcerpc_interface_table dcerpc_table_(\w+);/) { - print TABLEC "\t&dcerpc_table_$1,\n"; - print TABLEH "NTSTATUS dcerpc_$1\_init(void);\n"; - } - } - - close(FILE); -} - -print "Creating $opt_output.[ch]\n"; -open(TABLEH, ">$opt_output.h") || die "failed to open $opt_output.h\n"; -open(TABLEC, ">$opt_output.c") || die "failed to open $opt_output.c\n"; - -#include "includes.h" - -#define NDR_BASE_MARSHALL_SIZE 1024 - -print TABLEC " -#include \"includes.h\" -"; - -foreach my $filename (@ARGV) { - process_include($filename); -} - - -print TABLEC " -/* - generated by pidl IDL table generator -*/ -const struct dcerpc_interface_table * const dcerpc_pipes[] = { -"; - -print TABLEH " -/* - table headers generated by pidl IDL table generator -*/ - -extern const struct dcerpc_interface_table * const dcerpc_pipes[]; - -"; - -foreach my $filename (@ARGV) { - process_file($filename); -} - - -print TABLEC "\tNULL\n};\n"; - -close(TABLEH); -close(TABLEC); |