23 * Use is subject to license terms.
24 *
25 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _SMBSRV_NDR_H
29 #define _SMBSRV_NDR_H
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 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
44 #error "not used in kernel code"
45 #else /* _KERNEL */
46 #include <sys/types.h>
47 #include <sys/uio.h>
48 #include <syslog.h>
49 #include <stdlib.h>
50 #include <string.h>
51 #include <smbsrv/wintypes.h>
52 #include <smbsrv/ndl/rpcpdu.ndl>
53 #include <smbsrv/string.h>
54 #endif /* _KERNEL */
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 /*
61 * Normal sequence:
62 * - Application calls client-side stub w/ TOP-MOST arg structure
63 * - client stub performs NDR_M_OP_MARSHALL+NDR_DIR_IN
64 * - PDU conveyed (request, aka call, aka query)
65 * - server stub performs NDR_M_OP_UNMARSHALL+NDR_DIR_IN
66 * - server function called w/ TOP-MOST arg structure
67 * - server function returns w/ TOP-MOST arg structure modified
68 * - server stub performs NDR_M_OP_MARSHALL+NDR_DIR_OUT
69 * - PDU conveyed (reply, aka result, aka response)
70 * - client stub performs NDR_M_OP_UNMARSHALL+NDR_DIR_OUT
71 * - return to Application w/ TOP-MOST arg structure modified
72 *
73 * An interface is a sequence of top-most constructs. Each top-most
74 * construct corresponds to one parameter, either argument or return
75 * value.
438
439 int ndr_params(ndr_ref_t *);
440 int ndr_topmost(ndr_ref_t *);
441 int ndr_run_outer_queue(struct ndr_stream *);
442 int ndr_outer(ndr_ref_t *);
443 int ndr_outer_fixed(ndr_ref_t *);
444 int ndr_outer_fixed_array(ndr_ref_t *);
445 int ndr_outer_conformant_array(ndr_ref_t *);
446 int ndr_outer_conformant_construct(ndr_ref_t *);
447 int ndr_size_is(ndr_ref_t *);
448 int ndr_outer_string(ndr_ref_t *);
449 int ndr_outer_peek_sizing(ndr_ref_t *, unsigned, unsigned long *);
450 int ndr_outer_poke_sizing(ndr_ref_t *, unsigned, unsigned long *);
451 int ndr_outer_align(ndr_ref_t *);
452 int ndr_outer_grow(ndr_ref_t *, unsigned);
453 int ndr_inner(ndr_ref_t *);
454 int ndr_inner_pointer(ndr_ref_t *);
455 int ndr_inner_reference(ndr_ref_t *);
456 int ndr_inner_array(ndr_ref_t *);
457
458 size_t ndr_mbstowcs(struct ndr_stream *, smb_wchar_t *, const char *, size_t);
459 int ndr_mbtowc(struct ndr_stream *, smb_wchar_t *, const char *, size_t);
460
461 void nds_bswap(void *src, void *dst, size_t len);
462
463 #ifdef __cplusplus
464 }
465 #endif
466
467 #endif /* _SMBSRV_NDR_H */
|
23 * Use is subject to license terms.
24 *
25 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _SMBSRV_NDR_H
29 #define _SMBSRV_NDR_H
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 #include <sys/types.h>
44 #include <sys/uio.h>
45 #include <stdlib.h>
46 #include <string.h>
47
48 #include <smb/wintypes.h>
49 #include <libmlrpc/ndrtypes.ndl>
50 #include <libmlrpc/rpcpdu.ndl>
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 /*
57 * Normal sequence:
58 * - Application calls client-side stub w/ TOP-MOST arg structure
59 * - client stub performs NDR_M_OP_MARSHALL+NDR_DIR_IN
60 * - PDU conveyed (request, aka call, aka query)
61 * - server stub performs NDR_M_OP_UNMARSHALL+NDR_DIR_IN
62 * - server function called w/ TOP-MOST arg structure
63 * - server function returns w/ TOP-MOST arg structure modified
64 * - server stub performs NDR_M_OP_MARSHALL+NDR_DIR_OUT
65 * - PDU conveyed (reply, aka result, aka response)
66 * - client stub performs NDR_M_OP_UNMARSHALL+NDR_DIR_OUT
67 * - return to Application w/ TOP-MOST arg structure modified
68 *
69 * An interface is a sequence of top-most constructs. Each top-most
70 * construct corresponds to one parameter, either argument or return
71 * value.
434
435 int ndr_params(ndr_ref_t *);
436 int ndr_topmost(ndr_ref_t *);
437 int ndr_run_outer_queue(struct ndr_stream *);
438 int ndr_outer(ndr_ref_t *);
439 int ndr_outer_fixed(ndr_ref_t *);
440 int ndr_outer_fixed_array(ndr_ref_t *);
441 int ndr_outer_conformant_array(ndr_ref_t *);
442 int ndr_outer_conformant_construct(ndr_ref_t *);
443 int ndr_size_is(ndr_ref_t *);
444 int ndr_outer_string(ndr_ref_t *);
445 int ndr_outer_peek_sizing(ndr_ref_t *, unsigned, unsigned long *);
446 int ndr_outer_poke_sizing(ndr_ref_t *, unsigned, unsigned long *);
447 int ndr_outer_align(ndr_ref_t *);
448 int ndr_outer_grow(ndr_ref_t *, unsigned);
449 int ndr_inner(ndr_ref_t *);
450 int ndr_inner_pointer(ndr_ref_t *);
451 int ndr_inner_reference(ndr_ref_t *);
452 int ndr_inner_array(ndr_ref_t *);
453
454 size_t ndr_mbstowcs(struct ndr_stream *, ndr_wchar_t *, const char *, size_t);
455
456 void nds_bswap(void *src, void *dst, size_t len);
457
458 #ifdef __cplusplus
459 }
460 #endif
461
462 #endif /* _SMBSRV_NDR_H */
|