]> git.saurik.com Git - apple/security.git/blob - cdsa/cdsa_pluginlib/pluginspi.h
Security-28.tar.gz
[apple/security.git] / cdsa / cdsa_pluginlib / pluginspi.h
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
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
8 * using this file.
9 *
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.
16 */
17
18
19 //
20 // pluginspi - "roof" level entry points into a CSSM plugin.
21 //
22 // This file is meant to be included into the top-level source file
23 // for a CSSM plugin written to the C++ alternate interface.
24 // It contains actual code that defines the four required entry points.
25 //
26
27 //
28 // Provide some flexibility for the includer
29 //
30 #if !defined(SPIPREFIX)
31 # define SPIPREFIX extern "C" CSSMSPI
32 #endif
33
34
35 SPIPREFIX CSSM_RETURN CSSM_SPI_ModuleLoad (const CSSM_GUID *CssmGuid,
36 const CSSM_GUID *ModuleGuid,
37 CSSM_SPI_ModuleEventHandler CssmNotifyCallback,
38 void *CssmNotifyCallbackCtx)
39 {
40 BEGIN_API
41 plugin().moduleLoad(Guid::required(CssmGuid),
42 Guid::required(ModuleGuid),
43 ModuleCallback(CssmNotifyCallback, CssmNotifyCallbackCtx));
44 END_API(CSSM)
45 }
46
47 SPIPREFIX CSSM_RETURN CSSM_SPI_ModuleUnload (const CSSM_GUID *CssmGuid,
48 const CSSM_GUID *ModuleGuid,
49 CSSM_SPI_ModuleEventHandler CssmNotifyCallback,
50 void *CssmNotifyCallbackCtx)
51 {
52 BEGIN_API
53 plugin().moduleUnload(Guid::required(CssmGuid),
54 Guid::required(ModuleGuid),
55 ModuleCallback(CssmNotifyCallback, CssmNotifyCallbackCtx));
56 END_API(CSSM)
57 }
58
59 SPIPREFIX CSSM_RETURN CSSM_SPI_ModuleAttach (const CSSM_GUID *ModuleGuid,
60 const CSSM_VERSION *Version,
61 uint32 SubserviceID,
62 CSSM_SERVICE_TYPE SubServiceType,
63 CSSM_ATTACH_FLAGS AttachFlags,
64 CSSM_MODULE_HANDLE ModuleHandle,
65 CSSM_KEY_HIERARCHY KeyHierarchy,
66 const CSSM_GUID *CssmGuid,
67 const CSSM_GUID *ModuleManagerGuid,
68 const CSSM_GUID *CallerGuid,
69 const CSSM_UPCALLS *Upcalls,
70 CSSM_MODULE_FUNCS_PTR *FuncTbl)
71 {
72 BEGIN_API
73 plugin().moduleAttach(ModuleHandle,
74 Guid::required(CssmGuid),
75 Guid::required(ModuleGuid),
76 Guid::required(ModuleManagerGuid),
77 Guid::required(CallerGuid),
78 *Version,
79 SubserviceID,
80 SubServiceType,
81 AttachFlags,
82 KeyHierarchy,
83 Required(Upcalls),
84 Required(FuncTbl));
85 END_API(CSSM)
86 }
87
88 SPIPREFIX CSSM_RETURN CSSM_SPI_ModuleDetach (CSSM_MODULE_HANDLE ModuleHandle)
89 {
90 BEGIN_API
91 plugin().moduleDetach(ModuleHandle);
92 END_API(CSSM)
93 }