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// AppleFileDL.cpp - File Based DL plug-in module. 21// 22#include "AppleFileDL.h" 23 24#include <security_cdsa_plugin/DLsession.h> 25 26 27// Names and IDs of tables used in a DL database 28 29static const AppleDatabaseTableName kTableNames[] = { 30 { CSSM_DL_DB_SCHEMA_INFO, "CSSM_DL_DB_SCHEMA_INFO" }, 31 { CSSM_DL_DB_SCHEMA_ATTRIBUTES, "CSSM_DL_DB_SCHEMA_ATTRIBUTES" }, 32 { CSSM_DL_DB_SCHEMA_INDEXES, "CSSM_DL_DB_SCHEMA_INDEXES" }, 33 { CSSM_DL_DB_SCHEMA_PARSING_MODULE, "CSSM_DL_DB_SCHEMA_PARSING_MODULE" }, 34 { CSSM_DL_DB_RECORD_CERT, "CSSM_DL_DB_RECORD_CERT" }, 35 { CSSM_DL_DB_RECORD_CRL, "CSSM_DL_DB_RECORD_CRL" }, 36 { CSSM_DL_DB_RECORD_POLICY, "CSSM_DL_DB_RECORD_POLICY" }, 37 { CSSM_DL_DB_RECORD_GENERIC, "CSSM_DL_DB_RECORD_GENERIC" }, 38 { CSSM_DL_DB_RECORD_PUBLIC_KEY, "CSSM_DL_DB_RECORD_PUBLIC_KEY" }, 39 { CSSM_DL_DB_RECORD_PRIVATE_KEY, "CSSM_DL_DB_RECORD_PRIVATE_KEY" }, 40 { CSSM_DL_DB_RECORD_SYMMETRIC_KEY, "CSSM_DL_DB_RECORD_SYMMETRIC_KEY" }, 41 { ~0U, NULL } 42}; 43 44// 45// Make and break the plugin object 46// 47AppleFileDL::AppleFileDL() 48 : mDatabaseManager(kTableNames) 49{ 50} 51 52AppleFileDL::~AppleFileDL() 53{ 54} 55 56 57// 58// Create a new plugin session, our way 59// 60PluginSession *AppleFileDL::makeSession(CSSM_MODULE_HANDLE handle, 61 const CSSM_VERSION &version, 62 uint32 subserviceId, 63 CSSM_SERVICE_TYPE subserviceType, 64 CSSM_ATTACH_FLAGS attachFlags, 65 const CSSM_UPCALLS &upcalls) 66{ 67 switch (subserviceType) { 68 case CSSM_SERVICE_DL: 69 return new DLPluginSession(handle, 70 *this, 71 version, 72 subserviceId, 73 subserviceType, 74 attachFlags, 75 upcalls, 76 mDatabaseManager); 77 default: 78 CssmError::throwMe(CSSMERR_CSSM_INVALID_SERVICE_MASK); 79 return 0; // placebo 80 } 81} 82