1#ifndef _mach_voucher_server_
2#define _mach_voucher_server_
3
4/* Module mach_voucher */
5
6#include <string.h>
7#include <mach/ndr.h>
8#include <mach/boolean.h>
9#include <mach/kern_return.h>
10#include <mach/notify.h>
11#include <mach/mach_types.h>
12#include <mach/message.h>
13#include <mach/mig_errors.h>
14#include <mach/port.h>
15
16/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
17
18#if defined(__has_include)
19#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
20#ifndef USING_MIG_STRNCPY_ZEROFILL
21#define USING_MIG_STRNCPY_ZEROFILL
22#endif
23#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
24#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
25#ifdef __cplusplus
26extern "C" {
27#endif
28 extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
29#ifdef __cplusplus
30}
31#endif
32#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
33#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
34#endif /* __has_include */
35
36/* END MIG_STRNCPY_ZEROFILL CODE */
37
38
39#ifdef AUTOTEST
40#ifndef FUNCTION_PTR_T
41#define FUNCTION_PTR_T
42typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
43typedef struct {
44 char *name;
45 function_ptr_t function;
46} function_table_entry;
47typedef function_table_entry *function_table_t;
48#endif /* FUNCTION_PTR_T */
49#endif /* AUTOTEST */
50
51#ifndef mach_voucher_MSG_COUNT
52#define mach_voucher_MSG_COUNT 5
53#endif /* mach_voucher_MSG_COUNT */
54
55#include <mach/std_types.h>
56#include <mach/mig.h>
57#include <ipc/ipc_voucher.h>
58#include <kern/ipc_kobject.h>
59#include <kern/ipc_tt.h>
60#include <kern/ipc_host.h>
61#include <kern/ipc_sync.h>
62#include <kern/ledger.h>
63#include <kern/processor.h>
64#include <kern/sync_lock.h>
65#include <kern/sync_sema.h>
66#include <vm/memory_object.h>
67#include <vm/vm_map.h>
68#include <kern/ipc_mig.h>
69#include <mach/mig.h>
70#include <mach/mach_types.h>
71
72#ifdef __BeforeMigServerHeader
73__BeforeMigServerHeader
74#endif /* __BeforeMigServerHeader */
75
76
77/* Routine mach_voucher_extract_attr_content */
78#ifdef mig_external
79mig_external
80#else
81extern
82#endif /* mig_external */
83kern_return_t mach_voucher_extract_attr_content
84(
85 ipc_voucher_t voucher,
86 mach_voucher_attr_key_t key,
87 mach_voucher_attr_content_t content,
88 mach_msg_type_number_t *contentCnt
89);
90
91/* Routine mach_voucher_extract_attr_recipe */
92#ifdef mig_external
93mig_external
94#else
95extern
96#endif /* mig_external */
97kern_return_t mach_voucher_extract_attr_recipe
98(
99 ipc_voucher_t voucher,
100 mach_voucher_attr_key_t key,
101 mach_voucher_attr_raw_recipe_t recipe,
102 mach_msg_type_number_t *recipeCnt
103);
104
105/* Routine mach_voucher_extract_all_attr_recipes */
106#ifdef mig_external
107mig_external
108#else
109extern
110#endif /* mig_external */
111kern_return_t mach_voucher_extract_all_attr_recipes
112(
113 ipc_voucher_t voucher,
114 mach_voucher_attr_raw_recipe_array_t recipes,
115 mach_msg_type_number_t *recipesCnt
116);
117
118/* Routine mach_voucher_attr_command */
119#ifdef mig_external
120mig_external
121#else
122extern
123#endif /* mig_external */
124kern_return_t mach_voucher_attr_command
125(
126 ipc_voucher_t voucher,
127 mach_voucher_attr_key_t key,
128 mach_voucher_attr_command_t command,
129 mach_voucher_attr_content_t in_content,
130 mach_msg_type_number_t in_contentCnt,
131 mach_voucher_attr_content_t out_content,
132 mach_msg_type_number_t *out_contentCnt
133);
134
135/* Routine mach_voucher_debug_info */
136#ifdef mig_external
137mig_external
138#else
139extern
140#endif /* mig_external */
141kern_return_t mach_voucher_debug_info
142(
143 ipc_space_t task,
144 mach_port_name_t voucher_name,
145 mach_voucher_attr_raw_recipe_array_t recipes,
146 mach_msg_type_number_t *recipesCnt
147);
148
149#ifdef mig_external
150mig_external
151#else
152extern
153#endif /* mig_external */
154boolean_t mach_voucher_server(
155 mach_msg_header_t *InHeadP,
156 mach_msg_header_t *OutHeadP);
157
158#ifdef mig_external
159mig_external
160#else
161extern
162#endif /* mig_external */
163mig_routine_t mach_voucher_server_routine(
164 mach_msg_header_t *InHeadP);
165
166
167/* Description of this subsystem, for use in direct RPC */
168extern const struct mach_voucher_subsystem {
169 mig_server_routine_t server; /* Server routine */
170 mach_msg_id_t start; /* Min routine number */
171 mach_msg_id_t end; /* Max routine number + 1 */
172 unsigned int maxsize; /* Max msg size */
173 vm_address_t reserved; /* Reserved */
174 struct routine_descriptor /*Array of routine descriptors */
175 routine[5];
176} mach_voucher_subsystem;
177
178/* typedefs for all requests */
179
180#ifndef __Request__mach_voucher_subsystem__defined
181#define __Request__mach_voucher_subsystem__defined
182
183#ifdef __MigPackStructs
184#pragma pack(4)
185#endif
186 typedef struct {
187 mach_msg_header_t Head;
188 NDR_record_t NDR;
189 mach_voucher_attr_key_t key;
190 mach_msg_type_number_t contentCnt;
191 } __Request__mach_voucher_extract_attr_content_t __attribute__((unused));
192#ifdef __MigPackStructs
193#pragma pack()
194#endif
195
196#ifdef __MigPackStructs
197#pragma pack(4)
198#endif
199 typedef struct {
200 mach_msg_header_t Head;
201 NDR_record_t NDR;
202 mach_voucher_attr_key_t key;
203 mach_msg_type_number_t recipeCnt;
204 } __Request__mach_voucher_extract_attr_recipe_t __attribute__((unused));
205#ifdef __MigPackStructs
206#pragma pack()
207#endif
208
209#ifdef __MigPackStructs
210#pragma pack(4)
211#endif
212 typedef struct {
213 mach_msg_header_t Head;
214 NDR_record_t NDR;
215 mach_msg_type_number_t recipesCnt;
216 } __Request__mach_voucher_extract_all_attr_recipes_t __attribute__((unused));
217#ifdef __MigPackStructs
218#pragma pack()
219#endif
220
221#ifdef __MigPackStructs
222#pragma pack(4)
223#endif
224 typedef struct {
225 mach_msg_header_t Head;
226 NDR_record_t NDR;
227 mach_voucher_attr_key_t key;
228 mach_voucher_attr_command_t command;
229 mach_msg_type_number_t in_contentCnt;
230 uint8_t in_content[4096];
231 mach_msg_type_number_t out_contentCnt;
232 } __Request__mach_voucher_attr_command_t __attribute__((unused));
233#ifdef __MigPackStructs
234#pragma pack()
235#endif
236
237#ifdef __MigPackStructs
238#pragma pack(4)
239#endif
240 typedef struct {
241 mach_msg_header_t Head;
242 NDR_record_t NDR;
243 mach_port_name_t voucher_name;
244 mach_msg_type_number_t recipesCnt;
245 } __Request__mach_voucher_debug_info_t __attribute__((unused));
246#ifdef __MigPackStructs
247#pragma pack()
248#endif
249#endif /* !__Request__mach_voucher_subsystem__defined */
250
251
252/* union of all requests */
253
254#ifndef __RequestUnion__mach_voucher_subsystem__defined
255#define __RequestUnion__mach_voucher_subsystem__defined
256union __RequestUnion__mach_voucher_subsystem {
257 __Request__mach_voucher_extract_attr_content_t Request_mach_voucher_extract_attr_content;
258 __Request__mach_voucher_extract_attr_recipe_t Request_mach_voucher_extract_attr_recipe;
259 __Request__mach_voucher_extract_all_attr_recipes_t Request_mach_voucher_extract_all_attr_recipes;
260 __Request__mach_voucher_attr_command_t Request_mach_voucher_attr_command;
261 __Request__mach_voucher_debug_info_t Request_mach_voucher_debug_info;
262};
263#endif /* __RequestUnion__mach_voucher_subsystem__defined */
264/* typedefs for all replies */
265
266#ifndef __Reply__mach_voucher_subsystem__defined
267#define __Reply__mach_voucher_subsystem__defined
268
269#ifdef __MigPackStructs
270#pragma pack(4)
271#endif
272 typedef struct {
273 mach_msg_header_t Head;
274 NDR_record_t NDR;
275 kern_return_t RetCode;
276 mach_msg_type_number_t contentCnt;
277 uint8_t content[4096];
278 } __Reply__mach_voucher_extract_attr_content_t __attribute__((unused));
279#ifdef __MigPackStructs
280#pragma pack()
281#endif
282
283#ifdef __MigPackStructs
284#pragma pack(4)
285#endif
286 typedef struct {
287 mach_msg_header_t Head;
288 NDR_record_t NDR;
289 kern_return_t RetCode;
290 mach_msg_type_number_t recipeCnt;
291 uint8_t recipe[4096];
292 } __Reply__mach_voucher_extract_attr_recipe_t __attribute__((unused));
293#ifdef __MigPackStructs
294#pragma pack()
295#endif
296
297#ifdef __MigPackStructs
298#pragma pack(4)
299#endif
300 typedef struct {
301 mach_msg_header_t Head;
302 NDR_record_t NDR;
303 kern_return_t RetCode;
304 mach_msg_type_number_t recipesCnt;
305 uint8_t recipes[5120];
306 } __Reply__mach_voucher_extract_all_attr_recipes_t __attribute__((unused));
307#ifdef __MigPackStructs
308#pragma pack()
309#endif
310
311#ifdef __MigPackStructs
312#pragma pack(4)
313#endif
314 typedef struct {
315 mach_msg_header_t Head;
316 NDR_record_t NDR;
317 kern_return_t RetCode;
318 mach_msg_type_number_t out_contentCnt;
319 uint8_t out_content[4096];
320 } __Reply__mach_voucher_attr_command_t __attribute__((unused));
321#ifdef __MigPackStructs
322#pragma pack()
323#endif
324
325#ifdef __MigPackStructs
326#pragma pack(4)
327#endif
328 typedef struct {
329 mach_msg_header_t Head;
330 NDR_record_t NDR;
331 kern_return_t RetCode;
332 mach_msg_type_number_t recipesCnt;
333 uint8_t recipes[5120];
334 } __Reply__mach_voucher_debug_info_t __attribute__((unused));
335#ifdef __MigPackStructs
336#pragma pack()
337#endif
338#endif /* !__Reply__mach_voucher_subsystem__defined */
339
340
341/* union of all replies */
342
343#ifndef __ReplyUnion__mach_voucher_subsystem__defined
344#define __ReplyUnion__mach_voucher_subsystem__defined
345union __ReplyUnion__mach_voucher_subsystem {
346 __Reply__mach_voucher_extract_attr_content_t Reply_mach_voucher_extract_attr_content;
347 __Reply__mach_voucher_extract_attr_recipe_t Reply_mach_voucher_extract_attr_recipe;
348 __Reply__mach_voucher_extract_all_attr_recipes_t Reply_mach_voucher_extract_all_attr_recipes;
349 __Reply__mach_voucher_attr_command_t Reply_mach_voucher_attr_command;
350 __Reply__mach_voucher_debug_info_t Reply_mach_voucher_debug_info;
351};
352#endif /* __RequestUnion__mach_voucher_subsystem__defined */
353
354#ifndef subsystem_to_name_map_mach_voucher
355#define subsystem_to_name_map_mach_voucher \
356 { "mach_voucher_extract_attr_content", 5400 },\
357 { "mach_voucher_extract_attr_recipe", 5401 },\
358 { "mach_voucher_extract_all_attr_recipes", 5402 },\
359 { "mach_voucher_attr_command", 5403 },\
360 { "mach_voucher_debug_info", 5404 }
361#endif
362
363#ifdef __AfterMigServerHeader
364__AfterMigServerHeader
365#endif /* __AfterMigServerHeader */
366
367#endif /* _mach_voucher_server_ */
368