Esempio n. 1
0
IOFireWireSBP2LibLUN::IOFireWireSBP2LibLUN( void )
{
    // init cf plugin ref counting
    fRefCount = 0;

    // init user client connection
    fConnection = MACH_PORT_NULL;
    fService = MACH_PORT_NULL;

    // init async callbacks
    fAsyncPort = MACH_PORT_NULL;
    fCFAsyncPort = NULL;
    fCFRunLoopSource = NULL;
    fMessageCallbackRoutine = NULL;
    fMessageCallbackRefCon = NULL;

    // create plugin interface map
    fIOCFPlugInInterface.pseudoVTable = (IUnknownVTbl *) &sIOCFPlugInInterface;
    fIOCFPlugInInterface.obj = this;

    // create test driver interface map
    fIOFireWireSBP2LibLUNInterface.pseudoVTable
        = (IUnknownVTbl *) &sIOFireWireSBP2LibLUNInterface;
    fIOFireWireSBP2LibLUNInterface.obj = this;

    fFactoryId = kIOFireWireSBP2LibFactoryID;
    CFRetain( fFactoryId );
    CFPlugInAddInstanceForFactory( fFactoryId );
}
Esempio n. 2
0
HP_HardwarePlugIn::HP_HardwarePlugIn(CFUUIDRef inFactoryUUID)
:
	HP_Object(kAudioObjectUnknown, kAudioPlugInClassID, this),
	mInterface(&sInterface),
	mFactoryUUID((CFUUIDRef)CFRetain(inFactoryUUID)),
	mRefCount(0)
{
	CFPlugInAddInstanceForFactory(inFactoryUUID);
}
void IOHIDIUnknown::factoryAddRef()
{
    if (0 == factoryRefCount++) {
        CFUUIDRef factoryId = kIOHIDDeviceFactoryID;

        CFRetain(factoryId);
        CFPlugInAddInstanceForFactory(factoryId);
    }
}
void
SATSMARTClient::sFactoryAddRef ( void )
{

    if ( sFactoryRefCount++ == 0 )
    {

        CFUUIDRef factoryID = kIOATASMARTLibFactoryID;

        CFRetain ( factoryID );
        CFPlugInAddInstanceForFactory ( factoryID );

    }

}
Esempio n. 5
0
File: Main.c Progetto: stesla/koan
MetadataImporterPluginType *
AllocMetadataImporterPluginType (CFUUIDRef inFactoryID)
{
    MetadataImporterPluginType *newInstance = (MetadataImporterPluginType *) malloc (sizeof (MetadataImporterPluginType));
    memset (newInstance, 0, sizeof (MetadataImporterPluginType));

    newInstance->conduitInterface = &testInterfaceFunctionTable;

    // Retain and keep an open instance refcount for each factory.
    newInstance->factoryID = CFRetain (inFactoryID);
    CFPlugInAddInstanceForFactory (inFactoryID);

    // This function returns the IUnknown interface so set the refCount to one.
    newInstance->refCount = 1;
    return newInstance;
}
Esempio n. 6
0
// -----------------------------------------------------------------------------
//	AllocMetadataImporterPluginType
// -----------------------------------------------------------------------------
//	Utility function that allocates a new instance.
//      You can do some initial setup for the importer here if you wish
//      like allocating globals etc...
//
MetadataImporterPluginType *AllocMetadataImporterPluginType(CFUUIDRef inFactoryID)
{
    MetadataImporterPluginType *theNewInstance;

    theNewInstance = (MetadataImporterPluginType *)malloc(sizeof(MetadataImporterPluginType));
    memset(theNewInstance,0,sizeof(MetadataImporterPluginType));

        /* Point to the function table */
    theNewInstance->conduitInterface = &testInterfaceFtbl;

        /*  Retain and keep an open instance refcount for each factory. */
    theNewInstance->factoryID = CFRetain(inFactoryID);
    CFPlugInAddInstanceForFactory(inFactoryID);

        /* This function returns the IUnknown interface so set the refCount to one. */
    theNewInstance->refCount = 1;
    return theNewInstance;
}
Esempio n. 7
0
// -----------------------------------------------------------------------------
//    AllocQuickLookGeneratorPluginType
// -----------------------------------------------------------------------------
//    Utility function that allocates a new instance.
//      You can do some initial setup for the generator here if you wish
//      like allocating globals etc...
//
QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID)
{
    QuickLookGeneratorPluginType *theNewInstance;

    theNewInstance = (QuickLookGeneratorPluginType *)malloc(sizeof(QuickLookGeneratorPluginType));
    memset(theNewInstance,0,sizeof(QuickLookGeneratorPluginType));

    /* Point to the function table Malloc enough to store the stuff and copy the filler from myInterfaceFtbl over */
    theNewInstance->conduitInterface = malloc(sizeof(QLGeneratorInterfaceStruct));
    memcpy(theNewInstance->conduitInterface,&myInterfaceFtbl,sizeof(QLGeneratorInterfaceStruct));

    /*  Retain and keep an open instance refcount for each factory. */
    theNewInstance->factoryID = CFRetain(inFactoryID);
    CFPlugInAddInstanceForFactory(inFactoryID);

    /* This function returns the IUnknown interface so set the refCount to one. */
    theNewInstance->refCount = 1;
    return theNewInstance;
}
Esempio n. 8
0
static CFPlugType *_allocCFPlugType(CFUUIDRef factoryID)
{
	//  Allocate memory for the new instance.
	CFPlugType *newOne = (CFPlugType *)malloc(sizeof(CFPlugType));
	
	//  Point to the function table
	newOne->_PPROCFPlugFormat = &CFPlugFormat;
	
	//  Retain and keep an open instance refcount for each factory.
	if (factoryID) {
		newOne->_factoryID = (CFUUIDRef)CFRetain(factoryID);
		CFPlugInAddInstanceForFactory(factoryID);
	}
	
	//  This function returns the IUnknown interface so set the refCount to one.
	
	newOne->_refCount = 1;
	return newOne;
}
//------------------------------------------------------------------------------
// IOHIDEventSystemStatistics::IOHIDEventSystemStatistics
//------------------------------------------------------------------------------
IOHIDEventSystemStatistics::IOHIDEventSystemStatistics(CFUUIDRef factoryID)
:
_sessionInterface(&sIOHIDEventSystemStatisticsFtbl),
_factoryID( static_cast<CFUUIDRef>( CFRetain(factoryID) ) ),
_refCount(1),
_displayState(1),
_displayToken(0),
_pending_source(0),
_dispatch_queue(0),
_last_motionstat_ts(0),
_logButtonFiltering(false),
_logStrings(NULL),
_logfd(-1),
_asl(NULL)
{
    bzero(&_pending_buttons, sizeof(_pending_buttons));
    bzero(&_pending_motionstats, sizeof(_pending_motionstats));
    CFPlugInAddInstanceForFactory( factoryID );
}
Esempio n. 10
0
    // Utility function that allocates a new instance.
    static MyType *_allocMyType(CFUUIDRef factoryID) {
#if PRINTDEBUG
        printf("JAS: _allocMyType\n");
#endif

        // Allocate memory for the new instance.
        MyType *newOne = (MyType *)malloc( sizeof(MyType) );

        // Point to the function table
        newOne->_testInterface = &testInterfaceFtbl;

        // Retain and keep an open instance refcount
        // for each factory.
        newOne->_factoryID = (CFUUIDRef)CFRetain( factoryID );
        CFPlugInAddInstanceForFactory( factoryID );

        // This function returns the IUnknown interface
        // so set the refCount to one.
        newOne->_refCount = 1;
        return newOne;
    }
