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 /* hold the authentication state information */
75 struct auth_ntlmssp_state *ntlmssp_state;
76 struct dcerpc_auth *auth_info;
80 /* the state associated with a dcerpc server connection */
82 /* the top level context for this server */
83 struct dcesrv_context *dce;
87 /* the endpoint that was opened */
88 struct dcesrv_endpoint endpoint;
90 /* endpoint operations provided by the endpoint server */
91 const struct dcesrv_endpoint_ops *ops;
93 /* the ndr function table for the chosen interface */
94 const struct dcerpc_interface_table *ndr;
96 /* the dispatch table for the chosen interface. Must contain
97 enough entries for all entries in the ndr table */
98 const dcesrv_dispatch_fn_t *dispatch;
100 /* the state of the current calls */
101 struct dcesrv_call_state *call_list;
103 /* the maximum size the client wants to receive */
104 uint32 cli_max_recv_frag;
106 /* private data for the endpoint server */
109 /* current rpc handles - this is really the wrong scope for
110 them, but it will do for now */
111 struct dcesrv_handle *handles;
113 DATA_BLOB partial_input;
115 /* the current authentication state */
116 struct dcesrv_auth auth_state;
120 struct dcesrv_endpoint_ops {
121 /* this function is used to ask an endpoint server if it
122 handles a particular endpoint */
123 BOOL (*query_endpoint)(const struct dcesrv_endpoint *);
125 /* this function sets up the dispatch table for this
127 BOOL (*set_interface)(struct dcesrv_state *, const char *, uint32);
129 /* connect() is called when a connection is made to an endpoint */
130 NTSTATUS (*connect)(struct dcesrv_state *);
132 /* disconnect() is called when the endpoint is disconnected */
133 void (*disconnect)(struct dcesrv_state *);
135 /* this function is used to ask an endpoint server for a list
136 of endpoints/interfaces it wants to handle */
137 int (*lookup_endpoints)(TALLOC_CTX *mem_ctx, struct dcesrv_ep_iface **);
141 /* server-wide context information for the dcerpc server */
142 struct dcesrv_context {
144 /* the list of endpoints servers that have registered */
145 struct dce_endpoint {
146 struct dce_endpoint *next, *prev;
147 struct dcesrv_endpoint endpoint;
148 const struct dcesrv_endpoint_ops *endpoint_ops;