1/* iig(DriverKit-286) generated from IODispatchSource.iig */
2
3/* IODispatchSource.iig:1-36 */
4/*
5 * Copyright (c) 2019-2019 Apple Inc. All rights reserved.
6 *
7 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
8 *
9 * This file contains Original Code and/or Modifications of Original Code
10 * as defined in and that are subject to the Apple Public Source License
11 * Version 2.0 (the 'License'). You may not use this file except in
12 * compliance with the License. The rights granted to you under the License
13 * may not be used to create, or enable the creation or redistribution of,
14 * unlawful or unlicensed copies of an Apple operating system, or to
15 * circumvent, violate, or enable the circumvention or violation of, any
16 * terms of an Apple operating system software license agreement.
17 *
18 * Please obtain a copy of the License at
19 * http://www.opensource.apple.com/apsl/ and read it before using this file.
20 *
21 * The Original Code and all software distributed under the License are
22 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
23 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
24 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
26 * Please see the License for the specific language governing rights and
27 * limitations under the License.
28 *
29 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
30 */
31
32#ifndef _IOKIT_UIODISPATCHSOURCE_H
33#define _IOKIT_UIODISPATCHSOURCE_H
34
35#include <DriverKit/OSObject.h> /* .iig include */
36
37
38typedef void (^IODispatchSourceCancelHandler)(void);
39
40/* source class IODispatchSource IODispatchSource.iig:37-66 */
41
42#if __DOCUMENTATION__
43#define KERNEL IIG_KERNEL
44
45/*!
46 * @class IODispatchSource
47
48 * @abstract
49 * IODispatchSource common base class for dispatch sources.
50 */
51
52class NATIVE KERNEL IODispatchSource : public OSObject
53{
54public:
55
56 virtual bool
57 init() override;
58
59 virtual void
60 free() override;
61
62 virtual kern_return_t
63 Cancel(IODispatchSourceCancelHandler handler) = 0;
64
65 virtual kern_return_t
66 SetEnableWithCompletion(
67 bool enable,
68 IODispatchSourceCancelHandler handler) = 0;
69
70 virtual kern_return_t
71 CheckForWork(bool synchronous) INVOKEREPLY = 0;
72
73 virtual kern_return_t
74 SetEnable(bool enable) LOCAL;
75};
76
77#undef KERNEL
78#else /* __DOCUMENTATION__ */
79
80/* generated class IODispatchSource IODispatchSource.iig:37-66 */
81
82#define IODispatchSource_Cancel_ID 0xd963bb196f70bb93ULL
83#define IODispatchSource_SetEnableWithCompletion_ID 0xbb42c489fe4dee8eULL
84#define IODispatchSource_CheckForWork_ID 0xef19d38d4f945fd0ULL
85#define IODispatchSource_SetEnable_ID 0xbbc036b4c2a26c45ULL
86
87#define IODispatchSource_Cancel_Args \
88 IODispatchSourceCancelHandler handler
89
90#define IODispatchSource_SetEnableWithCompletion_Args \
91 bool enable, \
92 IODispatchSourceCancelHandler handler
93
94#define IODispatchSource_CheckForWork_Args \
95 const IORPC rpc, \
96 bool synchronous
97
98#define IODispatchSource_SetEnable_Args \
99 bool enable
100
101#define IODispatchSource_Methods \
102\
103public:\
104\
105 virtual kern_return_t\
106 Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
107\
108 static kern_return_t\
109 _Dispatch(IODispatchSource * self, const IORPC rpc);\
110\
111 kern_return_t\
112 Cancel(\
113 IODispatchSourceCancelHandler handler,\
114 OSDispatchMethod supermethod = NULL);\
115\
116 kern_return_t\
117 SetEnableWithCompletion(\
118 bool enable,\
119 IODispatchSourceCancelHandler handler,\
120 OSDispatchMethod supermethod = NULL);\
121\
122 kern_return_t\
123 CheckForWork(\
124 bool synchronous,\
125 OSDispatchMethod supermethod = NULL);\
126\
127 kern_return_t\
128 SetEnable(\
129 bool enable,\
130 OSDispatchMethod supermethod = NULL);\
131\
132\
133protected:\
134 /* _Impl methods */\
135\
136 kern_return_t\
137 SetEnable_Impl(IODispatchSource_SetEnable_Args);\
138\
139\
140public:\
141 /* _Invoke methods */\
142\
143 typedef kern_return_t (*Cancel_Handler)(OSMetaClassBase * target, IODispatchSource_Cancel_Args);\
144 static kern_return_t\
145 Cancel_Invoke(const IORPC rpc,\
146 OSMetaClassBase * target,\
147 Cancel_Handler func);\
148\
149 typedef kern_return_t (*SetEnableWithCompletion_Handler)(OSMetaClassBase * target, IODispatchSource_SetEnableWithCompletion_Args);\
150 static kern_return_t\
151 SetEnableWithCompletion_Invoke(const IORPC rpc,\
152 OSMetaClassBase * target,\
153 SetEnableWithCompletion_Handler func);\
154\
155 typedef kern_return_t (*CheckForWork_Handler)(OSMetaClassBase * target, IODispatchSource_CheckForWork_Args);\
156 static kern_return_t\
157 CheckForWork_Invoke(const IORPC rpc,\
158 OSMetaClassBase * target,\
159 CheckForWork_Handler func);\
160\
161 typedef kern_return_t (*SetEnable_Handler)(OSMetaClassBase * target, IODispatchSource_SetEnable_Args);\
162 static kern_return_t\
163 SetEnable_Invoke(const IORPC rpc,\
164 OSMetaClassBase * target,\
165 SetEnable_Handler func);\
166\
167
168
169#define IODispatchSource_KernelMethods \
170\
171protected:\
172 /* _Impl methods */\
173\
174
175
176#define IODispatchSource_VirtualMethods \
177\
178public:\
179\
180 virtual bool\
181 init(\
182) APPLE_KEXT_OVERRIDE;\
183\
184 virtual void\
185 free(\
186) APPLE_KEXT_OVERRIDE;\
187\
188
189
190#if !KERNEL
191
192extern OSMetaClass * gIODispatchSourceMetaClass;
193extern const OSClassLoadInformation IODispatchSource_Class;
194
195class IODispatchSourceMetaClass : public OSMetaClass
196{
197public:
198 virtual kern_return_t
199 New(OSObject * instance) override;
200 virtual kern_return_t
201 Dispatch(const IORPC rpc) override;
202};
203
204#endif /* !KERNEL */
205
206class IODispatchSourceInterface : public OSInterface
207{
208public:
209};
210
211struct IODispatchSource_IVars;
212struct IODispatchSource_LocalIVars;
213
214class IODispatchSource : public OSObject, public IODispatchSourceInterface
215{
216#if KERNEL
217 OSDeclareDefaultStructorsWithDispatch(IODispatchSource);
218#endif /* KERNEL */
219
220#if !KERNEL
221 friend class IODispatchSourceMetaClass;
222#endif /* !KERNEL */
223
224public:
225#ifdef IODispatchSource_DECLARE_IVARS
226IODispatchSource_DECLARE_IVARS
227#else /* IODispatchSource_DECLARE_IVARS */
228 union
229 {
230 IODispatchSource_IVars * ivars;
231 IODispatchSource_LocalIVars * lvars;
232 };
233#endif /* IODispatchSource_DECLARE_IVARS */
234#if !KERNEL
235 static OSMetaClass *
236 sGetMetaClass() { return gIODispatchSourceMetaClass; };
237 virtual const OSMetaClass *
238 getMetaClass() const APPLE_KEXT_OVERRIDE { return gIODispatchSourceMetaClass; };
239#endif /* KERNEL */
240
241 using super = OSObject;
242
243#if !KERNEL
244 IODispatchSource_Methods
245#endif /* !KERNEL */
246
247 IODispatchSource_VirtualMethods
248};
249
250#endif /* !__DOCUMENTATION__ */
251
252/* IODispatchSource.iig:68- */
253
254#endif /* ! _IOKIT_UIODISPATCHSOURCE_H */
255