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 2013 Nexenta Systems, 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) */
  49 struct 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 
  58 struct ndr_uuid {
  59         DWORD           data1;
  60         WORD            data2;
  61         WORD            data3;
  62         BYTE            data4[8];
  63 };
  64 typedef 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 
  93 struct ndr_representation_label {
  94         BYTE            intg_char_rep;          /* integer and charset */
  95         BYTE            float_rep;
  96         BYTE            _spare[2];
  97 };
  98 typedef 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_
 179 struct ndr_p_syntax_id {
 180         ndr_uuid_t      if_uuid;
 181         DWORD           if_version;
 182 };
 183 typedef struct ndr_p_syntax_id  ndr_p_syntax_id_t;
 184 
 185 _NO_REORDER_
 186 struct 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 };
 198 typedef struct ndr_common_header        ndr_common_header_t;
 199 EXTERNTYPEINFO(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_
 208 struct 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 };
 215 typedef struct ndr_serialtype1_hdr  ndr_serialtype1_hdr_t;
 216 EXTERNTYPEINFO(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_
 223 struct ndr_serialtype1_priv_hdr {
 224         DWORD           buflen;         /* 00:04 */
 225         DWORD           filler;         /* 04:04 must be zero */
 226                                         /* 8: */
 227 };
 228 typedef struct ndr_serialtype1_priv_hdr ndr_serialtype1_priv_hdr_t;
 229 EXTERNTYPEINFO(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_
 238 struct 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 };
 248 typedef struct ndr_serialtype2_hdr  ndr_serialtype2_hdr_t;
 249 EXTERNTYPEINFO(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_
 256 struct ndr_serialtype2_priv_hdr {
 257         DWORD           buflen;         /* 00:04 */
 258         DWORD           filler[3];      /* 04:12 must be zero */
 259                                         /* 16: */
 260 };
 261 typedef struct ndr_serialtype2_priv_hdr ndr_serialtype2_priv_hdr_t;
 262 EXTERNTYPEINFO(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_
 269 struct ndr_pac_hdr {
 270         ndr_serialtype1_hdr_t           common_hdr;
 271         ndr_serialtype1_priv_hdr_t      priv_hdr;
 272         DWORD                           ref_pointer;
 273 };
 274 typedef struct ndr_pac_hdr      ndr_pac_hdr_t;
 275 EXTERNTYPEINFO(ndr_pac_hdr)
 276 
 277 /*
 278  * Supporting types (X/Open CAE Spec 12.6.3.1)
 279  */
 280 typedef WORD    ndr_p_context_id_t;
 281 
 282 _NO_REORDER_
 283 struct 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 };
 291 typedef struct ndr_p_cont_elem  ndr_p_cont_elem_t;
 292 EXTERNTYPEINFO(ndr_p_cont_elem)
 293 
 294 _NO_REORDER_
 295 struct 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 };
 302 typedef struct ndr_p_cont_list  ndr_p_cont_list_t;
 303 EXTERNTYPEINFO(ndr_p_cont_list)
 304 
 305 typedef 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  */
 314 typedef 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_
 321 struct 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 };
 326 typedef struct ndr_p_result             ndr_p_result_t;
 327 EXTERNTYPEINFO(ndr_p_result)
 328 
 329 _NO_REORDER_
 330 struct 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 };
 337 typedef struct ndr_p_result_list        ndr_p_result_list_t;
 338 EXTERNTYPEINFO(ndr_p_result_list)
 339 
 340 #define NDR_PORT_ANY_MAX_PORT_SPEC      30
 341 _NO_REORDER_
 342 struct 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 };
 349 typedef struct ndr_port_any             ndr_port_any_t;
 350 EXTERNTYPEINFO(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_INAVLID_CHECKSUM                                    9
 367 
 368 /*
 369  * Alter Context PDU (0x0E)
 370  * (X/Open CAE Spec 12.6.4.1)
 371  */
 372 _NO_REORDER_
 373 struct ndr_alter_context_hdr {
 374         ndr_common_header_t common_hdr; /* 00:16 (see above) */
 375 
 376         WORD max_xmit_frag;             /* 16:02 ignored */
 377         WORD max_recv_frag;             /* 18:02 ignored */
 378         DWORD assoc_group_id;           /* 20:04 ignored */
 379 
 380         /* 
 381          * Presentation context list (see bind hdr comments).
 382          */
 383         ndr_p_cont_list_t p_context_elem;       /* 24: */
 384 
 385         /* optional authentication verifier if auth_length != 0 */
 386         /* auth_verifier_co_t auth_verifier; */
 387 };
 388 typedef struct ndr_alter_context_hdr ndr_alter_context_hdr_t;
 389 
 390 
 391 /*
 392  * Alter Context Response PDU (0x0F)
 393  * (X/Open CAE Spec 12.6.4.2)
 394  *
 395  * We can't automatically generate an alter context response header because
 396  * the sec_addr is an interior conformant (variable length) array, which is
 397  * inconsistent with IDL/NDR rules.  We mark this import-extern and provide
 398  * a hand-coded marshalling function.
 399  */
 400 IMPORT_EXTERN
 401 _NO_REORDER_
 402 struct ndr_alter_context_rsp_hdr {
 403         ndr_common_header_t common_hdr; /* 00:16 (see above) */
 404 
 405         WORD max_xmit_frag;             /* 16:02 ignored */
 406         WORD max_recv_frag;             /* 18:02 ignored */
 407         DWORD assoc_group_id;           /* 20:04 ignored */
 408         ndr_port_any_t sec_addr;        /* 24:20 ignored */
 409 
 410         /* 
 411          * Presentation context list (see bind hdr comments).
 412          */
 413         ndr_p_result_list_t p_result_list; /* 44:nn */
 414 
 415         /* optional authentication verifier if auth_length != 0 */
 416         /* auth_verifier_co_t auth_verifier; */
 417 };
 418 typedef struct ndr_alter_context_rsp_hdr ndr_alter_context_rsp_hdr_t;
 419 
 420 
 421 /*
 422  * Bind PDU (0x0B)
 423  * (X/Open CAE Spec 12.6.4.3)
 424  */
 425 _NO_REORDER_
 426 struct ndr_bind_hdr {
 427         ndr_common_header_t     common_hdr; /* 00:16 (see above) */
 428 
 429         WORD            max_xmit_frag;  /* 16:02 max xmit frag size, bytes */
 430         WORD            max_recv_frag;  /* 18:02 max recv frag size, bytes */
 431         DWORD           assoc_group_id; /* 20:04 association group */
 432                                         /* 24: */
 433 
 434         /* presentation, a variable**2 list, of presentation contexts */
 435         ndr_p_cont_list_t p_context_elem;
 436 
 437         /*
 438          * This could be followed by more transfer_syntaxes[] for the
 439          * p_cont_elem[0], and subsequently followed by more p_cont_elem[],
 440          * each with one or more transfer_syntaxes[].  A single
 441          * p_cont_elem[] with a single transfer_syntaxes[] is so common,
 442          * though, we embed it in the bind_hdr but the bind processor must
 443          * walk through this tail if there is one.
 444          */
 445 
 446         /* optional authentication verifier iff auth_length != 0 */
 447         /* auth_verifier_co_t   auth_verifier; */
 448 };
 449 typedef struct ndr_bind_hdr     ndr_bind_hdr_t;
 450 
 451 
 452 /*
 453  * Bind_Ack PDU (0x0C)
 454  * (X/Open CAE Spec 12.6.4.4)
 455  *
 456  * We can't automatically generate a bind ack header because the sec_addr
 457  * is an interior conformant (variable length) array, which is inconsistent
 458  * with IDL/NDR rules.  We mark this import-extern and provide a hand-coded
 459  * marshalling function.
 460  */
 461 IMPORT_EXTERN
 462 _NO_REORDER_
 463 struct ndr_bind_ack_hdr {
 464         ndr_common_header_t     common_hdr; /* 00:16 (see above) */
 465 
 466         WORD            max_xmit_frag;  /* 16:02 max xmit frag size, bytes */
 467         WORD            max_recv_frag;  /* 18:02 max recv frag size, bytes */
 468         DWORD           assoc_group_id; /* 20:04 association group */
 469         ndr_port_any_t  sec_addr;       /* 24:20 */
 470 
 471         ndr_p_result_list_t p_result_list; /* 44:nn */
 472         /* This could be followed by more. See bind_hdr above */
 473 
 474         /* optional authentication verifier iff auth_length != 0 */
 475         /* auth_verifier_co_t   auth_verifier; */
 476 };
 477 typedef struct ndr_bind_ack_hdr ndr_bind_ack_hdr_t;
 478 
 479 
 480 /*
 481  * Request PDU (0x00)
 482  ****************************************************************
 483  * Two flavors, selected based on PFC_OBJECT_UUID in hdr.pfc_flags
 484  *      one without the "object" (flag clear)
 485  *      one with the "object" (flag set)
 486  * (X/Open CAE Spec 12.6.4.9)
 487  */
 488 
 489 _NO_REORDER_
 490 struct ndr_request_hdr {
 491         ndr_common_header_t     common_hdr; /* 00:16 (see above) */
 492 
 493         /* needed for request, response, or fault */
 494         DWORD           alloc_hint;     /* 16:04 allocation hint */
 495         ndr_p_context_id_t p_cont_id;   /* 20:02 pres context, i.e. data rep */
 496         WORD            opnum;          /* 22:02 op number w/i interface */
 497 
 498         /* optional field if PFC_OBJECT_UUID, not present */
 499         /* ndr_uuid_t   object; */
 500 
 501         /* stub-data, 8-octet aligned */ /* 24:nn */
 502         /* nn = frag_len - sizeof(common_header) - auth_len */
 503 
 504         /* optional authentication verifier iff auth_length != 0 */
 505         /* auth_verifier_co_t   auth_verifier; */
 506 };
 507 typedef struct ndr_request_hdr  ndr_request_hdr_t;
 508 
 509 _NO_REORDER_
 510 struct ndr_request_hdr_with_object {
 511         ndr_common_header_t     common_hdr; /* 00:16 (see above) */
 512 
 513         /* needed for request, response, or fault */
 514         DWORD           alloc_hint;     /* 16:04 allocation hint */
 515         ndr_p_context_id_t p_cont_id;   /* 20:02 pres context, i.e. data rep */
 516         WORD            opnum;          /* 22:02 op number w/i interface */
 517 
 518         /* optional field if PFC_OBJECT_UUID, is present */
 519         ndr_uuid_t      object;         /* 24:16 object UUID, unknown purpose*/
 520 
 521         /* stub-data, 8-octet aligned */ /* 28:nn */
 522         /* nn = frag_len - sizeof(common_header) - auth_len */
 523         /* nn -= sizeof(ndr_uuid_t); */
 524 
 525         /* optional authentication verifier iff auth_length != 0 */
 526         /* auth_verifier_co_t   auth_verifier; */
 527 };
 528 
 529 
 530 /*
 531  * Convenient for response header sizing and multi-fragment responses.
 532  * We know the header is going to be 24 bytes.
 533  */
 534 #define NDR_RSP_HDR_SIZE                        24
 535 
 536 
 537 /*
 538  * Response PDU (0x02)
 539  * (X/Open CAE Spec 12.6.4.10)
 540  */
 541 
 542 _NO_REORDER_
 543 struct ndr_response_hdr {
 544         ndr_common_header_t     common_hdr; /* 00:16 (see above) */
 545 
 546         /* needed for request, response, or fault */
 547         DWORD           alloc_hint;     /* 16:04 allocation hint */
 548         ndr_p_context_id_t p_cont_id;   /* 20:02 pres context, i.e. data rep */
 549 
 550         /* needed for response or fault */
 551         BYTE            cancel_count;   /* 22:01 cancel count */
 552         BYTE            reserved;       /* 23:01 mbz */
 553 
 554         /* stub-data, 8-octet aligned */ /* 24:nn */
 555         /* nn = frag_len - sizeof(common_header) - auth_len */
 556 
 557         /* optional authentication verifier iff auth_length != 0 */
 558         /* auth_verifier_co_t   auth_verifier; */
 559 };
 560 typedef struct ndr_response_hdr ndr_response_hdr_t;
 561 
 562 
 563 /*
 564  * Fault PDU (0x03)
 565  * (X/Open CAE Spec 12.6.4.7)
 566  */
 567 
 568 _NO_REORDER_
 569 struct ndr_fault_hdr {
 570         ndr_common_header_t     common_hdr; /* 00:16 (see above) */
 571 
 572         DWORD           alloc_hint;     /* 16:04 allocation hint */
 573         ndr_p_context_id_t p_cont_id;   /* 20:02 pres context, i.e. data rep */
 574 
 575         /* needed for response or fault */
 576         BYTE            cancel_count;   /* 22:01 cancel count */
 577         BYTE            reserved;       /* 23:01 mbz */
 578 
 579         /* fault code */
 580         DWORD           status;         /* 24:04 run-time fault code or 0 */
 581 
 582         /* pad to 8-byte alignment */
 583         BYTE            reserved2[4];   /* 28:04 must-be-zero */
 584 
 585         /* stub-data here if status==0. We do not use this mode. */
 586 
 587         /* optional authentication verifier iff auth_length != 0 */
 588         /* auth_verifier_co_t   auth_verifier; */
 589 };
 590 typedef struct ndr_fault_hdr    ndr_fault_hdr_t;
 591 
 592 
 593 /* Fault status code (X/Open CAE Spec Appendix E) */
 594 #define NDR_FAULT_NCA_RPC_VERSION_MISMATCH      0x1c000008      /* CO/CL */
 595 #define NDR_FAULT_NCA_UNSPEC_REJECT             0x1c000009      /* CO/CL */
 596 #define NDR_FAULT_NCA_S_BAD_ACTID               0x1c00000A      /*    CL */
 597 #define NDR_FAULT_NCA_WHO_ARE_YOU_FAILED        0x1c00000B      /*    CL */
 598 #define NDR_FAULT_NCA_MANAGER_NOT_ENTERED       0x1c00000C      /* CO/CL */
 599 #define NDR_FAULT_NCA_OP_RNG_ERROR              0x1c010002      /* CO/CL */
 600 #define NDR_FAULT_NCA_UNK_IF                    0x1c010003      /* CO/CL */
 601 #define NDR_FAULT_NCA_WRONG_BOOT_TIME           0x1c010006      /*    CL */
 602 #define NDR_FAULT_NCA_S_YOU_CRASHED             0x1c010009      /*    CL */
 603 #define NDR_FAULT_NCA_PROTO_ERROR               0x1c01000B      /* CO/CL */
 604 #define NDR_FAULT_NCA_OUT_ARGS_TOO_BIG          0x1c010013      /* CO/CL */
 605 #define NDR_FAULT_NCA_SERVER_TOO_BUSY           0x1c010014      /* CO/CL */
 606 #define NDR_FAULT_NCA_UNSUPPORTED_TYPE          0x1c010017      /* CO/CL */
 607 #define NDR_FAULT_NCA_INVALID_PRES_CONTEXT_ID   0x1c00001c      /* CO    */
 608 #define NDR_FAULT_NCA_UNSUPPORTED_AUTHN_LEVEL   0x1c00001d      /* CO/CL */
 609 #define NDR_FAULT_NCA_INVALID_CHECKSUM          0x1c00001f      /* CO/CL */
 610 #define NDR_FAULT_NCA_INVALID_CRC               0x1c000020      /* CO/CL */
 611 
 612 
 613 /*
 614  * The Header Union/Switch
 615  ****************************************************************
 616  */
 617 
 618 #define NDR_PTYPE_COMMON                999
 619 #define NDR_PTYPE_REQUEST_WITH          998
 620 #define NDR_PTYPE_SERIALTYPE_V1         997
 621 #define NDR_PTYPE_SERIALTYPE_V2         996
 622 #define NDR_PTYPE_PAC                   995
 623 
 624 INTERFACE(0)
 625 union ndr_hdr {
 626     CASE(NDR_PTYPE_COMMON)      /* exceeds BYTE range, obtains common hdr */
 627         struct ndr_common_header                common_hdr;
 628 
 629     CASE(NDR_PTYPE_BIND)
 630         struct ndr_bind_hdr                     bind_hdr;
 631 
 632     CASE(NDR_PTYPE_BIND_ACK)
 633         struct ndr_bind_ack_hdr                 bind_ack_hdr;
 634 
 635     CASE(NDR_PTYPE_REQUEST)
 636         struct ndr_request_hdr                  request_hdr;
 637 
 638     CASE(NDR_PTYPE_REQUEST_WITH)        /* exceeds BYTE range, ... */
 639         struct ndr_request_hdr_with_object      request_hdr_with;
 640 
 641     CASE(NDR_PTYPE_RESPONSE)
 642         struct ndr_response_hdr                 response_hdr;
 643 
 644     CASE(NDR_PTYPE_ALTER_CONTEXT)
 645         struct ndr_alter_context_hdr            alter_context_hdr;
 646 
 647     CASE(NDR_PTYPE_ALTER_CONTEXT_RESP)
 648         struct ndr_alter_context_rsp_hdr        alter_context_rsp_hdr;
 649 
 650     CASE(NDR_PTYPE_SERIALTYPE_V1)
 651         struct ndr_serialtype1_hdr              serialtype1_hdr;
 652 
 653     CASE(NDR_PTYPE_SERIALTYPE_V2)
 654         struct ndr_serialtype2_hdr              serialtype2_hdr;
 655 
 656     CASE(NDR_PTYPE_PAC)
 657         struct ndr_pac_hdr                      pac_hdr;
 658 
 659     CASE(NDR_PTYPE_FAULT)
 660         struct ndr_fault_hdr                    fault_hdr;
 661 };
 662 typedef union ndr_hdr   ndr_hdr_t;
 663 EXTERNTYPEINFO(ndr_hdr)
 664 
 665 #endif /* _RPCPDU_NDL_ */
 666