1*c54f35caSApple OSS Distributions/* 2*c54f35caSApple OSS Distributions * Copyright (c) 2019-2019 Apple Inc. All rights reserved. 3*c54f35caSApple OSS Distributions * 4*c54f35caSApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*c54f35caSApple OSS Distributions * 6*c54f35caSApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*c54f35caSApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*c54f35caSApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*c54f35caSApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*c54f35caSApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*c54f35caSApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*c54f35caSApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*c54f35caSApple OSS Distributions * terms of an Apple operating system software license agreement. 14*c54f35caSApple OSS Distributions * 15*c54f35caSApple OSS Distributions * Please obtain a copy of the License at 16*c54f35caSApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*c54f35caSApple OSS Distributions * 18*c54f35caSApple OSS Distributions * The Original Code and all software distributed under the License are 19*c54f35caSApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*c54f35caSApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*c54f35caSApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*c54f35caSApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*c54f35caSApple OSS Distributions * Please see the License for the specific language governing rights and 24*c54f35caSApple OSS Distributions * limitations under the License. 25*c54f35caSApple OSS Distributions * 26*c54f35caSApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*c54f35caSApple OSS Distributions */ 28*c54f35caSApple OSS Distributions 29*c54f35caSApple OSS Distributions#if !__IIG 30*c54f35caSApple OSS Distributions#if KERNEL 31*c54f35caSApple OSS Distributions#include <libkern/c++/OSObject.h> 32*c54f35caSApple OSS Distributions#endif 33*c54f35caSApple OSS Distributions#endif 34*c54f35caSApple OSS Distributions 35*c54f35caSApple OSS Distributions#ifndef _IOKIT_UOSOBJECT_H 36*c54f35caSApple OSS Distributions#define _IOKIT_UOSOBJECT_H 37*c54f35caSApple OSS Distributions 38*c54f35caSApple OSS Distributions#if !KERNEL 39*c54f35caSApple OSS Distributions#include <stddef.h> 40*c54f35caSApple OSS Distributions#include <stdint.h> 41*c54f35caSApple OSS Distributions#include <DriverKit/IOReturn.h> 42*c54f35caSApple OSS Distributions#if DRIVERKIT_PRIVATE 43*c54f35caSApple OSS Distributions#include <mach/port.h> 44*c54f35caSApple OSS Distributions#endif /* DRIVERKIT_PRIVATE */ 45*c54f35caSApple OSS Distributions#if !__IIG 46*c54f35caSApple OSS Distributions#include <string.h> 47*c54f35caSApple OSS Distributions#include <DriverKit/OSMetaClass.h> 48*c54f35caSApple OSS Distributions#endif /* !__IIG */ 49*c54f35caSApple OSS Distributionsclass OSObject; 50*c54f35caSApple OSS Distributionstypedef OSObject * OSObjectPtr; 51*c54f35caSApple OSS Distributions#endif /* !KERNEL */ 52*c54f35caSApple OSS Distributions 53*c54f35caSApple OSS Distributions#if !__IIG_ATTRIBUTES_DEFINED__ 54*c54f35caSApple OSS Distributions 55*c54f35caSApple OSS Distributions#define __IIG_ATTRIBUTES_DEFINED__ 1 56*c54f35caSApple OSS Distributions 57*c54f35caSApple OSS Distributions#if __IIG || __DOCUMENTATION__ 58*c54f35caSApple OSS Distributions 59*c54f35caSApple OSS Distributions#define IIG_KERNEL __attribute__((annotate("kernel"))) 60*c54f35caSApple OSS Distributions#define IIG_NATIVE __attribute__((annotate("native"))) 61*c54f35caSApple OSS Distributions#define IIG_LOCAL __attribute__((annotate("local"))) 62*c54f35caSApple OSS Distributions#define IIG_LOCALONLY __attribute__((annotate("localonly"))) 63*c54f35caSApple OSS Distributions#define IIG_REMOTE __attribute__((annotate("remote"))) 64*c54f35caSApple OSS Distributions#define IIG_LOCALHOST __attribute__((annotate("localhost"))) 65*c54f35caSApple OSS Distributions#define IIG_INVOKEREPLY __attribute__((annotate("invokereply"))) 66*c54f35caSApple OSS Distributions#define IIG_REPLY __attribute__((annotate("reply"))) 67*c54f35caSApple OSS Distributions#define IIG_PORTMAKESEND __attribute__((annotate("MACH_MSG_TYPE_MAKE_SEND"))) 68*c54f35caSApple OSS Distributions#define IIG_PORTCOPYSEND __attribute__((annotate("MACH_MSG_TYPE_COPY_SEND"))) 69*c54f35caSApple OSS Distributions#define IIG_TARGET __attribute__((annotate("target"))) 70*c54f35caSApple OSS Distributions#define IIG_TYPE(p) __attribute__((annotate("type=" # p))) 71*c54f35caSApple OSS Distributions//#define IIG_ARRAY(maxcount) __attribute__((annotate(# maxcount), annotate("array"))) 72*c54f35caSApple OSS Distributions#define IIG_EXTENDS(cls) __attribute__((annotate("extends=" # cls))) 73*c54f35caSApple OSS Distributions//#define IIG_INTERFACE __attribute__((annotate("interface"))) 74*c54f35caSApple OSS Distributions//#define IIG_IMPLEMENTS(i) void __implements(i *); 75*c54f35caSApple OSS Distributions#define IIG_QUEUENAME(name) __attribute__((annotate("queuename=" # name))) 76*c54f35caSApple OSS Distributions#define IIG_SERIALIZABLE __attribute__((annotate("serializable"))) 77*c54f35caSApple OSS Distributions 78*c54f35caSApple OSS Distributions#if __IIG 79*c54f35caSApple OSS Distributions#define KERNEL IIG_KERNEL 80*c54f35caSApple OSS Distributions#endif /* __IIG */ 81*c54f35caSApple OSS Distributions#define NATIVE IIG_NATIVE 82*c54f35caSApple OSS Distributions#define LOCAL IIG_LOCAL 83*c54f35caSApple OSS Distributions#define LOCALONLY IIG_LOCALONLY 84*c54f35caSApple OSS Distributions#define REMOTE IIG_REMOTE 85*c54f35caSApple OSS Distributions#define LOCALHOST IIG_LOCALHOST 86*c54f35caSApple OSS Distributions#define INVOKEREPLY IIG_INVOKEREPLY 87*c54f35caSApple OSS Distributions#define REPLY IIG_REPLY 88*c54f35caSApple OSS Distributions#define PORTMAKESEND IIG_PORTMAKESEND 89*c54f35caSApple OSS Distributions#define PORTCOPYSEND IIG_PORTCOPYSEND 90*c54f35caSApple OSS Distributions#define TARGET IIG_TARGET 91*c54f35caSApple OSS Distributions#define TYPE(p) IIG_TYPE(p) 92*c54f35caSApple OSS Distributions//#define ARRAY(maxcount) IIG_ARRAY(maxcount) 93*c54f35caSApple OSS Distributions#define EXTENDS(cls) IIG_EXTENDS(cls) 94*c54f35caSApple OSS Distributions//#define INTERFACE IIG_INTERFACE 95*c54f35caSApple OSS Distributions//#define IMPLEMENTS(i) IIG_IMPLEMENTS(i) 96*c54f35caSApple OSS Distributions#define QUEUENAME(name) IIG_QUEUENAME(name) 97*c54f35caSApple OSS Distributions 98*c54f35caSApple OSS Distributions#else /* __IIG || __DOCUMENTATION__ */ 99*c54f35caSApple OSS Distributions 100*c54f35caSApple OSS Distributions#define IIG_KERNEL 101*c54f35caSApple OSS Distributions#define IIG_NATIVE 102*c54f35caSApple OSS Distributions#define IIG_LOCAL 103*c54f35caSApple OSS Distributions#define IIG_LOCALONLY 104*c54f35caSApple OSS Distributions#define IIG_REMOTE 105*c54f35caSApple OSS Distributions#define IIG_LOCALHOST 106*c54f35caSApple OSS Distributions#define IIG_INVOKEREPLY 107*c54f35caSApple OSS Distributions#define IIG_REPLY 108*c54f35caSApple OSS Distributions#define IIG_PORTMAKESEND 109*c54f35caSApple OSS Distributions#define IIG_PORTCOPYSEND 110*c54f35caSApple OSS Distributions#define IIG_TARGET 111*c54f35caSApple OSS Distributions#define IIG_TYPE(p) 112*c54f35caSApple OSS Distributions//#define IIG_ARRAY(maxcount) 113*c54f35caSApple OSS Distributions#define IIG_EXTENDS(cls) 114*c54f35caSApple OSS Distributions//#define IIG_INTERFACE 115*c54f35caSApple OSS Distributions//#define IIG_IMPLEMENTS(i) 116*c54f35caSApple OSS Distributions#define IIG_QUEUENAME(name) 117*c54f35caSApple OSS Distributions#define IIG_SERIALIZABLE 118*c54f35caSApple OSS Distributions 119*c54f35caSApple OSS Distributions#endif /* __IIG || __DOCUMENTATION__ */ 120*c54f35caSApple OSS Distributions 121*c54f35caSApple OSS Distributions#endif /* __IIG_ATTRIBUTES_DEFINED__ */ 122*c54f35caSApple OSS Distributions 123*c54f35caSApple OSS Distributions 124*c54f35caSApple OSS Distributions#if !__IIG 125*c54f35caSApple OSS Distributions#if KERNEL 126*c54f35caSApple OSS Distributionstypedef OSObject OSContainer; 127*c54f35caSApple OSS Distributions#else /* KERNEL */ 128*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSContainer; 129*c54f35caSApple OSS Distributions#endif /* KERNEL */ 130*c54f35caSApple OSS Distributions#else /* !__IIG */ 131*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSContainer; 132*c54f35caSApple OSS Distributions#endif /* !__IIG */ 133*c54f35caSApple OSS Distributions 134*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSData; 135*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSNumber; 136*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSString; 137*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSBoolean; 138*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSDictionary; 139*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSArray; 140*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSSet; 141*c54f35caSApple OSS Distributionsclass IIG_SERIALIZABLE OSOrderedSet; 142*c54f35caSApple OSS Distributions 143*c54f35caSApple OSS Distributionsclass OSMetaClass; 144*c54f35caSApple OSS Distributionsclass IODispatchQueue; 145*c54f35caSApple OSS Distributionstypedef char IODispatchQueueName[256]; 146*c54f35caSApple OSS Distributions 147*c54f35caSApple OSS Distributions#if __IIG 148*c54f35caSApple OSS Distributionsclass OSMetaClassBase 149*c54f35caSApple OSS Distributions{ 150*c54f35caSApple OSS Distributions virtual const OSMetaClass * 151*c54f35caSApple OSS Distributions getMetaClass() const LOCALONLY; 152*c54f35caSApple OSS Distributions 153*c54f35caSApple OSS Distributions virtual void 154*c54f35caSApple OSS Distributions retain() const LOCALONLY; 155*c54f35caSApple OSS Distributions 156*c54f35caSApple OSS Distributions virtual void 157*c54f35caSApple OSS Distributions release() const LOCALONLY; 158*c54f35caSApple OSS Distributions 159*c54f35caSApple OSS Distributions virtual bool 160*c54f35caSApple OSS Distributions isEqualTo(const OSMetaClassBase * anObject) const LOCALONLY; 161*c54f35caSApple OSS Distributions}; 162*c54f35caSApple OSS Distributions#endif /* __IIG */ 163*c54f35caSApple OSS Distributions 164*c54f35caSApple OSS Distributions 165*c54f35caSApple OSS Distributions/*! 166*c54f35caSApple OSS Distributions@iig implementation 167*c54f35caSApple OSS Distributions#include <DriverKit/IODispatchQueue.h> 168*c54f35caSApple OSS Distributions@iig end 169*c54f35caSApple OSS Distributions*/ 170*c54f35caSApple OSS Distributions 171*c54f35caSApple OSS Distributionsclass OSObject : public OSMetaClassBase 172*c54f35caSApple OSS Distributions{ 173*c54f35caSApple OSS Distributionspublic: 174*c54f35caSApple OSS Distributions 175*c54f35caSApple OSS Distributions virtual bool 176*c54f35caSApple OSS Distributions init() LOCALONLY; 177*c54f35caSApple OSS Distributions 178*c54f35caSApple OSS Distributions virtual void 179*c54f35caSApple OSS Distributions free() LOCALONLY; 180*c54f35caSApple OSS Distributions 181*c54f35caSApple OSS Distributions virtual void 182*c54f35caSApple OSS Distributions retain() const override; 183*c54f35caSApple OSS Distributions 184*c54f35caSApple OSS Distributions virtual void 185*c54f35caSApple OSS Distributions release() const override; 186*c54f35caSApple OSS Distributions 187*c54f35caSApple OSS Distributions virtual kern_return_t 188*c54f35caSApple OSS Distributions SetDispatchQueue( 189*c54f35caSApple OSS Distributions const IODispatchQueueName name, 190*c54f35caSApple OSS Distributions IODispatchQueue * queue) KERNEL = 0; 191*c54f35caSApple OSS Distributions 192*c54f35caSApple OSS Distributions virtual kern_return_t 193*c54f35caSApple OSS Distributions CopyDispatchQueue( 194*c54f35caSApple OSS Distributions const IODispatchQueueName name, 195*c54f35caSApple OSS Distributions IODispatchQueue ** queue) KERNEL = 0; 196*c54f35caSApple OSS Distributions}; 197*c54f35caSApple OSS Distributions 198*c54f35caSApple OSS Distributions#define DEFN(classname, name) \ 199*c54f35caSApple OSS Distributionsname ## _Impl(classname ## _ ## name ## _Args) 200*c54f35caSApple OSS Distributions 201*c54f35caSApple OSS Distributions/* 202*c54f35caSApple OSS Distributions * Use of the IMPL macro is discouraged and should be replaced by a normal c++ 203*c54f35caSApple OSS Distributions * method implementation (with the all method arguments) and the name of the method 204*c54f35caSApple OSS Distributions * given a suffix '_Impl' 205*c54f35caSApple OSS Distributions */ 206*c54f35caSApple OSS Distributions 207*c54f35caSApple OSS Distributions#define IMPL(classname, name) \ 208*c54f35caSApple OSS Distributionsclassname :: DEFN(classname, name) 209*c54f35caSApple OSS Distributions 210*c54f35caSApple OSS Distributions/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 211*c54f35caSApple OSS Distributions 212*c54f35caSApple OSS Distributions#endif /* ! _IOKIT_UOSOBJECT_H */ 213