diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-02-27 18:52:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:18:14 -0500 |
commit | 2b5d317af191256abea65328ce8d8a8833dcae69 (patch) | |
tree | f13a55d67fa26b4489da5ef99bf80e883929835b /source3/librpc/tables.pl | |
parent | 2838d7499cbd5b7ebade52321985244aee9a9f70 (diff) | |
download | samba-2b5d317af191256abea65328ce8d8a8833dcae69.tar.gz samba-2b5d317af191256abea65328ce8d8a8833dcae69.tar.xz samba-2b5d317af191256abea65328ce8d8a8833dcae69.zip |
r21565: Import ndrdump (doesn't compile yet, needs table support functions).
(This used to be commit 9a9b9421673ed1c455658d8ae79d7a1522a1baa7)
Diffstat (limited to 'source3/librpc/tables.pl')
-rwxr-xr-x | source3/librpc/tables.pl | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/source3/librpc/tables.pl b/source3/librpc/tables.pl new file mode 100755 index 00000000000..9ad0675cb23 --- /dev/null +++ b/source3/librpc/tables.pl @@ -0,0 +1,89 @@ +#!/usr/bin/perl -w + +################################################### +# package to produce a table of all idl parsers +# Copyright tridge@samba.org 2003 +# Copyright jelmer@samba.org 2005 +# released under the GNU GPL + +use strict; + +use Getopt::Long; +use File::Basename; + +my $opt_output = 'librpc/gen_ndr/tables.c'; +my $opt_help = 0; + + +######################################### +# display help text +sub ShowHelp() +{ + print " + perl DCE/RPC interface table generator + Copyright (C) tridge\@samba.org + + Usage: tables.pl [options] <idlfile> + + \n"; + exit(0); +} + +# main program +GetOptions ( + 'help|h|?' => \$opt_help, + 'output=s' => \$opt_output, + ); + +if ($opt_help) { + ShowHelp(); + exit(0); +} + +my $init_fns = ""; + +################################### +# extract table entries from 1 file +sub process_file($) +{ + my $filename = shift; + open(FILE, $filename) || die "unable to open $filename\n"; + my $found = 0; + + while (my $line = <FILE>) { + if ($line =~ /extern const struct dcerpc_interface_table (\w+);/) { + $found = 1; + $init_fns.="\tstatus = librpc_register_interface(&$1);\n"; + $init_fns.="\tif (NT_STATUS_IS_ERR(status)) return status;\n\n"; + } + } + + if ($found) { + print "#include \"$filename\"\n"; + } + + close(FILE); +} + +print <<EOF; + +/* Automatically generated by tables.pl. DO NOT EDIT */ + +#include "includes.h" +#include "librpc/rpc/dcerpc.h" +#include "librpc/rpc/dcerpc_table.h" +EOF + +process_file($_) foreach (@ARGV); + +print <<EOF; + +NTSTATUS dcerpc_register_builtin_interfaces(void) +{ + NTSTATUS status; + +$init_fns + + return NT_STATUS_OK; +} +EOF |