| 1 | /* iig(DriverKit-286) generated from IOUserClient.iig */ |
| 2 | |
| 3 | /* IOUserClient.iig:1-156 */ |
| 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 | #if !__IIG |
| 33 | #if KERNEL |
| 34 | #include <IOKit/IOUserClient.h> |
| 35 | #endif |
| 36 | #endif |
| 37 | |
| 38 | #ifndef _IOKIT_UIOUSERCLIENT_H |
| 39 | #define _IOKIT_UIOUSERCLIENT_H |
| 40 | |
| 41 | #include <DriverKit/OSAction.h> /* .iig include */ |
| 42 | #include <DriverKit/IOService.h> /* .iig include */ |
| 43 | #include <DriverKit/IOBufferMemoryDescriptor.h> /* .iig include */ |
| 44 | |
| 45 | |
| 46 | enum { |
| 47 | kIOUserClientScalarArrayCountMax = 16, |
| 48 | }; |
| 49 | typedef uint64_t IOUserClientScalarArray[kIOUserClientScalarArrayCountMax]; |
| 50 | |
| 51 | enum { |
| 52 | kIOUserClientAsyncReferenceCountMax = 16, |
| 53 | }; |
| 54 | typedef uint64_t IOUserClientAsyncReferenceArray[kIOUserClientAsyncReferenceCountMax]; |
| 55 | |
| 56 | enum { |
| 57 | kIOUserClientAsyncArgumentsCountMax = 16, |
| 58 | }; |
| 59 | typedef uint64_t IOUserClientAsyncArgumentsArray[kIOUserClientAsyncArgumentsCountMax]; |
| 60 | |
| 61 | // CopyClientMemoryForType options |
| 62 | enum { |
| 63 | kIOUserClientMemoryReadOnly = 0x00000001, |
| 64 | }; |
| 65 | |
| 66 | #define kIOUserClientQueueNameExternalMethod "IOUserClientQueueExternalMethod" |
| 67 | |
| 68 | |
| 69 | /*! @enum |
| 70 | * @abstract Constant to denote a variable length structure argument to IOUserClient. |
| 71 | * @constant kIOUserClientVariableStructureSize Use in the structures IOUserClientMethodDispatch to specify the size of the structure is variable. |
| 72 | */ |
| 73 | enum { |
| 74 | kIOUserClientVariableStructureSize = 0xffffffff |
| 75 | }; |
| 76 | |
| 77 | |
| 78 | enum { |
| 79 | #define IO_USER_CLIENT_METHOD_ARGUMENTS_CURRENT_VERSION 2 |
| 80 | kIOUserClientMethodArgumentsCurrentVersion = IO_USER_CLIENT_METHOD_ARGUMENTS_CURRENT_VERSION |
| 81 | }; |
| 82 | |
| 83 | /*! |
| 84 | * @struct IOUserClientMethodArguments |
| 85 | * @brief Holds arguments from IOKit.framework IOConnectMethod calls. |
| 86 | * @discussion Any argument may be passed as NULL if not passed by the caller. |
| 87 | * @field selector Selector argument to IOConnectMethod. |
| 88 | * @field scalarInput Array of scalars from caller. |
| 89 | * @field scalarInputCount Count of valid scalars in scalarInput. |
| 90 | * @field structureInput OSData object containing structure input from IOConnectMethod. |
| 91 | * @field structureInputDescriptor IOMemoryDescriptor containing structure input from IOConnectMethod. |
| 92 | * This parameter is only set for large structures, and if set structureInput will be NULL. |
| 93 | * @field scalarOutput Array of scalars to return to the caller. |
| 94 | * @field scalarOutputCount Count of scalars to return to the caller in scalarOutput. |
| 95 | * @field structureOutput An OSData to be returned to the caller as structure output. |
| 96 | * This field should be set by the driver to an OSData object it created with |
| 97 | * the data to be returned, and the OSData instance will be released by the OS. |
| 98 | * It is an error for the driver to set this field if structureOutputDescriptor was passed in |
| 99 | * @field structureOutputDescriptor A IOMemoryDescriptor specified by the caller for structure output. |
| 100 | * @field structureOutputMaximumSize Maximum size of structure output specified by caller |
| 101 | * or kIOUserClientVariableStructureSize. |
| 102 | * @field completion For IOConnectAsyncMethod, an OSAction used to deliver async data to the caller. |
| 103 | * It is only retained during the invocation of ExternalMethod and should be retained if |
| 104 | * used beyond then. |
| 105 | */ |
| 106 | |
| 107 | struct IOUserClientMethodArguments { |
| 108 | uint64_t version; |
| 109 | uint64_t selector; |
| 110 | OSAction * completion; |
| 111 | const uint64_t * scalarInput; |
| 112 | uint32_t scalarInputCount; |
| 113 | OSData * structureInput; |
| 114 | IOMemoryDescriptor * structureInputDescriptor; |
| 115 | uint64_t * scalarOutput; |
| 116 | uint32_t scalarOutputCount; |
| 117 | OSData * structureOutput; |
| 118 | IOMemoryDescriptor * structureOutputDescriptor; |
| 119 | uint64_t structureOutputMaximumSize; |
| 120 | uint64_t __reserved[30]; |
| 121 | }; |
| 122 | |
| 123 | typedef kern_return_t (*IOUserClientMethodFunction)( |
| 124 | OSObject * target, |
| 125 | void * reference, |
| 126 | IOUserClientMethodArguments * arguments); |
| 127 | |
| 128 | /*! |
| 129 | * @struct IOUserClientMethodDispatch |
| 130 | * @brief Used to check fields in IOUserClientMethodArguments |
| 131 | * @field function to invoke after making the checks specified below. If NULL and all checks pass, |
| 132 | * kIOReturnNoCompletion will be returned for the caller to implement the method. |
| 133 | * @field checkCompletionExists |
| 134 | * if true completion field must be set, |
| 135 | * if false must be zero, |
| 136 | * if -1U don't care |
| 137 | * @field checkScalarInputCount |
| 138 | * if has value kIOUserClientVariableStructureSize don't care, |
| 139 | * otherwise must equal args->scalarInputCount |
| 140 | * @field checkStructureInputSize |
| 141 | * if has value kIOUserClientVariableStructureSize don't care, |
| 142 | * otherwise must equal length of structureInput or structureInputDescriptor |
| 143 | * @field checkScalarOutputCount |
| 144 | * if has value kIOUserClientVariableStructureSize don't care, |
| 145 | * otherwise must equal args->scalarOutputCount |
| 146 | * @field checkStructureOutputSize |
| 147 | * if has value kIOUserClientVariableStructureSize don't care, |
| 148 | * otherwise must equal length of structureOutputMaximumSize |
| 149 | */ |
| 150 | |
| 151 | struct IOUserClientMethodDispatch { |
| 152 | IOUserClientMethodFunction function; |
| 153 | uint32_t checkCompletionExists; |
| 154 | uint32_t checkScalarInputCount; |
| 155 | uint32_t checkStructureInputSize; |
| 156 | uint32_t checkScalarOutputCount; |
| 157 | uint32_t checkStructureOutputSize; |
| 158 | }; |
| 159 | |
| 160 | /* source class IOUserClient IOUserClient.iig:157-300 */ |
| 161 | |
| 162 | #if __DOCUMENTATION__ |
| 163 | #define KERNEL IIG_KERNEL |
| 164 | |
| 165 | /*! |
| 166 | * @class IOUserClient |
| 167 | * |
| 168 | * @abstract |
| 169 | * IOUserClient represents a connection opened by IOServiceOpen in the IOKit.framework. |
| 170 | * |
| 171 | * @discussion |
| 172 | * An application may open an IOUserClient by calling IOServiceOpen(). This results in a call |
| 173 | * to the IOService::NewUserClient API to create an instance representing the connection. |
| 174 | * and to receive untyped data via IOConnectMethod/IOConnectAsyncMethod. |
| 175 | * As an IOService subclass, IOUserClient receives the normal Start()/Stop() lifecyle calls. |
| 176 | * |
| 177 | |
| 178 | */ |
| 179 | |
| 180 | class KERNEL IOUserClient : public IOService |
| 181 | { |
| 182 | public: |
| 183 | virtual bool |
| 184 | init() override; |
| 185 | |
| 186 | virtual void |
| 187 | free() override; |
| 188 | |
| 189 | /*! |
| 190 | * @brief Receive arguments from IOKit.framework IOConnectMethod calls. |
| 191 | * @discussion IOConnectMethod calls from the owner of the connection come here. |
| 192 | * Any argument may be passed as NULL if not passed by the caller. |
| 193 | * The method runs on a queue set by IOService::SetDispatchQueuue() |
| 194 | * with the name kIOUserClientQueueNameExternalMethod, or the default |
| 195 | * queue for the IOUserClient object if one was not set. |
| 196 | * @param selector Selector argument to IOConnectMethod. |
| 197 | * @param arguments Structure describing all arguments being passed to IOConnectMethod. |
| 198 | * See the IOUserClientMethodArguments definition. |
| 199 | * @param dispatch NULL when called in the driver. The IOUserClient::ExternalMethod() |
| 200 | * implementation may be called with a non-NULL argument to check |
| 201 | * certain fields of the arguments structure before calling a target procedure |
| 202 | * specified by the dispatch structure 'function' field, and the |
| 203 | * 'target' and 'reference' parameters to this method. |
| 204 | * See the IOUserClientMethodDispatch definition. |
| 205 | * @param target Target for the dispatch function |
| 206 | * @param reference Reference constant for the dispatch function |
| 207 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 208 | */ |
| 209 | |
| 210 | virtual kern_return_t |
| 211 | ExternalMethod( |
| 212 | uint64_t selector, |
| 213 | IOUserClientMethodArguments * arguments, |
| 214 | const IOUserClientMethodDispatch * dispatch, |
| 215 | OSObject * target, |
| 216 | void * reference) LOCALONLY |
| 217 | QUEUENAME(IOUserClientQueueExternalMethod); |
| 218 | |
| 219 | |
| 220 | /*! |
| 221 | * @brief Send asynchronous arguments to a completion supplied by ExternalMethod(). |
| 222 | * @discussion IOConnectAsyncMethod calls from the owner of the connection come will pass an OSAction instance. |
| 223 | * To deliver the asynchronous results the driver calls AsyncCompletion(). |
| 224 | * @param action OSAction passed to IOExternalMethod(). |
| 225 | * @param status An IOReturn status value to be sent. |
| 226 | * @param asyncData An array of scalar data to be sent. |
| 227 | * @param asyncDataCount Count of valid data in asyncData. |
| 228 | */ |
| 229 | virtual void |
| 230 | AsyncCompletion( |
| 231 | OSAction * action TARGET, |
| 232 | IOReturn status, |
| 233 | const IOUserClientAsyncArgumentsArray asyncData, |
| 234 | uint32_t asyncDataCount) = 0; |
| 235 | |
| 236 | /*! |
| 237 | * @brief Return an IOMemoryDescriptor to be mapped into the client task. |
| 238 | * @discussion IOConnectMapMemory()/UnmapMemory() will result in a call to this method to obtain |
| 239 | * an IOMemoryDescriptor instance for shared memory. For a given IOUserClient instance, calling |
| 240 | * CopyClientMemoryForType() with a given type, should return the same IOMemoryDescriptor instance. |
| 241 | * @param type Type parameter IOConnectMapMemory()/UnmapMemory(). |
| 242 | * @param options Set kIOUserClientMemoryReadOnly for memory to be mapped read only in the client. |
| 243 | * @param memory An instance of IOMemoryDescriptor on success. One reference will be consumed by the caller |
| 244 | * of this method. |
| 245 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 246 | */ |
| 247 | virtual kern_return_t |
| 248 | CopyClientMemoryForType( |
| 249 | uint64_t type, |
| 250 | uint64_t * options, |
| 251 | IOMemoryDescriptor ** memory) = 0; |
| 252 | |
| 253 | /*! |
| 254 | * @brief Create a memory descriptor that describes a set of virtual ranges in |
| 255 | * the client task of the user client. |
| 256 | * @param memoryDescriptorCreateOptions |
| 257 | * kIOMemoryDirectionIn memory described will be writable |
| 258 | * kIOMemoryDirectionOut memory described will be readable |
| 259 | * @param segmentsCount Number of valid address ranges being passed |
| 260 | * in the segments array. |
| 261 | * @param segments Array of address ranges. |
| 262 | * @param memory Returned IOMemoryDescriptor object with +1 retain count. |
| 263 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 264 | */ |
| 265 | virtual kern_return_t |
| 266 | CreateMemoryDescriptorFromClient( |
| 267 | uint64_t memoryDescriptorCreateOptions, |
| 268 | uint32_t segmentsCount, |
| 269 | const IOAddressSegment segments[32], |
| 270 | IOMemoryDescriptor ** memory) __attribute__((availability(driverkit,introduced=20.0))); |
| 271 | |
| 272 | /*! |
| 273 | * @function CopyClientEntitlements |
| 274 | * @abstract Return owning task's entitlements dictionary. |
| 275 | * @param entitlements Dictionary of entitlements given to the owning task. To be released by caller. |
| 276 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 277 | */ |
| 278 | virtual kern_return_t |
| 279 | CopyClientEntitlements(OSDictionary ** entitlements) LOCAL; |
| 280 | |
| 281 | |
| 282 | private: |
| 283 | virtual kern_return_t |
| 284 | _ExternalMethod( |
| 285 | uint64_t selector, |
| 286 | const IOUserClientScalarArray scalarInput, |
| 287 | uint32_t scalarInputCount, |
| 288 | OSData * structureInput, |
| 289 | IOMemoryDescriptor * structureInputDescriptor, |
| 290 | IOUserClientScalarArray scalarOutput, |
| 291 | uint32_t * scalarOutputCount, |
| 292 | uint64_t structureOutputMaximumSize, |
| 293 | OSData ** structureOutput, |
| 294 | IOMemoryDescriptor * structureOutputDescriptor, |
| 295 | OSAction * completion TYPE(IOUserClient::AsyncCompletion)) LOCAL |
| 296 | QUEUENAME(IOUserClientQueueExternalMethod); |
| 297 | |
| 298 | virtual void |
| 299 | KernelCompletion( |
| 300 | OSAction * action TARGET, |
| 301 | IOReturn status, |
| 302 | const IOUserClientAsyncArgumentsArray asyncData, |
| 303 | uint32_t asyncDataCount) |
| 304 | KERNEL |
| 305 | TYPE(IOUserClient::AsyncCompletion); |
| 306 | }; |
| 307 | |
| 308 | #undef KERNEL |
| 309 | #else /* __DOCUMENTATION__ */ |
| 310 | |
| 311 | /* generated class IOUserClient IOUserClient.iig:157-300 */ |
| 312 | |
| 313 | #define IOUserClient_AsyncCompletion_ID 0xdbc5b2e5d2b446f4ULL |
| 314 | #define IOUserClient_CopyClientMemoryForType_ID 0x8399bdb3d0b4f474ULL |
| 315 | #define IOUserClient_CreateMemoryDescriptorFromClient_ID 0xf2fa2faa5cc11191ULL |
| 316 | #define IOUserClient_CopyClientEntitlements_ID 0xcaf3bd8932c8486fULL |
| 317 | #define IOUserClient__ExternalMethod_ID 0xcfe0c99e739d92f9ULL |
| 318 | #define IOUserClient_KernelCompletion_ID 0xf609f134c9046444ULL |
| 319 | |
| 320 | #define IOUserClient_AsyncCompletion_Args \ |
| 321 | OSAction * action, \ |
| 322 | IOReturn status, \ |
| 323 | const unsigned long long * asyncData, \ |
| 324 | uint32_t asyncDataCount |
| 325 | |
| 326 | #define IOUserClient_CopyClientMemoryForType_Args \ |
| 327 | uint64_t type, \ |
| 328 | uint64_t * options, \ |
| 329 | IOMemoryDescriptor ** memory |
| 330 | |
| 331 | #define IOUserClient_CreateMemoryDescriptorFromClient_Args \ |
| 332 | uint64_t memoryDescriptorCreateOptions, \ |
| 333 | uint32_t segmentsCount, \ |
| 334 | const IOAddressSegment * segments, \ |
| 335 | IOMemoryDescriptor ** memory |
| 336 | |
| 337 | #define IOUserClient_CopyClientEntitlements_Args \ |
| 338 | OSDictionary ** entitlements |
| 339 | |
| 340 | #define IOUserClient__ExternalMethod_Args \ |
| 341 | uint64_t selector, \ |
| 342 | const unsigned long long * scalarInput, \ |
| 343 | uint32_t scalarInputCount, \ |
| 344 | OSData * structureInput, \ |
| 345 | IOMemoryDescriptor * structureInputDescriptor, \ |
| 346 | unsigned long long * scalarOutput, \ |
| 347 | uint32_t * scalarOutputCount, \ |
| 348 | uint64_t structureOutputMaximumSize, \ |
| 349 | OSData ** structureOutput, \ |
| 350 | IOMemoryDescriptor * structureOutputDescriptor, \ |
| 351 | OSAction * completion |
| 352 | |
| 353 | #define IOUserClient_KernelCompletion_Args \ |
| 354 | OSAction * action, \ |
| 355 | IOReturn status, \ |
| 356 | const unsigned long long * asyncData, \ |
| 357 | uint32_t asyncDataCount |
| 358 | |
| 359 | #define IOUserClient_Methods \ |
| 360 | \ |
| 361 | public:\ |
| 362 | \ |
| 363 | virtual kern_return_t\ |
| 364 | Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\ |
| 365 | \ |
| 366 | static kern_return_t\ |
| 367 | _Dispatch(IOUserClient * self, const IORPC rpc);\ |
| 368 | \ |
| 369 | void\ |
| 370 | AsyncCompletion(\ |
| 371 | OSAction * action,\ |
| 372 | IOReturn status,\ |
| 373 | const unsigned long long * asyncData,\ |
| 374 | uint32_t asyncDataCount,\ |
| 375 | OSDispatchMethod supermethod = NULL);\ |
| 376 | \ |
| 377 | kern_return_t\ |
| 378 | CopyClientMemoryForType(\ |
| 379 | uint64_t type,\ |
| 380 | uint64_t * options,\ |
| 381 | IOMemoryDescriptor ** memory,\ |
| 382 | OSDispatchMethod supermethod = NULL);\ |
| 383 | \ |
| 384 | kern_return_t\ |
| 385 | CreateMemoryDescriptorFromClient(\ |
| 386 | uint64_t memoryDescriptorCreateOptions,\ |
| 387 | uint32_t segmentsCount,\ |
| 388 | const IOAddressSegment * segments,\ |
| 389 | IOMemoryDescriptor ** memory,\ |
| 390 | OSDispatchMethod supermethod = NULL) __attribute__((availability(driverkit,introduced=20.0)));\ |
| 391 | \ |
| 392 | kern_return_t\ |
| 393 | CopyClientEntitlements(\ |
| 394 | OSDictionary ** entitlements,\ |
| 395 | OSDispatchMethod supermethod = NULL);\ |
| 396 | \ |
| 397 | kern_return_t\ |
| 398 | _ExternalMethod(\ |
| 399 | uint64_t selector,\ |
| 400 | const unsigned long long * scalarInput,\ |
| 401 | uint32_t scalarInputCount,\ |
| 402 | OSData * structureInput,\ |
| 403 | IOMemoryDescriptor * structureInputDescriptor,\ |
| 404 | unsigned long long * scalarOutput,\ |
| 405 | uint32_t * scalarOutputCount,\ |
| 406 | uint64_t structureOutputMaximumSize,\ |
| 407 | OSData ** structureOutput,\ |
| 408 | IOMemoryDescriptor * structureOutputDescriptor,\ |
| 409 | OSAction * completion,\ |
| 410 | OSDispatchMethod supermethod = NULL);\ |
| 411 | \ |
| 412 | kern_return_t\ |
| 413 | CreateActionKernelCompletion(size_t referenceSize, OSAction ** action);\ |
| 414 | \ |
| 415 | \ |
| 416 | protected:\ |
| 417 | /* _Impl methods */\ |
| 418 | \ |
| 419 | kern_return_t\ |
| 420 | CopyClientEntitlements_Impl(IOUserClient_CopyClientEntitlements_Args);\ |
| 421 | \ |
| 422 | kern_return_t\ |
| 423 | _ExternalMethod_Impl(IOUserClient__ExternalMethod_Args);\ |
| 424 | \ |
| 425 | \ |
| 426 | public:\ |
| 427 | /* _Invoke methods */\ |
| 428 | \ |
| 429 | typedef void (*AsyncCompletion_Handler)(OSMetaClassBase * target, IOUserClient_AsyncCompletion_Args);\ |
| 430 | static kern_return_t\ |
| 431 | AsyncCompletion_Invoke(const IORPC rpc,\ |
| 432 | OSMetaClassBase * target,\ |
| 433 | AsyncCompletion_Handler func,\ |
| 434 | const OSMetaClass * targetActionClass);\ |
| 435 | \ |
| 436 | static kern_return_t\ |
| 437 | AsyncCompletion_Invoke(const IORPC rpc,\ |
| 438 | OSMetaClassBase * target,\ |
| 439 | AsyncCompletion_Handler func);\ |
| 440 | \ |
| 441 | typedef kern_return_t (*CopyClientMemoryForType_Handler)(OSMetaClassBase * target, IOUserClient_CopyClientMemoryForType_Args);\ |
| 442 | static kern_return_t\ |
| 443 | CopyClientMemoryForType_Invoke(const IORPC rpc,\ |
| 444 | OSMetaClassBase * target,\ |
| 445 | CopyClientMemoryForType_Handler func);\ |
| 446 | \ |
| 447 | typedef kern_return_t (*CreateMemoryDescriptorFromClient_Handler)(OSMetaClassBase * target, IOUserClient_CreateMemoryDescriptorFromClient_Args);\ |
| 448 | static kern_return_t\ |
| 449 | CreateMemoryDescriptorFromClient_Invoke(const IORPC rpc,\ |
| 450 | OSMetaClassBase * target,\ |
| 451 | CreateMemoryDescriptorFromClient_Handler func);\ |
| 452 | \ |
| 453 | typedef kern_return_t (*CopyClientEntitlements_Handler)(OSMetaClassBase * target, IOUserClient_CopyClientEntitlements_Args);\ |
| 454 | static kern_return_t\ |
| 455 | CopyClientEntitlements_Invoke(const IORPC rpc,\ |
| 456 | OSMetaClassBase * target,\ |
| 457 | CopyClientEntitlements_Handler func);\ |
| 458 | \ |
| 459 | typedef kern_return_t (*_ExternalMethod_Handler)(OSMetaClassBase * target, IOUserClient__ExternalMethod_Args);\ |
| 460 | static kern_return_t\ |
| 461 | _ExternalMethod_Invoke(const IORPC rpc,\ |
| 462 | OSMetaClassBase * target,\ |
| 463 | _ExternalMethod_Handler func);\ |
| 464 | \ |
| 465 | |
| 466 | |
| 467 | #define IOUserClient_KernelMethods \ |
| 468 | \ |
| 469 | protected:\ |
| 470 | /* _Impl methods */\ |
| 471 | \ |
| 472 | kern_return_t\ |
| 473 | CreateMemoryDescriptorFromClient_Impl(IOUserClient_CreateMemoryDescriptorFromClient_Args);\ |
| 474 | \ |
| 475 | void\ |
| 476 | KernelCompletion_Impl(IOUserClient_KernelCompletion_Args);\ |
| 477 | \ |
| 478 | |
| 479 | |
| 480 | #define IOUserClient_VirtualMethods \ |
| 481 | \ |
| 482 | public:\ |
| 483 | \ |
| 484 | virtual bool\ |
| 485 | init(\ |
| 486 | ) APPLE_KEXT_OVERRIDE;\ |
| 487 | \ |
| 488 | virtual void\ |
| 489 | free(\ |
| 490 | ) APPLE_KEXT_OVERRIDE;\ |
| 491 | \ |
| 492 | virtual kern_return_t\ |
| 493 | ExternalMethod(\ |
| 494 | uint64_t selector,\ |
| 495 | IOUserClientMethodArguments * arguments,\ |
| 496 | const IOUserClientMethodDispatch * dispatch,\ |
| 497 | OSObject * target,\ |
| 498 | void * reference) APPLE_KEXT_OVERRIDE;\ |
| 499 | \ |
| 500 | |
| 501 | |
| 502 | #if !KERNEL |
| 503 | |
| 504 | extern OSMetaClass * gIOUserClientMetaClass; |
| 505 | extern const OSClassLoadInformation IOUserClient_Class; |
| 506 | |
| 507 | class IOUserClientMetaClass : public OSMetaClass |
| 508 | { |
| 509 | public: |
| 510 | virtual kern_return_t |
| 511 | New(OSObject * instance) override; |
| 512 | virtual kern_return_t |
| 513 | Dispatch(const IORPC rpc) override; |
| 514 | }; |
| 515 | |
| 516 | #endif /* !KERNEL */ |
| 517 | |
| 518 | #if !KERNEL |
| 519 | |
| 520 | class IOUserClientInterface : public OSInterface |
| 521 | { |
| 522 | public: |
| 523 | virtual kern_return_t |
| 524 | ExternalMethod(uint64_t selector, |
| 525 | IOUserClientMethodArguments * arguments, |
| 526 | const IOUserClientMethodDispatch * dispatch, |
| 527 | OSObject * target, |
| 528 | void * reference) = 0; |
| 529 | |
| 530 | kern_return_t |
| 531 | ExternalMethod_Call(uint64_t selector, |
| 532 | IOUserClientMethodArguments * arguments, |
| 533 | const IOUserClientMethodDispatch * dispatch, |
| 534 | OSObject * target, |
| 535 | void * reference) { return ExternalMethod(selector, arguments, dispatch, target, reference); };\ |
| 536 | |
| 537 | }; |
| 538 | |
| 539 | struct IOUserClient_IVars; |
| 540 | struct IOUserClient_LocalIVars; |
| 541 | |
| 542 | class IOUserClient : public IOService, public IOUserClientInterface |
| 543 | { |
| 544 | #if !KERNEL |
| 545 | friend class IOUserClientMetaClass; |
| 546 | #endif /* !KERNEL */ |
| 547 | |
| 548 | #if !KERNEL |
| 549 | public: |
| 550 | #ifdef IOUserClient_DECLARE_IVARS |
| 551 | IOUserClient_DECLARE_IVARS |
| 552 | #else /* IOUserClient_DECLARE_IVARS */ |
| 553 | union |
| 554 | { |
| 555 | IOUserClient_IVars * ivars; |
| 556 | IOUserClient_LocalIVars * lvars; |
| 557 | }; |
| 558 | #endif /* IOUserClient_DECLARE_IVARS */ |
| 559 | #endif /* !KERNEL */ |
| 560 | |
| 561 | #if !KERNEL |
| 562 | static OSMetaClass * |
| 563 | sGetMetaClass() { return gIOUserClientMetaClass; }; |
| 564 | #endif /* KERNEL */ |
| 565 | |
| 566 | using super = IOService; |
| 567 | |
| 568 | #if !KERNEL |
| 569 | IOUserClient_Methods |
| 570 | IOUserClient_VirtualMethods |
| 571 | #endif /* !KERNEL */ |
| 572 | |
| 573 | }; |
| 574 | #endif /* !KERNEL */ |
| 575 | |
| 576 | |
| 577 | #define OSAction_IOUserClient_KernelCompletion_Methods \ |
| 578 | \ |
| 579 | public:\ |
| 580 | \ |
| 581 | virtual kern_return_t\ |
| 582 | Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\ |
| 583 | \ |
| 584 | static kern_return_t\ |
| 585 | _Dispatch(OSAction_IOUserClient_KernelCompletion * self, const IORPC rpc);\ |
| 586 | \ |
| 587 | \ |
| 588 | protected:\ |
| 589 | /* _Impl methods */\ |
| 590 | \ |
| 591 | \ |
| 592 | public:\ |
| 593 | /* _Invoke methods */\ |
| 594 | \ |
| 595 | |
| 596 | |
| 597 | #define OSAction_IOUserClient_KernelCompletion_KernelMethods \ |
| 598 | \ |
| 599 | protected:\ |
| 600 | /* _Impl methods */\ |
| 601 | \ |
| 602 | |
| 603 | |
| 604 | #define OSAction_IOUserClient_KernelCompletion_VirtualMethods \ |
| 605 | \ |
| 606 | public:\ |
| 607 | \ |
| 608 | |
| 609 | |
| 610 | #if !KERNEL |
| 611 | |
| 612 | extern OSMetaClass * gOSAction_IOUserClient_KernelCompletionMetaClass; |
| 613 | extern const OSClassLoadInformation OSAction_IOUserClient_KernelCompletion_Class; |
| 614 | |
| 615 | class OSAction_IOUserClient_KernelCompletionMetaClass : public OSMetaClass |
| 616 | { |
| 617 | public: |
| 618 | virtual kern_return_t |
| 619 | New(OSObject * instance) override; |
| 620 | virtual kern_return_t |
| 621 | Dispatch(const IORPC rpc) override; |
| 622 | }; |
| 623 | |
| 624 | #endif /* !KERNEL */ |
| 625 | |
| 626 | class OSAction_IOUserClient_KernelCompletionInterface : public OSInterface |
| 627 | { |
| 628 | public: |
| 629 | }; |
| 630 | |
| 631 | struct OSAction_IOUserClient_KernelCompletion_IVars; |
| 632 | struct OSAction_IOUserClient_KernelCompletion_LocalIVars; |
| 633 | |
| 634 | class __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer" ))) OSAction_IOUserClient_KernelCompletion : public OSAction, public OSAction_IOUserClient_KernelCompletionInterface |
| 635 | { |
| 636 | #if KERNEL |
| 637 | OSDeclareDefaultStructorsWithDispatch(OSAction_IOUserClient_KernelCompletion); |
| 638 | #endif /* KERNEL */ |
| 639 | |
| 640 | #if !KERNEL |
| 641 | friend class OSAction_IOUserClient_KernelCompletionMetaClass; |
| 642 | #endif /* !KERNEL */ |
| 643 | |
| 644 | public: |
| 645 | #ifdef OSAction_IOUserClient_KernelCompletion_DECLARE_IVARS |
| 646 | OSAction_IOUserClient_KernelCompletion_DECLARE_IVARS |
| 647 | #else /* OSAction_IOUserClient_KernelCompletion_DECLARE_IVARS */ |
| 648 | union |
| 649 | { |
| 650 | OSAction_IOUserClient_KernelCompletion_IVars * ivars; |
| 651 | OSAction_IOUserClient_KernelCompletion_LocalIVars * lvars; |
| 652 | }; |
| 653 | #endif /* OSAction_IOUserClient_KernelCompletion_DECLARE_IVARS */ |
| 654 | #if !KERNEL |
| 655 | static OSMetaClass * |
| 656 | sGetMetaClass() { return gOSAction_IOUserClient_KernelCompletionMetaClass; }; |
| 657 | virtual const OSMetaClass * |
| 658 | getMetaClass() const APPLE_KEXT_OVERRIDE { return gOSAction_IOUserClient_KernelCompletionMetaClass; }; |
| 659 | #endif /* KERNEL */ |
| 660 | |
| 661 | using super = OSAction; |
| 662 | |
| 663 | #if !KERNEL |
| 664 | OSAction_IOUserClient_KernelCompletion_Methods |
| 665 | #endif /* !KERNEL */ |
| 666 | |
| 667 | OSAction_IOUserClient_KernelCompletion_VirtualMethods |
| 668 | }; |
| 669 | |
| 670 | #endif /* !__DOCUMENTATION__ */ |
| 671 | |
| 672 | /* IOUserClient.iig:302- */ |
| 673 | |
| 674 | #endif /* ! _IOKIT_UIOUSERCLIENT_H */ |
| 675 | |