2 * Copyright (c) 2019-2019 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
31 #include <libkern/c++/OSObject.h>
35 #ifndef _IOKIT_UOSOBJECT_H
36 #define _IOKIT_UOSOBJECT_H
41 #include <DriverKit/IOReturn.h>
43 #include <mach/port.h>
44 #endif /* DRIVERKIT_PRIVATE */
47 #include <DriverKit/OSMetaClass.h>
50 typedef OSObject * OSObjectPtr;
53 #if !__IIG_ATTRIBUTES_DEFINED__
55 #define __IIG_ATTRIBUTES_DEFINED__ 1
57 #if __IIG || __DOCUMENTATION__
59 #define IIG_KERNEL __attribute__((annotate("kernel")))
60 #define IIG_NATIVE __attribute__((annotate("native")))
61 #define IIG_LOCAL __attribute__((annotate("local")))
62 #define IIG_LOCALONLY __attribute__((annotate("localonly")))
63 #define IIG_REMOTE __attribute__((annotate("remote")))
64 #define IIG_LOCALHOST __attribute__((annotate("localhost")))
65 #define IIG_INVOKEREPLY __attribute__((annotate("invokereply")))
66 #define IIG_REPLY __attribute__((annotate("reply")))
67 #define IIG_PORTMAKESEND __attribute__((annotate("MACH_MSG_TYPE_MAKE_SEND")))
68 #define IIG_PORTCOPYSEND __attribute__((annotate("MACH_MSG_TYPE_COPY_SEND")))
69 #define IIG_TARGET __attribute__((annotate("target")))
70 #define IIG_TYPE(p) __attribute__((annotate("type=" # p)))
71 //#define IIG_ARRAY(maxcount) __attribute__((annotate(# maxcount), annotate("array")))
72 #define IIG_EXTENDS(cls) __attribute__((annotate("extends=" # cls)))
73 //#define IIG_INTERFACE __attribute__((annotate("interface")))
74 //#define IIG_IMPLEMENTS(i) void __implements(i *);
75 #define IIG_QUEUENAME(name) __attribute__((annotate("queuename=" # name)))
76 #define IIG_SERIALIZABLE __attribute__((annotate("serializable")))
79 #define KERNEL IIG_KERNEL
81 #define NATIVE IIG_NATIVE
82 #define LOCAL IIG_LOCAL
83 #define LOCALONLY IIG_LOCALONLY
84 #define REMOTE IIG_REMOTE
85 #define LOCALHOST IIG_LOCALHOST
86 #define INVOKEREPLY IIG_INVOKEREPLY
87 #define REPLY IIG_REPLY
88 #define PORTMAKESEND IIG_PORTMAKESEND
89 #define PORTCOPYSEND IIG_PORTCOPYSEND
90 #define TARGET IIG_TARGET
91 #define TYPE(p) IIG_TYPE(p)
92 //#define ARRAY(maxcount) IIG_ARRAY(maxcount)
93 #define EXTENDS(cls) IIG_EXTENDS(cls)
94 //#define INTERFACE IIG_INTERFACE
95 //#define IMPLEMENTS(i) IIG_IMPLEMENTS(i)
96 #define QUEUENAME(name) IIG_QUEUENAME(name)
98 #else /* __IIG || __DOCUMENTATION__ */
103 #define IIG_LOCALONLY
105 #define IIG_LOCALHOST
106 #define IIG_INVOKEREPLY
108 #define IIG_PORTMAKESEND
109 #define IIG_PORTCOPYSEND
112 //#define IIG_ARRAY(maxcount)
113 #define IIG_EXTENDS(cls)
114 //#define IIG_INTERFACE
115 //#define IIG_IMPLEMENTS(i)
116 #define IIG_QUEUENAME(name)
117 #define IIG_SERIALIZABLE
119 #endif /* __IIG || __DOCUMENTATION__ */
121 #endif /* __IIG_ATTRIBUTES_DEFINED__ */
126 typedef OSObject OSContainer;
128 class IIG_SERIALIZABLE OSContainer;
131 class IIG_SERIALIZABLE OSContainer;
134 class IIG_SERIALIZABLE OSData;
135 class IIG_SERIALIZABLE OSNumber;
136 class IIG_SERIALIZABLE OSString;
137 class IIG_SERIALIZABLE OSBoolean;
138 class IIG_SERIALIZABLE OSDictionary;
139 class IIG_SERIALIZABLE OSArray;
142 class IODispatchQueue;
143 typedef char IODispatchQueueName[256];
146 class OSMetaClassBase
148 virtual const OSMetaClass *
149 getMetaClass() const LOCALONLY;
152 retain() const LOCALONLY;
155 release() const LOCALONLY;
158 isEqualTo(const OSMetaClassBase * anObject) const LOCALONLY;
165 #include <DriverKit/IODispatchQueue.h>
169 class OSObject : public OSMetaClassBase
180 retain() const override;
183 release() const override;
185 virtual kern_return_t
187 const IODispatchQueueName name,
188 IODispatchQueue * queue) KERNEL = 0;
190 virtual kern_return_t
192 const IODispatchQueueName name,
193 IODispatchQueue ** queue) KERNEL = 0;
196 #define DEFN(classname, name) \
197 name ## _Impl(classname ## _ ## name ## _Args)
200 * Use of the IMPL macro is discouraged and should be replaced by a normal c++
201 * method implementation (with the all method arguments) and the name of the method
202 * given a suffix '_Impl'
205 #define IMPL(classname, name) \
206 classname :: DEFN(classname, name)
208 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
210 #endif /* ! _IOKIT_UOSOBJECT_H */