1/* 2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * The contents of this file constitute Original Code as defined in and 7 * are subject to the Apple Public Source License Version 1.1 (the 8 * "License"). You may not use this file except in compliance with the 9 * License. Please obtain a copy of the License at 10 * http://www.apple.com/publicsource and read it before using this file. 11 * 12 * This Original Code and all software distributed under the License are 13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the 17 * License for the specific language governing rights and limitations 18 * under the License. 19 * 20 * @APPLE_LICENSE_HEADER_END@ 21 */ 22 23#ifndef _IOKIT_IOFIREWIRESBP2LIBMGMTORB_H_ 24#define _IOKIT_IOFIREWIRESBP2LIBMGMTORB_H_ 25 26#include "IOFireWireSBP2LibLUN.h" 27#include "IOFireWireSBP2UserClientCommon.h" 28 29class IOFireWireSBP2LibMgmtORB 30{ 31 32public: 33 34 struct InterfaceMap 35 { 36 IUnknownVTbl *pseudoVTable; 37 IOFireWireSBP2LibMgmtORB *obj; 38 }; 39 40 IOFireWireSBP2LibMgmtORB( void ); 41 virtual ~IOFireWireSBP2LibMgmtORB(); 42 43 virtual IOReturn init( io_connect_t connection, mach_port_t asyncPort ); 44 45protected: 46 47 ////////////////////////////////////// 48 // cf plugin interfaces 49 50 static IOFireWireSBP2LibMgmtORBInterface sIOFireWireSBP2LibMgmtORBInterface; 51 InterfaceMap fIOFireWireSBP2LibMgmtORBInterface; 52 53 ////////////////////////////////////// 54 // cf plugin ref counting 55 56 UInt32 fRefCount; 57 58 ////////////////////////////////////// 59 // user client connection 60 61 io_connect_t fConnection; // connection to user client in kernel 62 mach_port_t fAsyncPort; // async port for callback from kernel 63 uint64_t fMgmtORBRef; // reference to kernel orb object 64 65 IOFWSBP2ORBAppendCallback fORBCallbackRoutine; 66 void * fORBCallbackRefCon; 67 68 void * fRefCon; 69 70 // utility function to get "this" pointer from interface 71 static inline IOFireWireSBP2LibMgmtORB *getThis( void *self ) 72 { return (IOFireWireSBP2LibMgmtORB *) ((InterfaceMap *) self)->obj; }; 73 74 ////////////////////////////////////// 75 // IUnknown static methods 76 77 static HRESULT staticQueryInterface( void * self, REFIID iid, void **ppv ); 78 virtual HRESULT queryInterface( REFIID iid, void **ppv ); 79 80 static UInt32 staticAddRef( void * self ); 81 virtual UInt32 addRef( void ); 82 83 static UInt32 staticRelease( void * self ); 84 virtual UInt32 release( void ); 85 86 ////////////////////////////////////// 87 // IOFireWireSBP2LibMgmtORB static methods 88 static IOReturn staticSubmitORB( void * self ); 89 virtual IOReturn submitORB( void ); 90 91 static void staticSetORBCallback( void * self, void * refCon, 92 IOFWSBP2ORBAppendCallback callback ); 93 virtual void setORBCallback( void * refCon, IOFWSBP2ORBAppendCallback callback ); 94 95 static void staticSetRefCon( void * self, void * refCon ); 96 virtual void setRefCon( void * refCon ); 97 98 static void * staticGetRefCon( void * self ); 99 virtual void * getRefCon( void ); 100 101 static IOReturn staticSetCommandFunction( void * self, UInt32 function ); 102 virtual IOReturn setCommandFunction( UInt32 function ); 103 104 static IOReturn staticSetManageeORB( void * self, void * orb ); 105 virtual IOReturn setManageeORB( void * orb ); 106 107 static IOReturn staticSetManageeLogin( void * self, void * login ); 108 virtual IOReturn setManageeLogin( void * login ); 109 110 static IOReturn staticSetResponseBuffer( void * self, void * buf, UInt32 len ); 111 virtual IOReturn setResponseBuffer( void * buf, UInt32 len ); 112 113 ////////////////////////////////////// 114 // callback static methods 115 116 static void staticORBCompletion( void *refcon, IOReturn result, io_user_reference_t *args, int numArgs ); 117 virtual void ORBCompletion( IOReturn result, io_user_reference_t *args, int numArgs ); 118 119public: 120 121 static IUnknownVTbl **alloc( io_connect_t connection, mach_port_t asyncPort ); 122 123}; 124#endif 125