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