2 Unix SMB/CIFS implementation.
4 dcerpc utility functions
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) Jelmer Vernooij 2004
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "dlinklist.h"
27 struct dcerpc_interface_list *dcerpc_pipes = NULL;
30 register a dcerpc client interface
32 NTSTATUS librpc_register_interface(const struct dcerpc_interface_table *interface)
34 struct dcerpc_interface_list *l;
36 for (l = dcerpc_pipes; l; l = l->next) {
37 if (GUID_equal(&interface->uuid, &l->table->uuid)) {
38 DEBUG(0, ("Attempt to register interface %s which has the "
39 "same UUID as already registered interface %s\n",
40 interface->name, l->table->name));
41 return NT_STATUS_OBJECT_NAME_COLLISION;
45 l = talloc(talloc_autofree_context(), struct dcerpc_interface_list);
48 DLIST_ADD(dcerpc_pipes, l);
54 find the pipe name for a local IDL interface
56 const char *idl_pipe_name(const struct GUID *uuid, uint32_t if_version)
58 const struct dcerpc_interface_list *l;
59 for (l=librpc_dcerpc_pipes();l;l=l->next) {
60 if (GUID_equal(&l->table->uuid, uuid) &&
61 l->table->if_version == if_version) {
62 return l->table->name;
69 find the number of calls defined by local IDL
71 int idl_num_calls(const struct GUID *uuid, uint32_t if_version)
73 const struct dcerpc_interface_list *l;
74 for (l=librpc_dcerpc_pipes();l;l=l->next){
75 if (GUID_equal(&l->table->uuid, uuid) &&
76 l->table->if_version == if_version) {
77 return l->table->num_calls;
85 find a dcerpc interface by name
87 const struct dcerpc_interface_table *idl_iface_by_name(const char *name)
89 const struct dcerpc_interface_list *l;
90 for (l=librpc_dcerpc_pipes();l;l=l->next) {
91 if (strcasecmp(l->table->name, name) == 0) {
99 find a dcerpc interface by uuid
101 const struct dcerpc_interface_table *idl_iface_by_uuid(const struct GUID *uuid)
103 const struct dcerpc_interface_list *l;
104 for (l=librpc_dcerpc_pipes();l;l=l->next) {
105 if (GUID_equal(&l->table->uuid, uuid)) {
113 return the list of registered dcerpc_pipes
115 const struct dcerpc_interface_list *librpc_dcerpc_pipes(void)