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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _NDR_TYPES_NDL_
27 #define _NDR_TYPES_NDL_
28
29 #define TYPEINFO(TYPE) ndt__##TYPE
30
31 #ifdef NDRGEN
32
33 #define ALIGN(X) [align(X)]
34 #define OPERATION(X) [operation(X)]
35 #define IN [in]
36 #define OUT [out]
37 #define INOUT [in out]
38
39 #define STRING [string]
40 #define SIZE_IS(X) [size_is(X)]
41
42 #define SWITCH(X) [switch_is(X)]
43 #define CASE(X) [case(X)]
44 #define DEFAULT [default]
45
46 #define INTERFACE(X) [interface(X)]
47 #define UUID(X) [uuid(X)]
48
52 #define REF [reference]
53 #define UNIQUE [unique]
54 #define PTR [ptr]
55 #define POINTER_DEFAULT(X) [pointer_default(X)]
56
57 #define ANY_SIZE_ARRAY *
58
59 #define IMPORT_EXTERN [extern]
60
61 #define BYTE uchar
62 #define WORD ushort
63 #define DWORD ulong
64 #define ntstatus_t ulong
65
66 #define LPTSTR STRING wchar *
67
68 #define LPBYTE uchar *
69 #define LPWORD ushort *
70 #define LPDWORD ulong *
71
72 /*
73 * Opaque context handle.
74 */
75 #ifndef CONTEXT_HANDLE
76 #define CONTEXT_HANDLE(NAME) \
77 struct NAME { \
78 DWORD data1; \
79 DWORD data2; \
80 WORD data3[2]; \
81 BYTE data4[8]; \
82 }; \
83 typedef struct NAME
84 #endif /* CONTEXT_HANDLE */
85
86 #define EXTERNTYPEINFO(TYPE)
87
88 #else /* NDRGEN */
89
90 #define ALIGN(X)
91 #define OPERATION(X)
92 #define IN
93 #define OUT
94 #define INOUT
95
96 #define STRING
97 #define SIZE_IS(X)
98
99 #define SWITCH(X)
100 #define CASE(X)
101 #define DEFAULT
102
103 #define INTERFACE(X)
104 #define UUID(X)
105
106 #define ARG_IS(X)
107
108 #define REFERENCE
109 #define REF
110 #define UNIQUE
111 #define PTR
112 #define POINTER_DEFAULT(X)
113
114 #define IMPORT_EXTERN
115
116 /*
117 * When not using ndrgen, get BYTE, WORD, DWORD definitions from wintypes.h.
118 */
119 #include <smbsrv/wintypes.h>
120
121 #define EXTERNTYPEINFO(TYPE) extern struct ndr_typeinfo TYPEINFO(TYPE);
122
123
124 /*
125 ***********************************************************************
126 * There is a bug in the way that midl and the marshalling code handles
127 * unions so we need to fix some of the data offsets at runtime. The
128 * following macros and the fixup function handle the correction.
129 ***********************************************************************
130 */
131
132 /*
133 * DECL_FIXUP_STRUCT allows us to declare external references to data
134 * structures generated by ndrgen in the _ndr.c file.
135 */
136 #define DECL_FIXUP_STRUCT(NAME) extern struct ndr_typeinfo ndt__##NAME
137
138 /*
139 * CASE_INFO_ENT is intended to simplify the declaration of the case
150 * by DECL_FIXUP_STRUCT) at runtime. The values are based on the
151 * switch_index.
152 */
153 #define FIXUP_PDU_SIZE(NAME,SIZE) { \
154 ndt__##NAME.pdu_size_fixed_part = SIZE; \
155 ndt__##NAME.c_size_fixed_part = SIZE; \
156 }
157
158
159 #endif /* NDRGEN */
160
161 /*
162 * UNION_INFO_ENT is intended to simplify adding new entries to a union.
163 * If the entry structures are named using the form FunctionNameX,
164 * where X is the sitch_value, you can just add a single line. Note
165 * that you must also update the fixup function in mlsvc_xxx.c.
166 */
167 #define UNION_INFO_ENT(N,NAME) CASE(N) struct NAME##N info##N
168 #define UNION_INFO_PTR(N,NAME) CASE(N) struct NAME##N *info##N
169
170 #endif /* _NDR_TYPES_NDL_ */
|
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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _NDRTYPES_NDL_
29 #define _NDRTYPES_NDL_
30
31 /*
32 * Type definitions (and related) used in NDL files and the
33 * NDL run-time support libraries. See also: libmlrpc.h
34 */
35
36 #define TYPEINFO(TYPE) ndt__##TYPE
37
38 #ifdef NDRGEN
39
40 #define ALIGN(X) [align(X)]
41 #define OPERATION(X) [operation(X)]
42 #define IN [in]
43 #define OUT [out]
44 #define INOUT [in out]
45
46 #define STRING [string]
47 #define SIZE_IS(X) [size_is(X)]
48
49 #define SWITCH(X) [switch_is(X)]
50 #define CASE(X) [case(X)]
51 #define DEFAULT [default]
52
53 #define INTERFACE(X) [interface(X)]
54 #define UUID(X) [uuid(X)]
55
59 #define REF [reference]
60 #define UNIQUE [unique]
61 #define PTR [ptr]
62 #define POINTER_DEFAULT(X) [pointer_default(X)]
63
64 #define ANY_SIZE_ARRAY *
65
66 #define IMPORT_EXTERN [extern]
67
68 #define BYTE uchar
69 #define WORD ushort
70 #define DWORD ulong
71 #define ntstatus_t ulong
72
73 #define LPTSTR STRING wchar *
74
75 #define LPBYTE uchar *
76 #define LPWORD ushort *
77 #define LPDWORD ulong *
78
79 #define EXTERNTYPEINFO(TYPE)
80
81 #else /* NDRGEN */
82
83 #define ALIGN(X)
84 #define OPERATION(X)
85 #define IN
86 #define OUT
87 #define INOUT
88
89 #define STRING
90 #define SIZE_IS(X)
91
92 #define SWITCH(X)
93 #define CASE(X)
94 #define DEFAULT
95
96 #define INTERFACE(X)
97 #define UUID(X)
98
99 #define ARG_IS(X)
100
101 #define REFERENCE
102 #define REF
103 #define UNIQUE
104 #define PTR
105 #define POINTER_DEFAULT(X)
106
107 #define IMPORT_EXTERN
108
109 /*
110 * When not using ndrgen, get BYTE, WORD, DWORD definitions from wintypes.h.
111 */
112 #include <smb/wintypes.h>
113
114 #define EXTERNTYPEINFO(TYPE) extern struct ndr_typeinfo TYPEINFO(TYPE);
115
116
117 /*
118 ***********************************************************************
119 * There is a bug in the way that midl and the marshalling code handles
120 * unions so we need to fix some of the data offsets at runtime. The
121 * following macros and the fixup function handle the correction.
122 ***********************************************************************
123 */
124
125 /*
126 * DECL_FIXUP_STRUCT allows us to declare external references to data
127 * structures generated by ndrgen in the _ndr.c file.
128 */
129 #define DECL_FIXUP_STRUCT(NAME) extern struct ndr_typeinfo ndt__##NAME
130
131 /*
132 * CASE_INFO_ENT is intended to simplify the declaration of the case
143 * by DECL_FIXUP_STRUCT) at runtime. The values are based on the
144 * switch_index.
145 */
146 #define FIXUP_PDU_SIZE(NAME,SIZE) { \
147 ndt__##NAME.pdu_size_fixed_part = SIZE; \
148 ndt__##NAME.c_size_fixed_part = SIZE; \
149 }
150
151
152 #endif /* NDRGEN */
153
154 /*
155 * UNION_INFO_ENT is intended to simplify adding new entries to a union.
156 * If the entry structures are named using the form FunctionNameX,
157 * where X is the sitch_value, you can just add a single line. Note
158 * that you must also update the fixup function in mlsvc_xxx.c.
159 */
160 #define UNION_INFO_ENT(N,NAME) CASE(N) struct NAME##N info##N
161 #define UNION_INFO_PTR(N,NAME) CASE(N) struct NAME##N *info##N
162
163 /*
164 * Opaque context handle.
165 */
166 #ifndef CONTEXT_HANDLE
167 #define CONTEXT_HANDLE(NAME) \
168 struct NAME { \
169 DWORD data1; \
170 DWORD data2; \
171 WORD data3[2]; \
172 BYTE data4[8]; \
173 }; \
174 typedef struct NAME
175 #endif /* CONTEXT_HANDLE */
176
177 #endif /* _NDRTYPES_NDL_ */
|