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