1/* 2 * Copyright (c) 1998-2007 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#import <IOKit/firewire/IOFireWireFamilyCommon.h> 24 25#import "IOFireWireLibIUnknown.h" 26#import "IOFireWireLib.h" 27#import "IOFireWireLibPriv.h" 28 29namespace IOFireWireLib 30{ 31 class Device; 32 33 class PHYPacketListener : public IOFireWireIUnknown 34 { 35 protected: 36 37 static IOFireWireLibPHYPacketListenerInterface sInterface; 38 39 Device & mUserClient; 40 UserObjectHandle mKernelRef; 41 UInt32 mQueueCount; 42 void * mRefCon; 43 44 IOFireWireLibPHYPacketCallback mCallback; 45 IOFireWireLibPHYPacketSkippedCallback mSkippedCallback; 46 UInt32 mFlags; 47 Boolean mNotifyIsOn; 48 49 public: 50 PHYPacketListener( Device& userClient, UInt32 queue_count ); 51 52 virtual ~PHYPacketListener( ); 53 54 static IUnknownVTbl** Alloc( Device& userclient, UInt32 queue_count ); 55 56 virtual HRESULT QueryInterface( REFIID iid, LPVOID* ppv ); 57 58 protected: 59 inline PHYPacketListener * GetThis( IOFireWireLibPHYPacketListenerRef self ) 60 { return IOFireWireIUnknown::InterfaceMap<PHYPacketListener>::GetThis( self ); } 61 62 static void SSetRefCon( IOFireWireLibPHYPacketListenerRef self, void * refCon ); 63 64 static void * SGetRefCon( IOFireWireLibPHYPacketListenerRef self ); 65 66 static void SSetListenerCallback( IOFireWireLibPHYPacketListenerRef self, 67 IOFireWireLibPHYPacketCallback callback ); 68 69 static void SSetSkippedPacketCallback( IOFireWireLibPHYPacketListenerRef self, 70 IOFireWireLibPHYPacketSkippedCallback callback ); 71 72 static Boolean SNotificationIsOn( IOFireWireLibPHYPacketListenerRef self ); 73 74 static IOReturn STurnOnNotification( IOFireWireLibPHYPacketListenerRef self ); 75 IOReturn TurnOnNotification( IOFireWireLibPHYPacketListenerRef self ); 76 77 static void STurnOffNotification( IOFireWireLibPHYPacketListenerRef self ); 78 void TurnOffNotification( IOFireWireLibPHYPacketListenerRef self ); 79 80 static void SClientCommandIsComplete( IOFireWireLibPHYPacketListenerRef self, 81 FWClientCommandID commandID ); 82 83 static void SSetFlags( IOFireWireLibPHYPacketListenerRef self, 84 UInt32 flags ); 85 86 static UInt32 SGetFlags( IOFireWireLibPHYPacketListenerRef self ); 87 88 static void SListenerCallback( IOFireWireLibPHYPacketListenerRef self, IOReturn result, void ** args, int numArgs ); 89 static void SSkippedCallback( IOFireWireLibPHYPacketListenerRef self, IOReturn result, void ** args, int numArgs ); 90 91 }; 92 93}