]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cdsa_plugin/lib/DLabstractsession.cpp
Security-59754.80.3.tar.gz
[apple/security.git] / OSX / libsecurity_cdsa_plugin / lib / DLabstractsession.cpp
1 //
2 // DL plugin transition layer.
3 // This file was automatically generated. Do not edit on penalty of futility!
4 //
5 #include <security_cdsa_plugin/DLsession.h>
6 #include <security_cdsa_plugin/cssmplugin.h>
7 #include <security_cdsa_utilities/cssmbridge.h>
8 #include <Security/cssmdli.h>
9 // The disclaimer up top used to be true but rdar://24426719 removed libsecurity_cdsa_plugin_generate
10 #include "LegacyAPICounts.h"
11
12
13 DLAbstractPluginSession::~DLAbstractPluginSession()
14 { /* virtual */ }
15
16 static CSSM_RETURN CSSMDLI cssm_DataGetFirst(CSSM_DL_DB_HANDLE DLDBHandle,
17 const CSSM_QUERY *Query,
18 CSSM_HANDLE_PTR ResultsHandle,
19 CSSM_DB_RECORD_ATTRIBUTE_DATA_PTR Attributes,
20 CSSM_DATA_PTR Data,
21 CSSM_DB_UNIQUE_RECORD_PTR *UniqueId)
22 {
23 BEGIN_API
24 if ((Required(ResultsHandle) = findSession<DLPluginSession>(DLDBHandle.DLHandle).DataGetFirst(DLDBHandle.DBHandle,
25 CssmQuery::optional(Query),
26 Attributes,
27 CssmData::optional(Data),
28 Required(UniqueId))) == CSSM_INVALID_HANDLE)
29 return CSSMERR_DL_ENDOFDATA;
30 END_API(DL)
31 }
32
33 static CSSM_RETURN CSSMDLI cssm_GetDbNames(CSSM_DL_HANDLE DLHandle,
34 CSSM_NAME_LIST_PTR *NameList)
35 {
36 BEGIN_API
37 findSession<DLPluginSession>(DLHandle).GetDbNames(Required(NameList));
38 END_API(DL)
39 }
40
41 static CSSM_RETURN CSSMDLI cssm_DbClose(CSSM_DL_DB_HANDLE DLDBHandle)
42 {
43 BEGIN_API
44 findSession<DLPluginSession>(DLDBHandle.DLHandle).DbClose(DLDBHandle.DBHandle);
45 END_API(DL)
46 }
47
48 static CSSM_RETURN CSSMDLI cssm_DataInsert(CSSM_DL_DB_HANDLE DLDBHandle,
49 CSSM_DB_RECORDTYPE RecordType,
50 const CSSM_DB_RECORD_ATTRIBUTE_DATA *Attributes,
51 const CSSM_DATA *Data,
52 CSSM_DB_UNIQUE_RECORD_PTR *UniqueId)
53 {
54 BEGIN_API
55 findSession<DLPluginSession>(DLDBHandle.DLHandle).DataInsert(DLDBHandle.DBHandle,
56 RecordType,
57 Attributes,
58 CssmData::optional(Data),
59 Required(UniqueId));
60 END_API(DL)
61 }
62
63 static CSSM_RETURN CSSMDLI cssm_GetDbNameFromHandle(CSSM_DL_DB_HANDLE DLDBHandle,
64 char **DbName)
65 {
66 BEGIN_API
67 findSession<DLPluginSession>(DLDBHandle.DLHandle).GetDbNameFromHandle(DLDBHandle.DBHandle,
68 DbName);
69 END_API(DL)
70 }
71
72 static CSSM_RETURN CSSMDLI cssm_ChangeDbAcl(CSSM_DL_DB_HANDLE DLDBHandle,
73 const CSSM_ACCESS_CREDENTIALS *AccessCred,
74 const CSSM_ACL_EDIT *AclEdit)
75 {
76 BEGIN_API
77 findSession<DLPluginSession>(DLDBHandle.DLHandle).ChangeDbAcl(DLDBHandle.DBHandle,
78 AccessCredentials::required(AccessCred),
79 Required(AclEdit));
80 END_API(DL)
81 }
82
83 static CSSM_RETURN CSSMDLI cssm_FreeNameList(CSSM_DL_HANDLE DLHandle,
84 CSSM_NAME_LIST_PTR NameList)
85 {
86 BEGIN_API
87 findSession<DLPluginSession>(DLHandle).FreeNameList(Required(NameList));
88 END_API(DL)
89 }
90
91 static CSSM_RETURN CSSMDLI cssm_CreateRelation(CSSM_DL_DB_HANDLE DLDBHandle,
92 CSSM_DB_RECORDTYPE RelationID,
93 const char *RelationName,
94 uint32 NumberOfAttributes,
95 const CSSM_DB_SCHEMA_ATTRIBUTE_INFO *pAttributeInfo,
96 uint32 NumberOfIndexes,
97 const CSSM_DB_SCHEMA_INDEX_INFO *pIndexInfo)
98 {
99 BEGIN_API
100 findSession<DLPluginSession>(DLDBHandle.DLHandle).CreateRelation(DLDBHandle.DBHandle,
101 RelationID,
102 RelationName,
103 NumberOfAttributes,
104 pAttributeInfo,
105 NumberOfIndexes,
106 Required(pIndexInfo));
107 END_API(DL)
108 }
109
110 static CSSM_RETURN CSSMDLI cssm_DataAbortQuery(CSSM_DL_DB_HANDLE DLDBHandle,
111 CSSM_HANDLE ResultsHandle)
112 {
113 BEGIN_API
114 findSession<DLPluginSession>(DLDBHandle.DLHandle).DataAbortQuery(DLDBHandle.DBHandle,
115 ResultsHandle);
116 END_API(DL)
117 }
118
119 static CSSM_RETURN CSSMDLI cssm_DataModify(CSSM_DL_DB_HANDLE DLDBHandle,
120 CSSM_DB_RECORDTYPE RecordType,
121 CSSM_DB_UNIQUE_RECORD_PTR UniqueRecordIdentifier,
122 const CSSM_DB_RECORD_ATTRIBUTE_DATA *AttributesToBeModified,
123 const CSSM_DATA *DataToBeModified,
124 CSSM_DB_MODIFY_MODE ModifyMode)
125 {
126 BEGIN_API
127 findSession<DLPluginSession>(DLDBHandle.DLHandle).DataModify(DLDBHandle.DBHandle,
128 RecordType,
129 Required(UniqueRecordIdentifier),
130 AttributesToBeModified,
131 CssmData::optional(DataToBeModified),
132 ModifyMode);
133 END_API(DL)
134 }
135
136 static CSSM_RETURN CSSMDLI cssm_DestroyRelation(CSSM_DL_DB_HANDLE DLDBHandle,
137 CSSM_DB_RECORDTYPE RelationID)
138 {
139 BEGIN_API
140 findSession<DLPluginSession>(DLDBHandle.DLHandle).DestroyRelation(DLDBHandle.DBHandle,
141 RelationID);
142 END_API(DL)
143 }
144
145 static CSSM_RETURN CSSMDLI cssm_DbCreate(CSSM_DL_HANDLE DLHandle,
146 const char *DbName,
147 const CSSM_NET_ADDRESS *DbLocation,
148 const CSSM_DBINFO *DBInfo,
149 CSSM_DB_ACCESS_TYPE AccessRequest,
150 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
151 const void *OpenParameters,
152 CSSM_DB_HANDLE *DbHandle)
153 {
154 BEGIN_API
155 findSession<DLPluginSession>(DLHandle).DbCreate(DbName,
156 DbLocation,
157 Required(DBInfo),
158 AccessRequest,
159 CredAndAclEntry,
160 OpenParameters,
161 Required(DbHandle));
162 END_API(DL)
163 }
164
165 static CSSM_RETURN CSSMDLI cssm_DbOpen(CSSM_DL_HANDLE DLHandle,
166 const char *DbName,
167 const CSSM_NET_ADDRESS *DbLocation,
168 CSSM_DB_ACCESS_TYPE AccessRequest,
169 const CSSM_ACCESS_CREDENTIALS *AccessCred,
170 const void *OpenParameters,
171 CSSM_DB_HANDLE *DbHandle)
172 {
173 BEGIN_API
174 findSession<DLPluginSession>(DLHandle).DbOpen(DbName,
175 DbLocation,
176 AccessRequest,
177 AccessCredentials::optional(AccessCred),
178 OpenParameters,
179 Required(DbHandle));
180 END_API(DL)
181 }
182
183 static CSSM_RETURN CSSMDLI cssm_DataGetNext(CSSM_DL_DB_HANDLE DLDBHandle,
184 CSSM_HANDLE ResultsHandle,
185 CSSM_DB_RECORD_ATTRIBUTE_DATA_PTR Attributes,
186 CSSM_DATA_PTR Data,
187 CSSM_DB_UNIQUE_RECORD_PTR *UniqueId)
188 {
189 BEGIN_API
190 if (!findSession<DLPluginSession>(DLDBHandle.DLHandle).DataGetNext(DLDBHandle.DBHandle,
191 ResultsHandle,
192 Attributes,
193 CssmData::optional(Data),
194 Required(UniqueId)))
195 return CSSMERR_DL_ENDOFDATA;
196 END_API(DL)
197 }
198
199 static CSSM_RETURN CSSMDLI cssm_FreeUniqueRecord(CSSM_DL_DB_HANDLE DLDBHandle,
200 CSSM_DB_UNIQUE_RECORD_PTR UniqueRecord)
201 {
202 BEGIN_API
203 findSession<DLPluginSession>(DLDBHandle.DLHandle).FreeUniqueRecord(DLDBHandle.DBHandle,
204 Required(UniqueRecord));
205 END_API(DL)
206 }
207
208 static CSSM_RETURN CSSMDLI cssm_ChangeDbOwner(CSSM_DL_DB_HANDLE DLDBHandle,
209 const CSSM_ACCESS_CREDENTIALS *AccessCred,
210 const CSSM_ACL_OWNER_PROTOTYPE *NewOwner)
211 {
212 BEGIN_API
213 findSession<DLPluginSession>(DLDBHandle.DLHandle).ChangeDbOwner(DLDBHandle.DBHandle,
214 AccessCredentials::required(AccessCred),
215 Required(NewOwner));
216 END_API(DL)
217 }
218
219 static CSSM_RETURN CSSMDLI cssm_DbDelete(CSSM_DL_HANDLE DLHandle,
220 const char *DbName,
221 const CSSM_NET_ADDRESS *DbLocation,
222 const CSSM_ACCESS_CREDENTIALS *AccessCred)
223 {
224 BEGIN_API
225 findSession<DLPluginSession>(DLHandle).DbDelete(DbName,
226 DbLocation,
227 AccessCredentials::optional(AccessCred));
228 END_API(DL)
229 }
230
231 static CSSM_RETURN CSSMDLI cssm_Authenticate(CSSM_DL_DB_HANDLE DLDBHandle,
232 CSSM_DB_ACCESS_TYPE AccessRequest,
233 const CSSM_ACCESS_CREDENTIALS *AccessCred)
234 {
235 BEGIN_API
236 findSession<DLPluginSession>(DLDBHandle.DLHandle).Authenticate(DLDBHandle.DBHandle,
237 AccessRequest,
238 AccessCredentials::required(AccessCred));
239 END_API(DL)
240 }
241
242 static CSSM_RETURN CSSMDLI cssm_DataDelete(CSSM_DL_DB_HANDLE DLDBHandle,
243 const CSSM_DB_UNIQUE_RECORD *UniqueRecordIdentifier)
244 {
245 BEGIN_API
246 findSession<DLPluginSession>(DLDBHandle.DLHandle).DataDelete(DLDBHandle.DBHandle,
247 Required(UniqueRecordIdentifier));
248 END_API(DL)
249 }
250
251 static CSSM_RETURN CSSMDLI cssm_GetDbOwner(CSSM_DL_DB_HANDLE DLDBHandle,
252 CSSM_ACL_OWNER_PROTOTYPE_PTR Owner)
253 {
254 BEGIN_API
255 findSession<DLPluginSession>(DLDBHandle.DLHandle).GetDbOwner(DLDBHandle.DBHandle,
256 Required(Owner));
257 END_API(DL)
258 }
259
260 static CSSM_RETURN CSSMDLI cssm_PassThrough(CSSM_DL_DB_HANDLE DLDBHandle,
261 uint32 PassThroughId,
262 const void *InputParams,
263 void **OutputParams)
264 {
265 BEGIN_API
266 findSession<DLPluginSession>(DLDBHandle.DLHandle).PassThrough(DLDBHandle.DBHandle,
267 PassThroughId,
268 InputParams,
269 OutputParams);
270 END_API(DL)
271 }
272
273 static CSSM_RETURN CSSMDLI cssm_GetDbAcl(CSSM_DL_DB_HANDLE DLDBHandle,
274 const CSSM_STRING *SelectionTag,
275 uint32 *NumberOfAclInfos,
276 CSSM_ACL_ENTRY_INFO_PTR *AclInfos)
277 {
278 BEGIN_API
279 findSession<DLPluginSession>(DLDBHandle.DLHandle).GetDbAcl(DLDBHandle.DBHandle,
280 SelectionTag,
281 Required(NumberOfAclInfos),
282 Required(AclInfos));
283 END_API(DL)
284 }
285
286 static CSSM_RETURN CSSMDLI cssm_DataGetFromUniqueRecordId(CSSM_DL_DB_HANDLE DLDBHandle,
287 const CSSM_DB_UNIQUE_RECORD *UniqueRecord,
288 CSSM_DB_RECORD_ATTRIBUTE_DATA_PTR Attributes,
289 CSSM_DATA_PTR Data)
290 {
291 BEGIN_API
292 findSession<DLPluginSession>(DLDBHandle.DLHandle).DataGetFromUniqueRecordId(DLDBHandle.DBHandle,
293 Required(UniqueRecord),
294 Attributes,
295 CssmData::optional(Data));
296 END_API(DL)
297 }
298
299
300 static const CSSM_SPI_DL_FUNCS DLFunctionStruct = {
301 cssm_DbOpen,
302 cssm_DbClose,
303 cssm_DbCreate,
304 cssm_DbDelete,
305 cssm_CreateRelation,
306 cssm_DestroyRelation,
307 cssm_Authenticate,
308 cssm_GetDbAcl,
309 cssm_ChangeDbAcl,
310 cssm_GetDbOwner,
311 cssm_ChangeDbOwner,
312 cssm_GetDbNames,
313 cssm_GetDbNameFromHandle,
314 cssm_FreeNameList,
315 cssm_DataInsert,
316 cssm_DataDelete,
317 cssm_DataModify,
318 cssm_DataGetFirst,
319 cssm_DataGetNext,
320 cssm_DataAbortQuery,
321 cssm_DataGetFromUniqueRecordId,
322 cssm_FreeUniqueRecord,
323 cssm_PassThrough,
324 };
325
326 static CSSM_MODULE_FUNCS DLFunctionTable = {
327 CSSM_SERVICE_DL, // service type
328 23, // number of functions
329 (const CSSM_PROC_ADDR *)&DLFunctionStruct
330 };
331
332 CSSM_MODULE_FUNCS_PTR DLPluginSession::construct()
333 {
334 return &DLFunctionTable;
335 }