1 | #ifndef _host_security_user_ |
2 | #define _host_security_user_ |
3 | |
4 | /* Module host_security */ |
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 |
26 | extern "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 |
42 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
43 | typedef struct { |
44 | char *name; |
45 | function_ptr_t function; |
46 | } function_table_entry; |
47 | typedef function_table_entry *function_table_t; |
48 | #endif /* FUNCTION_PTR_T */ |
49 | #endif /* AUTOTEST */ |
50 | |
51 | #ifndef host_security_MSG_COUNT |
52 | #define host_security_MSG_COUNT 2 |
53 | #endif /* host_security_MSG_COUNT */ |
54 | |
55 | #include <mach/std_types.h> |
56 | #include <mach/mig.h> |
57 | #include <mach/mig.h> |
58 | #include <mach/mach_types.h> |
59 | |
60 | #ifdef __BeforeMigUserHeader |
61 | __BeforeMigUserHeader |
62 | #endif /* __BeforeMigUserHeader */ |
63 | |
64 | #include <sys/cdefs.h> |
65 | __BEGIN_DECLS |
66 | |
67 | |
68 | /* Routine host_security_create_task_token */ |
69 | #ifdef mig_external |
70 | mig_external |
71 | #else |
72 | extern |
73 | #endif /* mig_external */ |
74 | kern_return_t host_security_create_task_token |
75 | ( |
76 | host_security_t host_security, |
77 | task_t parent_task, |
78 | security_token_t sec_token, |
79 | audit_token_t audit_token, |
80 | host_t host, |
81 | ledger_array_t ledgers, |
82 | mach_msg_type_number_t ledgersCnt, |
83 | boolean_t inherit_memory, |
84 | task_t *child_task |
85 | ); |
86 | |
87 | /* Routine host_security_set_task_token */ |
88 | #ifdef mig_external |
89 | mig_external |
90 | #else |
91 | extern |
92 | #endif /* mig_external */ |
93 | kern_return_t host_security_set_task_token |
94 | ( |
95 | host_security_t host_security, |
96 | task_t target_task, |
97 | security_token_t sec_token, |
98 | audit_token_t audit_token, |
99 | host_t host |
100 | ); |
101 | |
102 | __END_DECLS |
103 | |
104 | /********************** Caution **************************/ |
105 | /* The following data types should be used to calculate */ |
106 | /* maximum message sizes only. The actual message may be */ |
107 | /* smaller, and the position of the arguments within the */ |
108 | /* message layout may vary from what is presented here. */ |
109 | /* For example, if any of the arguments are variable- */ |
110 | /* sized, and less than the maximum is sent, the data */ |
111 | /* will be packed tight in the actual message to reduce */ |
112 | /* the presence of holes. */ |
113 | /********************** Caution **************************/ |
114 | |
115 | /* typedefs for all requests */ |
116 | |
117 | #ifndef __Request__host_security_subsystem__defined |
118 | #define __Request__host_security_subsystem__defined |
119 | |
120 | #ifdef __MigPackStructs |
121 | #pragma pack(4) |
122 | #endif |
123 | typedef struct { |
124 | mach_msg_header_t Head; |
125 | /* start of the kernel processed data */ |
126 | mach_msg_body_t msgh_body; |
127 | mach_msg_port_descriptor_t parent_task; |
128 | mach_msg_port_descriptor_t host; |
129 | mach_msg_ool_ports_descriptor_t ledgers; |
130 | /* end of the kernel processed data */ |
131 | NDR_record_t NDR; |
132 | security_token_t sec_token; |
133 | audit_token_t audit_token; |
134 | mach_msg_type_number_t ledgersCnt; |
135 | boolean_t inherit_memory; |
136 | } __Request__host_security_create_task_token_t __attribute__((unused)); |
137 | #ifdef __MigPackStructs |
138 | #pragma pack() |
139 | #endif |
140 | |
141 | #ifdef __MigPackStructs |
142 | #pragma pack(4) |
143 | #endif |
144 | typedef struct { |
145 | mach_msg_header_t Head; |
146 | /* start of the kernel processed data */ |
147 | mach_msg_body_t msgh_body; |
148 | mach_msg_port_descriptor_t target_task; |
149 | mach_msg_port_descriptor_t host; |
150 | /* end of the kernel processed data */ |
151 | NDR_record_t NDR; |
152 | security_token_t sec_token; |
153 | audit_token_t audit_token; |
154 | } __Request__host_security_set_task_token_t __attribute__((unused)); |
155 | #ifdef __MigPackStructs |
156 | #pragma pack() |
157 | #endif |
158 | #endif /* !__Request__host_security_subsystem__defined */ |
159 | |
160 | /* union of all requests */ |
161 | |
162 | #ifndef __RequestUnion__host_security_subsystem__defined |
163 | #define __RequestUnion__host_security_subsystem__defined |
164 | union __RequestUnion__host_security_subsystem { |
165 | __Request__host_security_create_task_token_t Request_host_security_create_task_token; |
166 | __Request__host_security_set_task_token_t Request_host_security_set_task_token; |
167 | }; |
168 | #endif /* !__RequestUnion__host_security_subsystem__defined */ |
169 | /* typedefs for all replies */ |
170 | |
171 | #ifndef __Reply__host_security_subsystem__defined |
172 | #define __Reply__host_security_subsystem__defined |
173 | |
174 | #ifdef __MigPackStructs |
175 | #pragma pack(4) |
176 | #endif |
177 | typedef struct { |
178 | mach_msg_header_t Head; |
179 | /* start of the kernel processed data */ |
180 | mach_msg_body_t msgh_body; |
181 | mach_msg_port_descriptor_t child_task; |
182 | /* end of the kernel processed data */ |
183 | } __Reply__host_security_create_task_token_t __attribute__((unused)); |
184 | #ifdef __MigPackStructs |
185 | #pragma pack() |
186 | #endif |
187 | |
188 | #ifdef __MigPackStructs |
189 | #pragma pack(4) |
190 | #endif |
191 | typedef struct { |
192 | mach_msg_header_t Head; |
193 | NDR_record_t NDR; |
194 | kern_return_t RetCode; |
195 | } __Reply__host_security_set_task_token_t __attribute__((unused)); |
196 | #ifdef __MigPackStructs |
197 | #pragma pack() |
198 | #endif |
199 | #endif /* !__Reply__host_security_subsystem__defined */ |
200 | |
201 | /* union of all replies */ |
202 | |
203 | #ifndef __ReplyUnion__host_security_subsystem__defined |
204 | #define __ReplyUnion__host_security_subsystem__defined |
205 | union __ReplyUnion__host_security_subsystem { |
206 | __Reply__host_security_create_task_token_t Reply_host_security_create_task_token; |
207 | __Reply__host_security_set_task_token_t Reply_host_security_set_task_token; |
208 | }; |
209 | #endif /* !__RequestUnion__host_security_subsystem__defined */ |
210 | |
211 | #ifndef subsystem_to_name_map_host_security |
212 | #define subsystem_to_name_map_host_security \ |
213 | { "host_security_create_task_token", 600 },\ |
214 | { "host_security_set_task_token", 601 } |
215 | #endif |
216 | |
217 | #ifdef __AfterMigUserHeader |
218 | __AfterMigUserHeader |
219 | #endif /* __AfterMigUserHeader */ |
220 | |
221 | #endif /* _host_security_user_ */ |
222 | |