1 /*
2    Unix SMB/CIFS implementation.
3    COM standard objects
4    Copyright (C) Jelmer Vernooij					  2004-2005.
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 #ifndef _DCOM_H /* _DCOM_H */
22 #define _DCOM_H
23 
24 struct cli_credentials;
25 struct dcerpc_pipe;
26 struct IRemUnknown;
27 struct rpc_request;
28 
29 #include "lib/com/com.h"
30 #include "librpc/gen_ndr/orpc.h"
31 
32 #define NT_STATUS_RPC_NT_CALL_FAILED	NT_STATUS(0xC002001BL)
33 
34 typedef NTSTATUS (*marshal_fn)(struct IUnknown *pv, struct OBJREF *o);
35 typedef NTSTATUS (*unmarshal_fn)(struct OBJREF *o, struct IUnknown **pv);
36 
37 #include "lib/com/dcom/proto.h"
38 
39 struct dcom_client_context {
40 	struct dcom_server_credentials {
41 		const char *server;
42 		struct cli_credentials *credentials;
43 		struct dcom_server_credentials *prev, *next;
44 	} *credentials;
45 	struct dcom_object_exporter {
46 		uint64_t oxid;
47 		char *host;
48 		struct IRemUnknown *rem_unknown;
49 		struct DUALSTRINGARRAY *bindings;
50 		struct dcerpc_pipe *pipe;
51 		struct dcom_object_exporter *prev, *next;
52 	} *object_exporters;
53 };
54 
55 struct dcom_proxy_async_call_state {
56         struct IUnknown *d;
57         const struct dcerpc_interface_table *table;
58         uint32_t opnum;
59         void (*continuation)(struct rpc_request *);
60         TALLOC_CTX *mem_ctx;
61         void *r;
62 };
63 
64 #define WERR_NDR_CHECK(call) do { NTSTATUS _status; \
65 				_status = call; \
66 				if (!NT_STATUS_IS_OK(_status)) \
67 				return ntstatus_to_werror(_status); \
68 			    } while (0)
69 
70 #define IUnknown_ipid(d) ((d)->obj.u_objref.u_standard.std.ipid)
71 
72 #endif /* _DCOM_H */
73