s3-pysmbd: Fix error message
[Samba/gebeck_regimport.git] / source4 / lib / com / dcom / tables.c
blobf94aa879253e68c0eba04644481c81840652e3de
1 /*
2 Unix SMB/CIFS implementation.
3 DCOM proxy tables functionality
4 Copyright (C) 2005 Jelmer Vernooij <jelmer@samba.org>
5 Copyright (C) 2006 Andrzej Hajda <andrzej.hajda@wp.pl>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "includes.h"
23 #include "../lib/util/dlinklist.h"
24 #include "librpc/gen_ndr/com_dcom.h"
25 #include "lib/com/dcom/dcom.h"
27 static struct dcom_proxy {
28 struct IUnknown_vtable *vtable;
29 struct dcom_proxy *prev, *next;
30 } *proxies = NULL;
32 NTSTATUS dcom_register_proxy(struct IUnknown_vtable *proxy_vtable)
34 struct dcom_proxy *proxy = talloc(talloc_autofree_context(), struct dcom_proxy);
36 proxy->vtable = proxy_vtable;
37 DLIST_ADD(proxies, proxy);
39 return NT_STATUS_OK;
42 struct IUnknown_vtable *dcom_proxy_vtable_by_iid(struct GUID *iid)
44 struct dcom_proxy *p;
45 for (p = proxies; p; p = p->next) {
46 if (GUID_equal(&p->vtable->iid, iid)) {
47 return p->vtable;
50 return NULL;
53 static struct dcom_marshal {
54 struct GUID clsid;
55 marshal_fn marshal;
56 unmarshal_fn unmarshal;
57 struct dcom_marshal *prev, *next;
58 } *marshals = NULL;
60 NTSTATUS dcom_register_marshal(struct GUID *clsid, marshal_fn marshal, unmarshal_fn unmarshal)
62 struct dcom_marshal *p = talloc(talloc_autofree_context(), struct dcom_marshal);
64 p->clsid = *clsid;
65 p->marshal = marshal;
66 p->unmarshal = unmarshal;
67 DLIST_ADD(marshals, p);
68 return NT_STATUS_OK;
71 _PUBLIC_ marshal_fn dcom_marshal_by_clsid(struct GUID *clsid)
73 struct dcom_marshal *p;
74 for (p = marshals; p; p = p->next) {
75 if (GUID_equal(&p->clsid, clsid)) {
76 return p->marshal;
79 return NULL;
82 _PUBLIC_ unmarshal_fn dcom_unmarshal_by_clsid(struct GUID *clsid)
84 struct dcom_marshal *p;
85 for (p = marshals; p; p = p->next) {
86 if (GUID_equal(&p->clsid, clsid)) {
87 return p->unmarshal;
90 return NULL;