2 Unix SMB/CIFS implementation.
4 server side dcerpc defines
6 Copyright (C) Andrew Tridgell 2003
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 enum endpoint_type {ENDPOINT_SMB, ENDPOINT_TCP};
26 /* a description of a single dcerpc endpoint. Not as flexible as a full epm tower,
27 but much easier to work with */
28 struct dcesrv_endpoint {
29 enum endpoint_type type;
36 /* a endpoint combined with an interface description */
37 struct dcesrv_ep_iface {
39 struct dcesrv_endpoint endpoint;
46 /* the dispatch functions for an interface take this form */
47 typedef NTSTATUS (*dcesrv_dispatch_fn_t)(struct dcesrv_state *, TALLOC_CTX *, void *);
49 /* the state of an ongoing dcerpc call */
50 struct dcesrv_call_state {
51 struct dcesrv_call_state *next, *prev;
52 struct dcesrv_state *dce;
54 struct dcerpc_packet pkt;
58 struct dcesrv_call_reply {
59 struct dcesrv_call_reply *next, *prev;
65 /* a dcerpc handle in internal format */
66 struct dcesrv_handle {
67 struct dcesrv_handle *next, *prev;
68 struct policy_handle wire_handle;
73 /* the state associated with a dcerpc server connection */
75 /* the top level context for this server */
76 struct dcesrv_context *dce;
80 /* the endpoint that was opened */
81 struct dcesrv_endpoint endpoint;
83 /* endpoint operations provided by the endpoint server */
84 const struct dcesrv_endpoint_ops *ops;
86 /* the ndr function table for the chosen interface */
87 const struct dcerpc_interface_table *ndr;
89 /* the dispatch table for the chosen interface. Must contain
90 enough entries for all entries in the ndr table */
91 const dcesrv_dispatch_fn_t *dispatch;
93 /* the state of the current calls */
94 struct dcesrv_call_state *call_list;
96 /* the maximum size the client wants to receive */
97 uint32 cli_max_recv_frag;
99 /* private data for the endpoint server */
102 /* current rpc handles - this is really the wrong scope for
103 them, but it will do for now */
105 struct dcesrv_handle *handles;
107 DATA_BLOB partial_input;
111 struct dcesrv_endpoint_ops {
112 /* this function is used to ask an endpoint server if it
113 handles a particular endpoint */
114 BOOL (*query_endpoint)(const struct dcesrv_endpoint *);
116 /* this function sets up the dispatch table for this
118 BOOL (*set_interface)(struct dcesrv_state *, const char *, uint32);
120 /* connect() is called when a connection is made to an endpoint */
121 NTSTATUS (*connect)(struct dcesrv_state *);
123 /* disconnect() is called when the endpoint is disconnected */
124 void (*disconnect)(struct dcesrv_state *);
126 /* this function is used to ask an endpoint server for a list
127 of endpoints/interfaces it wants to handle */
128 int (*lookup_endpoints)(TALLOC_CTX *mem_ctx, struct dcesrv_ep_iface **);
132 /* server-wide context information for the dcerpc server */
133 struct dcesrv_context {
135 /* the list of endpoints servers that have registered */
136 struct dce_endpoint {
137 struct dce_endpoint *next, *prev;
138 struct dcesrv_endpoint endpoint;
139 const struct dcesrv_endpoint_ops *endpoint_ops;