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;
56 struct dcesrv_call_reply {
57 struct dcesrv_call_reply *next, *prev;
63 /* a dcerpc handle in internal format */
64 struct dcesrv_handle {
65 struct dcesrv_handle *next, *prev;
66 struct policy_handle wire_handle;
71 /* the state associated with a dcerpc server connection */
73 /* the top level context for this server */
74 struct dcesrv_context *dce;
78 /* the endpoint that was opened */
79 struct dcesrv_endpoint endpoint;
81 /* endpoint operations provided by the endpoint server */
82 const struct dcesrv_endpoint_ops *ops;
84 /* the ndr function table for the chosen interface */
85 const struct dcerpc_interface_table *ndr;
87 /* the dispatch table for the chosen interface. Must contain
88 enough entries for all entries in the ndr table */
89 const dcesrv_dispatch_fn_t *dispatch;
91 /* the state of the current calls */
92 struct dcesrv_call_state *call_list;
94 /* the maximum size the client wants to receive */
95 uint32 cli_max_recv_frag;
97 /* private data for the endpoint server */
100 /* current rpc handles - this is really the wrong scope for
101 them, but it will do for now */
103 struct dcesrv_handle *handles;
107 struct dcesrv_endpoint_ops {
108 /* this function is used to ask an endpoint server if it
109 handles a particular endpoint */
110 BOOL (*query_endpoint)(const struct dcesrv_endpoint *);
112 /* this function sets up the dispatch table for this
114 BOOL (*set_interface)(struct dcesrv_state *, const char *, uint32);
116 /* connect() is called when a connection is made to an endpoint */
117 NTSTATUS (*connect)(struct dcesrv_state *);
119 /* disconnect() is called when the endpoint is disconnected */
120 void (*disconnect)(struct dcesrv_state *);
122 /* this function is used to ask an endpoint server for a list
123 of endpoints/interfaces it wants to handle */
124 int (*lookup_endpoints)(TALLOC_CTX *mem_ctx, struct dcesrv_ep_iface **);
128 /* server-wide context information for the dcerpc server */
129 struct dcesrv_context {
131 /* the list of endpoints servers that have registered */
132 struct dce_endpoint {
133 struct dce_endpoint *next, *prev;
134 const struct dcesrv_endpoint_ops *endpoint_ops;