2 Unix SMB/CIFS implementation.
3 DCERPC interface structures
5 Copyright (C) Tim Potter 2003
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.
23 enum dcerpc_transport_t {NCACN_NP, NCACN_IP_TCP};
26 this defines a generic security context for signed/sealed dcerpc pipes.
29 struct dcerpc_security {
30 struct dcerpc_auth *auth_info;
31 struct gensec_security *generic_state;
33 /* get the session key */
34 NTSTATUS (*session_key)(struct dcerpc_pipe *, DATA_BLOB *);
40 uint32_t srv_max_xmit_frag;
41 uint32_t srv_max_recv_frag;
43 struct dcerpc_security security_state;
44 const char *binding_string;
46 struct dcerpc_syntax_id syntax;
47 struct dcerpc_syntax_id transfer_syntax;
49 struct dcerpc_transport {
50 enum dcerpc_transport_t transport;
53 NTSTATUS (*shutdown_pipe)(struct dcerpc_pipe *);
55 const char *(*peer_name)(struct dcerpc_pipe *);
57 /* send a request to the server */
58 NTSTATUS (*send_request)(struct dcerpc_pipe *, DATA_BLOB *, BOOL trigger_read);
60 /* send a read request to the server */
61 NTSTATUS (*send_read)(struct dcerpc_pipe *);
63 /* get an event context for the connection */
64 struct event_context *(*event_context)(struct dcerpc_pipe *);
66 /* a callback to the dcerpc code when a full fragment
68 void (*recv_data)(struct dcerpc_pipe *, DATA_BLOB *, NTSTATUS status);
72 /* the last fault code from a DCERPC fault */
73 uint32_t last_fault_code;
75 /* pending requests */
76 struct rpc_request *pending;
78 /* private pointer for pending full requests */
79 void *full_request_private;
82 /* dcerpc pipe flags */
83 #define DCERPC_DEBUG_PRINT_IN (1<<0)
84 #define DCERPC_DEBUG_PRINT_OUT (1<<1)
85 #define DCERPC_DEBUG_PRINT_BOTH (DCERPC_DEBUG_PRINT_IN | DCERPC_DEBUG_PRINT_OUT)
87 #define DCERPC_DEBUG_VALIDATE_IN (1<<2)
88 #define DCERPC_DEBUG_VALIDATE_OUT (1<<3)
89 #define DCERPC_DEBUG_VALIDATE_BOTH (DCERPC_DEBUG_VALIDATE_IN | DCERPC_DEBUG_VALIDATE_OUT)
91 #define DCERPC_CONNECT (1<<4)
92 #define DCERPC_SIGN (1<<5)
93 #define DCERPC_SEAL (1<<6)
95 #define DCERPC_PUSH_BIGENDIAN (1<<7)
96 #define DCERPC_PULL_BIGENDIAN (1<<8)
98 #define DCERPC_SCHANNEL_BDC (1<<9)
99 #define DCERPC_SCHANNEL_WORKSTATION (1<<10)
100 #define DCERPC_SCHANNEL_DOMAIN (1<<11)
101 #define DCERPC_SCHANNEL_ANY (DCERPC_SCHANNEL_BDC| \
102 DCERPC_SCHANNEL_DOMAIN| \
103 DCERPC_SCHANNEL_WORKSTATION)
104 /* use a 128 bit session key */
105 #define DCERPC_SCHANNEL_128 (1<<12)
107 #define DCERPC_AUTH_OPTIONS (DCERPC_SEAL|DCERPC_SIGN|DCERPC_SCHANNEL_ANY)
109 /* check incoming pad bytes */
110 #define DCERPC_DEBUG_PAD_CHECK (1<<13)
112 /* set LIBNDR_FLAG_REF_ALLOC flag when decoding NDR */
113 #define DCERPC_NDR_REF_ALLOC (1<<14)
116 this is used to find pointers to calls
118 struct dcerpc_interface_call {
121 NTSTATUS (*ndr_push)(struct ndr_push *, int , void *);
122 NTSTATUS (*ndr_pull)(struct ndr_pull *, int , void *);
123 void (*ndr_print)(struct ndr_print *, const char *, int, void *);
126 struct dcerpc_endpoint_list {
128 const char * const *names;
131 struct dcerpc_interface_table {
135 const char *helpstring;
137 const struct dcerpc_interface_call *calls;
138 const struct dcerpc_endpoint_list *endpoints;
142 /* this describes a binding to a particular transport/pipe */
143 struct dcerpc_binding {
144 enum dcerpc_transport_t transport;
146 const char **options;
151 enum rpc_request_state {
157 handle for an async dcerpc request
160 struct rpc_request *next, *prev;
161 struct dcerpc_pipe *p;
164 enum rpc_request_state state;
169 /* use by the ndr level async recv call */
170 struct rpc_request_ndr {
171 NTSTATUS (*ndr_push)(struct ndr_push *, int, void *);
172 NTSTATUS (*ndr_pull)(struct ndr_pull *, int, void *);
179 void (*callback)(struct rpc_request *);