]>
Commit | Line | Data |
---|---|---|
cb323159 A |
1 | /* |
2 | * Copyright (c) 2019-2019 Apple 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 | #if !__IIG | |
30 | #if KERNEL | |
31 | #include <libkern/c++/OSObject.h> | |
32 | #endif | |
33 | #endif | |
34 | ||
35 | #ifndef _IOKIT_UOSOBJECT_H | |
36 | #define _IOKIT_UOSOBJECT_H | |
37 | ||
38 | #if !KERNEL | |
39 | #include <stddef.h> | |
40 | #include <stdint.h> | |
41 | #include <DriverKit/IOReturn.h> | |
42 | #if DRIVERKIT_PRIVATE | |
43 | #include <mach/port.h> | |
44 | #endif | |
45 | #if !__IIG | |
46 | #include <string.h> | |
47 | #include <DriverKit/OSMetaClass.h> | |
48 | #endif | |
49 | class OSObject; | |
50 | typedef OSObject * OSObjectPtr; | |
51 | #endif | |
52 | ||
53 | #if __IIG && !__IIG_ATTRIBUTES_DEFINED__ | |
54 | ||
55 | #define __IIG_ATTRIBUTES_DEFINED__ 1 | |
56 | ||
57 | #define KERNEL __attribute__((annotate("kernel"))) | |
58 | #define NATIVE __attribute__((annotate("native"))) | |
59 | #define LOCAL __attribute__((annotate("local"))) | |
60 | #define LOCALONLY __attribute__((annotate("localonly"))) | |
61 | #define REMOTE __attribute__((annotate("remote"))) | |
62 | ||
63 | #define LOCALHOST __attribute__((annotate("localhost"))) | |
64 | ||
65 | #define INVOKEREPLY __attribute__((annotate("invokereply"))) | |
66 | #define REPLY __attribute__((annotate("reply"))) | |
67 | ||
68 | #define PORTMAKESEND __attribute__((annotate("MACH_MSG_TYPE_MAKE_SEND"))) | |
69 | #define PORTCOPYSEND __attribute__((annotate("MACH_MSG_TYPE_COPY_SEND"))) | |
70 | ||
71 | #define TARGET __attribute__((annotate("target"))) | |
72 | #define TYPE(p) __attribute__((annotate("type=" # p))) | |
73 | ||
74 | //#define ARRAY(maxcount) __attribute__((annotate(# maxcount), annotate("array"))) | |
75 | #define EXTENDS(cls) __attribute__((annotate("extends=" # cls))) | |
76 | ||
77 | //#define INTERFACE __attribute__((annotate("interface"))) | |
78 | //#define IMPLEMENTS(i) void implements(i *); | |
79 | ||
80 | #define QUEUENAME(name) __attribute__((annotate("queuename=" # name))) | |
81 | ||
82 | #define IIG_SERIALIZABLE __attribute__((annotate("serializable"))) | |
83 | ||
84 | #else | |
85 | ||
86 | #define IIG_SERIALIZABLE | |
87 | ||
88 | #endif /* __IIG */ | |
89 | ||
90 | ||
91 | #if !__IIG | |
92 | #if KERNEL | |
93 | typedef OSObject OSContainer; | |
94 | #else | |
95 | class IIG_SERIALIZABLE OSContainer; | |
96 | #endif | |
97 | #else | |
98 | class IIG_SERIALIZABLE OSContainer; | |
99 | #endif | |
100 | ||
101 | class IIG_SERIALIZABLE OSData; | |
102 | class IIG_SERIALIZABLE OSNumber; | |
103 | class IIG_SERIALIZABLE OSString; | |
104 | class IIG_SERIALIZABLE OSBoolean; | |
105 | class IIG_SERIALIZABLE OSDictionary; | |
106 | class IIG_SERIALIZABLE OSArray; | |
107 | ||
108 | class OSMetaClass; | |
109 | class IODispatchQueue; | |
110 | typedef char IODispatchQueueName[256]; | |
111 | ||
112 | #if __IIG | |
113 | class OSMetaClassBase | |
114 | { | |
115 | virtual const OSMetaClass * | |
116 | getMetaClass() const LOCALONLY; | |
117 | ||
118 | virtual void | |
119 | retain() const LOCALONLY; | |
120 | ||
121 | virtual void | |
122 | release() const LOCALONLY; | |
123 | ||
124 | virtual bool | |
125 | isEqualTo(const OSMetaClassBase * anObject) const LOCALONLY; | |
126 | }; | |
127 | #endif /* __IIG */ | |
128 | ||
129 | ||
130 | /*! | |
131 | @iig implementation | |
132 | #include <DriverKit/IODispatchQueue.h> | |
133 | @iig end | |
134 | */ | |
135 | ||
136 | class OSObject : public OSMetaClassBase | |
137 | { | |
138 | public: | |
139 | ||
140 | virtual bool | |
141 | init() LOCALONLY; | |
142 | ||
143 | virtual void | |
144 | free() LOCALONLY; | |
145 | ||
146 | virtual void | |
147 | retain() const override; | |
148 | ||
149 | virtual void | |
150 | release() const override; | |
151 | ||
152 | virtual kern_return_t | |
153 | SetDispatchQueue( | |
154 | const IODispatchQueueName name, | |
155 | IODispatchQueue * queue) KERNEL = 0; | |
156 | ||
157 | virtual kern_return_t | |
158 | CopyDispatchQueue( | |
159 | const IODispatchQueueName name, | |
160 | IODispatchQueue ** queue) KERNEL = 0; | |
161 | }; | |
162 | ||
163 | #define DEFN(classname, name) \ | |
164 | name ## _Impl(classname ## _ ## name ## _Args) | |
165 | ||
166 | #define IMPL(classname, name) \ | |
167 | classname :: DEFN(classname, name) | |
168 | ||
169 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
170 | ||
171 | #endif /* ! _IOKIT_UOSOBJECT_H */ |