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_IOFIREWIRESBP2LIBLOGIN_H_ 24#define _IOKIT_IOFIREWIRESBP2LIBLOGIN_H_ 25 26#include "IOFireWireSBP2LibLUN.h" 27#include "IOFireWireSBP2UserClientCommon.h" 28 29class IOFireWireSBP2LibLogin 30{ 31 32public: 33 34 struct InterfaceMap 35 { 36 IUnknownVTbl *pseudoVTable; 37 IOFireWireSBP2LibLogin *obj; 38 }; 39 40 IOFireWireSBP2LibLogin( void ); 41 virtual ~IOFireWireSBP2LibLogin(); 42 43 virtual IOReturn init( io_connect_t connection, mach_port_t asyncPort ); 44 45protected: 46 47 ////////////////////////////////////// 48 // cf plugin interfaces 49 50 static IOFireWireSBP2LibLoginInterface sIOFireWireSBP2LibLoginInterface; 51 InterfaceMap fIOFireWireSBP2LibLoginInterface; 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 fLoginRef; // reference to kernel login object 64 65 IOFWSBP2LoginCallback fLoginCallbackRoutine; 66 void * fLoginCallbackRefCon; 67 68 IOFWSBP2LogoutCallback fLogoutCallbackRoutine; 69 void * fLogoutCallbackRefCon; 70 71 IOFWSBP2NotifyCallback fUnsolicitedStatusNotifyRoutine; 72 void * fUnsolicitedStatusNotifyRefCon; 73 74 IOFWSBP2NotifyCallback fStatusNotifyRoutine; 75 void * fStatusNotifyRefCon; 76 77 IOFWSBP2StatusCallback fFetchAgentResetCallback; 78 void * fFetchAgentResetRefCon; 79 80 IOFWSBP2FetchAgentWriteCallback fFetchAgentWriteCallback; 81 void * fFetchAgentWriteRefCon; 82 83 void * fRefCon; 84 85 ////////////////////////////////////// 86 // IUnknown static methods 87 88 static HRESULT staticQueryInterface( void * self, REFIID iid, void **ppv ); 89 virtual HRESULT queryInterface( REFIID iid, void **ppv ); 90 91 static UInt32 staticAddRef( void * self ); 92 virtual UInt32 addRef( void ); 93 94 static UInt32 staticRelease( void * self ); 95 virtual UInt32 release( void ); 96 97 ////////////////////////////////////// 98 // IOFireWireSBP2Login static methods 99 100 static IOReturn staticSubmitLogin( void * self ); 101 virtual IOReturn submitLogin( void ); 102 103 static IOReturn staticSubmitLogout( void * self ); 104 virtual IOReturn submitLogout( void ); 105 106 static void staticSetLoginFlags( void * self, UInt32 flags ); 107 virtual void setLoginFlags( UInt32 flags ); 108 109 static void staticSetLoginCallback( void * self, void * refCon, IOFWSBP2LoginCallback callback ); 110 virtual void setLoginCallback( void * refCon, IOFWSBP2LoginCallback callback ); 111 112 static void staticSetLogoutCallback( void * self, void * refCon, IOFWSBP2LogoutCallback callback ); 113 virtual void setLogoutCallback( void * refCon, IOFWSBP2LogoutCallback callback ); 114 115 static void staticSetRefCon( void * self, void * refCon ); 116 virtual void setRefCon( void * refCon ); 117 118 static void * staticGetRefCon( void * self ); 119 virtual void * getRefCon( void ); 120 121 static UInt32 staticGetMaxCommandBlockSize( void * self ); 122 virtual UInt32 getMaxCommandBlockSize( void ); 123 124 static UInt32 staticGetLoginID( void * self ); 125 virtual UInt32 getLoginID( void ); 126 127 static void staticSetMaxPayloadSize( void * self, UInt32 size ); 128 virtual void setMaxPayloadSize( UInt32 size ); 129 130 static void staticSetReconnectTime( void * self, UInt32 time ); 131 virtual void setReconnectTime( UInt32 time ); 132 133 static IUnknownVTbl ** staticCreateORB( void * self, REFIID iid ); 134 virtual IUnknownVTbl ** createORB( REFIID iid ); 135 136 static IOReturn staticSubmitORB( void * self, IOFireWireSBP2LibORBInterface ** orb ); 137 virtual IOReturn submitORB( IOFireWireSBP2LibORBInterface ** orb ); 138 139 static void staticSetUnsolicitedStatusNotify( void * self, void * refCon, IOFWSBP2NotifyCallback callback ); 140 virtual void setUnsolicitedStatusNotify( void * refCon, IOFWSBP2NotifyCallback callback ); 141 142 static void staticSetStatusNotify( void * self, void * refCon, IOFWSBP2NotifyCallback callback ); 143 virtual void setStatusNotify( void * refCon, IOFWSBP2NotifyCallback callback ); 144 145 static void staticSetFetchAgentResetCallback( void * self, void * refCon, IOFWSBP2StatusCallback callback ); 146 virtual void setFetchAgentResetCallback( void * refCon, IOFWSBP2StatusCallback callback ); 147 148 static IOReturn staticSubmitFetchAgentReset( void * self ); 149 virtual IOReturn submitFetchAgentReset( void ); 150 151 static void staticSetFetchAgentWriteCallback( void * self, void * refCon, IOFWSBP2FetchAgentWriteCallback callback ); 152 virtual void setFetchAgentWriteCallback( void * refCon, IOFWSBP2FetchAgentWriteCallback callback ); 153 154 static IOReturn staticRingDoorbell( void * self ); 155 virtual IOReturn ringDoorbell( void ); 156 157 static IOReturn staticEnableUnsolicitedStatus( void * self ); 158 virtual IOReturn enableUnsolicitedStatus( void ); 159 160 static IOReturn staticSetBusyTimeoutRegisterValue( void * self, UInt32 timeout ); 161 virtual IOReturn setBusyTimeoutRegisterValue( UInt32 timeout ); 162 163 static IOReturn staticSetPassword( void * self, void * buffer, UInt32 length ); 164 virtual IOReturn setPassword( void * buffer, UInt32 length ); 165 166 ////////////////////////////////////// 167 // callback static methods 168 169 static void staticLoginCompletion( void *refcon, IOReturn result, io_user_reference_t *args, int numArgs ); 170 virtual void loginCompletion( IOReturn result, io_user_reference_t *args, int numArgs ); 171 172 static void staticLogoutCompletion( void *refcon, IOReturn result, io_user_reference_t *args, int numArgs ); 173 virtual void logoutCompletion( IOReturn result, io_user_reference_t *args, int numArgs ); 174 175 static void staticUnsolicitedStatusNotify( void *refcon, IOReturn result, io_user_reference_t *args, int numArgs ); 176 virtual void unsolicitedStatusNotify( IOReturn result, io_user_reference_t *args, int numArgs ); 177 178 static void staticStatusNotify( void *refcon, IOReturn result, io_user_reference_t *args, int numArgs ); 179 virtual void statusNotify( IOReturn result, io_user_reference_t *args, int numArgs ); 180 181 static void staticFetchAgentResetCompletion( void *refcon, IOReturn result, io_user_reference_t *args, int numArgs ); 182 virtual void fetchAgentResetCompletion( IOReturn result, io_user_reference_t *args, int numArgs ); 183 184 static void staticFetchAgentWriteCompletion( void *refcon, IOReturn result, io_user_reference_t *args, int numArgs ); 185 virtual void fetchAgentWriteCompletion( IOReturn result, io_user_reference_t *args, int numArgs ); 186 187public: 188 189 // utility function to get "this" pointer from interface 190 static inline IOFireWireSBP2LibLogin *getThis( void *self ) 191 { return (IOFireWireSBP2LibLogin *) ((InterfaceMap *) self)->obj; }; 192 193 static IUnknownVTbl **alloc( io_connect_t connection, mach_port_t asyncPort ); 194 195 virtual UInt32 getLoginRef( void ); 196 197}; 198#endif 199