1#ifndef _notify_server_
2#define _notify_server_
3
4/* Module notify */
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#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
29#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
30#endif
31 extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
32#ifdef __cplusplus
33}
34#endif
35#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
36#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
37#endif /* __has_include */
38
39/* END MIG_STRNCPY_ZEROFILL CODE */
40
41
42#ifdef AUTOTEST
43#ifndef FUNCTION_PTR_T
44#define FUNCTION_PTR_T
45typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
46typedef struct {
47 char * name;
48 function_ptr_t function;
49} function_table_entry;
50typedef function_table_entry *function_table_t;
51#endif /* FUNCTION_PTR_T */
52#endif /* AUTOTEST */
53
54#ifndef notify_MSG_COUNT
55#define notify_MSG_COUNT 9
56#endif /* notify_MSG_COUNT */
57
58#include <Availability.h>
59#include <mach/std_types.h>
60#include <mach/mig.h>
61
62#ifdef __BeforeMigServerHeader
63__BeforeMigServerHeader
64#endif /* __BeforeMigServerHeader */
65
66#ifndef MIG_SERVER_ROUTINE
67#define MIG_SERVER_ROUTINE
68#endif
69
70
71/* SimpleRoutine mach_notify_port_deleted */
72#ifdef mig_external
73mig_external
74#else
75extern
76#endif /* mig_external */
77MIG_SERVER_ROUTINE
78kern_return_t do_mach_notify_port_deleted
79(
80 mach_port_t notify,
81 mach_port_name_t name
82);
83
84/* SimpleRoutine mach_notify_port_destroyed */
85#ifdef mig_external
86mig_external
87#else
88extern
89#endif /* mig_external */
90MIG_SERVER_ROUTINE
91kern_return_t do_mach_notify_port_destroyed
92(
93 mach_port_t notify,
94 mach_port_t rights
95);
96
97/* SimpleRoutine mach_notify_no_senders */
98#ifdef mig_external
99mig_external
100#else
101extern
102#endif /* mig_external */
103MIG_SERVER_ROUTINE
104kern_return_t do_mach_notify_no_senders
105(
106 mach_port_t notify,
107 mach_port_mscount_t mscount
108);
109
110/* SimpleRoutine mach_notify_send_once */
111#ifdef mig_external
112mig_external
113#else
114extern
115#endif /* mig_external */
116MIG_SERVER_ROUTINE
117kern_return_t do_mach_notify_send_once
118(
119 mach_port_t notify
120);
121
122/* SimpleRoutine mach_notify_dead_name */
123#ifdef mig_external
124mig_external
125#else
126extern
127#endif /* mig_external */
128MIG_SERVER_ROUTINE
129kern_return_t do_mach_notify_dead_name
130(
131 mach_port_t notify,
132 mach_port_name_t name
133);
134
135#ifdef mig_external
136mig_external
137#else
138extern
139#endif /* mig_external */
140boolean_t notify_server(
141 mach_msg_header_t *InHeadP,
142 mach_msg_header_t *OutHeadP);
143
144#ifdef mig_external
145mig_external
146#else
147extern
148#endif /* mig_external */
149mig_routine_t notify_server_routine(
150 mach_msg_header_t *InHeadP);
151
152
153/* Description of this subsystem, for use in direct RPC */
154extern const struct do_notify_subsystem {
155 mig_server_routine_t server; /* Server routine */
156 mach_msg_id_t start; /* Min routine number */
157 mach_msg_id_t end; /* Max routine number + 1 */
158 unsigned int maxsize; /* Max msg size */
159 vm_address_t reserved; /* Reserved */
160 struct routine_descriptor /* Array of routine descriptors */
161 routine[9];
162} do_notify_subsystem;
163
164/* typedefs for all requests */
165
166#ifndef __Request__notify_subsystem__defined
167#define __Request__notify_subsystem__defined
168
169#ifdef __MigPackStructs
170#pragma pack(push, 4)
171#endif
172 typedef struct {
173 mach_msg_header_t Head;
174 NDR_record_t NDR;
175 mach_port_name_t name;
176 } __Request__mach_notify_port_deleted_t __attribute__((unused));
177#ifdef __MigPackStructs
178#pragma pack(pop)
179#endif
180
181#ifdef __MigPackStructs
182#pragma pack(push, 4)
183#endif
184 typedef struct {
185 mach_msg_header_t Head;
186 /* start of the kernel processed data */
187 mach_msg_body_t msgh_body;
188 mach_msg_port_descriptor_t rights;
189 /* end of the kernel processed data */
190 } __Request__mach_notify_port_destroyed_t __attribute__((unused));
191#ifdef __MigPackStructs
192#pragma pack(pop)
193#endif
194
195#ifdef __MigPackStructs
196#pragma pack(push, 4)
197#endif
198 typedef struct {
199 mach_msg_header_t Head;
200 NDR_record_t NDR;
201 mach_port_mscount_t mscount;
202 } __Request__mach_notify_no_senders_t __attribute__((unused));
203#ifdef __MigPackStructs
204#pragma pack(pop)
205#endif
206
207#ifdef __MigPackStructs
208#pragma pack(push, 4)
209#endif
210 typedef struct {
211 mach_msg_header_t Head;
212 } __Request__mach_notify_send_once_t __attribute__((unused));
213#ifdef __MigPackStructs
214#pragma pack(pop)
215#endif
216
217#ifdef __MigPackStructs
218#pragma pack(push, 4)
219#endif
220 typedef struct {
221 mach_msg_header_t Head;
222 NDR_record_t NDR;
223 mach_port_name_t name;
224 } __Request__mach_notify_dead_name_t __attribute__((unused));
225#ifdef __MigPackStructs
226#pragma pack(pop)
227#endif
228#endif /* !__Request__notify_subsystem__defined */
229
230
231/* union of all requests */
232
233#ifndef __RequestUnion__do_notify_subsystem__defined
234#define __RequestUnion__do_notify_subsystem__defined
235union __RequestUnion__do_notify_subsystem {
236 __Request__mach_notify_port_deleted_t Request_mach_notify_port_deleted;
237 __Request__mach_notify_port_destroyed_t Request_mach_notify_port_destroyed;
238 __Request__mach_notify_no_senders_t Request_mach_notify_no_senders;
239 __Request__mach_notify_send_once_t Request_mach_notify_send_once;
240 __Request__mach_notify_dead_name_t Request_mach_notify_dead_name;
241};
242#endif /* __RequestUnion__do_notify_subsystem__defined */
243/* typedefs for all replies */
244
245#ifndef __Reply__notify_subsystem__defined
246#define __Reply__notify_subsystem__defined
247
248#ifdef __MigPackStructs
249#pragma pack(push, 4)
250#endif
251 typedef struct {
252 mach_msg_header_t Head;
253 NDR_record_t NDR;
254 kern_return_t RetCode;
255 } __Reply__mach_notify_port_deleted_t __attribute__((unused));
256#ifdef __MigPackStructs
257#pragma pack(pop)
258#endif
259
260#ifdef __MigPackStructs
261#pragma pack(push, 4)
262#endif
263 typedef struct {
264 mach_msg_header_t Head;
265 NDR_record_t NDR;
266 kern_return_t RetCode;
267 } __Reply__mach_notify_port_destroyed_t __attribute__((unused));
268#ifdef __MigPackStructs
269#pragma pack(pop)
270#endif
271
272#ifdef __MigPackStructs
273#pragma pack(push, 4)
274#endif
275 typedef struct {
276 mach_msg_header_t Head;
277 NDR_record_t NDR;
278 kern_return_t RetCode;
279 } __Reply__mach_notify_no_senders_t __attribute__((unused));
280#ifdef __MigPackStructs
281#pragma pack(pop)
282#endif
283
284#ifdef __MigPackStructs
285#pragma pack(push, 4)
286#endif
287 typedef struct {
288 mach_msg_header_t Head;
289 NDR_record_t NDR;
290 kern_return_t RetCode;
291 } __Reply__mach_notify_send_once_t __attribute__((unused));
292#ifdef __MigPackStructs
293#pragma pack(pop)
294#endif
295
296#ifdef __MigPackStructs
297#pragma pack(push, 4)
298#endif
299 typedef struct {
300 mach_msg_header_t Head;
301 NDR_record_t NDR;
302 kern_return_t RetCode;
303 } __Reply__mach_notify_dead_name_t __attribute__((unused));
304#ifdef __MigPackStructs
305#pragma pack(pop)
306#endif
307#endif /* !__Reply__notify_subsystem__defined */
308
309
310/* union of all replies */
311
312#ifndef __ReplyUnion__do_notify_subsystem__defined
313#define __ReplyUnion__do_notify_subsystem__defined
314union __ReplyUnion__do_notify_subsystem {
315 __Reply__mach_notify_port_deleted_t Reply_mach_notify_port_deleted;
316 __Reply__mach_notify_port_destroyed_t Reply_mach_notify_port_destroyed;
317 __Reply__mach_notify_no_senders_t Reply_mach_notify_no_senders;
318 __Reply__mach_notify_send_once_t Reply_mach_notify_send_once;
319 __Reply__mach_notify_dead_name_t Reply_mach_notify_dead_name;
320};
321#endif /* __ReplyUnion__do_notify_subsystem__defined */
322
323#ifndef subsystem_to_name_map_notify
324#define subsystem_to_name_map_notify \
325 { "mach_notify_port_deleted", 65 },\
326 { "mach_notify_port_destroyed", 69 },\
327 { "mach_notify_no_senders", 70 },\
328 { "mach_notify_send_once", 71 },\
329 { "mach_notify_dead_name", 72 }
330#endif
331
332#ifdef __AfterMigServerHeader
333__AfterMigServerHeader
334#endif /* __AfterMigServerHeader */
335
336#endif /* _notify_server_ */
337