summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-20 13:19:39 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-20 13:19:39 +0200
commite0905c30908b4d621030689d33de28a13c04a690 (patch)
treefe4a2e8ab06ab5dfbcb40e32df385dcdd6767d46 /source4/librpc
parent29838debb3d350aaee0bf9744f1a7371b8b06736 (diff)
downloadsamba-e0905c30908b4d621030689d33de28a13c04a690.tar.gz
samba-e0905c30908b4d621030689d33de28a13c04a690.tar.bz2
samba-e0905c30908b4d621030689d33de28a13c04a690.zip
Use tables in Samba 3 ndrdump.
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/config.mk6
-rw-r--r--source4/librpc/ndr/ndr_table.c134
-rw-r--r--source4/librpc/tables.pl89
3 files changed, 2 insertions, 227 deletions
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index 819b79f91f..6a0cd00e11 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -373,7 +373,7 @@ clean::
$(gen_ndrsrcdir)/tables.c: $(IDL_NDR_PARSE_H_FILES)
@echo Generating $@
- @$(PERL) $(librpcsrcdir)/tables.pl --output=$@ $^ > $(gen_ndrsrcdir)/tables.x
+ @$(PERL) ../librpc/tables.pl --output=$@ $^ > $(gen_ndrsrcdir)/tables.x
@mv $(gen_ndrsrcdir)/tables.x $@
[SUBSYSTEM::NDR_TABLE]
@@ -390,9 +390,7 @@ PUBLIC_DEPENDENCIES = \
NDR_SASL_HELPERS NDR_NOTIFY NDR_WINBIND NDR_FRSRPC NDR_FRSAPI NDR_NFS4ACL NDR_NTP_SIGND \
NDR_DCOM NDR_WMI
-NDR_TABLE_OBJ_FILES = $(ndrsrcdir)/ndr_table.o $(gen_ndrsrcdir)/tables.o
-
-$(eval $(call proto_header_template,$(ndrsrcdir)/ndr_table.h,$(NDR_TABLE_OBJ_FILES:.o=.c)))
+NDR_TABLE_OBJ_FILES = ../librpc/ndr/ndr_table.o $(gen_ndrsrcdir)/tables.o
[SUBSYSTEM::RPC_NDR_ROT]
PUBLIC_DEPENDENCIES = NDR_ROT dcerpc
diff --git a/source4/librpc/ndr/ndr_table.c b/source4/librpc/ndr/ndr_table.c
deleted file mode 100644
index 6308ba20dd..0000000000
--- a/source4/librpc/ndr/ndr_table.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- dcerpc utility functions
-
- Copyright (C) Andrew Tridgell 2003
- Copyright (C) Jelmer Vernooij 2004
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "../lib/util/dlinklist.h"
-#include "librpc/ndr/libndr.h"
-#include "librpc/ndr/ndr_table.h"
-
-static struct ndr_interface_list *ndr_interfaces;
-
-/*
- register a ndr interface table
-*/
-NTSTATUS ndr_table_register(const struct ndr_interface_table *table)
-{
- struct ndr_interface_list *l;
-
- for (l = ndr_interfaces; l; l = l->next) {
- if (GUID_equal(&table->syntax_id.uuid, &l->table->syntax_id.uuid)) {
- DEBUG(0, ("Attempt to register interface %s which has the "
- "same UUID as already registered interface %s\n",
- table->name, l->table->name));
- return NT_STATUS_OBJECT_NAME_COLLISION;
- }
- }
-
- l = talloc(talloc_autofree_context(), struct ndr_interface_list);
- l->table = table;
-
- DLIST_ADD(ndr_interfaces, l);
-
- return NT_STATUS_OK;
-}
-
-/*
- find the pipe name for a local IDL interface
-*/
-const char *ndr_interface_name(const struct GUID *uuid, uint32_t if_version)
-{
- const struct ndr_interface_list *l;
- for (l=ndr_table_list();l;l=l->next) {
- if (GUID_equal(&l->table->syntax_id.uuid, uuid) &&
- l->table->syntax_id.if_version == if_version) {
- return l->table->name;
- }
- }
- return "UNKNOWN";
-}
-
-/*
- find the number of calls defined by local IDL
-*/
-int ndr_interface_num_calls(const struct GUID *uuid, uint32_t if_version)
-{
- const struct ndr_interface_list *l;
- for (l=ndr_interfaces;l;l=l->next){
- if (GUID_equal(&l->table->syntax_id.uuid, uuid) &&
- l->table->syntax_id.if_version == if_version) {
- return l->table->num_calls;
- }
- }
- return -1;
-}
-
-
-/*
- find a dcerpc interface by name
-*/
-const struct ndr_interface_table *ndr_table_by_name(const char *name)
-{
- const struct ndr_interface_list *l;
- for (l=ndr_interfaces;l;l=l->next) {
- if (strcasecmp(l->table->name, name) == 0) {
- return l->table;
- }
- }
- return NULL;
-}
-
-/*
- find a dcerpc interface by uuid
-*/
-const struct ndr_interface_table *ndr_table_by_uuid(const struct GUID *uuid)
-{
- const struct ndr_interface_list *l;
- for (l=ndr_interfaces;l;l=l->next) {
- if (GUID_equal(&l->table->syntax_id.uuid, uuid)) {
- return l->table;
- }
- }
- return NULL;
-}
-
-/*
- return the list of registered dcerpc_pipes
-*/
-const struct ndr_interface_list *ndr_table_list(void)
-{
- return ndr_interfaces;
-}
-
-
-NTSTATUS ndr_table_register_builtin_tables(void);
-
-NTSTATUS ndr_table_init(void)
-{
- static bool initialized = false;
-
- if (initialized) return NT_STATUS_OK;
- initialized = true;
-
- ndr_table_register_builtin_tables();
-
- return NT_STATUS_OK;
-}
diff --git a/source4/librpc/tables.pl b/source4/librpc/tables.pl
deleted file mode 100644
index 04764f5fa0..0000000000
--- a/source4/librpc/tables.pl
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/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 NDR 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 ndr_interface_table (\w+);/) {
- $found = 1;
- $init_fns.="\tstatus = ndr_table_register(&$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/ndr/libndr.h"
-#include "librpc/ndr/ndr_table.h"
-EOF
-
-process_file($_) foreach (@ARGV);
-
-print <<EOF;
-
-NTSTATUS ndr_table_register_builtin_tables(void)
-{
- NTSTATUS status;
-
-$init_fns
-
- return NT_STATUS_OK;
-}
-EOF