/*****************************************************************************
* Alloc
* -
* Functionas as both +[alloc] and -[init] for the plugin. Add any
* initalization of member variables here.
*****************************************************************************/
static BonjourUserEventsPlugin* Alloc(CFUUIDRef factoryID)
{
    BonjourUserEventsPlugin* plugin = malloc(sizeof(BonjourUserEventsPlugin));

    plugin->_UserEventAgentInterface = &UserEventAgentInterfaceFtbl;
    plugin->_pluginContext = NULL;

    if (factoryID)
    {
        plugin->_factoryID = (CFUUIDRef)CFRetain(factoryID);
        CFPlugInAddInstanceForFactory(factoryID);
    }

    plugin->_refCount = 1;
    plugin->_tokenToBrowserMap = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kNetBrowserInfoDictionaryValueCallbacks);
    plugin->_browsers = CFDictionaryCreateMutable(NULL, 0, &kNetBrowserInfoDictionaryKeyCallbacks, &kCFTypeDictionaryValueCallBacks);
    plugin->_onAddEvents = CFDictionaryCreateMutable(NULL, 0, &kNetBrowserInfoDictionaryKeyCallbacks, &kCFTypeDictionaryValueCallBacks);
    plugin->_onRemoveEvents = CFDictionaryCreateMutable(NULL, 0, &kNetBrowserInfoDictionaryKeyCallbacks, &kCFTypeDictionaryValueCallBacks);

    return plugin;
}
Esempio n. 12
0
// -----------------------------------------------------------------------------
//	AllocSampleCMPluginType
// -----------------------------------------------------------------------------
//	Utility function that allocates a new instance.
//
static SampleCMPluginType* AllocSampleCMPluginType(
		CFUUIDRef		inFactoryID )
{
	
	// Allocate memory for the new instance.
	SampleCMPluginType *theNewInstance;
	theNewInstance = ( SampleCMPluginType* ) malloc(
			sizeof( SampleCMPluginType ) );

	// Point to the function table
	theNewInstance->cmInterface = &testInterfaceFtbl;

	// Retain and keep an open instance refcount<
	// for each factory.
	theNewInstance->factoryID = CFRetain( inFactoryID );
	CFPlugInAddInstanceForFactory( inFactoryID );

	// This function returns the IUnknown interface
	// so set the refCount to one.
	theNewInstance->refCount = 1;
	return theNewInstance;
}
Esempio n. 13
0
/* =============================================================================

    Name:	PrintDialogPDEPluginFactory()

    Description:
		This is the factory function which should be the only entry point of
		this plugin. This factory function creates the "base class" for the system.
		The factory functions name (ie "PrintDialogPDEPluginFactory") needs to be
		listed in the Info.plist to associate the factory function name
		with the factory function UUID. For example, this is how this function
		is associated with the UUID in the Info.plist file.

		CFPlugInFactories =
		{
       	 	"DFC01D58-0C4A-11D5-BB77-003065500EB8" = "PrintDialogPDEPluginFactory";
    	};

    Input Parameters:
        allocator	- the allocator function used by CoreFoundation
        reqTypeID	- requested instance type.

    Output Parameters:
        None.

    Return Value:


 * ========================================================================== */
