check return value before using key_values
[Samba.git] / librpc / idl / dcerpc.idl
blobbbb17f0b8c41294f492104bf71dc70f1aff4fd9d
1 #include "idl_types.h"
3 /*
4 the base dcerpc packet definitions - not traditionally coded as IDL,
5 but given that pidl can handle it nicely it simplifies things a lot
6 to do it this way
8 See [C706 - DCE 1.1: Remote Procedure Call] for the OpenGroup
9 DCERPC specification:
10 http://pubs.opengroup.org/onlinepubs/9629399/toc.htm
12 See C706 - Chapter 12: RPC PDU Encodings for packet layouts:
13 http://www.opengroup.org/onlinepubs/9629399/chap12.htm
15 See also [MS-RPCE] for the Microsoft
16 "Remote Procedure Call Protocol Extensions".
17 http://msdn.microsoft.com/en-us/library/cc243560.aspx
20 import "misc.idl";
22 cpp_quote("extern const uint8_t DCERPC_SEC_VT_MAGIC[8];")
25 helper("../librpc/ndr/ndr_dcerpc.h")
27 interface dcerpc
29 typedef struct {
30 uint16 context_id;
31 uint8 num_transfer_syntaxes;
32 ndr_syntax_id abstract_syntax;
33 ndr_syntax_id transfer_syntaxes[num_transfer_syntaxes];
34 } dcerpc_ctx_list;
36 typedef [public] struct {
37 uint16 max_xmit_frag;
38 uint16 max_recv_frag;
39 uint32 assoc_group_id;
40 uint8 num_contexts;
41 dcerpc_ctx_list ctx_list[num_contexts];
42 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
43 } dcerpc_bind;
45 const uint8 DCERPC_REQUEST_LENGTH = 24;
47 typedef struct {
48 } dcerpc_empty;
50 typedef [nodiscriminant] union {
51 [case(LIBNDR_FLAG_OBJECT_PRESENT)] GUID object;
52 [default] dcerpc_empty empty;
53 } dcerpc_object;
55 typedef struct {
56 uint32 alloc_hint;
57 uint16 context_id;
58 uint16 opnum;
60 * NDR_DCERPC_REQUEST_OBJECT_PRESENT
61 * is defined differently for ndr_dcerpc.c and py_dcerpc.c
63 [switch_is(NDR_DCERPC_REQUEST_OBJECT_PRESENT)] dcerpc_object object;
64 [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
65 } dcerpc_request;
67 typedef [enum16bit] enum {
68 DCERPC_BIND_ACK_RESULT_ACCEPTANCE = 0,
69 DCERPC_BIND_ACK_RESULT_USER_REJECTION = 1,
70 DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION = 2,
71 DCERPC_BIND_ACK_RESULT_NEGOTIATE_ACK = 3
72 } dcerpc_bind_ack_result;
74 const int DCERPC_BIND_PROVIDER_REJECT =
75 DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION;
77 typedef [enum16bit] enum {
78 DCERPC_BIND_ACK_REASON_NOT_SPECIFIED = 0,
79 DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED = 1,
80 DCERPC_BIND_ACK_REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED = 2,
81 DCERPC_BIND_ACK_REASON_LOCAL_LIMIT_EXCEEDED = 3
82 } dcerpc_bind_ack_reason_values;
84 const int DCERPC_BIND_REASON_ASYNTAX =
85 DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED;
87 typedef [bitmap16bit] bitmap {
88 DCERPC_BIND_TIME_SECURITY_CONTEXT_MULTIPLEXING = 0x0001,
89 DCERPC_BIND_TIME_KEEP_CONNECTION_ON_ORPHAN = 0x0002
90 } dcerpc_bind_time_features;
92 typedef [nodiscriminant] union {
93 [case(DCERPC_BIND_ACK_RESULT_NEGOTIATE_ACK)]
94 dcerpc_bind_time_features negotiate;
95 [default] dcerpc_bind_ack_reason_values value;
96 } dcerpc_bind_ack_reason;
98 typedef struct {
99 dcerpc_bind_ack_result result;
100 [switch_is(result)] dcerpc_bind_ack_reason reason;
101 ndr_syntax_id syntax;
102 } dcerpc_ack_ctx;
104 typedef struct {
105 uint16 max_xmit_frag;
106 uint16 max_recv_frag;
107 uint32 assoc_group_id;
108 [value(strlen_m_term_null(secondary_address))] uint16 secondary_address_size;
109 [charset(DOS)] uint8 secondary_address[secondary_address_size];
110 [flag(NDR_ALIGN4)] DATA_BLOB _pad1;
111 uint8 num_results;
112 dcerpc_ack_ctx ctx_list[num_results];
113 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
114 } dcerpc_bind_ack;
116 typedef [public,enum16bit] enum {
117 DCERPC_BIND_NAK_REASON_NOT_SPECIFIED = 0,
118 DCERPC_BIND_NAK_REASON_TEMPORARY_CONGESTION = 1,
119 DCERPC_BIND_NAK_REASON_LOCAL_LIMIT_EXCEEDED = 2,
120 DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED = 4,
121 DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE = 8,
122 DCERPC_BIND_NAK_REASON_INVALID_CHECKSUM = 9
123 } dcerpc_bind_nak_reason;
125 const int DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED =
126 DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED;
127 const int DCERPC_BIND_REASON_INVALID_AUTH_TYPE =
128 DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE;
130 typedef [public] struct {
131 uint8 rpc_vers; /* RPC version */
132 uint8 rpc_vers_minor; /* Minor version */
133 } dcerpc_bind_nak_version;
135 typedef [public,nopull] struct {
136 dcerpc_bind_nak_reason reject_reason;
137 uint8 num_versions;
138 dcerpc_bind_nak_version versions[num_versions];
139 [flag(NDR_REMAINING)] DATA_BLOB _pad;
140 } dcerpc_bind_nak;
142 const uint8 DCERPC_RESPONSE_LENGTH = 24;
144 typedef struct {
145 uint32 alloc_hint;
146 uint16 context_id;
147 uint8 cancel_count;
148 [value(0)] uint8 reserved;
149 [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
150 } dcerpc_response;
152 typedef [v1_enum] enum {
153 DCERPC_NCA_S_COMM_FAILURE = 0x1C010001,
154 DCERPC_NCA_S_OP_RNG_ERROR = 0x1C010002,
155 DCERPC_NCA_S_UNKNOWN_IF = 0x1C010003,
156 DCERPC_NCA_S_WRONG_BOOT_TIME = 0x1C010006,
157 DCERPC_NCA_S_YOU_CRASHED = 0x1C010009,
158 DCERPC_NCA_S_PROTO_ERROR = 0x1C01000B,
159 DCERPC_NCA_S_OUT_ARGS_TOO_BIG = 0x1C010013,
160 DCERPC_NCA_S_SERVER_TOO_BUSY = 0x1C010014,
161 DCERPC_NCA_S_FAULT_STRING_TOO_LARGE = 0x1C010015,
162 DCERPC_NCA_S_UNSUPPORTED_TYPE = 0x1C010017,
163 DCERPC_NCA_S_FAULT_INT_DIV_BY_ZERO = 0x1C000001,
164 DCERPC_NCA_S_FAULT_ADDR_ERROR = 0x1C000002,
165 DCERPC_NCA_S_FAULT_FP_DIV_BY_ZERO = 0x1C000003,
166 DCERPC_NCA_S_FAULT_FP_UNDERFLOW = 0x1C000004,
167 DCERPC_NCA_S_FAULT_FP_OVERRFLOW = 0x1C000005,
168 DCERPC_NCA_S_FAULT_INVALID_TAG = 0x1C000006,
169 DCERPC_NCA_S_FAULT_INVALID_BOUND = 0x1C000007,
170 DCERPC_NCA_S_FAULT_RPC_VERSION_MISMATCH = 0x1C000008,
171 DCERPC_NCA_S_FAULT_UNSPEC_REJECT = 0x1C000009,
172 DCERPC_NCA_S_FAULT_BAD_ACTID = 0x1C00000A,
173 DCERPC_NCA_S_FAULT_WHO_ARE_YOU_FAILED = 0x1C00000B,
174 DCERPC_NCA_S_FAULT_MANAGER_NOT_ENTERED = 0x1C00000C,
175 DCERPC_NCA_S_FAULT_CANCEL = 0x1C00000D,
176 DCERPC_NCA_S_FAULT_ILL_INST = 0x1C00000E,
177 DCERPC_NCA_S_FAULT_FP_ERROR = 0x1C00000F,
178 DCERPC_NCA_S_FAULT_INT_OVERFLOW = 0x1C000010,
179 DCERPC_NCA_S_UNUSED_1C000011 = 0x1C000011,
180 DCERPC_NCA_S_FAULT_UNSPEC = 0x1C000012,
181 DCERPC_NCA_S_FAULT_REMOTE_COMM_FAILURE = 0x1C000013,
182 DCERPC_NCA_S_FAULT_PIPE_EMPTY = 0x1C000014,
183 DCERPC_NCA_S_FAULT_PIPE_CLOSED = 0x1C000015,
184 DCERPC_NCA_S_FAULT_PIPE_ORDER = 0x1C000016,
185 DCERPC_NCA_S_FAULT_PIPE_DISCIPLINE = 0x1C000017,
186 DCERPC_NCA_S_FAULT_PIPE_COMM_ERROR = 0x1C000018,
187 DCERPC_NCA_S_FAULT_PIPE_MEMORY = 0x1C000019,
188 DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH = 0x1C00001A,
189 DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY = 0x1C00001B,
190 DCERPC_NCA_S_INVALID_PRES_CONTEXT_ID = 0x1C00001C,
191 DCERPC_NCA_S_UNSUPPORTED_AUTHN_LEVEL = 0x1C00001D,
192 DCERPC_NCA_S_UNUSED_1C00001E = 0x1C00001E,
193 DCERPC_NCA_S_INVALID_CHECKSUM = 0x1C00001F,
194 DCERPC_NCA_S_INVALID_CRC = 0x1C000020,
195 DCERPC_NCA_S_FAULT_USER_DEFINED = 0x1C000021,
196 DCERPC_NCA_S_FAULT_TX_OPEN_FAILED = 0x1C000022,
197 DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR = 0x1C000023,
198 DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND = 0x1C000024,
199 DCERPC_NCA_S_FAULT_NO_CLIENT_STUB = 0x1C000025,
200 DCERPC_FAULT_ACCESS_DENIED = 0x00000005,
201 DCERPC_FAULT_SERVER_UNAVAILABLE = 0x000006ba,
202 DCERPC_FAULT_NO_CALL_ACTIVE = 0x000006bd,
203 DCERPC_FAULT_CANT_PERFORM = 0x000006d8,
204 DCERPC_FAULT_OUT_OF_RESOURCES = 0x000006d9,
205 DCERPC_FAULT_BAD_STUB_DATA = 0x000006f7,
206 DCERPC_FAULT_SEC_PKG_ERROR = 0x00000721
207 } dcerpc_nca_status;
209 const int DCERPC_FAULT_OP_RNG_ERROR = DCERPC_NCA_S_OP_RNG_ERROR;
210 const int DCERPC_FAULT_NDR = DCERPC_FAULT_BAD_STUB_DATA;
211 const int DCERPC_FAULT_INVALID_TAG = DCERPC_NCA_S_FAULT_INVALID_TAG;
212 const int DCERPC_FAULT_CONTEXT_MISMATCH = DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH;
213 const int DCERPC_FAULT_OTHER = 0x00000001;
215 /* we return this fault when we haven't yet run the test
216 to see what fault w2k3 returns in this case */
217 const int DCERPC_FAULT_TODO = 0x00000042;
219 typedef [bitmap8bit] bitmap {
220 DCERPC_FAULT_FLAG_EXTENDED_ERROR_INFORMATION = 0x01
221 } dcerpc_fault_flags;
223 typedef struct {
224 uint32 alloc_hint;
225 uint16 context_id;
226 uint8 cancel_count;
227 dcerpc_fault_flags flags;
228 dcerpc_nca_status status;
229 [value(0)] uint32 reserved;
230 [flag(NDR_REMAINING)] DATA_BLOB error_and_verifier;
231 } dcerpc_fault;
233 const uint8 DCERPC_FAULT_LENGTH = 32;
235 /* the auth types we know about */
236 typedef [enum8bit] enum {
237 DCERPC_AUTH_TYPE_NONE = 0,
238 /* this seems to be not krb5! */
239 DCERPC_AUTH_TYPE_KRB5_1 = 1,
240 DCERPC_AUTH_TYPE_SPNEGO = 9,
241 DCERPC_AUTH_TYPE_NTLMSSP = 10,
242 DCERPC_AUTH_TYPE_KRB5 = 16,
243 DCERPC_AUTH_TYPE_DPA = 17,
244 DCERPC_AUTH_TYPE_MSN = 18,
245 DCERPC_AUTH_TYPE_DIGEST = 21,
246 DCERPC_AUTH_TYPE_SCHANNEL = 68,
247 DCERPC_AUTH_TYPE_MSMQ = 100,
248 DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM = 200
249 } dcerpc_AuthType;
250 const char *AS_SYSTEM_MAGIC_PATH_TOKEN = "/root/ncalrpc_as_system";
252 typedef [enum8bit] enum {
253 DCERPC_AUTH_LEVEL_NONE = 1,
254 DCERPC_AUTH_LEVEL_CONNECT = 2,
255 DCERPC_AUTH_LEVEL_CALL = 3,
256 DCERPC_AUTH_LEVEL_PACKET = 4,
257 DCERPC_AUTH_LEVEL_INTEGRITY = 5,
258 DCERPC_AUTH_LEVEL_PRIVACY = 6
259 } dcerpc_AuthLevel;
261 typedef [public] struct {
262 dcerpc_AuthType auth_type;
263 dcerpc_AuthLevel auth_level;
264 uint8 auth_pad_length;
265 uint8 auth_reserved;
266 uint32 auth_context_id;
267 [flag(NDR_REMAINING)] DATA_BLOB credentials;
268 } dcerpc_auth;
270 const uint8 DCERPC_AUTH_TRAILER_LENGTH = 8;
271 const uint8 DCERPC_AUTH_PAD_ALIGNMENT = 16;
273 typedef [public] struct {
274 [value(0)] uint32 _pad;
275 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
276 } dcerpc_auth3;
278 typedef [public] struct {
279 [value(0)] uint32 _pad;
280 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
281 } dcerpc_orphaned;
283 typedef [public] struct {
284 [value(0)] uint32 _pad;
285 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
286 } dcerpc_co_cancel;
288 typedef [public] struct {
289 uint32 version;
290 uint32 id;
291 } dcerpc_cl_cancel;
293 typedef [public] struct {
294 uint32 version;
295 uint32 id;
296 boolean32 server_is_accepting;
297 } dcerpc_cancel_ack;
299 typedef [public] struct {
300 uint32 version;
301 uint8 _pad1;
302 uint16 window_size;
303 uint32 max_tdsu;
304 uint32 max_frag_size;
305 uint16 serial_no;
306 uint16 selack_size;
307 uint32 selack[selack_size];
308 } dcerpc_fack;
310 typedef [public] struct {
311 } dcerpc_ack;
313 typedef [public] struct {
314 } dcerpc_ping;
316 typedef [public] struct {
317 } dcerpc_shutdown;
319 typedef [public] struct {
320 } dcerpc_working;
322 /* RTS data structures */
323 typedef [public] struct {
324 GUID Cookie;
325 } RTSCookie;
327 typedef [v1_enum,public] enum {
328 RTS_IPV4 = 0,
329 RTS_IPV6 = 1
330 } AddressType;
332 typedef [nodiscriminant] union {
333 [case(RTS_IPV4)] ipv4address ClientAddressIPV4;
334 [case(RTS_IPV6)] ipv6address ClientAddressIPV6;
335 } ClientAddressType;
337 typedef [public] struct {
338 AddressType AddressType;
339 [switch_is(AddressType)] ClientAddressType ClientAddress;
340 uint8 Padding[12];
341 } ClientAddress;
343 typedef [v1_enum, public] enum {
344 FDClient = 0,
345 FDInProxy = 1,
346 FDServer = 2,
347 FDOutProxy = 3
348 } ForwardDestination;
350 typedef [public] struct {
351 uint32 BytesReceived;
352 uint32 AvailableWindow;
353 RTSCookie ChannelCookie;
354 } FlowControlAcknowledgment;
356 /* RTS commands */
358 /* RTS command: 0x0 */
359 typedef [public] struct {
360 [range(0x2000,0x40000)] uint32 ReceiveWindowSize;
361 } dcerpc_rts_cmd_ReceiveWindowSize;
363 /* RTS command: 0x1 */
364 typedef [public] struct {
365 FlowControlAcknowledgment Ack;
366 } dcerpc_rts_cmd_FlowControlAck;
368 /* RTS command: 0x2 */
369 typedef [public] struct {
370 [range(0x1D4C0,0xDBBA00)] uint32 ConnectionTimeout;
371 } dcerpc_rts_cmd_ConnectionTimeout;
373 /* RTS command: 0x3 */
374 typedef [public] struct {
375 RTSCookie Cookie;
376 } dcerpc_rts_cmd_Cookie;
378 /* RTS command: 0x4 */
379 typedef [public] struct {
380 [range(0x20000,0x80000000)] uint32 ChannelLifetime;
381 } dcerpc_rts_cmd_ChannelLifetime;
383 /* RTS command: 0x5 */
384 typedef [public] struct {
385 uint32 ClientKeepalive;
386 } dcerpc_rts_cmd_ClientKeepalive;
388 /* RTS command: 0x6 */
389 typedef [public] struct {
390 uint32 Version;
391 } dcerpc_rts_cmd_Version;
393 /* RTS command: 0x7 */
394 typedef [public] struct {
395 } dcerpc_rts_cmd_Empty;
397 /* RTS command: 0x8 */
398 typedef [public] struct {
399 [range(0x0,0xFFFF)] uint32 ConformanceCount;
400 uint8 Padding[ConformanceCount];
401 } dcerpc_rts_cmd_Padding;
403 /* RTS command: 0x9 */
404 typedef [public] struct {
405 } dcerpc_rts_cmd_NegativeANCE;
407 /* RTS Command: 0xA */
408 typedef [public] struct {
409 } dcerpc_rts_cmd_ANCE;
411 /* RTS command: 0xB */
412 typedef [public] struct {
413 ClientAddress ClientAddress;
414 } dcerpc_rts_cmd_ClientAddress;
416 /* RTS command: 0xC */
417 typedef [public] struct {
418 RTSCookie AssociationGroupId;
419 } dcerpc_rts_cmd_AssociationGroupId;
421 /* RTS command: 0xD */
422 typedef [public] struct {
423 ForwardDestination ForwardDestination;
424 } dcerpc_rts_cmd_Destination;
426 /* RTS command: 0xE */
427 typedef [public] struct {
428 uint32 PingTrafficSent;
429 } dcerpc_rts_cmd_PingTrafficSentNotify;
431 typedef [nodiscriminant] union {
432 [case(0x0)] dcerpc_rts_cmd_ReceiveWindowSize ReceiveWindowSize;
433 [case(0x1)] dcerpc_rts_cmd_FlowControlAck FlowControlAck;
434 [case(0x2)] dcerpc_rts_cmd_ConnectionTimeout ConnectionTimeout;
435 [case(0x3)] dcerpc_rts_cmd_Cookie Cookie;
436 [case(0x4)] dcerpc_rts_cmd_ChannelLifetime ChannelLifetime;
437 [case(0x5)] dcerpc_rts_cmd_ClientKeepalive ClientKeepalive;
438 [case(0x6)] dcerpc_rts_cmd_Version Version;
439 [case(0x7)] dcerpc_rts_cmd_Empty Empty;
440 [case(0x8)] dcerpc_rts_cmd_Padding Padding;
441 [case(0x9)] dcerpc_rts_cmd_NegativeANCE NegativeANCE;
442 [case(0xA)] dcerpc_rts_cmd_ANCE ANCE;
443 [case(0xB)] dcerpc_rts_cmd_ClientAddress ClientAddress;
444 [case(0xC)] dcerpc_rts_cmd_AssociationGroupId AssociationGroupId;
445 [case(0xD)] dcerpc_rts_cmd_Destination Destination;
446 [case(0xE)] dcerpc_rts_cmd_PingTrafficSentNotify PingTrafficSentNotify;
447 } dcerpc_rts_cmds;
449 typedef [public] struct {
450 uint32 CommandType;
451 [switch_is(CommandType)] dcerpc_rts_cmds Command;
452 } dcerpc_rts_cmd;
454 /* The RTS flags */
455 typedef [public, bitmap16bit] bitmap {
456 RTS_FLAG_NONE = 0x0000,
457 RTS_FLAG_PING = 0x0001,
458 RTS_FLAG_OTHER_CMD = 0x0002,
459 RTS_FLAG_RECYCLE_CHANNEL = 0x0004,
460 RTS_FLAG_IN_CHANNEL = 0x0008,
461 RTS_FLAG_OUT_CHANNEL = 0x0010,
462 RTS_FLAG_EOF = 0x0020,
463 RTS_FLAG_ECHO = 0x0040
464 } dcerpc_rts_flags;
466 typedef [public] struct {
467 dcerpc_rts_flags Flags;
468 uint16 NumberOfCommands;
469 dcerpc_rts_cmd Commands[NumberOfCommands];
470 } dcerpc_rts;
472 typedef [public,enum8bit] enum {
473 DCERPC_PKT_REQUEST = 0, /* Ordinary request. */
474 DCERPC_PKT_PING = 1, /* Connectionless is server alive ? */
475 DCERPC_PKT_RESPONSE = 2, /* Ordinary reply. */
476 DCERPC_PKT_FAULT = 3, /* Fault in processing of call. */
477 DCERPC_PKT_WORKING = 4, /* Connectionless reply to a ping when server busy. */
478 DCERPC_PKT_NOCALL = 5, /* Connectionless reply to a ping when server has lost part of clients call. */
479 DCERPC_PKT_REJECT = 6, /* Refuse a request with a code. */
480 DCERPC_PKT_ACK = 7, /* Connectionless client to server code. */
481 DCERPC_PKT_CL_CANCEL = 8, /* Connectionless cancel. */
482 DCERPC_PKT_FACK = 9, /* Connectionless fragment ack. Both client and server send. */
483 DCERPC_PKT_CANCEL_ACK = 10, /* Server ACK to client cancel request. */
484 DCERPC_PKT_BIND = 11, /* Bind to interface. */
485 DCERPC_PKT_BIND_ACK = 12, /* Server ack of bind. */
486 DCERPC_PKT_BIND_NAK = 13, /* Server nack of bind. */
487 DCERPC_PKT_ALTER = 14, /* Alter auth. */
488 DCERPC_PKT_ALTER_RESP = 15, /* Reply to alter auth. */
489 DCERPC_PKT_AUTH3 = 16, /* not the real name! this is undocumented! */
490 DCERPC_PKT_SHUTDOWN = 17, /* Server to client request to shutdown. */
491 DCERPC_PKT_CO_CANCEL = 18, /* Connection-oriented cancel request. */
492 DCERPC_PKT_ORPHANED = 19, /* Client telling server it's aborting a partially sent request or telling server to stop sending replies. */
493 DCERPC_PKT_RTS = 20 /* RTS packets used in ncacn_http */
494 } dcerpc_pkt_type;
496 typedef [public,nodiscriminant] union {
497 [case(DCERPC_PKT_REQUEST)] dcerpc_request request;
498 [case(DCERPC_PKT_PING)] dcerpc_ping ping;
499 [case(DCERPC_PKT_RESPONSE)] dcerpc_response response;
500 [case(DCERPC_PKT_FAULT)] dcerpc_fault fault;
501 [case(DCERPC_PKT_WORKING)] dcerpc_working working;
502 [case(DCERPC_PKT_NOCALL)] dcerpc_fack nocall;
503 [case(DCERPC_PKT_REJECT)] dcerpc_fault reject;
504 [case(DCERPC_PKT_ACK)] dcerpc_ack ack;
505 [case(DCERPC_PKT_CL_CANCEL)] dcerpc_cl_cancel cl_cancel;
506 [case(DCERPC_PKT_FACK)] dcerpc_fack fack;
507 [case(DCERPC_PKT_CANCEL_ACK)] dcerpc_cancel_ack cancel_ack;
508 [case(DCERPC_PKT_BIND)] dcerpc_bind bind;
509 [case(DCERPC_PKT_BIND_ACK)] dcerpc_bind_ack bind_ack;
510 [case(DCERPC_PKT_BIND_NAK)] dcerpc_bind_nak bind_nak;
511 [case(DCERPC_PKT_ALTER)] dcerpc_bind alter;
512 [case(DCERPC_PKT_ALTER_RESP)] dcerpc_bind_ack alter_resp;
513 [case(DCERPC_PKT_SHUTDOWN)] dcerpc_shutdown shutdown;
514 [case(DCERPC_PKT_CO_CANCEL)] dcerpc_co_cancel co_cancel;
515 [case(DCERPC_PKT_ORPHANED)] dcerpc_orphaned orphaned;
516 [case(DCERPC_PKT_AUTH3)] dcerpc_auth3 auth3;
517 [case(DCERPC_PKT_RTS)] dcerpc_rts rts;
518 } dcerpc_payload;
520 /* pfc_flags values */
521 typedef [public,bitmap8bit] bitmap {
522 DCERPC_PFC_FLAG_FIRST = 0x01, /* First fragment */
523 DCERPC_PFC_FLAG_LAST = 0x02, /* Last fragment */
524 DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING = 0x04, /* depends on the pdu type */
525 DCERPC_PFC_FLAG_CONC_MPX = 0x10, /* supports concurrent multiplexing of a single connection. */
526 DCERPC_PFC_FLAG_DID_NOT_EXECUTE = 0x20, /* on a fault it means the server hasn't done anything */
527 DCERPC_PFC_FLAG_MAYBE = 0x40, /* `maybe' call semantics requested */
528 DCERPC_PFC_FLAG_OBJECT_UUID = 0x80 /* on valid guid is in the optional object field */
529 } dcerpc_pfc_flags;
531 /* Cancel was pending at sender */
532 const int DCERPC_PFC_FLAG_PENDING_CANCEL =
533 DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING;
534 const int DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN =
535 DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING;
537 /* these offsets are needed by the signing code */
538 const uint8 DCERPC_PFC_OFFSET = 3;
539 const uint8 DCERPC_DREP_OFFSET = 4;
540 const uint8 DCERPC_FRAG_LEN_OFFSET = 8;
541 const uint32 DCERPC_FRAG_MAX_SIZE = 5840;
542 const uint8 DCERPC_AUTH_LEN_OFFSET = 10;
543 const uint8 DCERPC_NCACN_PAYLOAD_OFFSET = 16;
546 * See [MS-RPCE] 3.3.3.5.4 Maximum Server Input Data Size
547 * 4 MByte is the default limit of reassembled request payload
549 const uint32 DCERPC_NCACN_REQUEST_DEFAULT_MAX_SIZE = 0x400000;
552 * See [MS-RPCE] 3.3.2.5.2 Handling Responses
554 * Indicates that Windows accepts up to 0x7FFFFFFF ~2 GByte
556 * talloc has a limit of 256 MByte, so we need to use something smaller.
558 * For now we try our luck with 240 MByte.
560 const uint32 DCERPC_NCACN_RESPONSE_DEFAULT_MAX_SIZE = 0xf000000; /* 240 MByte */
562 /* little-endian flag */
563 const uint8 DCERPC_DREP_LE = 0x10;
565 typedef [public,nopush,nopull,noprint] struct {
566 uint8 rpc_vers; /* RPC version */
567 uint8 rpc_vers_minor; /* Minor version */
568 dcerpc_pkt_type ptype; /* Packet type */
569 dcerpc_pfc_flags pfc_flags; /* Fragmentation flags */
570 uint8 drep[4]; /* NDR data representation */
571 uint16 frag_length; /* Total length of fragment */
572 uint16 auth_length; /* authenticator length */
573 uint32 call_id; /* Call identifier */
574 [switch_is(ptype)] dcerpc_payload u;
575 } ncacn_packet;
577 typedef [public] struct {
578 uint8 rpc_vers; /* RPC version (4) */
579 uint8 ptype;
580 uint8 pfc_flags;
581 uint8 ncadg_flags;
582 uint8 drep[3];
583 uint8 serial_high;
584 GUID object;
585 GUID iface;
586 GUID activity;
587 uint32 server_boot; /* Server boot time */
588 uint32 iface_version;
589 uint32 seq_num;
590 uint16 opnum;
591 uint16 ihint;
592 uint16 ahint;
593 uint16 len;
594 uint16 fragnum;
595 uint8 auth_proto;
596 uint8 serial_low;
597 [switch_is(ptype)] dcerpc_payload u;
598 } ncadg_packet;
600 typedef [bitmap16bit] bitmap {
601 DCERPC_SEC_VT_COMMAND_ENUM = 0x3FFF,
602 DCERPC_SEC_VT_COMMAND_END = 0x4000,
603 DCERPC_SEC_VT_MUST_PROCESS = 0x8000
604 } dcerpc_sec_vt_command;
606 typedef [enum16bit] enum {
607 DCERPC_SEC_VT_COMMAND_BITMASK1 = 0x0001,
608 DCERPC_SEC_VT_COMMAND_PCONTEXT = 0x0002,
609 DCERPC_SEC_VT_COMMAND_HEADER2 = 0x0003
610 } dcerpc_sec_vt_command_enum;
612 typedef [bitmap32bit] bitmap {
613 DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING = 0x00000001
614 } dcerpc_sec_vt_bitmask1;
616 typedef struct {
617 ndr_syntax_id abstract_syntax;
618 ndr_syntax_id transfer_syntax;
619 } dcerpc_sec_vt_pcontext;
621 typedef struct {
622 dcerpc_pkt_type ptype; /* Packet type */
623 [value(0)] uint8 reserved1;
624 [value(0)] uint16 reserved2;
625 uint8 drep[4]; /* NDR data representation */
626 uint32 call_id; /* Call identifier */
627 uint16 context_id;
628 uint16 opnum;
629 } dcerpc_sec_vt_header2;
631 typedef [switch_type(dcerpc_sec_vt_command_enum),nodiscriminant] union {
632 [case(DCERPC_SEC_VT_COMMAND_BITMASK1)] dcerpc_sec_vt_bitmask1 bitmask1;
633 [case(DCERPC_SEC_VT_COMMAND_PCONTEXT)] dcerpc_sec_vt_pcontext pcontext;
634 [case(DCERPC_SEC_VT_COMMAND_HEADER2)] dcerpc_sec_vt_header2 header2;
635 [default,flag(NDR_REMAINING)] DATA_BLOB _unknown;
636 } dcerpc_sec_vt_union;
638 typedef struct {
639 dcerpc_sec_vt_command command;
640 [switch_is(command & DCERPC_SEC_VT_COMMAND_ENUM)]
641 [subcontext(2),flag(NDR_SUBCONTEXT_NO_UNREAD_BYTES)]
642 dcerpc_sec_vt_union u;
643 } dcerpc_sec_vt;
645 typedef [public,nopush,nopull] struct {
646 uint16 count;
647 } dcerpc_sec_vt_count;
650 * We assume that the whole verification trailer fits into
651 * the last 1024 bytes after the stub data.
653 * There're currently only 3 commands defined and each should
654 * only be used once.
656 const uint16 DCERPC_SEC_VT_MAX_SIZE = 1024;
658 typedef [public,flag(NDR_PAHEX)] struct {
659 [flag(NDR_ALIGN4)] DATA_BLOB _pad;
660 [value(DCERPC_SEC_VT_MAGIC)] uint8 magic[8];
661 dcerpc_sec_vt_count count;
662 dcerpc_sec_vt commands[count.count];
663 } dcerpc_sec_verification_trailer;