2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 // modloader.h - CSSM module loader interface
22 // This is a thin abstraction of plugin module loading/handling for CSSM.
23 // The resulting module ("Plugin") notion is specific to CSSM plugin modules.
24 // This implementation uses MacOS X bundles.
30 #include <Security/utilities.h>
31 #include <Security/osxsigning.h>
32 #include <Security/cssmint.h>
41 // An abstract representation of a loadable plugin.
42 // Note that "loadable" doesn't mean that actual code loading
43 // is necessarily happening, but let's just assume it might.
51 virtual void load() = 0;
52 virtual void unload() = 0;
53 virtual bool isLoaded() const = 0;
55 virtual CSSM_RETURN
CSSM_SPI_ModuleLoad (const CSSM_GUID
*CssmGuid
,
56 const CSSM_GUID
*ModuleGuid
,
57 CSSM_SPI_ModuleEventHandler CssmNotifyCallback
,
58 void *CssmNotifyCallbackCtx
) = 0;
59 virtual CSSM_RETURN
CSSM_SPI_ModuleUnload (const CSSM_GUID
*CssmGuid
,
60 const CSSM_GUID
*ModuleGuid
,
61 CSSM_SPI_ModuleEventHandler CssmNotifyCallback
,
62 void *CssmNotifyCallbackCtx
) = 0;
63 virtual CSSM_RETURN
CSSM_SPI_ModuleAttach (const CSSM_GUID
*ModuleGuid
,
64 const CSSM_VERSION
*Version
,
66 CSSM_SERVICE_TYPE SubServiceType
,
67 CSSM_ATTACH_FLAGS AttachFlags
,
68 CSSM_MODULE_HANDLE ModuleHandle
,
69 CSSM_KEY_HIERARCHY KeyHierarchy
,
70 const CSSM_GUID
*CssmGuid
,
71 const CSSM_GUID
*ModuleManagerGuid
,
72 const CSSM_GUID
*CallerGuid
,
73 const CSSM_UPCALLS
*Upcalls
,
74 CSSM_MODULE_FUNCS_PTR
*FuncTbl
) = 0;
75 virtual CSSM_RETURN
CSSM_SPI_ModuleDetach (CSSM_MODULE_HANDLE ModuleHandle
) = 0;
80 // The supervisor class that manages searching and loading.
87 Plugin
*operator () (const char *path
);
90 // the table of all loaded modules
91 typedef map
<string
, Plugin
*> PluginTable
;
97 } // end namespace Security
100 #endif //_H_MODLOADER