xref: /xnu-11215/osfmk/ipc/ipc_types.h (revision 5c2921b0)
1 /*
2  * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 /*
29  * @OSF_COPYRIGHT@
30  */
31 
32 /*
33  * Define Basic IPC types available to callers.
34  * These are not intended to be used directly, but
35  * are used to define other types available through
36  * port.h and mach_types.h for in-kernel entities.
37  */
38 
39 #ifndef _IPC_IPC_TYPES_H_
40 #define _IPC_IPC_TYPES_H_
41 
42 #include <mach/port.h>
43 #include <mach/message.h>
44 #include <mach/mach_types.h>
45 
46 #ifdef  MACH_KERNEL_PRIVATE
47 
48 typedef natural_t ipc_table_index_t;    /* index into tables */
49 typedef natural_t ipc_table_elems_t;    /* size of tables */
50 typedef natural_t ipc_entry_bits_t;
51 typedef ipc_table_elems_t ipc_entry_num_t;      /* number of entries */
52 typedef ipc_table_index_t ipc_port_request_index_t;
53 
54 typedef mach_port_name_t mach_port_index_t;             /* index values */
55 typedef mach_port_name_t mach_port_gen_t;               /* generation numbers */
56 
57 typedef struct ipc_entry *ipc_entry_t;
58 
59 typedef struct ipc_table_size *ipc_table_size_t;
60 typedef struct ipc_port_request *ipc_port_request_t;
61 typedef struct ipc_pset *ipc_pset_t;
62 typedef struct ipc_kmsg *ipc_kmsg_t;
63 typedef uint8_t sync_qos_count_t;
64 
65 typedef uint64_t ipc_label_t;
66 #define IPC_LABEL_NONE          ((ipc_label_t)0x0000)
67 #define IPC_LABEL_DEXT          ((ipc_label_t)0x0001)
68 #define IPC_LABEL_PLATFORM      ((ipc_label_t)0x0002)
69 #define IPC_LABEL_SPECIAL       ((ipc_label_t)0x0003)
70 #define IPC_LABEL_SPACE_MASK    ((ipc_label_t)0x00ff)
71 
72 #define IPC_LABEL_SUBST_TASK        ((ipc_label_t)0x0100)
73 #define IPC_LABEL_SUBST_THREAD      ((ipc_label_t)0x0200)
74 #define IPC_LABEL_SUBST_ONCE        ((ipc_label_t)0x0300)
75 #define IPC_LABEL_SUBST_TASK_READ   ((ipc_label_t)0x0400)
76 #define IPC_LABEL_SUBST_THREAD_READ ((ipc_label_t)0x0500)
77 #define IPC_LABEL_SUBST_MASK        ((ipc_label_t)0xff00)
78 
79 typedef struct ipc_kobject_label *ipc_kobject_label_t;
80 
81 #define IE_NULL ((ipc_entry_t)NULL)
82 
83 #define ITS_NULL        ((ipc_table_size_t)NULL)
84 #define ITS_SIZE_NONE   ((ipc_table_elems_t) -1)
85 #define IPR_NULL        ((ipc_port_request_t)NULL)
86 #define IPS_NULL        ((ipc_pset_t)NULL)
87 #define IKM_NULL        ((ipc_kmsg_t)NULL)
88 
89 typedef void (*mach_msg_continue_t)(mach_msg_return_t); /* after wakeup */
90 #define MACH_MSG_CONTINUE_NULL  ((mach_msg_continue_t)NULL)
91 
92 typedef struct ipc_importance_elem *__single ipc_importance_elem_t;
93 #define IIE_NULL        ((ipc_importance_elem_t)NULL)
94 
95 typedef struct ipc_importance_task *__single ipc_importance_task_t;
96 #define IIT_NULL        ((ipc_importance_task_t)NULL)
97 
98 typedef struct ipc_importance_inherit *__single ipc_importance_inherit_t;
99 #define III_NULL        ((ipc_importance_inherit_t)NULL)
100 
101 #else   /* MACH_KERNEL_PRIVATE */
102 
103 struct ipc_object;
104 
105 #endif  /* MACH_KERNEL_PRIVATE */
106 
107 typedef struct ipc_object       *ipc_object_t;
108 
109 #define IPC_OBJECT_NULL         ((ipc_object_t) 0)
110 #define IPC_OBJECT_DEAD         ((ipc_object_t)~0)
111 #define IPC_OBJECT_VALID(io)    (((io) != IPC_OBJECT_NULL) && \
112 	                         ((io) != IPC_OBJECT_DEAD))
113 
114 #endif  /* _IPC_IPC_TYPES_H_ */
115