xref: /titanic_52/usr/src/uts/common/smbsrv/ndl/rpcpdu.ndl (revision c586600796766c83eb9485c446886fd9ed2359a9)
1da6c28aaSamw/*
2da6c28aaSamw * CDDL HEADER START
3da6c28aaSamw *
4da6c28aaSamw * The contents of this file are subject to the terms of the
5da6c28aaSamw * Common Development and Distribution License (the "License").
6da6c28aaSamw * You may not use this file except in compliance with the License.
7da6c28aaSamw *
8da6c28aaSamw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9da6c28aaSamw * or http://www.opensolaris.org/os/licensing.
10da6c28aaSamw * See the License for the specific language governing permissions
11da6c28aaSamw * and limitations under the License.
12da6c28aaSamw *
13da6c28aaSamw * When distributing Covered Code, include this CDDL HEADER in each
14da6c28aaSamw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15da6c28aaSamw * If applicable, add the following below this CDDL HEADER, with the
16da6c28aaSamw * fields enclosed by brackets "[]" replaced with your own identifying
17da6c28aaSamw * information: Portions Copyright [yyyy] [name of copyright owner]
18da6c28aaSamw *
19da6c28aaSamw * CDDL HEADER END
20da6c28aaSamw */
21da6c28aaSamw/*
22*c5866007SKeyur Desai * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23da6c28aaSamw */
24da6c28aaSamw
258d7e4166Sjose borrego#ifndef _RPCPDU_NDL_
268d7e4166Sjose borrego#define _RPCPDU_NDL_
27da6c28aaSamw
28da6c28aaSamw#include "ndrtypes.ndl"
29da6c28aaSamw
30da6c28aaSamw/*
31da6c28aaSamw * Normally, constructs are (un)marshalled atoms first, then
32da6c28aaSamw * constructs, then pointers. This can be confusing sometimes
33da6c28aaSamw * when debugging. We know that everything in here can be
34da6c28aaSamw * safely (un)marshalled in member order, so we say so.
35da6c28aaSamw */
36da6c28aaSamw#ifdef NDRGEN
37da6c28aaSamw#define _NO_REORDER_ [_no_reorder]
38da6c28aaSamw#else
39da6c28aaSamw#define _NO_REORDER_
40da6c28aaSamw#endif
41da6c28aaSamw
428d7e4166Sjose borrego#define NDR_TRANSFER_SYNTAX_UUID	"8a885d04-1ceb-11c9-9fe8-08002b104860"
438d7e4166Sjose borrego
44da6c28aaSamw/*
45da6c28aaSamw * UUID (Universal Unique IDentifier)
46da6c28aaSamw */
47da6c28aaSamw/* (X/Open CAE Spec Appendix A) */
48dc20a302Sas200622struct ndr_dce_uuid {
49da6c28aaSamw	DWORD		time_low;
50da6c28aaSamw	WORD		time_mid;
51da6c28aaSamw	WORD		time_hi_and_version;
52da6c28aaSamw	BYTE		clock_seq_hi_and_reserved;
53da6c28aaSamw	BYTE		clock_seq_low;
54da6c28aaSamw	BYTE		node[6];
55da6c28aaSamw};
56da6c28aaSamw
57dc20a302Sas200622struct ndr_uuid {
58da6c28aaSamw	DWORD		data1;
59da6c28aaSamw	WORD		data2;
60da6c28aaSamw	WORD		data3;
61da6c28aaSamw	BYTE		data4[8];
62da6c28aaSamw};
63dc20a302Sas200622typedef struct ndr_uuid ndr_uuid_t;
64da6c28aaSamw
65da6c28aaSamw/*
66da6c28aaSamw * Representation label -- needed for RPC header
67da6c28aaSamw * (X/Open CAE Spec Chapter 14.1)
68da6c28aaSamw *
69da6c28aaSamw * Bits   Data Type   Description
70da6c28aaSamw * ----   ---------   -----------
71da6c28aaSamw * 0-3    charset     0=ASCII
72da6c28aaSamw *                    1=EBCDIC
73da6c28aaSamw * 4-7    byte-order  0=big-endian
74da6c28aaSamw *                    1=little-endian
75da6c28aaSamw * 8-15   float       0=IEEE
76da6c28aaSamw *                    1=VAX
77da6c28aaSamw *                    2=Cray
78da6c28aaSamw *                    3=IBM
79da6c28aaSamw * 16-31  reserved
80da6c28aaSamw */
818d7e4166Sjose borrego#define NDR_REPLAB_CHAR_MASK		0x0F	/* low nibble of intg_char */
828d7e4166Sjose borrego#define NDR_REPLAB_CHAR_ASCII		0x00	/* ASCII */
838d7e4166Sjose borrego#define NDR_REPLAB_CHAR_EBCDIC		0x01	/* EBCDIC (never happen) */
848d7e4166Sjose borrego#define NDR_REPLAB_INTG_MASK		0xF0	/* hi nibble of intg_char */
858d7e4166Sjose borrego#define NDR_REPLAB_INTG_BIG_ENDIAN	0x00	/* big endian */
868d7e4166Sjose borrego#define NDR_REPLAB_INTG_LITTLE_ENDIAN	0x10	/* little endian (x86) */
878d7e4166Sjose borrego#define NDR_REPLAB_FLOAT_IEEE		0x00
888d7e4166Sjose borrego#define NDR_REPLAB_FLOAT_VAX		0x01
898d7e4166Sjose borrego#define NDR_REPLAB_FLOAT_CRAY		0x02
908d7e4166Sjose borrego#define NDR_REPLAB_FLOAT_IBM		0x03
91da6c28aaSamw
928d7e4166Sjose borregostruct ndr_representation_label {
93da6c28aaSamw	BYTE		intg_char_rep;		/* integer and charset */
94da6c28aaSamw	BYTE		float_rep;
95da6c28aaSamw	BYTE		_spare[2];
96da6c28aaSamw};
978d7e4166Sjose borregotypedef struct ndr_representation_label	ndr_replab_t;
98da6c28aaSamw
99da6c28aaSamw
100da6c28aaSamw
101da6c28aaSamw/*
102da6c28aaSamw * RPC PDU (Protocol Data Unit) types
103da6c28aaSamw ****************************************************************
104da6c28aaSamw * (X/Open CAE Spec 12.1)
105da6c28aaSamw */
106da6c28aaSamw
1078d7e4166Sjose borrego#define NDR_PTYPE_REQUEST		0x00	/* CO/CL */
1088d7e4166Sjose borrego#define NDR_PTYPE_PING			0x01	/*    CL */
1098d7e4166Sjose borrego#define NDR_PTYPE_RESPONSE		0x02	/* CO/CL */
1108d7e4166Sjose borrego#define NDR_PTYPE_FAULT			0x03	/* CL/CL */
1118d7e4166Sjose borrego#define NDR_PTYPE_WORKING		0x04	/*    CL */
1128d7e4166Sjose borrego#define NDR_PTYPE_NOCALL		0x05	/*    CL */
1138d7e4166Sjose borrego#define NDR_PTYPE_REJECT		0x06	/*    CL */
1148d7e4166Sjose borrego#define NDR_PTYPE_ACK			0x07	/*    CL */
1158d7e4166Sjose borrego#define NDR_PTYPE_CL_CANCEL		0x08	/*    CL */
1168d7e4166Sjose borrego#define NDR_PTYPE_FACK			0x09	/*    CL */
1178d7e4166Sjose borrego#define NDR_PTYPE_CANCEL_ACK		0x0A	/*    CL */
1188d7e4166Sjose borrego#define NDR_PTYPE_BIND			0x0B	/* CO    */
1198d7e4166Sjose borrego#define NDR_PTYPE_BIND_ACK		0x0C	/* CO    */
1208d7e4166Sjose borrego#define NDR_PTYPE_BIND_NAK		0x0D	/* CO    */
1218d7e4166Sjose borrego#define NDR_PTYPE_ALTER_CONTEXT		0x0E	/* CO    */
1228d7e4166Sjose borrego#define NDR_PTYPE_ALTER_CONTEXT_RESP	0x0F	/* CO    */
123da6c28aaSamw						/* 0x10 missing from DCE/RPC */
1248d7e4166Sjose borrego#define NDR_PTYPE_SHUTDOWN		0x11	/* CO    */
1258d7e4166Sjose borrego#define NDR_PTYPE_CO_CANCEL		0x12	/* CO    */
1268d7e4166Sjose borrego#define NDR_PTYPE_ORPHANED		0x13	/* CO    */
127da6c28aaSamw
128da6c28aaSamw/*
129da6c28aaSamw * Flags in the RPC header for Connection-oriented PDU data types
130da6c28aaSamw * (X/Open CAE Spec 12.6.3.1)
131*c5866007SKeyur Desai *
132*c5866007SKeyur Desai * MS-RPCE 2.2.2.3 PFC_SUPPORT_HEADER_SIGN
133*c5866007SKeyur Desai * For PDU types bind, bind_ack, alter_context and alter_context_resp,
134*c5866007SKeyur Desai * 0x04 means PFC_SUPPORT_HEADER_SIGN.
135*c5866007SKeyur Desai * For other PDU types 0x04 means PFC_PENDING_CANCEL.
136da6c28aaSamw */
1378d7e4166Sjose borrego#define NDR_PFC_FIRST_FRAG		0x01	/* First fragment */
1388d7e4166Sjose borrego#define NDR_PFC_LAST_FRAG		0x02	/* Last framgent */
1398d7e4166Sjose borrego#define NDR_PFC_PENDING_CANCEL		0x04	/* Cancel was pending@sender*/
140*c5866007SKeyur Desai#define NDR_PFC_SUPPORT_HEADER_SIGN	NDR_PFC_PENDING_CANCEL
1418d7e4166Sjose borrego#define NDR_PFC_RESERVED_1		0x08	/* */
1428d7e4166Sjose borrego#define NDR_PFC_CONC_MPX		0x10	/* supports concurrent muxing
143da6c28aaSamw						 * of single connection */
1448d7e4166Sjose borrego#define NDR_PFC_DID_NOT_EXECUTE		0x20	/* for PTYPE_FAULT, guarantee
145da6c28aaSamw						 * call did not execute */
1468d7e4166Sjose borrego#define NDR_PFC_MAYBE			0x40	/* "maybe" semantics req'ed*/
1478d7e4166Sjose borrego#define NDR_PFC_OBJECT_UUID		0x80	/* */
148da6c28aaSamw
149*c5866007SKeyur Desai/*
150*c5866007SKeyur Desai * Security Providers
151*c5866007SKeyur Desai * MS-RPCE 2.2.1.1.6
152*c5866007SKeyur Desai */
153*c5866007SKeyur Desai#define	NDR_C_AUTHN_NONE			0x00	/* No authentication */
154*c5866007SKeyur Desai#define	NDR_C_AUTHN_GSS_NEGOTIATE		0x09	/* SPNEGO */
155*c5866007SKeyur Desai#define	NDR_C_AUTHN_WINNT			0x0A	/* NTLM */
156*c5866007SKeyur Desai#define	NDR_C_AUTHN_GSS_KERBEROS		0x10	/* Kerberos */
157*c5866007SKeyur Desai#define	NDR_C_AUTHN_GSS_NETLOGON		0x44	/* Netlogon */
158*c5866007SKeyur Desai#define	NDR_C_AUTHN_GSS_DEFAULT			0xFF	/* Default is NTLM */
159*c5866007SKeyur Desai
160*c5866007SKeyur Desai/*
161*c5866007SKeyur Desai * Encoding protection levels
162*c5866007SKeyur Desai * X/Open CAE Spec 13.1.2.1
163*c5866007SKeyur Desai * MS-RPCE 2.2.1.1.7
164*c5866007SKeyur Desai */
165*c5866007SKeyur Desai#define	NDR_C_AUTHN_LEVEL_DEFAULT		0x00	/* Same as Connect */
166*c5866007SKeyur Desai#define	NDR_C_AUTHN_LEVEL_NONE			0x01
167*c5866007SKeyur Desai#define	NDR_C_AUTHN_LEVEL_CONNECT		0x02
168*c5866007SKeyur Desai#define	NDR_C_AUTHN_LEVEL_CALL			0x03
169*c5866007SKeyur Desai#define	NDR_C_AUTHN_LEVEL_PKT			0x04
170*c5866007SKeyur Desai#define	NDR_C_AUTHN_LEVEL_PKT_INTEGRITY		0x05
171*c5866007SKeyur Desai#define	NDR_C_AUTHN_LEVEL_PKT_PRIVACY		0x06
172da6c28aaSamw
173da6c28aaSamw/*
174da6c28aaSamw * Header common to all Connection-oriented RPC PDUs
175da6c28aaSamw * (X/Open CAE Spec 12.6.3.1)
176da6c28aaSamw */
177da6c28aaSamw_NO_REORDER_
178*c5866007SKeyur Desaistruct ndr_p_syntax_id {
179*c5866007SKeyur Desai	ndr_uuid_t	if_uuid;
180*c5866007SKeyur Desai	DWORD		if_version;
181*c5866007SKeyur Desai};
182*c5866007SKeyur Desaitypedef struct ndr_p_syntax_id	ndr_p_syntax_id_t;
183*c5866007SKeyur Desai
184*c5866007SKeyur Desai_NO_REORDER_
1852c1b14e5Sjose borregostruct ndr_common_header {
186da6c28aaSamw	BYTE		rpc_vers;	/* 00:01 5 */
187da6c28aaSamw	BYTE		rpc_vers_minor;	/* 01:01 0 */
1888d7e4166Sjose borrego	BYTE		ptype;		/* 02:01 NDR_PTYPE_... */
1898d7e4166Sjose borrego	BYTE		pfc_flags;	/* 03:01 NDR_PFC_... */
1908d7e4166Sjose borrego	struct ndr_representation_label
191da6c28aaSamw			packed_drep;	/* 04:04 NDR representation label */
192da6c28aaSamw	WORD		frag_length;	/* 08:02 total length of frag */
193da6c28aaSamw	WORD		auth_length;	/* 10:02 length of auth_value */
194da6c28aaSamw	DWORD		call_id;	/* 12:04 call identifier */
195da6c28aaSamw					/* 16: */
196da6c28aaSamw};
1972c1b14e5Sjose borregotypedef struct ndr_common_header	ndr_common_header_t;
1982c1b14e5Sjose borregoEXTERNTYPEINFO(ndr_common_header)
199da6c28aaSamw
200*c5866007SKeyur Desai/*
201*c5866007SKeyur Desai * MS-RPCE 2.2.6 Type Serialization Version 1 extensions to IDL/+ pickle
202*c5866007SKeyur Desai * One header per serialization stream: the header must be little endian.
203*c5866007SKeyur Desai * The filler must be set to 0xcccccccc during marshaling and ignored
204*c5866007SKeyur Desai * during unmarshaling.
205*c5866007SKeyur Desai */
206*c5866007SKeyur Desai_NO_REORDER_
207*c5866007SKeyur Desaistruct ndr_serialtype1_hdr {
208*c5866007SKeyur Desai	BYTE		version;	/* 00:01 1 */
209*c5866007SKeyur Desai	BYTE		endianness;	/* 01:01 0=big, 1=little */
210*c5866007SKeyur Desai	WORD		hdrlen;		/* 02:02 8 */
211*c5866007SKeyur Desai	DWORD		filler;		/* 04:04 0xcccccccc */
212*c5866007SKeyur Desai					/* 8: */
213*c5866007SKeyur Desai};
214*c5866007SKeyur Desaitypedef struct ndr_serialtype1_hdr  ndr_serialtype1_hdr_t;
215*c5866007SKeyur DesaiEXTERNTYPEINFO(ndr_serialtype1_hdr)
216da6c28aaSamw
217da6c28aaSamw/*
218*c5866007SKeyur Desai * Type Serialization Version 1 Private Header.
219*c5866007SKeyur Desai * A private header must precede a top-level NDR constructed type.
220*c5866007SKeyur Desai */
221*c5866007SKeyur Desai_NO_REORDER_
222*c5866007SKeyur Desaistruct ndr_serialtype1_priv_hdr {
223*c5866007SKeyur Desai	DWORD		buflen;		/* 00:04 */
224*c5866007SKeyur Desai	DWORD		filler;		/* 04:04 must be zero */
225*c5866007SKeyur Desai					/* 8: */
226*c5866007SKeyur Desai};
227*c5866007SKeyur Desaitypedef struct ndr_serialtype1_priv_hdr	ndr_serialtype1_priv_hdr_t;
228*c5866007SKeyur DesaiEXTERNTYPEINFO(ndr_serialtype1_priv_hdr)
229*c5866007SKeyur Desai
230*c5866007SKeyur Desai/*
231*c5866007SKeyur Desai * MS-RPCE 2.2.7 Type Serialization Version 2 extensions Version 1 (2.2.6).
232*c5866007SKeyur Desai * The header must be little endian.
233*c5866007SKeyur Desai * The endianinfo and reserved fields must be set to 0xcccccccc during
234*c5866007SKeyur Desai * marshaling and ignored during unmarshaling.
235*c5866007SKeyur Desai */
236*c5866007SKeyur Desai_NO_REORDER_
237*c5866007SKeyur Desaistruct ndr_serialtype2_hdr {
238*c5866007SKeyur Desai	BYTE		version;	/* 00:01 1 */
239*c5866007SKeyur Desai	BYTE		endianness;	/* 01:01 0=big, 1=little */
240*c5866007SKeyur Desai	WORD		hdrlen;		/* 02:02 8 */
241*c5866007SKeyur Desai	DWORD		endianinfo;	/* 04:04 0xcccccccc */
242*c5866007SKeyur Desai	DWORD		reserved[4];	/* 08:16 0xcccccccc */
243*c5866007SKeyur Desai	ndr_p_syntax_id_t	transfer_syntax;	/* 24:20 */
244*c5866007SKeyur Desai	ndr_p_syntax_id_t	interface_id;		/* 44:20 */
245*c5866007SKeyur Desai					/* 64: */
246*c5866007SKeyur Desai};
247*c5866007SKeyur Desaitypedef struct ndr_serialtype2_hdr  ndr_serialtype2_hdr_t;
248*c5866007SKeyur DesaiEXTERNTYPEINFO(ndr_serialtype2_hdr)
249*c5866007SKeyur Desai
250*c5866007SKeyur Desai/*
251*c5866007SKeyur Desai * Type Serialization Version 2 Private Header.
252*c5866007SKeyur Desai * A private header must precede a top-level NDR constructed type.
253*c5866007SKeyur Desai */
254*c5866007SKeyur Desai_NO_REORDER_
255*c5866007SKeyur Desaistruct ndr_serialtype2_priv_hdr {
256*c5866007SKeyur Desai	DWORD		buflen;		/* 00:04 */
257*c5866007SKeyur Desai	DWORD		filler[3];	/* 04:12 must be zero */
258*c5866007SKeyur Desai					/* 16: */
259*c5866007SKeyur Desai};
260*c5866007SKeyur Desaitypedef struct ndr_serialtype2_priv_hdr	ndr_serialtype2_priv_hdr_t;
261*c5866007SKeyur DesaiEXTERNTYPEINFO(ndr_serialtype2_priv_hdr)
262*c5866007SKeyur Desai
263*c5866007SKeyur Desai/*
264*c5866007SKeyur Desai * This header comes before the NDR-encoded KERB_VALIDATION_INFO structure,
265*c5866007SKeyur Desai * which can be found in one of the info buffers of the PAC.
266*c5866007SKeyur Desai */
267*c5866007SKeyur Desai_NO_REORDER_
268*c5866007SKeyur Desaistruct ndr_pac_hdr {
269*c5866007SKeyur Desai	ndr_serialtype1_hdr_t		common_hdr;
270*c5866007SKeyur Desai	ndr_serialtype1_priv_hdr_t	priv_hdr;
271*c5866007SKeyur Desai	DWORD				ref_pointer;
272*c5866007SKeyur Desai};
273*c5866007SKeyur Desaitypedef struct ndr_pac_hdr	ndr_pac_hdr_t;
274*c5866007SKeyur DesaiEXTERNTYPEINFO(ndr_pac_hdr)
275*c5866007SKeyur Desai
276*c5866007SKeyur Desai/*
277*c5866007SKeyur Desai * Supporting types (X/Open CAE Spec 12.6.3.1)
278da6c28aaSamw */
2798d7e4166Sjose borregotypedef WORD	ndr_p_context_id_t;
280da6c28aaSamw
281da6c28aaSamw_NO_REORDER_
2828d7e4166Sjose borregostruct ndr_p_cont_elem {
2838d7e4166Sjose borrego	ndr_p_context_id_t	p_cont_id;
284da6c28aaSamw	BYTE			n_transfer_syn;
285da6c28aaSamw	BYTE			_reserved;
2868d7e4166Sjose borrego	ndr_p_syntax_id_t	abstract_syntax;
287da6c28aaSamw    /*SIZE_IS(n_transfer_syn)*/
2888d7e4166Sjose borrego	ndr_p_syntax_id_t	transfer_syntaxes[1];
289da6c28aaSamw};
2908d7e4166Sjose borregotypedef struct ndr_p_cont_elem	ndr_p_cont_elem_t;
2918d7e4166Sjose borregoEXTERNTYPEINFO(ndr_p_cont_elem)
292da6c28aaSamw
293da6c28aaSamw_NO_REORDER_
2948d7e4166Sjose borregostruct ndr_p_cont_list {
295da6c28aaSamw	BYTE		n_context_elem;
296da6c28aaSamw	BYTE		_reserved;
297da6c28aaSamw	WORD		_reserved2;
298da6c28aaSamw    /*SIZE_IS(n_context_elem)*/
2998d7e4166Sjose borrego	ndr_p_cont_elem_t p_cont_elem[1];
300da6c28aaSamw};
3018d7e4166Sjose borregotypedef struct ndr_p_cont_list	ndr_p_cont_list_t;
3028d7e4166Sjose borregoEXTERNTYPEINFO(ndr_p_cont_list)
303da6c28aaSamw
3048d7e4166Sjose borregotypedef WORD	ndr_p_cont_def_result_t;
3058d7e4166Sjose borrego#define NDR_PCDR_ACCEPTANCE					0
3068d7e4166Sjose borrego#define NDR_PCDR_USER_REJECTION					1
3078d7e4166Sjose borrego#define NDR_PCDR_PROVIDER_REJECTION				2
308da6c28aaSamw
309*c5866007SKeyur Desai/*
310*c5866007SKeyur Desai * Reasons for provider rejection.
311*c5866007SKeyur Desai * X/Open CAE Spec 12.6.3.1
312*c5866007SKeyur Desai */
3138d7e4166Sjose borregotypedef WORD	ndr_p_provider_reason_t;
3148d7e4166Sjose borrego#define	NDR_PPR_REASON_NOT_SPECIFIED				0
3158d7e4166Sjose borrego#define	NDR_PPR_ABSTRACT_SYNTAX_NOT_SUPPORTED			1
3168d7e4166Sjose borrego#define	NDR_PPR_PROPOSED_TRANSFER_SYNTAXES_NOT_SUPPORTED	2
3178d7e4166Sjose borrego#define	NDR_PPR_LOCAL_LIMIT_EXCEEDED				3
318da6c28aaSamw
319da6c28aaSamw_NO_REORDER_
3208d7e4166Sjose borregostruct ndr_p_result {
3218d7e4166Sjose borrego	ndr_p_cont_def_result_t	result;		/* NDR_PCDR_... */
3228d7e4166Sjose borrego	ndr_p_provider_reason_t	reason;		/* NDR_PPR_... */
323*c5866007SKeyur Desai	ndr_p_syntax_id_t	transfer_syntax; /* 0-fill if result!=ACCEPT */
324da6c28aaSamw};
3258d7e4166Sjose borregotypedef struct ndr_p_result		ndr_p_result_t;
3268d7e4166Sjose borregoEXTERNTYPEINFO(ndr_p_result)
327da6c28aaSamw
328da6c28aaSamw_NO_REORDER_
3298d7e4166Sjose borregostruct ndr_p_result_list {
330da6c28aaSamw	BYTE		n_results;
331da6c28aaSamw	BYTE		reserved;
332da6c28aaSamw	WORD		reserved2;
333da6c28aaSamw    /*SIZE_IS(n_results)*/
3348d7e4166Sjose borrego	ndr_p_result_t p_results[1];
335da6c28aaSamw};
3368d7e4166Sjose borregotypedef struct ndr_p_result_list	ndr_p_result_list_t;
3378d7e4166Sjose borregoEXTERNTYPEINFO(ndr_p_result_list)
338da6c28aaSamw
3398d7e4166Sjose borrego#define NDR_PORT_ANY_MAX_PORT_SPEC	30
340da6c28aaSamw_NO_REORDER_
3418d7e4166Sjose borregostruct ndr_port_any {
342da6c28aaSamw	WORD		length;		/* always 18 */
343da6c28aaSamw    /*SIZE_IS(length)*/
3448d7e4166Sjose borrego	BYTE		port_spec[NDR_PORT_ANY_MAX_PORT_SPEC];
345da6c28aaSamw					/* \PIPE\ntsvcs */
346da6c28aaSamw	/* We cheat by using 18, and pad on the right with zeroes */
347da6c28aaSamw};
3488d7e4166Sjose borregotypedef struct ndr_port_any		ndr_port_any_t;
3498d7e4166Sjose borregoEXTERNTYPEINFO(ndr_port_any)
350da6c28aaSamw
351*c5866007SKeyur Desai/*
352*c5866007SKeyur Desai * Reasons for rejecting an association in the bind_nak PDU.
353*c5866007SKeyur Desai * X/Open CAE Spec 12.6.3.1
354*c5866007SKeyur Desai * MS-RPCE 2.2.2.5
355*c5866007SKeyur Desai */
356*c5866007SKeyur Desai#define	NDR_REASON_NOT_SPECIFIED				0
357*c5866007SKeyur Desai#define NDR_TEMPORARY_CONGESTION				1
358*c5866007SKeyur Desai#define NDR_LOCAL_LIMIT_EXCEEDED				2
359*c5866007SKeyur Desai#define NDR_CALLED_PADDR_UNKNOWN				3
360*c5866007SKeyur Desai#define NDR_PROTOCOL_VERSION_NOT_SUPPORTED			4
361*c5866007SKeyur Desai#define NDR_DEFAULT_CONTEXT_NOT_SUPPORTED			5
362*c5866007SKeyur Desai#define NDR_USER_DATA_NOT_READABLE				6
363*c5866007SKeyur Desai#define NDR_NO_PSAP_AVAILABLE					7
364*c5866007SKeyur Desai#define NDR_AUTH_TYPE_NOT_RECOGNIZED				8
365*c5866007SKeyur Desai#define NDR_INAVLID_CHECKSUM					9
366da6c28aaSamw
367da6c28aaSamw/*
368da6c28aaSamw * Alter Context PDU (0x0E)
369da6c28aaSamw * (X/Open CAE Spec 12.6.4.1)
370da6c28aaSamw */
371da6c28aaSamw_NO_REORDER_
3722c1b14e5Sjose borregostruct ndr_alter_context_hdr {
3732c1b14e5Sjose borrego	ndr_common_header_t common_hdr; /* 00:16 (see above) */
374da6c28aaSamw
375da6c28aaSamw	WORD max_xmit_frag;		/* 16:02 ignored */
376da6c28aaSamw	WORD max_recv_frag;		/* 18:02 ignored */
377da6c28aaSamw	DWORD assoc_group_id;		/* 20:04 ignored */
378da6c28aaSamw
379da6c28aaSamw	/*
380da6c28aaSamw	 * Presentation context list (see bind hdr comments).
381da6c28aaSamw	 */
3828d7e4166Sjose borrego	ndr_p_cont_list_t p_context_elem;	/* 24: */
383da6c28aaSamw
384da6c28aaSamw	/* optional authentication verifier if auth_length != 0 */
385da6c28aaSamw	/* auth_verifier_co_t auth_verifier; */
386da6c28aaSamw};
3872c1b14e5Sjose borregotypedef struct ndr_alter_context_hdr ndr_alter_context_hdr_t;
388da6c28aaSamw
389da6c28aaSamw
390da6c28aaSamw/*
391da6c28aaSamw * Alter Context Response PDU (0x0F)
392da6c28aaSamw * (X/Open CAE Spec 12.6.4.2)
3932c1b14e5Sjose borrego *
3942c1b14e5Sjose borrego * We can't automatically generate an alter context response header because
3952c1b14e5Sjose borrego * the sec_addr is an interior conformant (variable length) array, which is
3962c1b14e5Sjose borrego * inconsistent with IDL/NDR rules.  We mark this import-extern and provide
3972c1b14e5Sjose borrego * a hand-coded marshalling function.
398da6c28aaSamw */
3992c1b14e5Sjose borregoIMPORT_EXTERN
400da6c28aaSamw_NO_REORDER_
4012c1b14e5Sjose borregostruct ndr_alter_context_rsp_hdr {
4022c1b14e5Sjose borrego	ndr_common_header_t common_hdr; /* 00:16 (see above) */
403da6c28aaSamw
404da6c28aaSamw	WORD max_xmit_frag;		/* 16:02 ignored */
405da6c28aaSamw	WORD max_recv_frag;		/* 18:02 ignored */
406da6c28aaSamw	DWORD assoc_group_id;		/* 20:04 ignored */
4078d7e4166Sjose borrego	ndr_port_any_t sec_addr;	/* 24:20 ignored */
408da6c28aaSamw
409da6c28aaSamw	/*
410da6c28aaSamw	 * Presentation context list (see bind hdr comments).
411da6c28aaSamw	 */
4128d7e4166Sjose borrego	ndr_p_result_list_t p_result_list; /* 44:nn */
413da6c28aaSamw
414da6c28aaSamw	/* optional authentication verifier if auth_length != 0 */
415da6c28aaSamw	/* auth_verifier_co_t auth_verifier; */
416da6c28aaSamw};
4172c1b14e5Sjose borregotypedef struct ndr_alter_context_rsp_hdr ndr_alter_context_rsp_hdr_t;
418da6c28aaSamw
419da6c28aaSamw
420da6c28aaSamw/*
421da6c28aaSamw * Bind PDU (0x0B)
422da6c28aaSamw * (X/Open CAE Spec 12.6.4.3)
423da6c28aaSamw */
424da6c28aaSamw_NO_REORDER_
4252c1b14e5Sjose borregostruct ndr_bind_hdr {
4262c1b14e5Sjose borrego	ndr_common_header_t	common_hdr; /* 00:16 (see above) */
427da6c28aaSamw
428da6c28aaSamw	WORD		max_xmit_frag;	/* 16:02 max xmit frag size, bytes */
429da6c28aaSamw	WORD		max_recv_frag;	/* 18:02 max recv frag size, bytes */
4302c1b14e5Sjose borrego	DWORD		assoc_group_id;	/* 20:04 association group */
431da6c28aaSamw					/* 24: */
432da6c28aaSamw
433da6c28aaSamw	/* presentation, a variable**2 list, of presentation contexts */
4348d7e4166Sjose borrego	ndr_p_cont_list_t p_context_elem;
4352c1b14e5Sjose borrego
436da6c28aaSamw	/*
4372c1b14e5Sjose borrego	 * This could be followed by more transfer_syntaxes[] for the
4382c1b14e5Sjose borrego	 * p_cont_elem[0], and subsequently followed by more p_cont_elem[],
4392c1b14e5Sjose borrego	 * each with one or more transfer_syntaxes[].  A single
4402c1b14e5Sjose borrego	 * p_cont_elem[] with a single transfer_syntaxes[] is so common,
4412c1b14e5Sjose borrego	 * though, we embed it in the bind_hdr but the bind processor must
4422c1b14e5Sjose borrego	 * walk through this tail if there is one.
443da6c28aaSamw	 */
444da6c28aaSamw
445da6c28aaSamw	/* optional authentication verifier iff auth_length != 0 */
446da6c28aaSamw	/* auth_verifier_co_t	auth_verifier; */
447da6c28aaSamw};
4482c1b14e5Sjose borregotypedef struct ndr_bind_hdr	ndr_bind_hdr_t;
449da6c28aaSamw
450da6c28aaSamw
451da6c28aaSamw/*
452da6c28aaSamw * Bind_Ack PDU (0x0C)
453da6c28aaSamw * (X/Open CAE Spec 12.6.4.4)
4542c1b14e5Sjose borrego *
4552c1b14e5Sjose borrego * We can't automatically generate a bind ack header because the sec_addr
4562c1b14e5Sjose borrego * is an interior conformant (variable length) array, which is inconsistent
4572c1b14e5Sjose borrego * with IDL/NDR rules.  We mark this import-extern and provide a hand-coded
4582c1b14e5Sjose borrego * marshalling function.
459da6c28aaSamw */
4602c1b14e5Sjose borregoIMPORT_EXTERN
461da6c28aaSamw_NO_REORDER_
4622c1b14e5Sjose borregostruct ndr_bind_ack_hdr {
4632c1b14e5Sjose borrego	ndr_common_header_t	common_hdr; /* 00:16 (see above) */
464da6c28aaSamw
465da6c28aaSamw	WORD		max_xmit_frag;	/* 16:02 max xmit frag size, bytes */
466da6c28aaSamw	WORD		max_recv_frag;	/* 18:02 max recv frag size, bytes */
4672c1b14e5Sjose borrego	DWORD		assoc_group_id;	/* 20:04 association group */
4688d7e4166Sjose borrego	ndr_port_any_t	sec_addr;	/* 24:20 */
469da6c28aaSamw
4708d7e4166Sjose borrego	ndr_p_result_list_t p_result_list; /* 44:nn */
471da6c28aaSamw	/* This could be followed by more. See bind_hdr above */
472da6c28aaSamw
473da6c28aaSamw	/* optional authentication verifier iff auth_length != 0 */
474da6c28aaSamw	/* auth_verifier_co_t	auth_verifier; */
475da6c28aaSamw};
4762c1b14e5Sjose borregotypedef struct ndr_bind_ack_hdr	ndr_bind_ack_hdr_t;
477da6c28aaSamw
478da6c28aaSamw
479da6c28aaSamw/*
480da6c28aaSamw * Request PDU (0x00)
481da6c28aaSamw ****************************************************************
4828d7e4166Sjose borrego * Two flavors, selected based on PFC_OBJECT_UUID in hdr.pfc_flags
483da6c28aaSamw *	one without the "object" (flag clear)
484da6c28aaSamw *	one with the "object" (flag set)
485da6c28aaSamw * (X/Open CAE Spec 12.6.4.9)
486da6c28aaSamw */
487da6c28aaSamw
488da6c28aaSamw_NO_REORDER_
4892c1b14e5Sjose borregostruct ndr_request_hdr {
4902c1b14e5Sjose borrego	ndr_common_header_t	common_hdr; /* 00:16 (see above) */
491da6c28aaSamw
492da6c28aaSamw	/* needed for request, response, or fault */
493da6c28aaSamw	DWORD		alloc_hint;	/* 16:04 allocation hint */
4948d7e4166Sjose borrego	ndr_p_context_id_t p_cont_id;	/* 20:02 pres context, i.e. data rep */
495da6c28aaSamw	WORD		opnum;		/* 22:02 op number w/i interface */
496da6c28aaSamw
497da6c28aaSamw	/* optional field if PFC_OBJECT_UUID, not present */
498dc20a302Sas200622	/* ndr_uuid_t	object; */
499da6c28aaSamw
500da6c28aaSamw	/* stub-data, 8-octet aligned */ /* 24:nn */
501da6c28aaSamw	/* nn = frag_len - sizeof(common_header) - auth_len */
502da6c28aaSamw
503da6c28aaSamw	/* optional authentication verifier iff auth_length != 0 */
504da6c28aaSamw	/* auth_verifier_co_t	auth_verifier; */
505da6c28aaSamw};
5062c1b14e5Sjose borregotypedef struct ndr_request_hdr	ndr_request_hdr_t;
507da6c28aaSamw
508da6c28aaSamw_NO_REORDER_
5092c1b14e5Sjose borregostruct ndr_request_hdr_with_object {
5102c1b14e5Sjose borrego	ndr_common_header_t	common_hdr; /* 00:16 (see above) */
511da6c28aaSamw
512da6c28aaSamw	/* needed for request, response, or fault */
513da6c28aaSamw	DWORD		alloc_hint;	/* 16:04 allocation hint */
5148d7e4166Sjose borrego	ndr_p_context_id_t p_cont_id;	/* 20:02 pres context, i.e. data rep */
515da6c28aaSamw	WORD		opnum;		/* 22:02 op number w/i interface */
516da6c28aaSamw
517da6c28aaSamw	/* optional field if PFC_OBJECT_UUID, is present */
518dc20a302Sas200622	ndr_uuid_t	object;		/* 24:16 object UUID, unknown purpose*/
519da6c28aaSamw
520da6c28aaSamw	/* stub-data, 8-octet aligned */ /* 28:nn */
521da6c28aaSamw	/* nn = frag_len - sizeof(common_header) - auth_len */
522dc20a302Sas200622	/* nn -= sizeof(ndr_uuid_t); */
523da6c28aaSamw
524da6c28aaSamw	/* optional authentication verifier iff auth_length != 0 */
525da6c28aaSamw	/* auth_verifier_co_t	auth_verifier; */
526da6c28aaSamw};
527da6c28aaSamw
528da6c28aaSamw
529da6c28aaSamw/*
5308d7e4166Sjose borrego * Convenient for response header sizing and multi-fragment responses.
531da6c28aaSamw * We know the header is going to be 24 bytes.
532da6c28aaSamw */
5338d7e4166Sjose borrego#define NDR_RSP_HDR_SIZE			24
534da6c28aaSamw
535da6c28aaSamw
536da6c28aaSamw/*
537da6c28aaSamw * Response PDU (0x02)
538da6c28aaSamw * (X/Open CAE Spec 12.6.4.10)
539da6c28aaSamw */
540da6c28aaSamw
541da6c28aaSamw_NO_REORDER_
5422c1b14e5Sjose borregostruct ndr_response_hdr {
5432c1b14e5Sjose borrego	ndr_common_header_t	common_hdr; /* 00:16 (see above) */
544da6c28aaSamw
545da6c28aaSamw	/* needed for request, response, or fault */
546da6c28aaSamw	DWORD		alloc_hint;	/* 16:04 allocation hint */
5478d7e4166Sjose borrego	ndr_p_context_id_t p_cont_id;	/* 20:02 pres context, i.e. data rep */
548da6c28aaSamw
549da6c28aaSamw	/* needed for response or fault */
550da6c28aaSamw	BYTE		cancel_count;	/* 22:01 cancel count */
551da6c28aaSamw	BYTE		reserved;	/* 23:01 mbz */
552da6c28aaSamw
553da6c28aaSamw	/* stub-data, 8-octet aligned */ /* 24:nn */
554da6c28aaSamw	/* nn = frag_len - sizeof(common_header) - auth_len */
555da6c28aaSamw
556da6c28aaSamw	/* optional authentication verifier iff auth_length != 0 */
557da6c28aaSamw	/* auth_verifier_co_t	auth_verifier; */
558da6c28aaSamw};
5592c1b14e5Sjose borregotypedef struct ndr_response_hdr	ndr_response_hdr_t;
560da6c28aaSamw
561da6c28aaSamw
562da6c28aaSamw/*
563da6c28aaSamw * Fault PDU (0x03)
564da6c28aaSamw * (X/Open CAE Spec 12.6.4.7)
565da6c28aaSamw */
566da6c28aaSamw
567da6c28aaSamw_NO_REORDER_
5682c1b14e5Sjose borregostruct ndr_fault_hdr {
5692c1b14e5Sjose borrego	ndr_common_header_t	common_hdr; /* 00:16 (see above) */
570da6c28aaSamw
571da6c28aaSamw	DWORD		alloc_hint;	/* 16:04 allocation hint */
5728d7e4166Sjose borrego	ndr_p_context_id_t p_cont_id;	/* 20:02 pres context, i.e. data rep */
573da6c28aaSamw
574da6c28aaSamw	/* needed for response or fault */
575da6c28aaSamw	BYTE		cancel_count;	/* 22:01 cancel count */
576da6c28aaSamw	BYTE		reserved;	/* 23:01 mbz */
577da6c28aaSamw
578da6c28aaSamw	/* fault code */
579da6c28aaSamw	DWORD		status;		/* 24:04 run-time fault code or 0 */
580da6c28aaSamw
581da6c28aaSamw	/* pad to 8-byte alignment */
582da6c28aaSamw	BYTE		reserved2[4];	/* 28:04 must-be-zero */
583da6c28aaSamw
584da6c28aaSamw	/* stub-data here if status==0. We do not use this mode. */
585da6c28aaSamw
586da6c28aaSamw	/* optional authentication verifier iff auth_length != 0 */
587da6c28aaSamw	/* auth_verifier_co_t	auth_verifier; */
588da6c28aaSamw};
5892c1b14e5Sjose borregotypedef struct ndr_fault_hdr	ndr_fault_hdr_t;
590da6c28aaSamw
591da6c28aaSamw
592da6c28aaSamw/* Fault status code (X/Open CAE Spec Appendix E) */
5938d7e4166Sjose borrego#define NDR_FAULT_NCA_RPC_VERSION_MISMATCH	0x1c000008	/* CO/CL */
5948d7e4166Sjose borrego#define NDR_FAULT_NCA_UNSPEC_REJECT		0x1c000009	/* CO/CL */
5958d7e4166Sjose borrego#define NDR_FAULT_NCA_S_BAD_ACTID		0x1c00000A	/*    CL */
5968d7e4166Sjose borrego#define NDR_FAULT_NCA_WHO_ARE_YOU_FAILED	0x1c00000B	/*    CL */
5978d7e4166Sjose borrego#define NDR_FAULT_NCA_MANAGER_NOT_ENTERED	0x1c00000C	/* CO/CL */
5988d7e4166Sjose borrego#define NDR_FAULT_NCA_OP_RNG_ERROR		0x1c010002	/* CO/CL */
5998d7e4166Sjose borrego#define NDR_FAULT_NCA_UNK_IF			0x1c010003	/* CO/CL */
6008d7e4166Sjose borrego#define NDR_FAULT_NCA_WRONG_BOOT_TIME		0x1c010006	/*    CL */
6018d7e4166Sjose borrego#define NDR_FAULT_NCA_S_YOU_CRASHED		0x1c010009	/*    CL */
6028d7e4166Sjose borrego#define NDR_FAULT_NCA_PROTO_ERROR		0x1c01000B	/* CO/CL */
6038d7e4166Sjose borrego#define NDR_FAULT_NCA_OUT_ARGS_TOO_BIG		0x1c010013	/* CO/CL */
6048d7e4166Sjose borrego#define NDR_FAULT_NCA_SERVER_TOO_BUSY		0x1c010014	/* CO/CL */
6058d7e4166Sjose borrego#define NDR_FAULT_NCA_UNSUPPORTED_TYPE		0x1c010017	/* CO/CL */
6068d7e4166Sjose borrego#define NDR_FAULT_NCA_INVALID_PRES_CONTEXT_ID	0x1c00001c	/* CO    */
6078d7e4166Sjose borrego#define NDR_FAULT_NCA_UNSUPPORTED_AUTHN_LEVEL	0x1c00001d	/* CO/CL */
6088d7e4166Sjose borrego#define NDR_FAULT_NCA_INVALID_CHECKSUM		0x1c00001f	/* CO/CL */
6098d7e4166Sjose borrego#define NDR_FAULT_NCA_INVALID_CRC		0x1c000020	/* CO/CL */
610da6c28aaSamw
611da6c28aaSamw
612da6c28aaSamw/*
613da6c28aaSamw * The Header Union/Switch
614da6c28aaSamw ****************************************************************
615da6c28aaSamw */
616da6c28aaSamw
6178d7e4166Sjose borrego#define NDR_PTYPE_COMMON		999
6188d7e4166Sjose borrego#define NDR_PTYPE_REQUEST_WITH		998
619*c5866007SKeyur Desai#define	NDR_PTYPE_SERIALTYPE_V1		997
620*c5866007SKeyur Desai#define	NDR_PTYPE_SERIALTYPE_V2		996
621*c5866007SKeyur Desai#define	NDR_PTYPE_PAC			995
622da6c28aaSamw
623da6c28aaSamwINTERFACE(0)
6242c1b14e5Sjose borregounion ndr_hdr {
6258d7e4166Sjose borrego    CASE(NDR_PTYPE_COMMON)	/* exceeds BYTE range, obtains common hdr */
6262c1b14e5Sjose borrego	struct ndr_common_header		common_hdr;
627da6c28aaSamw
6288d7e4166Sjose borrego    CASE(NDR_PTYPE_BIND)
6292c1b14e5Sjose borrego	struct ndr_bind_hdr			bind_hdr;
630da6c28aaSamw
6318d7e4166Sjose borrego    CASE(NDR_PTYPE_BIND_ACK)
6322c1b14e5Sjose borrego	struct ndr_bind_ack_hdr			bind_ack_hdr;
633da6c28aaSamw
6348d7e4166Sjose borrego    CASE(NDR_PTYPE_REQUEST)
6352c1b14e5Sjose borrego	struct ndr_request_hdr			request_hdr;
636da6c28aaSamw
6378d7e4166Sjose borrego    CASE(NDR_PTYPE_REQUEST_WITH)	/* exceeds BYTE range, ... */
6382c1b14e5Sjose borrego	struct ndr_request_hdr_with_object	request_hdr_with;
639da6c28aaSamw
6408d7e4166Sjose borrego    CASE(NDR_PTYPE_RESPONSE)
6412c1b14e5Sjose borrego	struct ndr_response_hdr			response_hdr;
642da6c28aaSamw
6438d7e4166Sjose borrego    CASE(NDR_PTYPE_ALTER_CONTEXT)
6442c1b14e5Sjose borrego	struct ndr_alter_context_hdr		alter_context_hdr;
645da6c28aaSamw
6468d7e4166Sjose borrego    CASE(NDR_PTYPE_ALTER_CONTEXT_RESP)
6472c1b14e5Sjose borrego	struct ndr_alter_context_rsp_hdr	alter_context_rsp_hdr;
648da6c28aaSamw
649*c5866007SKeyur Desai    CASE(NDR_PTYPE_SERIALTYPE_V1)
650*c5866007SKeyur Desai	struct ndr_serialtype1_hdr		serialtype1_hdr;
651*c5866007SKeyur Desai
652*c5866007SKeyur Desai    CASE(NDR_PTYPE_SERIALTYPE_V2)
653*c5866007SKeyur Desai	struct ndr_serialtype2_hdr		serialtype2_hdr;
654*c5866007SKeyur Desai
655*c5866007SKeyur Desai    CASE(NDR_PTYPE_PAC)
656*c5866007SKeyur Desai	struct ndr_pac_hdr			pac_hdr;
657*c5866007SKeyur Desai
6588d7e4166Sjose borrego    CASE(NDR_PTYPE_FAULT)
6592c1b14e5Sjose borrego	struct ndr_fault_hdr			fault_hdr;
660da6c28aaSamw};
6612c1b14e5Sjose borregotypedef union ndr_hdr	ndr_hdr_t;
6622c1b14e5Sjose borregoEXTERNTYPEINFO(ndr_hdr)
663da6c28aaSamw
6648d7e4166Sjose borrego#endif /* _RPCPDU_NDL_ */
665da6c28aaSamw
666