2 Unix SMB/CIFS implementation.
4 DCERPC client side interface structures
6 Copyright (C) 2008 Jelmer Vernooij
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 3 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, see <http://www.gnu.org/licenses/>.
22 /* This is a public header file that is installed as part of Samba.
23 * If you remove any functions or change their signature, update
24 * the so version number. */
29 #define SMB_RPC_INTERFACE_VERSION 1
31 enum dcerpc_transport_t
{
32 NCA_UNKNOWN
, NCACN_NP
, NCACN_IP_TCP
, NCACN_IP_UDP
, NCACN_VNS_IPC
,
33 NCACN_VNS_SPP
, NCACN_AT_DSP
, NCADG_AT_DDP
, NCALRPC
, NCACN_UNIX_STREAM
,
34 NCADG_UNIX_DGRAM
, NCACN_HTTP
, NCADG_IPX
, NCACN_SPX
, NCACN_INTERNAL
};
36 /** this describes a binding to a particular transport/pipe */
37 struct dcerpc_binding
{
38 enum dcerpc_transport_t transport
;
39 struct ndr_syntax_id object
;
41 const char *target_hostname
;
44 const char *localaddress
;
46 uint32_t assoc_group_id
;
50 /* dcerpc pipe flags */
51 #define DCERPC_DEBUG_PRINT_IN (1<<0)
52 #define DCERPC_DEBUG_PRINT_OUT (1<<1)
53 #define DCERPC_DEBUG_PRINT_BOTH (DCERPC_DEBUG_PRINT_IN | DCERPC_DEBUG_PRINT_OUT)
55 #define DCERPC_DEBUG_VALIDATE_IN (1<<2)
56 #define DCERPC_DEBUG_VALIDATE_OUT (1<<3)
57 #define DCERPC_DEBUG_VALIDATE_BOTH (DCERPC_DEBUG_VALIDATE_IN | DCERPC_DEBUG_VALIDATE_OUT)
59 #define DCERPC_CONNECT (1<<4)
60 #define DCERPC_SIGN (1<<5)
61 #define DCERPC_SEAL (1<<6)
63 #define DCERPC_PUSH_BIGENDIAN (1<<7)
64 #define DCERPC_PULL_BIGENDIAN (1<<8)
66 #define DCERPC_SCHANNEL (1<<9)
68 /* use a 128 bit session key */
69 #define DCERPC_SCHANNEL_128 (1<<12)
71 /* check incoming pad bytes */
72 #define DCERPC_DEBUG_PAD_CHECK (1<<13)
74 /* set LIBNDR_FLAG_REF_ALLOC flag when decoding NDR */
75 #define DCERPC_NDR_REF_ALLOC (1<<14)
77 #define DCERPC_AUTH_OPTIONS (DCERPC_SEAL|DCERPC_SIGN|DCERPC_SCHANNEL|DCERPC_AUTH_SPNEGO|DCERPC_AUTH_KRB5|DCERPC_AUTH_NTLM)
79 /* select spnego auth */
80 #define DCERPC_AUTH_SPNEGO (1<<15)
82 /* select krb5 auth */
83 #define DCERPC_AUTH_KRB5 (1<<16)
85 #define DCERPC_SMB2 (1<<17)
87 /* select NTLM auth */
88 #define DCERPC_AUTH_NTLM (1<<18)
90 /* this triggers the DCERPC_PFC_FLAG_CONC_MPX flag in the bind request */
91 #define DCERPC_CONCURRENT_MULTIPLEX (1<<19)
93 /* this triggers the DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN flag in the bind request */
94 #define DCERPC_HEADER_SIGNING (1<<20)
96 /* use NDR64 transport */
97 #define DCERPC_NDR64 (1<<21)
99 /* specify binding interface */
100 #define DCERPC_LOCALADDRESS (1<<22)
102 /* The following definitions come from librpc/rpc/binding.c */
106 const char *epm_floor_string(TALLOC_CTX
*mem_ctx
, struct epm_floor
*epm_floor
);
107 _PUBLIC_
char *dcerpc_binding_string(TALLOC_CTX
*mem_ctx
, const struct dcerpc_binding
*b
);
108 _PUBLIC_ NTSTATUS
dcerpc_parse_binding(TALLOC_CTX
*mem_ctx
, const char *s
, struct dcerpc_binding
**b_out
);
109 _PUBLIC_ NTSTATUS
dcerpc_floor_get_lhs_data(const struct epm_floor
*epm_floor
,
110 struct ndr_syntax_id
*syntax
);
111 const char *dcerpc_floor_get_rhs_data(TALLOC_CTX
*mem_ctx
, struct epm_floor
*epm_floor
);
112 enum dcerpc_transport_t
dcerpc_transport_by_endpoint_protocol(int prot
);
113 _PUBLIC_
enum dcerpc_transport_t
dcerpc_transport_by_tower(const struct epm_tower
*tower
);
114 _PUBLIC_
const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t
);
115 _PUBLIC_ NTSTATUS
dcerpc_binding_from_tower(TALLOC_CTX
*mem_ctx
,
116 struct epm_tower
*tower
,
117 struct dcerpc_binding
**b_out
);
118 _PUBLIC_ NTSTATUS
dcerpc_binding_build_tower(TALLOC_CTX
*mem_ctx
,
119 const struct dcerpc_binding
*binding
,
120 struct epm_tower
*tower
);
122 struct NL_AUTH_MESSAGE
;
123 struct pipe_auth_data
;
125 /* The following definitions come from librpc/rpc/dcerpc_helpers.c */
126 NTSTATUS
dcerpc_push_ncacn_packet(TALLOC_CTX
*mem_ctx
,
127 enum dcerpc_pkt_type ptype
,
129 uint16_t auth_length
,
131 union dcerpc_payload
*u
,
133 NTSTATUS
dcerpc_pull_ncacn_packet(TALLOC_CTX
*mem_ctx
,
134 const DATA_BLOB
*blob
,
135 struct ncacn_packet
*r
,
137 NTSTATUS
dcerpc_push_schannel_bind(TALLOC_CTX
*mem_ctx
,
138 struct NL_AUTH_MESSAGE
*r
,
140 NTSTATUS
dcerpc_push_dcerpc_auth(TALLOC_CTX
*mem_ctx
,
141 enum dcerpc_AuthType auth_type
,
142 enum dcerpc_AuthLevel auth_level
,
143 uint8_t auth_pad_length
,
144 uint32_t auth_context_id
,
145 const DATA_BLOB
*credentials
,
147 NTSTATUS
dcerpc_pull_dcerpc_auth(TALLOC_CTX
*mem_ctx
,
148 const DATA_BLOB
*blob
,
149 struct dcerpc_auth
*r
,
151 NTSTATUS
dcerpc_guess_sizes(struct pipe_auth_data
*auth
,
152 size_t header_len
, size_t data_left
,
153 size_t max_xmit_frag
, size_t pad_alignment
,
154 size_t *data_to_send
, size_t *frag_len
,
155 size_t *auth_len
, size_t *pad_len
);
156 NTSTATUS
dcerpc_add_auth_footer(struct pipe_auth_data
*auth
,
157 size_t pad_len
, DATA_BLOB
*rpc_out
);
158 NTSTATUS
dcerpc_check_auth(struct pipe_auth_data
*auth
,
159 struct ncacn_packet
*pkt
,
160 DATA_BLOB
*pkt_trailer
,
165 #include "../librpc/rpc/rpc_common.h"
167 #endif /* __DCERPC_H__ */