X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/ed6778a32ecff23bc2dfb6ca452badd0c68774a0..563f4f96f568bcdc0a04a82f89cafe3bebbe43f1:/cdsa/cssm/attachfactory.cpp diff --git a/cdsa/cssm/attachfactory.cpp b/cdsa/cssm/attachfactory.cpp deleted file mode 100644 index dfdd41db..00000000 --- a/cdsa/cssm/attachfactory.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved. - * - * The contents of this file constitute Original Code as defined in and are - * subject to the Apple Public Source License Version 1.2 (the 'License'). - * You may not use this file except in compliance with the License. Please obtain - * a copy of the License at http://www.apple.com/publicsource and read it before - * using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS - * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT - * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the - * specific language governing rights and limitations under the License. - */ - - -// -// attachfactory - industrial grade production of Attachment objects -// -#ifdef __MWERKS__ -#define _CPP_ATTACHFACTORY -#endif -#include "attachfactory.h" - -#include "cspattachment.h" -#include -#include -#include -#include -#include "funcnames.gen" -#include - - -// -// A template to generate AttachmentMakers for the standard plugin types. -// -template -class StandardAttachmentMaker : public AttachmentMaker { -public: - StandardAttachmentMaker() : AttachmentMaker(type) - { - for (unsigned n = 0; n < sizeof(nameTable) / sizeof(nameTable[0]); n++) - nameMap.insert(typename NameMap::value_type(nameTable[n], n)); - } - - Attachment *make(Module *module, - const CSSM_VERSION &version, - uint32 subserviceId, - CSSM_SERVICE_TYPE subserviceType, - const CSSM_API_MEMORY_FUNCS &memoryOps, - CSSM_ATTACH_FLAGS attachFlags, - CSSM_KEY_HIERARCHY keyHierarchy, - CSSM_FUNC_NAME_ADDR *FunctionTable, - uint32 NumFunctions) - { - StandardAttachment *attachment = - new StandardAttachment(module, - nameMap, - version, - subserviceId, - subserviceType, - memoryOps, - attachFlags, - keyHierarchy); - attachment->resolveSymbols(FunctionTable, NumFunctions); - return attachment; - } - -private: - typedef typename StandardAttachment::NameMap NameMap; - NameMap nameMap; -}; - - -// -// Implementation of an attachment factory -// -AttachmentFactory::AttachmentFactory() -{ - // generate explicitly known attachment types - factories[CSSM_SERVICE_AC] = new StandardAttachmentMaker; - factories[CSSM_SERVICE_CL] = new StandardAttachmentMaker; - factories[CSSM_SERVICE_CSP] = new StandardAttachmentMaker; - factories[CSSM_SERVICE_DL] = new StandardAttachmentMaker; - factories[CSSM_SERVICE_TP] = new StandardAttachmentMaker; -} - - -AttachmentMaker *AttachmentFactory::attachmentMakerFor(CSSM_SERVICE_TYPE type) const -{ - AttachFactories::const_iterator it = factories.find(type); - if (it == factories.end()) - CssmError::throwMe(CSSMERR_CSSM_INVALID_SERVICE_MASK); - return it->second; -} - - -// -// Manage an AttachmentMaker -// -AttachmentMaker::~AttachmentMaker() -{ -}