void* PrintDialogPDEPluginFactory( CFAllocatorRef allocator, CFUUIDRef reqTypeID )
{
    CFUUIDRef			myInstID;
    IUnknownInstance*	instance = NULL;

    // There is not much we can do with errors - just return NULL.
    myInstID = CFUUIDCreateFromString(kCFAllocatorDefault, kAppPrintDialogTypeIDStr);
    // If the requested type matches our plugin type (it should!)
    // have a plugin instance created which will query us for
    // interfaces:
    if (myInstID && CFEqual(reqTypeID, myInstID))
    {
        CFUUIDRef myFactoryID = CFUUIDCreateFromString(kCFAllocatorDefault, kPrintDialogPDEIntfFactoryIDStr);
        if(myFactoryID) {
            // allocate and clear our instance structure
            instance = (IUnknownInstance*) calloc(1, sizeof(IUnknownInstance));
            if (instance != NULL)
            {
                // Assign all members:
                instance->vtable = &instance->vtableStorage;

                instance->vtableStorage.QueryInterface = IUnknownQueryInterface;
                instance->vtableStorage.AddRef = IUnknownAddRef;
                instance->vtableStorage.Release = IUnknownRelease;

                instance->factoryID = myFactoryID;
                instance->refCount = 1;

                // Register the newly created instance
                CFPlugInAddInstanceForFactory(myFactoryID);
            }
        }
    }
    if(myInstID)
        CFRelease(myInstID);

    return ((void*) instance);
}