librpc/ndr: add ndr_pop_dcerpc_sec_verification_trailer()
[Samba.git] / librpc / idl / dcerpc.idl
blob32f9514bbfd8e451775990e34543659568f0c75c
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 [default] dcerpc_empty empty;
52 [case(LIBNDR_FLAG_OBJECT_PRESENT)] GUID object;
53 } dcerpc_object;
55 typedef struct {
56 uint32 alloc_hint;
57 uint16 context_id;
58 uint16 opnum;
59 [switch_is(ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT)] dcerpc_object object;
60 [flag(NDR_ALIGN8)] DATA_BLOB _pad;
61 [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
62 } dcerpc_request;
64 const int DCERPC_BIND_REASON_ASYNTAX = 1;
65 const int DCERPC_BIND_PROVIDER_REJECT = 2;
66 const int DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED = 4;
67 const int DCERPC_BIND_REASON_INVALID_AUTH_TYPE = 8;
69 typedef struct {
70 uint16 result;
71 uint16 reason;
72 ndr_syntax_id syntax;
73 } dcerpc_ack_ctx;
75 typedef struct {
76 uint16 max_xmit_frag;
77 uint16 max_recv_frag;
78 uint32 assoc_group_id;
79 [value(strlen(secondary_address)+1)] uint16 secondary_address_size;
80 [charset(DOS)] uint8 secondary_address[secondary_address_size];
81 [flag(NDR_ALIGN4)] DATA_BLOB _pad1;
82 uint8 num_results;
83 dcerpc_ack_ctx ctx_list[num_results];
84 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
85 } dcerpc_bind_ack;
87 typedef struct {
88 uint32 num_versions;
89 uint32 versions[num_versions];
90 } dcerpc_bind_nak_versions;
92 typedef [nodiscriminant] union {
93 [case(DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED)] dcerpc_bind_nak_versions v;
94 [default] ;
95 } dcerpc_bind_nak_versions_ctr;
97 typedef struct {
98 uint16 reject_reason;
99 [switch_is(reject_reason)] dcerpc_bind_nak_versions_ctr versions;
100 } dcerpc_bind_nak;
102 const uint8 DCERPC_RESPONSE_LENGTH = 24;
104 typedef struct {
105 uint32 alloc_hint;
106 uint16 context_id;
107 uint8 cancel_count;
108 [flag(NDR_ALIGN8)] DATA_BLOB _pad;
109 [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
110 } dcerpc_response;
112 typedef [v1_enum] enum {
113 DCERPC_NCA_S_COMM_FAILURE = 0x1C010001,
114 DCERPC_NCA_S_OP_RNG_ERROR = 0x1C010002,
115 DCERPC_NCA_S_UNKNOWN_IF = 0x1C010003,
116 DCERPC_NCA_S_WRONG_BOOT_TIME = 0x1C010006,
117 DCERPC_NCA_S_YOU_CRASHED = 0x1C010009,
118 DCERPC_NCA_S_PROTO_ERROR = 0x1C01000B,
119 DCERPC_NCA_S_OUT_ARGS_TOO_BIG = 0x1C010013,
120 DCERPC_NCA_S_SERVER_TOO_BUSY = 0x1C010014,
121 DCERPC_NCA_S_FAULT_STRING_TOO_LARGE = 0x1C010015,
122 DCERPC_NCA_S_UNSUPPORTED_TYPE = 0x1C010017,
123 DCERPC_NCA_S_FAULT_INT_DIV_BY_ZERO = 0x1C000001,
124 DCERPC_NCA_S_FAULT_ADDR_ERROR = 0x1C000002,
125 DCERPC_NCA_S_FAULT_FP_DIV_BY_ZERO = 0x1C000003,
126 DCERPC_NCA_S_FAULT_FP_UNDERFLOW = 0x1C000004,
127 DCERPC_NCA_S_FAULT_FP_OVERRFLOW = 0x1C000005,
128 DCERPC_NCA_S_FAULT_INVALID_TAG = 0x1C000006,
129 DCERPC_NCA_S_FAULT_INVALID_BOUND = 0x1C000007,
130 DCERPC_NCA_S_FAULT_RPC_VERSION_MISMATCH = 0x1C000008,
131 DCERPC_NCA_S_FAULT_UNSPEC_REJECT = 0x1C000009,
132 DCERPC_NCA_S_FAULT_BAD_ACTID = 0x1C00000A,
133 DCERPC_NCA_S_FAULT_WHO_ARE_YOU_FAILED = 0x1C00000B,
134 DCERPC_NCA_S_FAULT_MANAGER_NOT_ENTERED = 0x1C00000C,
135 DCERPC_NCA_S_FAULT_CANCEL = 0x1C00000D,
136 DCERPC_NCA_S_FAULT_ILL_INST = 0x1C00000E,
137 DCERPC_NCA_S_FAULT_FP_ERROR = 0x1C00000F,
138 DCERPC_NCA_S_FAULT_INT_OVERFLOW = 0x1C000010,
139 DCERPC_NCA_S_UNUSED_1C000011 = 0x1C000011,
140 DCERPC_NCA_S_FAULT_UNSPEC = 0x1C000012,
141 DCERPC_NCA_S_FAULT_REMOTE_COMM_FAILURE = 0x1C000013,
142 DCERPC_NCA_S_FAULT_PIPE_EMPTY = 0x1C000014,
143 DCERPC_NCA_S_FAULT_PIPE_CLOSED = 0x1C000015,
144 DCERPC_NCA_S_FAULT_PIPE_ORDER = 0x1C000016,
145 DCERPC_NCA_S_FAULT_PIPE_DISCIPLINE = 0x1C000017,
146 DCERPC_NCA_S_FAULT_PIPE_COMM_ERROR = 0x1C000018,
147 DCERPC_NCA_S_FAULT_PIPE_MEMORY = 0x1C000019,
148 DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH = 0x1C00001A,
149 DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY = 0x1C00001B,
150 DCERPC_NCA_S_INVALID_PRES_CONTEXT_ID = 0x1C00001C,
151 DCERPC_NCA_S_UNSUPPORTED_AUTHN_LEVEL = 0x1C00001D,
152 DCERPC_NCA_S_UNUSED_1C00001E = 0x1C00001E,
153 DCERPC_NCA_S_INVALID_CHECKSUM = 0x1C00001F,
154 DCERPC_NCA_S_INVALID_CRC = 0x1C000020,
155 DCERPC_NCA_S_FAULT_USER_DEFINED = 0x1C000021,
156 DCERPC_NCA_S_FAULT_TX_OPEN_FAILED = 0x1C000022,
157 DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR = 0x1C000023,
158 DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND = 0x1C000024,
159 DCERPC_NCA_S_FAULT_NO_CLIENT_STUB = 0x1C000025
160 } dcerpc_nca_status;
162 const int DCERPC_FAULT_OP_RNG_ERROR = 0x1c010002;
163 const int DCERPC_FAULT_UNK_IF = 0x1c010003;
164 const int DCERPC_FAULT_NDR = 0x000006f7;
165 const int DCERPC_FAULT_INVALID_TAG = 0x1c000006;
166 const int DCERPC_FAULT_CONTEXT_MISMATCH = 0x1c00001a;
167 const int DCERPC_FAULT_OTHER = 0x00000001;
168 const int DCERPC_FAULT_ACCESS_DENIED = 0x00000005;
169 const int DCERPC_FAULT_CANT_PERFORM = 0x000006d8;
170 const int DCERPC_FAULT_SEC_PKG_ERROR = 0x00000721;
172 /* we return this fault when we haven't yet run the test
173 to see what fault w2k3 returns in this case */
174 const int DCERPC_FAULT_TODO = 0x00000042;
176 typedef struct {
177 uint32 alloc_hint;
178 uint16 context_id;
179 uint8 cancel_count;
180 dcerpc_nca_status status;
181 [flag(NDR_REMAINING)] DATA_BLOB _pad;
182 } dcerpc_fault;
184 /* the auth types we know about */
185 typedef [enum8bit] enum {
186 DCERPC_AUTH_TYPE_NONE = 0,
187 /* this seems to be not krb5! */
188 DCERPC_AUTH_TYPE_KRB5_1 = 1,
189 DCERPC_AUTH_TYPE_SPNEGO = 9,
190 DCERPC_AUTH_TYPE_NTLMSSP = 10,
191 DCERPC_AUTH_TYPE_KRB5 = 16,
192 DCERPC_AUTH_TYPE_DPA = 17,
193 DCERPC_AUTH_TYPE_MSN = 18,
194 DCERPC_AUTH_TYPE_DIGEST = 21,
195 DCERPC_AUTH_TYPE_SCHANNEL = 68,
196 DCERPC_AUTH_TYPE_MSMQ = 100,
197 DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM = 200
198 } dcerpc_AuthType;
200 typedef [enum8bit] enum {
201 DCERPC_AUTH_LEVEL_NONE = 1,
202 DCERPC_AUTH_LEVEL_CONNECT = 2,
203 DCERPC_AUTH_LEVEL_CALL = 3,
204 DCERPC_AUTH_LEVEL_PACKET = 4,
205 DCERPC_AUTH_LEVEL_INTEGRITY = 5,
206 DCERPC_AUTH_LEVEL_PRIVACY = 6
207 } dcerpc_AuthLevel;
209 const uint8 DCERPC_AUTH_LEVEL_DEFAULT = DCERPC_AUTH_LEVEL_CONNECT;
211 typedef [public] struct {
212 dcerpc_AuthType auth_type;
213 dcerpc_AuthLevel auth_level;
214 uint8 auth_pad_length;
215 uint8 auth_reserved;
216 uint32 auth_context_id;
217 [flag(NDR_REMAINING)] DATA_BLOB credentials;
218 } dcerpc_auth;
220 const uint8 DCERPC_AUTH_TRAILER_LENGTH = 8;
222 typedef [public] struct {
223 [value(0)] uint32 _pad;
224 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
225 } dcerpc_auth3;
227 typedef [public] struct {
228 [value(0)] uint32 _pad;
229 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
230 } dcerpc_orphaned;
232 typedef [public] struct {
233 [value(0)] uint32 _pad;
234 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
235 } dcerpc_co_cancel;
237 typedef [public] struct {
238 uint32 version;
239 uint32 id;
240 } dcerpc_cl_cancel;
242 typedef [public] struct {
243 uint32 version;
244 uint32 id;
245 boolean32 server_is_accepting;
246 } dcerpc_cancel_ack;
248 typedef [public] struct {
249 uint32 version;
250 uint8 _pad1;
251 uint16 window_size;
252 uint32 max_tdsu;
253 uint32 max_frag_size;
254 uint16 serial_no;
255 uint16 selack_size;
256 uint32 selack[selack_size];
257 } dcerpc_fack;
259 typedef [public] struct {
260 } dcerpc_ack;
262 typedef [public] struct {
263 } dcerpc_ping;
265 typedef [public] struct {
266 } dcerpc_shutdown;
268 typedef [public] struct {
269 } dcerpc_working;
271 /* RTS data structures */
272 typedef [public] struct {
273 GUID Cookie;
274 } RTSCookie;
276 typedef [v1_enum,public] enum {
277 RTS_IPV4 = 0,
278 RTS_IPV6 = 1
279 } AddressType;
281 typedef [nodiscriminant] union {
282 [case(RTS_IPV4)] ipv4address ClientAddressIPV4;
283 [case(RTS_IPV6)] ipv6address ClientAddressIPV6;
284 } ClientAddressType;
286 typedef [public] struct {
287 AddressType AddressType;
288 [switch_is(AddressType)] ClientAddressType ClientAddress;
289 uint8 Padding[12];
290 } ClientAddress;
292 typedef [v1_enum, public] enum {
293 FDClient = 0,
294 FDInProxy = 1,
295 FDServer = 2,
296 FDOutProxy = 3
297 } ForwardDestination;
299 typedef [public] struct {
300 uint32 BytesReceived;
301 uint32 AvailableWindow;
302 RTSCookie ChannelCookie;
303 } FlowControlAcknowledgment;
305 /* RTS commands */
307 /* RTS command: 0x0 */
308 typedef [public] struct {
309 [range(0x2000,0x40000)] uint32 ReceiveWindowSize;
310 } dcerpc_rts_cmd_ReceiveWindowSize;
312 /* RTS command: 0x1 */
313 typedef [public] struct {
314 FlowControlAcknowledgment Ack;
315 } dcerpc_rts_cmd_FlowControlAck;
317 /* RTS command: 0x2 */
318 typedef [public] struct {
319 [range(0x1D4C0,0xDBBA00)] uint32 ConnectionTimeout;
320 } dcerpc_rts_cmd_ConnectionTimeout;
322 /* RTS command: 0x3 */
323 typedef [public] struct {
324 RTSCookie Cookie;
325 } dcerpc_rts_cmd_Cookie;
327 /* RTS command: 0x4 */
328 typedef [public] struct {
329 [range(0x20000,0x80000000)] uint32 ChannelLifetime;
330 } dcerpc_rts_cmd_ChannelLifetime;
332 /* RTS command: 0x5 */
333 typedef [public] struct {
334 uint32 ClientKeepalive;
335 } dcerpc_rts_cmd_ClientKeepalive;
337 /* RTS command: 0x6 */
338 typedef [public] struct {
339 uint32 Version;
340 } dcerpc_rts_cmd_Version;
342 /* RTS command: 0x7 */
343 typedef [public] struct {
344 } dcerpc_rts_cmd_Empty;
346 /* RTS command: 0x8 */
347 typedef [public] struct {
348 [range(0x0,0xFFFF)] uint32 ConformanceCount;
349 uint8 Padding[ConformanceCount];
350 } dcerpc_rts_cmd_Padding;
352 /* RTS command: 0x9 */
353 typedef [public] struct {
354 } dcerpc_rts_cmd_NegativeANCE;
356 /* RTS Command: 0xA */
357 typedef [public] struct {
358 } dcerpc_rts_cmd_ANCE;
360 /* RTS command: 0xB */
361 typedef [public] struct {
362 ClientAddress ClientAddress;
363 } dcerpc_rts_cmd_ClientAddress;
365 /* RTS command: 0xC */
366 typedef [public] struct {
367 RTSCookie AssociationGroupId;
368 } dcerpc_rts_cmd_AssociationGroupId;
370 /* RTS command: 0xD */
371 typedef [public] struct {
372 ForwardDestination ForwardDestination;
373 } dcerpc_rts_cmd_Destination;
375 /* RTS command: 0xE */
376 typedef [public] struct {
377 uint32 PingTrafficSent;
378 } dcerpc_rts_cmd_PingTrafficSentNotify;
380 typedef [nodiscriminant] union {
381 [case(0x0)] dcerpc_rts_cmd_ReceiveWindowSize ReceiveWindowSize;
382 [case(0x1)] dcerpc_rts_cmd_FlowControlAck FlowControlAck;
383 [case(0x2)] dcerpc_rts_cmd_ConnectionTimeout ConnectionTimeout;
384 [case(0x3)] dcerpc_rts_cmd_Cookie Cookie;
385 [case(0x4)] dcerpc_rts_cmd_ChannelLifetime ChannelLifetime;
386 [case(0x5)] dcerpc_rts_cmd_ClientKeepalive ClientKeepalive;
387 [case(0x6)] dcerpc_rts_cmd_Version Version;
388 [case(0x7)] dcerpc_rts_cmd_Empty Empty;
389 [case(0x8)] dcerpc_rts_cmd_Padding Padding;
390 [case(0x9)] dcerpc_rts_cmd_NegativeANCE NegativeANCE;
391 [case(0xA)] dcerpc_rts_cmd_ANCE ANCE;
392 [case(0xB)] dcerpc_rts_cmd_ClientAddress ClientAddress;
393 [case(0xC)] dcerpc_rts_cmd_AssociationGroupId AssociationGroupId;
394 [case(0xD)] dcerpc_rts_cmd_Destination Destination;
395 [case(0xE)] dcerpc_rts_cmd_PingTrafficSentNotify PingTrafficSentNotify;
396 } dcerpc_rts_cmds;
398 typedef [public] struct {
399 uint32 CommandType;
400 [switch_is(CommandType)] dcerpc_rts_cmds Command;
401 } dcerpc_rts_cmd;
403 /* The RTS flags */
404 typedef [public, bitmap16bit] bitmap {
405 RTS_FLAG_NONE = 0x0000,
406 RTS_FLAG_PING = 0x0001,
407 RTS_FLAG_OTHER_CMD = 0x0002,
408 RTS_FLAG_RECYCLE_CHANNEL = 0x0004,
409 RTS_FLAG_IN_CHANNEL = 0x0008,
410 RTS_FLAG_OUT_CHANNEL = 0x0010,
411 RTS_FLAG_EOF = 0x0020,
412 RTS_FLAG_ECHO = 0x0040
413 } dcerpc_rts_flags;
415 typedef [public] struct {
416 dcerpc_rts_flags Flags;
417 uint16 NumberOfCommands;
418 dcerpc_rts_cmd Commands[NumberOfCommands];
419 } dcerpc_rts;
421 typedef [enum8bit] enum {
422 DCERPC_PKT_REQUEST = 0, /* Ordinary request. */
423 DCERPC_PKT_PING = 1, /* Connectionless is server alive ? */
424 DCERPC_PKT_RESPONSE = 2, /* Ordinary reply. */
425 DCERPC_PKT_FAULT = 3, /* Fault in processing of call. */
426 DCERPC_PKT_WORKING = 4, /* Connectionless reply to a ping when server busy. */
427 DCERPC_PKT_NOCALL = 5, /* Connectionless reply to a ping when server has lost part of clients call. */
428 DCERPC_PKT_REJECT = 6, /* Refuse a request with a code. */
429 DCERPC_PKT_ACK = 7, /* Connectionless client to server code. */
430 DCERPC_PKT_CL_CANCEL = 8, /* Connectionless cancel. */
431 DCERPC_PKT_FACK = 9, /* Connectionless fragment ack. Both client and server send. */
432 DCERPC_PKT_CANCEL_ACK = 10, /* Server ACK to client cancel request. */
433 DCERPC_PKT_BIND = 11, /* Bind to interface. */
434 DCERPC_PKT_BIND_ACK = 12, /* Server ack of bind. */
435 DCERPC_PKT_BIND_NAK = 13, /* Server nack of bind. */
436 DCERPC_PKT_ALTER = 14, /* Alter auth. */
437 DCERPC_PKT_ALTER_RESP = 15, /* Reply to alter auth. */
438 DCERPC_PKT_AUTH3 = 16, /* not the real name! this is undocumented! */
439 DCERPC_PKT_SHUTDOWN = 17, /* Server to client request to shutdown. */
440 DCERPC_PKT_CO_CANCEL = 18, /* Connection-oriented cancel request. */
441 DCERPC_PKT_ORPHANED = 19, /* Client telling server it's aborting a partially sent request or telling server to stop sending replies. */
442 DCERPC_PKT_RTS = 20 /* RTS packets used in ncacn_http */
443 } dcerpc_pkt_type;
445 typedef [nodiscriminant] union {
446 [case(DCERPC_PKT_REQUEST)] dcerpc_request request;
447 [case(DCERPC_PKT_PING)] dcerpc_ping ping;
448 [case(DCERPC_PKT_RESPONSE)] dcerpc_response response;
449 [case(DCERPC_PKT_FAULT)] dcerpc_fault fault;
450 [case(DCERPC_PKT_WORKING)] dcerpc_working working;
451 [case(DCERPC_PKT_NOCALL)] dcerpc_fack nocall;
452 [case(DCERPC_PKT_REJECT)] dcerpc_fault reject;
453 [case(DCERPC_PKT_ACK)] dcerpc_ack ack;
454 [case(DCERPC_PKT_CL_CANCEL)] dcerpc_cl_cancel cl_cancel;
455 [case(DCERPC_PKT_FACK)] dcerpc_fack fack;
456 [case(DCERPC_PKT_CANCEL_ACK)] dcerpc_cancel_ack cancel_ack;
457 [case(DCERPC_PKT_BIND)] dcerpc_bind bind;
458 [case(DCERPC_PKT_BIND_ACK)] dcerpc_bind_ack bind_ack;
459 [case(DCERPC_PKT_BIND_NAK)] dcerpc_bind_nak bind_nak;
460 [case(DCERPC_PKT_ALTER)] dcerpc_bind alter;
461 [case(DCERPC_PKT_ALTER_RESP)] dcerpc_bind_ack alter_resp;
462 [case(DCERPC_PKT_SHUTDOWN)] dcerpc_shutdown shutdown;
463 [case(DCERPC_PKT_CO_CANCEL)] dcerpc_co_cancel co_cancel;
464 [case(DCERPC_PKT_ORPHANED)] dcerpc_orphaned orphaned;
465 [case(DCERPC_PKT_AUTH3)] dcerpc_auth3 auth3;
466 [case(DCERPC_PKT_RTS)] dcerpc_rts rts;
467 } dcerpc_payload;
469 /* pfc_flags values */
470 const uint8 DCERPC_PFC_FLAG_FIRST = 0x01; /* First fragment */
471 const uint8 DCERPC_PFC_FLAG_LAST = 0x02; /* Last fragment */
472 const uint8 DCERPC_PFC_FLAG_PENDING_CANCEL = 0x04; /* Cancel was pending at sender */
473 const uint8 DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN = DCERPC_PFC_FLAG_PENDING_CANCEL; /* depends on the pdu type */
474 const uint8 DCERPC_PFC_FLAG_CONC_MPX = 0x10; /* supports concurrent multiplexing of a single connection. */
475 const uint8 DCERPC_PFC_FLAG_DID_NOT_EXECUTE = 0x20; /* on a fault it means the server hasn't done anything */
476 const uint8 DCERPC_PFC_FLAG_MAYBE = 0x40; /* `maybe' call semantics requested */
477 const uint8 DCERPC_PFC_FLAG_OBJECT_UUID = 0x80; /* on valid guid is in the optional object field */
479 /* these offsets are needed by the signing code */
480 const uint8 DCERPC_PFC_OFFSET = 3;
481 const uint8 DCERPC_DREP_OFFSET = 4;
482 const uint8 DCERPC_FRAG_LEN_OFFSET = 8;
483 const uint8 DCERPC_AUTH_LEN_OFFSET = 10;
484 const uint8 DCERPC_NCACN_PAYLOAD_OFFSET = 16;
486 /* little-endian flag */
487 const uint8 DCERPC_DREP_LE = 0x10;
489 typedef [public] struct {
490 uint8 rpc_vers; /* RPC version */
491 uint8 rpc_vers_minor; /* Minor version */
492 dcerpc_pkt_type ptype; /* Packet type */
493 uint8 pfc_flags; /* Fragmentation flags */
494 uint8 drep[4]; /* NDR data representation */
495 uint16 frag_length; /* Total length of fragment */
496 uint16 auth_length; /* authenticator length */
497 uint32 call_id; /* Call identifier */
498 [switch_is(ptype)] dcerpc_payload u;
499 } ncacn_packet;
501 typedef [public] struct {
502 uint8 rpc_vers; /* RPC version (4) */
503 uint8 ptype;
504 uint8 pfc_flags;
505 uint8 ncadg_flags;
506 uint8 drep[3];
507 uint8 serial_high;
508 GUID object;
509 GUID iface;
510 GUID activity;
511 uint32 server_boot; /* Server boot time */
512 uint32 iface_version;
513 uint32 seq_num;
514 uint16 opnum;
515 uint16 ihint;
516 uint16 ahint;
517 uint16 len;
518 uint16 fragnum;
519 uint8 auth_proto;
520 uint8 serial_low;
521 [switch_is(ptype)] dcerpc_payload u;
522 } ncadg_packet;
524 typedef [bitmap16bit] bitmap {
525 DCERPC_SEC_VT_COMMAND_ENUM = 0x3FFF,
526 DCERPC_SEC_VT_COMMAND_END = 0x4000,
527 DCERPC_SEC_VT_MUST_PROCESS = 0x8000
528 } dcerpc_sec_vt_command;
530 typedef [enum16bit] enum {
531 DCERPC_SEC_VT_COMMAND_BITMASK1 = 0x0001,
532 DCERPC_SEC_VT_COMMAND_PCONTEXT = 0x0002,
533 DCERPC_SEC_VT_COMMAND_HEADER2 = 0x0003
534 } dcerpc_sec_vt_command_enum;
536 typedef [bitmap32bit] bitmap {
537 DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING = 0x00000001
538 } dcerpc_sec_vt_bitmask1;
540 typedef struct {
541 ndr_syntax_id abstract_syntax;
542 ndr_syntax_id transfer_syntax;
543 } dcerpc_sec_vt_pcontext;
545 typedef struct {
546 dcerpc_pkt_type ptype; /* Packet type */
547 [value(0)] uint8 reserved1;
548 [value(0)] uint16 reserved2;
549 uint8 drep[4]; /* NDR data representation */
550 uint32 call_id; /* Call identifier */
551 uint16 context_id;
552 uint16 opnum;
553 } dcerpc_sec_vt_header2;
555 typedef [switch_type(dcerpc_sec_vt_command_enum),nodiscriminant] union {
556 [case(DCERPC_SEC_VT_COMMAND_BITMASK1)] dcerpc_sec_vt_bitmask1 bitmask1;
557 [case(DCERPC_SEC_VT_COMMAND_PCONTEXT)] dcerpc_sec_vt_pcontext pcontext;
558 [case(DCERPC_SEC_VT_COMMAND_HEADER2)] dcerpc_sec_vt_header2 header2;
559 [default,flag(NDR_REMAINING)] DATA_BLOB _unknown;
560 } dcerpc_sec_vt_union;
562 typedef struct {
563 dcerpc_sec_vt_command command;
564 [switch_is(command & DCERPC_SEC_VT_COMMAND_ENUM)]
565 [subcontext(2),flag(NDR_SUBCONTEXT_NO_UNREAD_BYTES)]
566 dcerpc_sec_vt_union u;
567 } dcerpc_sec_vt;
569 typedef [public,nopush,nopull] struct {
570 uint16 count;
571 } dcerpc_sec_vt_count;
574 * We assume that the whole verification trailer fits into
575 * the last 1024 bytes after the stub data.
577 * There're currently only 3 commands defined and each should
578 * only be used once.
580 const uint16 DCERPC_SEC_VT_MAX_SIZE = 1024;
582 typedef [public,flag(NDR_PAHEX)] struct {
583 [flag(NDR_ALIGN4)] DATA_BLOB _pad;
584 [value(DCERPC_SEC_VT_MAGIC)] uint8 magic[8];
585 dcerpc_sec_vt_count count;
586 dcerpc_sec_vt commands[count.count];
587 } dcerpc_sec_verification_trailer;