initial rpc server side infrastructure
[abartlet/samba.git/.git] / source4 / rpc_server / dcerpc_server.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    server side dcerpc defines
5
6    Copyright (C) Andrew Tridgell 2003
7    
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.
12    
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.
17    
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.
21 */
22
23
24 enum endpoint_type {ENDPOINT_SMB, ENDPOINT_TCP};
25
26 /* a description of a single dcerpc endpoint */
27 struct dcesrv_endpoint {
28         enum endpoint_type type;
29         union {
30                 const char *smb_pipe;
31                 uint32 tcp_port;
32         } info;
33 };
34
35
36 /* the state associated with a dcerpc server connection */
37 struct dcesrv_state {
38         TALLOC_CTX *mem_ctx;
39
40         /* the endpoint that was opened */
41         struct dcesrv_endpoint endpoint;
42
43         /* endpoint operations provided by the endpoint server */
44         const struct dcesrv_endpoint_ops *ops;
45
46         /* private data for the endpoint server */
47         void *private;
48 };
49
50
51 struct dcesrv_endpoint_ops {
52         /* the query function is used to ask an endpoint server if it
53            handles a particular endpoint */
54         BOOL (*query)(const struct dcesrv_endpoint *);
55
56         /* connect() is called when a connection is made to an endpoint */
57         NTSTATUS (*connect)(struct dcesrv_state *);
58
59         /* disconnect() is called when the endpoint is disconnected */
60         void (*disconnect)(struct dcesrv_state *);
61 };
62
63
64 /* server-wide context information for the dcerpc server */
65 struct dcesrv_context {
66         
67         /* the list of endpoints servers that have registered */
68         struct dce_endpoint {
69                 struct dce_endpoint *next, *prev;
70                 const struct dcesrv_endpoint_ops *endpoint_ops;
71         } *endpoint_list;
72 };