]> git.saurik.com Git - apple/security.git/blob - libsecurity_cdsa_plugin/lib/pluginspi.h
Security-55471.tar.gz
[apple/security.git] / libsecurity_cdsa_plugin / lib / 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 #include <security_cdsa_utilities/cssmbridge.h>
27
28
29 //
30 // Provide some flexibility for the includer
31 //
32 #if !defined(SPIPREFIX)
33 # define SPIPREFIX extern "C" CSSMSPI
34 #endif
35
36 #if !defined(SPINAME)
37 # define SPINAME(s) s
38 #endif
39
40 SPIPREFIX CSSM_RETURN SPINAME(CSSM_SPI_ModuleLoad) (const CSSM_GUID *CssmGuid,
41 const CSSM_GUID *ModuleGuid,
42 CSSM_SPI_ModuleEventHandler CssmNotifyCallback,
43 void *CssmNotifyCallbackCtx);
44
45 SPIPREFIX CSSM_RETURN SPINAME(CSSM_SPI_ModuleLoad) (const CSSM_GUID *CssmGuid,
46 const CSSM_GUID *ModuleGuid,
47 CSSM_SPI_ModuleEventHandler CssmNotifyCallback,
48 void *CssmNotifyCallbackCtx)
49 {
50 BEGIN_API
51 plugin().moduleLoad(Guid::required(CssmGuid),
52 Guid::required(ModuleGuid),
53 ModuleCallback(CssmNotifyCallback, CssmNotifyCallbackCtx));
54 END_API(CSSM)
55 }
56
57 SPIPREFIX CSSM_RETURN SPINAME(CSSM_SPI_ModuleUnload) (const CSSM_GUID *CssmGuid,
58 const CSSM_GUID *ModuleGuid,
59 CSSM_SPI_ModuleEventHandler CssmNotifyCallback,
60 void *CssmNotifyCallbackCtx);
61
62 SPIPREFIX CSSM_RETURN SPINAME(CSSM_SPI_ModuleUnload) (const CSSM_GUID *CssmGuid,
63 const CSSM_GUID *ModuleGuid,
64 CSSM_SPI_ModuleEventHandler CssmNotifyCallback,
65 void *CssmNotifyCallbackCtx)
66 {
67 BEGIN_API
68 plugin().moduleUnload(Guid::required(CssmGuid),
69 Guid::required(ModuleGuid),
70 ModuleCallback(CssmNotifyCallback, CssmNotifyCallbackCtx));
71 END_API(CSSM)
72 }
73
74 SPIPREFIX CSSM_RETURN SPINAME(CSSM_SPI_ModuleAttach) (const CSSM_GUID *ModuleGuid,
75 const CSSM_VERSION *Version,
76 uint32 SubserviceID,
77 CSSM_SERVICE_TYPE SubServiceType,
78 CSSM_ATTACH_FLAGS AttachFlags,
79 CSSM_MODULE_HANDLE ModuleHandle,
80 CSSM_KEY_HIERARCHY KeyHierarchy,
81 const CSSM_GUID *CssmGuid,
82 const CSSM_GUID *ModuleManagerGuid,
83 const CSSM_GUID *CallerGuid,
84 const CSSM_UPCALLS *Upcalls,
85 CSSM_MODULE_FUNCS_PTR *FuncTbl);
86
87 SPIPREFIX CSSM_RETURN SPINAME(CSSM_SPI_ModuleAttach) (const CSSM_GUID *ModuleGuid,
88 const CSSM_VERSION *Version,
89 uint32 SubserviceID,
90 CSSM_SERVICE_TYPE SubServiceType,
91 CSSM_ATTACH_FLAGS AttachFlags,
92 CSSM_MODULE_HANDLE ModuleHandle,
93 CSSM_KEY_HIERARCHY KeyHierarchy,
94 const CSSM_GUID *CssmGuid,
95 const CSSM_GUID *ModuleManagerGuid,
96 const CSSM_GUID *CallerGuid,
97 const CSSM_UPCALLS *Upcalls,
98 CSSM_MODULE_FUNCS_PTR *FuncTbl)
99 {
100 BEGIN_API
101 plugin().moduleAttach(ModuleHandle,
102 Guid::required(CssmGuid),
103 Guid::required(ModuleGuid),
104 Guid::required(ModuleManagerGuid),
105 Guid::required(CallerGuid),
106 *Version,
107 SubserviceID,
108 SubServiceType,
109 AttachFlags,
110 KeyHierarchy,
111 Required(Upcalls),
112 Required(FuncTbl));
113 END_API(CSSM)
114 }
115
116 SPIPREFIX CSSM_RETURN SPINAME(CSSM_SPI_ModuleDetach) (CSSM_MODULE_HANDLE ModuleHandle);
117
118 SPIPREFIX CSSM_RETURN SPINAME(CSSM_SPI_ModuleDetach) (CSSM_MODULE_HANDLE ModuleHandle)
119 {
120 BEGIN_API
121 plugin().moduleDetach(ModuleHandle);
122 END_API(CSSM)
123 }