xref: /titanic_44/usr/src/uts/common/smbsrv/ndr.h (revision 5b3e1433c6213363bcb6387e66fc84ee9ff21a5d)
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 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SMBSRV_NDR_H
27 #define	_SMBSRV_NDR_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Network Data Representation (NDR) is a compatible subset of DCE RPC
33  * and MSRPC NDR.  NDR is used to move parameters consisting of
34  * complicated trees of data constructs between an RPC client and server.
35  *
36  * CAE Specification (1997)
37  * DCE 1.1: Remote Procedure Call
38  * Document Number: C706
39  * The Open Group
40  * ogspecs@opengroup.org
41  */
42 
43 #ifndef _KERNEL
44 #include <syslog.h>
45 #include <stdlib.h>
46 #include <string.h>
47 #include <smbsrv/smb_i18n.h>
48 #endif
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /*
55  * Normal sequence:
56  *	- Application calls client-side stub w/ TOP-MOST arg structure
57  *	- client stub performs NDR_M_OP_MARSHALL+NDR_DIR_IN
58  *	- PDU conveyed (request, aka call, aka query)
59  *	- server stub performs NDR_M_OP_UNMARSHALL+NDR_DIR_IN
60  *	- server function called w/ TOP-MOST arg structure
61  *	- server function returns w/ TOP-MOST arg structure modified
62  *	- server stub performs NDR_M_OP_MARSHALL+NDR_DIR_OUT
63  *	- PDU conveyed (reply, aka result, aka response)
64  *	- client stub performs NDR_M_OP_UNMARSHALL+NDR_DIR_OUT
65  *	- return to Application w/ TOP-MOST arg structure modified
66  *
67  * An interface is a sequence of top-most constructs.  Each top-most
68  * construct corresponds to one parameter, either argument or return
69  * value.
70  *
71  * A top-most construct is a sequence of outer constructs.  The first
72  * outer construct is the referent of the argument, and the subsequent
73  * outer constructs are descendents referenced by pointers from prior
74  * constructs.
75  *
76  * An outer construct is a sequence of variable-sized info, fixed-sized
77  * data, and variable-sized data.
78  */
79 
80 /*
81  * Terminology
82  *
83  * The ALL UPPER CASE terms recur in the DCE/RPC documentation.
84  * The mixed-case names have been introduced as a reading aid.
85  *
86  * Size		The size of an array in elements. Think of this
87  *		as the amount to malloc().
88  *
89  * Length	The number of elements of an array which are significant
90  *		Think of this as the amount to bcopy().
91  *
92  * Known	Size/length is known at build time.
93  *
94  * Determined	Size/length is determined at run time.
95  *
96  * FIXED	The Size and Length are Known.
97  *		Think of this as a string constant or a DOS 8.3 file name.
98  *		char array[] = "A Constant Size/Length";
99  *
100  * CONFORMANT	The Size is Determined. Length is the same as Size.
101  *		Think of this as strdup().
102  *		char *array = strdup("Something");
103  *
104  * VARYING	The Size is Known. The Length is determined.
105  *		Think of this as a strcpy() of a variable length string
106  *		into a fixed length buffer:
107  *		char array[100];
108  *		strcpy(array, "very short string");
109  *
110  * VARYING/CONFORMANT
111  *		The Size is Determined. The Length is separately Determined.
112  *		Think of this like:
113  *		char *array = malloc(size);
114  *		strcpy(array, "short string");
115  *
116  * STRING	Strings can be CONFORMANT, VARYING, or CONFORMANT/VARYING.
117  *		A string is fundamentally an array with the last
118  *		significant element some sort of NULL.
119  */
120 
121 #define	NDR_F_NONE		0x0000	/* no flags */
122 #define	NDR_F_PARAMS_MASK	0x00FF
123 #define	NDR_F_SIZE_IS		0x0001	/* [size_is(X)] required/given */
124 #define	NDR_F_LENGTH_IS		0x0002	/* not implemented */
125 #define	NDR_F_SWITCH_IS		0x0004	/* [switch_is(X)] req./given */
126 #define	NDR_F_IS_STRING		0x0008	/* [string] req./given */
127 #define	NDR_F_IS_POINTER	0x0010	/* TYPE * ... req./given */
128 #define	NDR_F_IS_REFERENCE	0x0020	/* TYPE & ... req./given */
129 #define	NDR_F_DIMENSION_IS	0x0040	/* TYPE [N] req./given */
130 
131 #define	NDR_F_WHENCE_MASK	0x00F0
132 #define	NDR_F_BACKPTR		0x0010	/* ref cause by pointer */
133 #define	NDR_F_OUTER		0x0020	/* ref caused by outer */
134 #define	NDR_F_TOPMOST		0x0040	/* ref caused by topmost */
135 
136 #define	NDR_F_TYPEOP_MASK	0x0F00
137 #define	NDR_F_ARRAY		0x0100	/* type is array of somethings */
138 #define	NDR_F_POINTER		0x0200	/* type is pointer to something(s) */
139 #define	NDR_F_STRING		0x0300	/* type is string of somethings */
140 #define	NDR_F_UNION		0x0400	/* type is a union */
141 #define	NDR_F_STRUCT		0x0500	/* type is a structure */
142 #define	NDR_F_OPERATION		0x0600	/* type is a structure, special */
143 #define	NDR_F_INTERFACE		0x0700	/* type is a union, special */
144 #define	NDR_F_CONFORMANT	0x1000	/* struct conforming (var-size tail) */
145 #define	NDR_F_VARYING		0x2000	/* not implemented */
146 
147 struct mlrpc_heap;
148 struct mlndr_stream;
149 struct ndr_reference;
150 struct ndr_typeinfo;
151 
152 struct ndr_typeinfo {
153 	unsigned char		version;	/* sanity check */
154 	unsigned char		alignment;	/* mask */
155 	unsigned short		type_flags;	/* NDR_F_... */
156 	int			(*ndr_func)(struct ndr_reference *encl_ref);
157 	unsigned short		pdu_size_fixed_part;
158 	unsigned short		pdu_size_variable_part;
159 	unsigned short		c_size_fixed_part;
160 	unsigned short		c_size_variable_part;
161 };
162 
163 struct ndr_reference {
164 	struct ndr_reference	*next;		/* queue list (outer only) */
165 	struct ndr_reference	*enclosing;	/* e.g. struct for this memb */
166 	struct mlndr_stream	*stream;	/* root of NDR */
167 	struct ndr_typeinfo	*ti;		/* type of data referenced */
168 	char			*name;		/* name of this member */
169 	unsigned long		pdu_offset;	/* referent in stub data */
170 	char			*datum;		/* referent in local memory */
171 	char			**backptr;	/* referer to set */
172 	unsigned short		outer_flags;	/* XXX_is() from top level */
173 	unsigned short		inner_flags;	/* XXX_is() in encapsulated */
174 	unsigned short		type_flags;	/* "requires" */
175 	unsigned short		packed_alignment;
176 	unsigned long		size_is;	/* conforming constructs */
177 	unsigned long		strlen_is;	/* strings */
178 	unsigned long		switch_is;	/* union arg selector */
179 	unsigned long		dimension_is;	/* fixed-len array size */
180 	unsigned long		pdu_end_offset;	/* offset for limit of PDU */
181 };
182 
183 /*
184  * For all operations, the mlndr_stream, which is the root of NDR processing,
185  * is the primary object.  When available, the appropriate ndr_reference
186  * is passed, NULL otherwise.  Functions that return 'int' should return
187  * TRUE (!0) or FALSE (0).  When functions return FALSE, including
188  * mlndo_malloc() returning NULL, they should set the stream->error to an
189  * appropriate indicator of what went wrong.
190  *
191  * Functions mlndo_get_pdu(), mlndo_put_pdu(), and mlndo_pad_pdu() must
192  * never grow the PDU data.  A request for out-of-bounds data is an error.
193  * The swap_bytes flag is 1 if NDR knows that the byte-order in the PDU
194  * is different from the local system.  mlndo_pad_pdu() advised that the
195  * affected bytes should be zero filled.
196  */
197 struct mlndr_stream_ops {
198 	char *(*mlndo_malloc)(struct mlndr_stream *, unsigned,
199 	    struct ndr_reference *);
200 
201 	int (*mlndo_free)(struct mlndr_stream *, char *,
202 	    struct ndr_reference *);
203 
204 	int (*mlndo_grow_pdu)(struct mlndr_stream *, unsigned long,
205 	    struct ndr_reference *);
206 
207 	int (*mlndo_pad_pdu)(struct mlndr_stream *, unsigned long,
208 	    unsigned long, struct ndr_reference *);
209 
210 	int (*mlndo_get_pdu)(struct mlndr_stream *, unsigned long,
211 	    unsigned long, char *, int, struct ndr_reference *);
212 
213 	int (*mlndo_put_pdu)(struct mlndr_stream *, unsigned long,
214 	    unsigned long, char *, int, struct ndr_reference *);
215 
216 	void (*mlndo_tattle)(struct mlndr_stream *, char *,
217 	    struct ndr_reference *);
218 
219 	void (*mlndo_tattle_error)(struct mlndr_stream *,
220 	    struct ndr_reference *);
221 
222 	int (*mlndo_reset)(struct mlndr_stream *);
223 	void (*mlndo_destruct)(struct mlndr_stream *);
224 };
225 
226 #define	MLNDS_MALLOC(MLNDS, LEN, REF) \
227 	(*(MLNDS)->mlndo->mlndo_malloc)(MLNDS, LEN, REF)
228 
229 #define	MLNDS_GROW_PDU(MLNDS, WANT_END_OFF, REF) \
230 	(*(MLNDS)->mlndo->mlndo_grow_pdu)(MLNDS, WANT_END_OFF, REF)
231 #define	MLNDS_PAD_PDU(MLNDS, PDU_OFFSET, N_BYTES, REF) \
232 	(*(MLNDS)->mlndo->mlndo_pad_pdu)(MLNDS, PDU_OFFSET, N_BYTES, REF)
233 #define	MLNDS_GET_PDU(MLNDS, PDU_OFFSET, N_BYTES, BUF, SWAP, REF) \
234 	(*(MLNDS)->mlndo->mlndo_get_pdu)(MLNDS, PDU_OFFSET, N_BYTES, BUF, \
235 	SWAP, REF)
236 #define	MLNDS_PUT_PDU(MLNDS, PDU_OFFSET, N_BYTES, BUF, SWAP, REF) \
237 	(*(MLNDS)->mlndo->mlndo_put_pdu)(MLNDS, PDU_OFFSET, N_BYTES, BUF, \
238 	SWAP, REF)
239 
240 #define	MLNDS_TATTLE(MLNDS, WHAT, REF) \
241 	(*(MLNDS)->mlndo->mlndo_tattle)(MLNDS, WHAT, REF)
242 #define	MLNDS_TATTLE_ERROR(MLNDS, WHAT, REF) \
243 	(*(MLNDS)->mlndo->mlndo_tattle_error)(MLNDS, REF)
244 #define	MLNDS_RESET(MLNDS) \
245 	(*(MLNDS)->mlndo->mlndo_reset)(MLNDS)
246 #define	MLNDS_DESTRUCT(MLNDS) \
247 	(*(MLNDS)->mlndo->mlndo_destruct)(MLNDS)
248 
249 struct mlndr_stream {
250 	unsigned long		pdu_size;
251 	unsigned long		pdu_size_with_rpc_hdrs;
252 	unsigned long		pdu_max_size;
253 	unsigned long		pdu_base_offset;
254 	unsigned long		pdu_scan_offset;
255 	unsigned char		*pdu_base_addr;
256 	unsigned char		*pdu_base_addr_with_rpc_hdrs;
257 
258 	struct mlndr_stream_ops *mlndo;
259 
260 	unsigned char		m_op;
261 	unsigned char		dir;
262 	unsigned char		swap;		/* native/net endian swap */
263 	unsigned char		flags;
264 	short			error;
265 	short			error_ref;
266 
267 	struct ndr_reference *outer_queue_head;
268 	struct ndr_reference **outer_queue_tailp;
269 	struct ndr_reference *outer_current;
270 	struct mlrpc_heap *heap;
271 };
272 
273 
274 #define	NDR_M_OP_NONE		0x00
275 #define	NDR_M_OP_MARSHALL	0x01	/* data moving from datum to PDU */
276 #define	NDR_M_OP_UNMARSHALL	0x02	/* data moving from PDU to datum */
277 
278 #define	NDR_DIR_NONE		0x00
279 #define	NDR_DIR_IN		0x10	/* data moving from caller to callee */
280 #define	NDR_DIR_OUT		0x20	/* data moving from callee to caller */
281 
282 #define	NDR_MODE_CALL_SEND	(NDR_M_OP_MARSHALL + NDR_DIR_IN)
283 #define	NDR_MODE_CALL_RECV	(NDR_M_OP_UNMARSHALL + NDR_DIR_IN)
284 #define	NDR_MODE_RETURN_SEND	(NDR_M_OP_MARSHALL + NDR_DIR_OUT)
285 #define	NDR_MODE_RETURN_RECV	(NDR_M_OP_UNMARSHALL + NDR_DIR_OUT)
286 
287 #define	NDR_MODE_TO_M_OP(MODE)	((MODE)&0x0F)
288 #define	NDR_MODE_TO_DIR(MODE)	((MODE)&0xF0)
289 #define	NDR_M_OP_AND_DIR_TO_MODE(M_OP, DIR)	((M_OP)|(DIR))
290 
291 #define	NDR_MODE_MATCH(MLNDS, MODE) \
292 	(NDR_M_OP_AND_DIR_TO_MODE((MLNDS)->m_op, (MLNDS)->dir) == (MODE))
293 
294 #define	MLNDS_F_NONE		0x00
295 #define	MLNDS_F_NOTERM		0x01	/* strings are not null terminated */
296 #define	MLNDS_SETF(S, F)	((S)->flags |= (F))
297 #define	MLNDS_CLEARF(S, F)	((S)->flags &= ~(F))
298 
299 #define	NDR_ERR_MALLOC_FAILED		-1
300 #define	NDR_ERR_M_OP_INVALID		-2
301 #define	NDR_ERR_UNDERFLOW		-3
302 #define	NDR_ERR_GROW_FAILED		-4	/* overflow */
303 #define	NDR_ERR_PAD_FAILED		-5	/* couldn't possibly happen */
304 #define	NDR_ERR_OUTER_HEADER_BAD	-6
305 #define	NDR_ERR_SWITCH_VALUE_ILLEGAL	-7
306 #define	NDR_ERR_SWITCH_VALUE_INVALID	-8
307 #define	NDR_ERR_SWITCH_VALUE_MISSING	-9
308 #define	NDR_ERR_SIZE_IS_MISMATCH_PDU	-10
309 #define	NDR_ERR_SIZE_IS_MISMATCH_AFTER	-11
310 #define	NDR_ERR_SIZE_IS_UNEXPECTED	-12
311 #define	NDR_ERR_SIZE_IS_DUPLICATED	-13
312 #define	NDR_ERR_OUTER_PARAMS_MISMATCH	-14
313 #define	NDR_ERR_ARRAY_VARLEN_ILLEGAL	-15
314 #define	NDR_ERR_ARRAY_UNION_ILLEGAL	-16
315 #define	NDR_ERR_OUTER_PARAMS_BAD	-17
316 #define	NDR_ERR_OUTER_UNION_ILLEGAL	-18
317 #define	NDR_ERR_TOPMOST_UNION_ILLEGAL	-19
318 #define	NDR_ERR_TOPMOST_VARLEN_ILLEGAL	-20
319 #define	NDR_ERR_INNER_PARAMS_BAD	-21
320 #define	NDR_ERR_UNIMPLEMENTED		-22
321 #define	NDR_ERR_NOT_AN_INTERFACE	-23
322 #define	NDR_ERR_STRLEN			-24
323 #define	NDR_ERR_STRING_SIZING		-25
324 #define	NDR_ERR_BOUNDS_CHECK		-26
325 
326 #define	NDR_SET_ERROR(REF, ERROR)			\
327 	((REF)->stream->error = (ERROR),		\
328 	(REF)->stream->error_ref = __LINE__,		\
329 	MLNDS_TATTLE_ERROR((REF)->stream, 0, REF))
330 
331 #define	NDR_TATTLE(REF, WHAT) \
332 	(*(REF)->stream->mlndo->mlndo_tattle)((REF)->stream, WHAT, REF)
333 
334 #define	MEMBER_STR(MEMBER) #MEMBER
335 
336 #define	NDR_DIR_IS_IN  (encl_ref->stream->dir == NDR_DIR_IN)
337 #define	NDR_DIR_IS_OUT (encl_ref->stream->dir == NDR_DIR_OUT)
338 
339 #define	NDR_MEMBER_WITH_ARG(TYPE, MEMBER, OFFSET, \
340 		ARGFLAGS, ARGMEM, ARGVAL) { \
341 		myref.pdu_offset = encl_ref->pdu_offset + (OFFSET);	\
342 		myref.name = MEMBER_STR(MEMBER);			\
343 		myref.datum = (char *)&val->MEMBER;			\
344 		myref.inner_flags = ARGFLAGS;				\
345 		myref.ti = &ndt_##TYPE;					\
346 		myref.ARGMEM = ARGVAL;					\
347 		if (!mlndr_inner(&myref))				\
348 			return (0);					\
349 	}
350 
351 #define	NDR_MEMBER(TYPE, MEMBER, OFFSET) \
352 	NDR_MEMBER_WITH_ARG(TYPE, MEMBER, OFFSET, \
353 		NDR_F_NONE, size_is, 0)
354 
355 #define	NDR_MEMBER_ARR_WITH_SIZE_IS(TYPE, MEMBER, OFFSET, SIZE_IS) \
356 	NDR_MEMBER_WITH_ARG(TYPE, MEMBER, OFFSET, \
357 		NDR_F_SIZE_IS, size_is, SIZE_IS)
358 
359 #define	NDR_MEMBER_ARR_WITH_DIMENSION(TYPE, MEMBER, OFFSET, SIZE_IS) \
360 	NDR_MEMBER_WITH_ARG(TYPE, MEMBER, OFFSET, \
361 		NDR_F_DIMENSION_IS, dimension_is, SIZE_IS)
362 
363 #define	NDR_MEMBER_PTR_WITH_SIZE_IS(TYPE, MEMBER, OFFSET, SIZE_IS) \
364 	NDR_MEMBER_WITH_ARG(TYPE, MEMBER, OFFSET, \
365 		NDR_F_SIZE_IS+NDR_F_IS_POINTER, size_is, SIZE_IS)
366 
367 #define	NDR_MEMBER_PTR(TYPE, MEMBER, OFFSET)		\
368 	NDR_MEMBER_WITH_ARG(TYPE, MEMBER, OFFSET,	\
369 		NDR_F_IS_POINTER, size_is, 0)
370 
371 #define	NDR_MEMBER_WITH_SWITCH_IS(TYPE, MEMBER, OFFSET, SWITCH_IS)	\
372 	NDR_MEMBER_WITH_ARG(TYPE, MEMBER, OFFSET,			\
373 		NDR_F_SWITCH_IS, switch_is, SWITCH_IS)
374 
375 
376 #define	NDR_TOPMOST_MEMBER_WITH_ARG(TYPE, MEMBER, \
377 		ARGFLAGS, ARGMEM, ARGVAL) { \
378 		myref.pdu_offset = -1;					\
379 		myref.name = MEMBER_STR(MEMBER);			\
380 		myref.datum = (char *)&val->MEMBER;			\
381 		myref.inner_flags = ARGFLAGS;				\
382 		myref.ti = &ndt_##TYPE;					\
383 		myref.ARGMEM = ARGVAL;					\
384 		if (!mlndr_topmost(&myref))				\
385 			return (0);					\
386 	}
387 
388 #define	NDR_TOPMOST_MEMBER(TYPE, MEMBER)	   			\
389 	NDR_TOPMOST_MEMBER_WITH_ARG(TYPE, MEMBER,			\
390 		NDR_F_NONE, size_is, 0)
391 
392 #define	NDR_TOPMOST_MEMBER_ARR_WITH_SIZE_IS(TYPE, MEMBER, SIZE_IS)	\
393 	NDR_TOPMOST_MEMBER_WITH_ARG(TYPE, MEMBER,		    	\
394 		NDR_F_SIZE_IS, size_is, SIZE_IS)
395 
396 #define	NDR_TOPMOST_MEMBER_ARR_WITH_DIMENSION(TYPE, MEMBER, SIZE_IS)	\
397 	NDR_TOPMOST_MEMBER_WITH_ARG(TYPE, MEMBER,		      	\
398 		NDR_F_DIMENSION_IS, dimension_is, SIZE_IS)
399 
400 #define	NDR_TOPMOST_MEMBER_PTR_WITH_SIZE_IS(TYPE, MEMBER, SIZE_IS)	\
401 	NDR_TOPMOST_MEMBER_WITH_ARG(TYPE, MEMBER,			\
402 		NDR_F_SIZE_IS+NDR_F_IS_POINTER, size_is, SIZE_IS)
403 
404 #define	NDR_TOPMOST_MEMBER_PTR(TYPE, MEMBER)		\
405 	NDR_TOPMOST_MEMBER_WITH_ARG(TYPE, MEMBER,	\
406 		NDR_F_IS_POINTER, size_is, 0)
407 
408 #define	NDR_TOPMOST_MEMBER_REF(TYPE, MEMBER)		\
409 	NDR_TOPMOST_MEMBER_WITH_ARG(TYPE, MEMBER,	\
410 		NDR_F_IS_REFERENCE, size_is, 0)
411 
412 #define	NDR_TOPMOST_MEMBER_REF_WITH_SIZE_IS(TYPE, MEMBER, SIZE_IS)	\
413 	NDR_TOPMOST_MEMBER_WITH_ARG(TYPE, MEMBER,			\
414 		NDR_F_SIZE_IS+NDR_F_IS_REFERENCE, size_is, SIZE_IS)
415 
416 #define	NDR_TOPMOST_MEMBER_WITH_SWITCH_IS(TYPE, MEMBER, SWITCH_IS)	\
417 	NDR_TOPMOST_MEMBER_WITH_ARG(TYPE, MEMBER,			\
418 		NDR_F_SWITCH_IS, switch_is, SWITCH_IS)
419 
420 /* this is assuming offset+0 */
421 #define	NDR_PARAMS_MEMBER_WITH_ARG(TYPE, MEMBER, ARGFLAGS, \
422 	ARGMEM, ARGVAL) { \
423 		myref.pdu_offset = encl_ref->pdu_offset;		\
424 		myref.name = MEMBER_STR(MEMBER);			\
425 		myref.datum = (char *)&val->MEMBER;			\
426 		myref.inner_flags = ARGFLAGS;				\
427 		myref.ti = &ndt_##TYPE;					\
428 		myref.ARGMEM = ARGVAL;					\
429 		if (!mlndr_params(&myref))				\
430 			return (0);					\
431 	}
432 
433 #define	NDR_PARAMS_MEMBER(TYPE, MEMBER)			\
434 	NDR_PARAMS_MEMBER_WITH_ARG(TYPE, MEMBER,	\
435 	NDR_F_NONE, size_is, 0)
436 
437 #define	NDR_STRING_DIM		1
438 #define	NDR_ANYSIZE_DIM		1
439 
440 int mlndo_process(struct mlndr_stream *, struct ndr_typeinfo *, char *);
441 int mlndo_operation(struct mlndr_stream *, struct ndr_typeinfo *,
442     int opnum, char *);
443 void mlndo_printf(struct mlndr_stream *, struct ndr_reference *,
444     const char *, ...);
445 void mlndo_trace(const char *);
446 void mlndo_fmt(struct mlndr_stream *, struct ndr_reference *, char *);
447 
448 int mlndr_params(struct ndr_reference *);
449 int mlndr_topmost(struct ndr_reference *);
450 int mlndr_run_outer_queue(struct mlndr_stream *);
451 int mlndr_outer(struct ndr_reference *);
452 int mlndr_outer_fixed(struct ndr_reference *);
453 int mlndr_outer_fixed_array(struct ndr_reference *);
454 int mlndr_outer_conformant_array(struct ndr_reference *);
455 int mlndr_outer_conformant_construct(struct ndr_reference *);
456 int mlndr_size_is(struct ndr_reference *);
457 int mlndr_outer_string(struct ndr_reference *);
458 int mlndr_outer_peek_sizing(struct ndr_reference *, unsigned,
459     unsigned long *);
460 int mlndr_outer_poke_sizing(struct ndr_reference *, unsigned,
461     unsigned long *);
462 int mlndr_outer_align(struct ndr_reference *);
463 int mlndr_outer_grow(struct ndr_reference *, unsigned);
464 int mlndr_inner(struct ndr_reference *);
465 int mlndr_inner_pointer(struct ndr_reference *);
466 int mlndr_inner_reference(struct ndr_reference *);
467 int mlndr_inner_array(struct ndr_reference *);
468 
469 size_t ndr_mbstowcs(struct mlndr_stream *, mts_wchar_t *, const char *, size_t);
470 int ndr_mbtowc(struct mlndr_stream *, mts_wchar_t *, const char *, size_t);
471 
472 void mlnds_bswap(void *src, void *dst, size_t len);
473 
474 #ifdef __cplusplus
475 }
476 #endif
477 
478 #endif /* _SMBSRV_NDR_H */
479