1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 23 * Copyright 2020 Tintri by DDN, Inc. All rights reserved. 24 */ 25 26#ifndef _RPCPDU_NDL_ 27#define _RPCPDU_NDL_ 28 29#include "ndrtypes.ndl" 30 31/* 32 * Normally, constructs are (un)marshalled atoms first, then 33 * constructs, then pointers. This can be confusing sometimes 34 * when debugging. We know that everything in here can be 35 * safely (un)marshalled in member order, so we say so. 36 */ 37#ifdef NDRGEN 38#define _NO_REORDER_ [_no_reorder] 39#else 40#define _NO_REORDER_ 41#endif 42 43#define NDR_TRANSFER_SYNTAX_UUID "8a885d04-1ceb-11c9-9fe8-08002b104860" 44 45/* 46 * UUID (Universal Unique IDentifier) 47 */ 48/* (X/Open CAE Spec Appendix A) */ 49struct ndr_dce_uuid { 50 DWORD time_low; 51 WORD time_mid; 52 WORD time_hi_and_version; 53 BYTE clock_seq_hi_and_reserved; 54 BYTE clock_seq_low; 55 BYTE node[6]; 56}; 57 58struct ndr_uuid { 59 DWORD data1; 60 WORD data2; 61 WORD data3; 62 BYTE data4[8]; 63}; 64typedef struct ndr_uuid ndr_uuid_t; 65 66/* 67 * Representation label -- needed for RPC header 68 * (X/Open CAE Spec Chapter 14.1) 69 * 70 * Bits Data Type Description 71 * ---- --------- ----------- 72 * 0-3 charset 0=ASCII 73 * 1=EBCDIC 74 * 4-7 byte-order 0=big-endian 75 * 1=little-endian 76 * 8-15 float 0=IEEE 77 * 1=VAX 78 * 2=Cray 79 * 3=IBM 80 * 16-31 reserved 81 */ 82#define NDR_REPLAB_CHAR_MASK 0x0F /* low nibble of intg_char */ 83#define NDR_REPLAB_CHAR_ASCII 0x00 /* ASCII */ 84#define NDR_REPLAB_CHAR_EBCDIC 0x01 /* EBCDIC (never happen) */ 85#define NDR_REPLAB_INTG_MASK 0xF0 /* hi nibble of intg_char */ 86#define NDR_REPLAB_INTG_BIG_ENDIAN 0x00 /* big endian */ 87#define NDR_REPLAB_INTG_LITTLE_ENDIAN 0x10 /* little endian (x86) */ 88#define NDR_REPLAB_FLOAT_IEEE 0x00 89#define NDR_REPLAB_FLOAT_VAX 0x01 90#define NDR_REPLAB_FLOAT_CRAY 0x02 91#define NDR_REPLAB_FLOAT_IBM 0x03 92 93struct ndr_representation_label { 94 BYTE intg_char_rep; /* integer and charset */ 95 BYTE float_rep; 96 BYTE _spare[2]; 97}; 98typedef struct ndr_representation_label ndr_replab_t; 99 100 101 102/* 103 * RPC PDU (Protocol Data Unit) types 104 **************************************************************** 105 * (X/Open CAE Spec 12.1) 106 */ 107 108#define NDR_PTYPE_REQUEST 0x00 /* CO/CL */ 109#define NDR_PTYPE_PING 0x01 /* CL */ 110#define NDR_PTYPE_RESPONSE 0x02 /* CO/CL */ 111#define NDR_PTYPE_FAULT 0x03 /* CL/CL */ 112#define NDR_PTYPE_WORKING 0x04 /* CL */ 113#define NDR_PTYPE_NOCALL 0x05 /* CL */ 114#define NDR_PTYPE_REJECT 0x06 /* CL */ 115#define NDR_PTYPE_ACK 0x07 /* CL */ 116#define NDR_PTYPE_CL_CANCEL 0x08 /* CL */ 117#define NDR_PTYPE_FACK 0x09 /* CL */ 118#define NDR_PTYPE_CANCEL_ACK 0x0A /* CL */ 119#define NDR_PTYPE_BIND 0x0B /* CO */ 120#define NDR_PTYPE_BIND_ACK 0x0C /* CO */ 121#define NDR_PTYPE_BIND_NAK 0x0D /* CO */ 122#define NDR_PTYPE_ALTER_CONTEXT 0x0E /* CO */ 123#define NDR_PTYPE_ALTER_CONTEXT_RESP 0x0F /* CO */ 124 /* 0x10 missing from DCE/RPC */ 125#define NDR_PTYPE_SHUTDOWN 0x11 /* CO */ 126#define NDR_PTYPE_CO_CANCEL 0x12 /* CO */ 127#define NDR_PTYPE_ORPHANED 0x13 /* CO */ 128 129/* 130 * Flags in the RPC header for Connection-oriented PDU data types 131 * (X/Open CAE Spec 12.6.3.1) 132 * 133 * MS-RPCE 2.2.2.3 PFC_SUPPORT_HEADER_SIGN 134 * For PDU types bind, bind_ack, alter_context and alter_context_resp, 135 * 0x04 means PFC_SUPPORT_HEADER_SIGN. 136 * For other PDU types 0x04 means PFC_PENDING_CANCEL. 137 */ 138#define NDR_PFC_FIRST_FRAG 0x01 /* First fragment */ 139#define NDR_PFC_LAST_FRAG 0x02 /* Last framgent */ 140#define NDR_PFC_PENDING_CANCEL 0x04 /* Cancel was pending@sender*/ 141#define NDR_PFC_SUPPORT_HEADER_SIGN NDR_PFC_PENDING_CANCEL 142#define NDR_PFC_RESERVED_1 0x08 /* */ 143#define NDR_PFC_CONC_MPX 0x10 /* supports concurrent muxing 144 * of single connection */ 145#define NDR_PFC_DID_NOT_EXECUTE 0x20 /* for PTYPE_FAULT, guarantee 146 * call did not execute */ 147#define NDR_PFC_MAYBE 0x40 /* "maybe" semantics req'ed*/ 148#define NDR_PFC_OBJECT_UUID 0x80 /* */ 149 150/* 151 * Security Providers 152 * MS-RPCE 2.2.1.1.6 153 */ 154#define NDR_C_AUTHN_NONE 0x00 /* No authentication */ 155#define NDR_C_AUTHN_GSS_NEGOTIATE 0x09 /* SPNEGO */ 156#define NDR_C_AUTHN_WINNT 0x0A /* NTLM */ 157#define NDR_C_AUTHN_GSS_KERBEROS 0x10 /* Kerberos */ 158#define NDR_C_AUTHN_GSS_NETLOGON 0x44 /* Netlogon */ 159#define NDR_C_AUTHN_GSS_DEFAULT 0xFF /* Default is NTLM */ 160 161/* 162 * Encoding protection levels 163 * X/Open CAE Spec 13.1.2.1 164 * MS-RPCE 2.2.1.1.7 165 */ 166#define NDR_C_AUTHN_LEVEL_DEFAULT 0x00 /* Same as Connect */ 167#define NDR_C_AUTHN_LEVEL_NONE 0x01 168#define NDR_C_AUTHN_LEVEL_CONNECT 0x02 169#define NDR_C_AUTHN_LEVEL_CALL 0x03 170#define NDR_C_AUTHN_LEVEL_PKT 0x04 171#define NDR_C_AUTHN_LEVEL_PKT_INTEGRITY 0x05 172#define NDR_C_AUTHN_LEVEL_PKT_PRIVACY 0x06 173 174/* 175 * Header common to all Connection-oriented RPC PDUs 176 * (X/Open CAE Spec 12.6.3.1) 177 */ 178_NO_REORDER_ 179struct ndr_p_syntax_id { 180 ndr_uuid_t if_uuid; 181 DWORD if_version; 182}; 183typedef struct ndr_p_syntax_id ndr_p_syntax_id_t; 184 185_NO_REORDER_ 186struct ndr_common_header { 187 BYTE rpc_vers; /* 00:01 5 */ 188 BYTE rpc_vers_minor; /* 01:01 0 */ 189 BYTE ptype; /* 02:01 NDR_PTYPE_... */ 190 BYTE pfc_flags; /* 03:01 NDR_PFC_... */ 191 struct ndr_representation_label 192 packed_drep; /* 04:04 NDR representation label */ 193 WORD frag_length; /* 08:02 total length of frag */ 194 WORD auth_length; /* 10:02 length of auth_value */ 195 DWORD call_id; /* 12:04 call identifier */ 196 /* 16: */ 197}; 198typedef struct ndr_common_header ndr_common_header_t; 199EXTERNTYPEINFO(ndr_common_header) 200 201/* 202 * MS-RPCE 2.2.6 Type Serialization Version 1 extensions to IDL/+ pickle 203 * One header per serialization stream: the header must be little endian. 204 * The filler must be set to 0xcccccccc during marshaling and ignored 205 * during unmarshaling. 206 */ 207_NO_REORDER_ 208struct ndr_serialtype1_hdr { 209 BYTE version; /* 00:01 1 */ 210 BYTE endianness; /* 01:01 0=big, 1=little */ 211 WORD hdrlen; /* 02:02 8 */ 212 DWORD filler; /* 04:04 0xcccccccc */ 213 /* 8: */ 214}; 215typedef struct ndr_serialtype1_hdr ndr_serialtype1_hdr_t; 216EXTERNTYPEINFO(ndr_serialtype1_hdr) 217 218/* 219 * Type Serialization Version 1 Private Header. 220 * A private header must precede a top-level NDR constructed type. 221 */ 222_NO_REORDER_ 223struct ndr_serialtype1_priv_hdr { 224 DWORD buflen; /* 00:04 */ 225 DWORD filler; /* 04:04 must be zero */ 226 /* 8: */ 227}; 228typedef struct ndr_serialtype1_priv_hdr ndr_serialtype1_priv_hdr_t; 229EXTERNTYPEINFO(ndr_serialtype1_priv_hdr) 230 231/* 232 * MS-RPCE 2.2.7 Type Serialization Version 2 extensions Version 1 (2.2.6). 233 * The header must be little endian. 234 * The endianinfo and reserved fields must be set to 0xcccccccc during 235 * marshaling and ignored during unmarshaling. 236 */ 237_NO_REORDER_ 238struct ndr_serialtype2_hdr { 239 BYTE version; /* 00:01 1 */ 240 BYTE endianness; /* 01:01 0=big, 1=little */ 241 WORD hdrlen; /* 02:02 8 */ 242 DWORD endianinfo; /* 04:04 0xcccccccc */ 243 DWORD reserved[4]; /* 08:16 0xcccccccc */ 244 ndr_p_syntax_id_t transfer_syntax; /* 24:20 */ 245 ndr_p_syntax_id_t interface_id; /* 44:20 */ 246 /* 64: */ 247}; 248typedef struct ndr_serialtype2_hdr ndr_serialtype2_hdr_t; 249EXTERNTYPEINFO(ndr_serialtype2_hdr) 250 251/* 252 * Type Serialization Version 2 Private Header. 253 * A private header must precede a top-level NDR constructed type. 254 */ 255_NO_REORDER_ 256struct ndr_serialtype2_priv_hdr { 257 DWORD buflen; /* 00:04 */ 258 DWORD filler[3]; /* 04:12 must be zero */ 259 /* 16: */ 260}; 261typedef struct ndr_serialtype2_priv_hdr ndr_serialtype2_priv_hdr_t; 262EXTERNTYPEINFO(ndr_serialtype2_priv_hdr) 263 264/* 265 * This header comes before the NDR-encoded KERB_VALIDATION_INFO structure, 266 * which can be found in one of the info buffers of the PAC. 267 */ 268_NO_REORDER_ 269struct ndr_pac_hdr { 270 ndr_serialtype1_hdr_t common_hdr; 271 ndr_serialtype1_priv_hdr_t priv_hdr; 272 DWORD ref_pointer; 273}; 274typedef struct ndr_pac_hdr ndr_pac_hdr_t; 275EXTERNTYPEINFO(ndr_pac_hdr) 276 277/* 278 * Supporting types (X/Open CAE Spec 12.6.3.1) 279 */ 280typedef WORD ndr_p_context_id_t; 281 282_NO_REORDER_ 283struct ndr_p_cont_elem { 284 ndr_p_context_id_t p_cont_id; 285 BYTE n_transfer_syn; 286 BYTE _reserved; 287 ndr_p_syntax_id_t abstract_syntax; 288 /*SIZE_IS(n_transfer_syn)*/ 289 ndr_p_syntax_id_t transfer_syntaxes[1]; 290}; 291typedef struct ndr_p_cont_elem ndr_p_cont_elem_t; 292EXTERNTYPEINFO(ndr_p_cont_elem) 293 294_NO_REORDER_ 295struct ndr_p_cont_list { 296 BYTE n_context_elem; 297 BYTE _reserved; 298 WORD _reserved2; 299 /*SIZE_IS(n_context_elem)*/ 300 ndr_p_cont_elem_t p_cont_elem[1]; 301}; 302typedef struct ndr_p_cont_list ndr_p_cont_list_t; 303EXTERNTYPEINFO(ndr_p_cont_list) 304 305typedef WORD ndr_p_cont_def_result_t; 306#define NDR_PCDR_ACCEPTANCE 0 307#define NDR_PCDR_USER_REJECTION 1 308#define NDR_PCDR_PROVIDER_REJECTION 2 309 310/* 311 * Reasons for provider rejection. 312 * X/Open CAE Spec 12.6.3.1 313 */ 314typedef WORD ndr_p_provider_reason_t; 315#define NDR_PPR_REASON_NOT_SPECIFIED 0 316#define NDR_PPR_ABSTRACT_SYNTAX_NOT_SUPPORTED 1 317#define NDR_PPR_PROPOSED_TRANSFER_SYNTAXES_NOT_SUPPORTED 2 318#define NDR_PPR_LOCAL_LIMIT_EXCEEDED 3 319 320_NO_REORDER_ 321struct ndr_p_result { 322 ndr_p_cont_def_result_t result; /* NDR_PCDR_... */ 323 ndr_p_provider_reason_t reason; /* NDR_PPR_... */ 324 ndr_p_syntax_id_t transfer_syntax; /* 0-fill if result!=ACCEPT */ 325}; 326typedef struct ndr_p_result ndr_p_result_t; 327EXTERNTYPEINFO(ndr_p_result) 328 329_NO_REORDER_ 330struct ndr_p_result_list { 331 BYTE n_results; 332 BYTE reserved; 333 WORD reserved2; 334 /*SIZE_IS(n_results)*/ 335 ndr_p_result_t p_results[1]; 336}; 337typedef struct ndr_p_result_list ndr_p_result_list_t; 338EXTERNTYPEINFO(ndr_p_result_list) 339 340#define NDR_PORT_ANY_MAX_PORT_SPEC 30 341_NO_REORDER_ 342struct ndr_port_any { 343 WORD length; /* always 18 */ 344 /*SIZE_IS(length)*/ 345 BYTE port_spec[NDR_PORT_ANY_MAX_PORT_SPEC]; 346 /* \PIPE\ntsvcs */ 347 /* We cheat by using 18, and pad on the right with zeroes */ 348}; 349typedef struct ndr_port_any ndr_port_any_t; 350EXTERNTYPEINFO(ndr_port_any) 351 352/* 353 * Reasons for rejecting an association in the bind_nak PDU. 354 * X/Open CAE Spec 12.6.3.1 355 * MS-RPCE 2.2.2.5 356 */ 357#define NDR_REASON_NOT_SPECIFIED 0 358#define NDR_TEMPORARY_CONGESTION 1 359#define NDR_LOCAL_LIMIT_EXCEEDED 2 360#define NDR_CALLED_PADDR_UNKNOWN 3 361#define NDR_PROTOCOL_VERSION_NOT_SUPPORTED 4 362#define NDR_DEFAULT_CONTEXT_NOT_SUPPORTED 5 363#define NDR_USER_DATA_NOT_READABLE 6 364#define NDR_NO_PSAP_AVAILABLE 7 365#define NDR_AUTH_TYPE_NOT_RECOGNIZED 8 366#define NDR_INVALID_CHECKSUM 9 367 368/* 369 * NDRGEN can't handle variable-length arrays, so we provide our own 370 * marshal/unmarshal routine, so that we can convert to and from 371 * our pointer and a fixed-size array. 372 * 373 * NOTE: MS-RPCE calls this a sec_trailer_t, so we use ndr_sec_t. 374 * auth_value should also be an ANY_SIZE_ARRAY, but NDRGEN can't handle 375 * variable-sized arrays. 376 */ 377IMPORT_EXTERN 378_NO_REORDER_ 379struct auth_verifier_co { 380 /* restore 16 byte alignment */ 381 /* SIZE_IS(auth_pad_len) */ 382 /* BYTE auth_pad[ANY_SIZE_ARRAY] */ /* align(16) */ 383 BYTE auth_type; /* 00:01 */ 384 BYTE auth_level; /* 01:01 */ 385 BYTE auth_pad_len; /* 02:01 */ 386 BYTE auth_rsvd; /* 03:01 */ 387 DWORD auth_context_id; /* 04:04 */ 388 /* SIZE_IS(hdr->auth_length) */ 389 BYTE *auth_value; /* 08:* credentials */ 390}; 391typedef struct auth_verifier_co ndr_sec_t; 392EXTERNTYPEINFO(auth_verifier_co) 393 394#define SEC_TRAILER_SIZE 8 395 396/* 397 * Alter Context PDU (0x0E) 398 * (X/Open CAE Spec 12.6.4.1) 399 */ 400_NO_REORDER_ 401struct ndr_alter_context_hdr { 402 ndr_common_header_t common_hdr; /* 00:16 (see above) */ 403 404 WORD max_xmit_frag; /* 16:02 ignored */ 405 WORD max_recv_frag; /* 18:02 ignored */ 406 DWORD assoc_group_id; /* 20:04 ignored */ 407 408 /* 409 * Presentation context list (see bind hdr comments). 410 */ 411 ndr_p_cont_list_t p_context_elem; /* 24: */ 412 413 /* optional authentication verifier if auth_length != 0 */ 414 /* auth_verifier_co_t auth_verifier; */ 415}; 416typedef struct ndr_alter_context_hdr ndr_alter_context_hdr_t; 417 418 419/* 420 * Alter Context Response PDU (0x0F) 421 * (X/Open CAE Spec 12.6.4.2) 422 * 423 * We can't automatically generate an alter context response header because 424 * the sec_addr is an interior conformant (variable length) array, which is 425 * inconsistent with IDL/NDR rules. We mark this import-extern and provide 426 * a hand-coded marshalling function. 427 */ 428IMPORT_EXTERN 429_NO_REORDER_ 430struct ndr_alter_context_rsp_hdr { 431 ndr_common_header_t common_hdr; /* 00:16 (see above) */ 432 433 WORD max_xmit_frag; /* 16:02 ignored */ 434 WORD max_recv_frag; /* 18:02 ignored */ 435 DWORD assoc_group_id; /* 20:04 ignored */ 436 ndr_port_any_t sec_addr; /* 24:20 ignored */ 437 438 /* 439 * Presentation context list (see bind hdr comments). 440 */ 441 ndr_p_result_list_t p_result_list; /* 44:nn */ 442 443 /* optional authentication verifier if auth_length != 0 */ 444 /* auth_verifier_co_t auth_verifier; */ 445}; 446typedef struct ndr_alter_context_rsp_hdr ndr_alter_context_rsp_hdr_t; 447 448 449/* 450 * Bind PDU (0x0B) 451 * (X/Open CAE Spec 12.6.4.3) 452 */ 453_NO_REORDER_ 454struct ndr_bind_hdr { 455 ndr_common_header_t common_hdr; /* 00:16 (see above) */ 456 457 WORD max_xmit_frag; /* 16:02 max xmit frag size, bytes */ 458 WORD max_recv_frag; /* 18:02 max recv frag size, bytes */ 459 DWORD assoc_group_id; /* 20:04 association group */ 460 /* 24: */ 461 462 /* presentation, a variable**2 list, of presentation contexts */ 463 ndr_p_cont_list_t p_context_elem; 464 465 /* 466 * This could be followed by more transfer_syntaxes[] for the 467 * p_cont_elem[0], and subsequently followed by more p_cont_elem[], 468 * each with one or more transfer_syntaxes[]. A single 469 * p_cont_elem[] with a single transfer_syntaxes[] is so common, 470 * though, we embed it in the bind_hdr but the bind processor must 471 * walk through this tail if there is one. 472 */ 473 474 /* optional authentication verifier iff auth_length != 0 */ 475 /* auth_verifier_co_t auth_verifier; */ 476}; 477typedef struct ndr_bind_hdr ndr_bind_hdr_t; 478 479 480/* 481 * Bind_Ack PDU (0x0C) 482 * (X/Open CAE Spec 12.6.4.4) 483 * 484 * We can't automatically generate a bind ack header because the sec_addr 485 * is an interior conformant (variable length) array, which is inconsistent 486 * with IDL/NDR rules. We mark this import-extern and provide a hand-coded 487 * marshalling function. 488 */ 489IMPORT_EXTERN 490_NO_REORDER_ 491struct ndr_bind_ack_hdr { 492 ndr_common_header_t common_hdr; /* 00:16 (see above) */ 493 494 WORD max_xmit_frag; /* 16:02 max xmit frag size, bytes */ 495 WORD max_recv_frag; /* 18:02 max recv frag size, bytes */ 496 DWORD assoc_group_id; /* 20:04 association group */ 497 ndr_port_any_t sec_addr; /* 24:20 */ 498 499 ndr_p_result_list_t p_result_list; /* 44:nn */ 500 /* This could be followed by more. See bind_hdr above */ 501 502 /* optional authentication verifier iff auth_length != 0 */ 503 /* auth_verifier_co_t auth_verifier; */ 504}; 505typedef struct ndr_bind_ack_hdr ndr_bind_ack_hdr_t; 506 507 508/* 509 * Request PDU (0x00) 510 **************************************************************** 511 * Two flavors, selected based on PFC_OBJECT_UUID in hdr.pfc_flags 512 * one without the "object" (flag clear) 513 * one with the "object" (flag set) 514 * (X/Open CAE Spec 12.6.4.9) 515 */ 516 517_NO_REORDER_ 518struct ndr_request_hdr { 519 ndr_common_header_t common_hdr; /* 00:16 (see above) */ 520 521 /* needed for request, response, or fault */ 522 DWORD alloc_hint; /* 16:04 allocation hint */ 523 ndr_p_context_id_t p_cont_id; /* 20:02 pres context, i.e. data rep */ 524 WORD opnum; /* 22:02 op number w/i interface */ 525 526 /* optional field if PFC_OBJECT_UUID, not present */ 527 /* ndr_uuid_t object; */ 528 529 /* stub-data, 8-octet aligned */ /* 24:nn */ 530 /* nn = frag_len - sizeof(common_header) - auth_len */ 531 532 /* optional authentication verifier iff auth_length != 0 */ 533 /* auth_verifier_co_t auth_verifier; */ 534}; 535typedef struct ndr_request_hdr ndr_request_hdr_t; 536 537_NO_REORDER_ 538struct ndr_request_hdr_with_object { 539 ndr_common_header_t common_hdr; /* 00:16 (see above) */ 540 541 /* needed for request, response, or fault */ 542 DWORD alloc_hint; /* 16:04 allocation hint */ 543 ndr_p_context_id_t p_cont_id; /* 20:02 pres context, i.e. data rep */ 544 WORD opnum; /* 22:02 op number w/i interface */ 545 546 /* optional field if PFC_OBJECT_UUID, is present */ 547 ndr_uuid_t object; /* 24:16 object UUID, unknown purpose*/ 548 549 /* stub-data, 8-octet aligned */ /* 28:nn */ 550 /* nn = frag_len - sizeof(common_header) - auth_len */ 551 /* nn -= sizeof(ndr_uuid_t); */ 552 553 /* optional authentication verifier iff auth_length != 0 */ 554 /* auth_verifier_co_t auth_verifier; */ 555}; 556 557 558/* 559 * Convenient for response header sizing and multi-fragment responses. 560 * We know the header is going to be 24 bytes. 561 */ 562#define NDR_RSP_HDR_SIZE 24 563 564 565/* 566 * Response PDU (0x02) 567 * (X/Open CAE Spec 12.6.4.10) 568 */ 569 570_NO_REORDER_ 571struct ndr_response_hdr { 572 ndr_common_header_t common_hdr; /* 00:16 (see above) */ 573 574 /* needed for request, response, or fault */ 575 DWORD alloc_hint; /* 16:04 allocation hint */ 576 ndr_p_context_id_t p_cont_id; /* 20:02 pres context, i.e. data rep */ 577 578 /* needed for response or fault */ 579 BYTE cancel_count; /* 22:01 cancel count */ 580 BYTE reserved; /* 23:01 mbz */ 581 582 /* stub-data, 8-octet aligned */ /* 24:nn */ 583 /* nn = frag_len - sizeof(common_header) - auth_len */ 584 585 /* optional authentication verifier iff auth_length != 0 */ 586 /* auth_verifier_co_t auth_verifier; */ 587}; 588typedef struct ndr_response_hdr ndr_response_hdr_t; 589 590 591/* 592 * Fault PDU (0x03) 593 * (X/Open CAE Spec 12.6.4.7) 594 */ 595 596_NO_REORDER_ 597struct ndr_fault_hdr { 598 ndr_common_header_t common_hdr; /* 00:16 (see above) */ 599 600 DWORD alloc_hint; /* 16:04 allocation hint */ 601 ndr_p_context_id_t p_cont_id; /* 20:02 pres context, i.e. data rep */ 602 603 /* needed for response or fault */ 604 BYTE cancel_count; /* 22:01 cancel count */ 605 BYTE reserved; /* 23:01 mbz */ 606 607 /* fault code */ 608 DWORD status; /* 24:04 run-time fault code or 0 */ 609 610 /* pad to 8-byte alignment */ 611 BYTE reserved2[4]; /* 28:04 must-be-zero */ 612 613 /* stub-data here if status==0. We do not use this mode. */ 614 615 /* optional authentication verifier iff auth_length != 0 */ 616 /* auth_verifier_co_t auth_verifier; */ 617}; 618typedef struct ndr_fault_hdr ndr_fault_hdr_t; 619 620 621/* Fault status code (X/Open CAE Spec Appendix E) */ 622#define NDR_FAULT_NCA_RPC_VERSION_MISMATCH 0x1c000008 /* CO/CL */ 623#define NDR_FAULT_NCA_UNSPEC_REJECT 0x1c000009 /* CO/CL */ 624#define NDR_FAULT_NCA_S_BAD_ACTID 0x1c00000A /* CL */ 625#define NDR_FAULT_NCA_WHO_ARE_YOU_FAILED 0x1c00000B /* CL */ 626#define NDR_FAULT_NCA_MANAGER_NOT_ENTERED 0x1c00000C /* CO/CL */ 627#define NDR_FAULT_NCA_OP_RNG_ERROR 0x1c010002 /* CO/CL */ 628#define NDR_FAULT_NCA_UNK_IF 0x1c010003 /* CO/CL */ 629#define NDR_FAULT_NCA_WRONG_BOOT_TIME 0x1c010006 /* CL */ 630#define NDR_FAULT_NCA_S_YOU_CRASHED 0x1c010009 /* CL */ 631#define NDR_FAULT_NCA_PROTO_ERROR 0x1c01000B /* CO/CL */ 632#define NDR_FAULT_NCA_OUT_ARGS_TOO_BIG 0x1c010013 /* CO/CL */ 633#define NDR_FAULT_NCA_SERVER_TOO_BUSY 0x1c010014 /* CO/CL */ 634#define NDR_FAULT_NCA_UNSUPPORTED_TYPE 0x1c010017 /* CO/CL */ 635#define NDR_FAULT_NCA_INVALID_PRES_CONTEXT_ID 0x1c00001c /* CO */ 636#define NDR_FAULT_NCA_UNSUPPORTED_AUTHN_LEVEL 0x1c00001d /* CO/CL */ 637#define NDR_FAULT_NCA_INVALID_CHECKSUM 0x1c00001f /* CO/CL */ 638#define NDR_FAULT_NCA_INVALID_CRC 0x1c000020 /* CO/CL */ 639 640 641/* 642 * The Header Union/Switch 643 **************************************************************** 644 */ 645 646#define NDR_PTYPE_COMMON 999 647#define NDR_PTYPE_REQUEST_WITH 998 648#define NDR_PTYPE_SERIALTYPE_V1 997 649#define NDR_PTYPE_SERIALTYPE_V2 996 650#define NDR_PTYPE_PAC 995 651 652INTERFACE(0) 653union ndr_hdr { 654 CASE(NDR_PTYPE_COMMON) /* exceeds BYTE range, obtains common hdr */ 655 struct ndr_common_header common_hdr; 656 657 CASE(NDR_PTYPE_BIND) 658 struct ndr_bind_hdr bind_hdr; 659 660 CASE(NDR_PTYPE_BIND_ACK) 661 struct ndr_bind_ack_hdr bind_ack_hdr; 662 663 CASE(NDR_PTYPE_REQUEST) 664 struct ndr_request_hdr request_hdr; 665 666 CASE(NDR_PTYPE_REQUEST_WITH) /* exceeds BYTE range, ... */ 667 struct ndr_request_hdr_with_object request_hdr_with; 668 669 CASE(NDR_PTYPE_RESPONSE) 670 struct ndr_response_hdr response_hdr; 671 672 CASE(NDR_PTYPE_ALTER_CONTEXT) 673 struct ndr_alter_context_hdr alter_context_hdr; 674 675 CASE(NDR_PTYPE_ALTER_CONTEXT_RESP) 676 struct ndr_alter_context_rsp_hdr alter_context_rsp_hdr; 677 678 CASE(NDR_PTYPE_SERIALTYPE_V1) 679 struct ndr_serialtype1_hdr serialtype1_hdr; 680 681 CASE(NDR_PTYPE_SERIALTYPE_V2) 682 struct ndr_serialtype2_hdr serialtype2_hdr; 683 684 CASE(NDR_PTYPE_PAC) 685 struct ndr_pac_hdr pac_hdr; 686 687 CASE(NDR_PTYPE_FAULT) 688 struct ndr_fault_hdr fault_hdr; 689}; 690typedef union ndr_hdr ndr_hdr_t; 691EXTERNTYPEINFO(ndr_hdr) 692 693#endif /* _RPCPDU_NDL_ */ 694 695