2  * Copyright (c) 2000-2001,2003-2004,2011,2014 Apple Inc. All Rights Reserved. 
   4  * @APPLE_LICENSE_HEADER_START@ 
   6  * This file contains Original Code and/or Modifications of Original Code 
   7  * as defined in and that are subject to the Apple Public Source License 
   8  * Version 2.0 (the 'License'). You may not use this file except in 
   9  * compliance with the License. Please obtain a copy of the License at 
  10  * http://www.opensource.apple.com/apsl/ and read it before using this 
  13  * The Original Code and all software distributed under the License are 
  14  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  15  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  16  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 
  17  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  18  * Please see the License for the specific language governing rights and 
  19  * limitations under the License. 
  21  * @APPLE_LICENSE_HEADER_END@ 
  26 // modloader.h - CSSM module loader interface 
  28 // This is a thin abstraction of plugin module loading/handling for CSSM. 
  29 // The resulting module ("Plugin") notion is specific to CSSM plugin modules. 
  30 // This implementation uses MacOS X bundles. 
  36 #include <security_utilities/osxcode.h> 
  46 // A collection of canonical plugin entry points (aka CSSM module SPI) 
  48 struct PluginFunctions 
{ 
  49         CSSM_SPI_ModuleLoadFunction 
*load
; 
  50         CSSM_SPI_ModuleUnloadFunction 
*unload
; 
  51         CSSM_SPI_ModuleAttachFunction 
*attach
; 
  52         CSSM_SPI_ModuleDetachFunction 
*detach
; 
  57 // An abstract representation of a loadable plugin. 
  58 // Note that "loadable" doesn't mean that actual code loading 
  59 // is necessarily happening, but let's just assume it might. 
  67     virtual void load() = 0; 
  68     virtual void unload() = 0; 
  69     virtual bool isLoaded() const = 0; 
  71         virtual CSSM_SPI_ModuleLoadFunction load 
= 0; 
  72         virtual CSSM_SPI_ModuleUnloadFunction unload 
= 0; 
  73         virtual CSSM_SPI_ModuleAttachFunction attach 
= 0; 
  74         virtual CSSM_SPI_ModuleDetachFunction detach 
= 0; 
  79 // The supervisor class that manages searching and loading. 
  86     Plugin 
*operator () (const string 
&path
); 
  89     // the table of all loaded modules 
  90     typedef map
<string
, Plugin 
*> PluginTable
; 
  96 } // end namespace Security