]> git.saurik.com Git - apple/security.git/blob - cdsa/mds/MDSModule.cpp
374322f677d8911f7b2070a47bfe3c9ec1c5fee2
[apple/security.git] / cdsa / mds / MDSModule.cpp
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 #include "MDSModule.h"
20 #include "MDSSession.h"
21 #include <Security/mds_schema.h>
22 #include <memory>
23
24 ModuleNexus<MDSModule> MDSModule::mModuleNexus;
25
26 // Names and IDs of tables used in the MDS databases
27
28 #define TABLE(t) { t, #t }
29
30 static const AppleDatabaseTableName kTableNames[] = {
31 // the meta-tables. the parsing module is not used by MDS, but is required
32 // by the implementation of the database
33 TABLE(MDS_CDSADIR_MDS_SCHEMA_RELATIONS),
34 TABLE(MDS_CDSADIR_MDS_SCHEMA_ATTRIBUTES),
35 TABLE(MDS_CDSADIR_MDS_SCHEMA_INDEXES),
36 TABLE(CSSM_DL_DB_SCHEMA_PARSING_MODULE),
37
38 // the MDS-specific tables
39 TABLE(MDS_OBJECT_RECORDTYPE),
40 TABLE(MDS_CDSADIR_CSSM_RECORDTYPE),
41 TABLE(MDS_CDSADIR_KRMM_RECORDTYPE),
42 TABLE(MDS_CDSADIR_EMM_RECORDTYPE),
43 TABLE(MDS_CDSADIR_COMMON_RECORDTYPE),
44 TABLE(MDS_CDSADIR_CSP_PRIMARY_RECORDTYPE),
45 TABLE(MDS_CDSADIR_CSP_CAPABILITY_RECORDTYPE),
46 TABLE(MDS_CDSADIR_CSP_ENCAPSULATED_PRODUCT_RECORDTYPE),
47 TABLE(MDS_CDSADIR_CSP_SC_INFO_RECORDTYPE),
48 TABLE(MDS_CDSADIR_DL_PRIMARY_RECORDTYPE),
49 TABLE(MDS_CDSADIR_DL_ENCAPSULATED_PRODUCT_RECORDTYPE),
50 TABLE(MDS_CDSADIR_CL_PRIMARY_RECORDTYPE),
51 TABLE(MDS_CDSADIR_CL_ENCAPSULATED_PRODUCT_RECORDTYPE),
52 TABLE(MDS_CDSADIR_TP_PRIMARY_RECORDTYPE),
53 TABLE(MDS_CDSADIR_TP_OIDS_RECORDTYPE),
54 TABLE(MDS_CDSADIR_TP_ENCAPSULATED_PRODUCT_RECORDTYPE),
55 TABLE(MDS_CDSADIR_EMM_PRIMARY_RECORDTYPE),
56 TABLE(MDS_CDSADIR_AC_PRIMARY_RECORDTYPE),
57 TABLE(MDS_CDSADIR_KR_PRIMARY_RECORDTYPE),
58
59 // marker for the end of the list
60 { ~0UL, NULL }
61 };
62
63 MDSModule &
64 MDSModule::get ()
65 {
66 return mModuleNexus ();
67 }
68
69 MDSModule::MDSModule ()
70 : mDatabaseManager(kTableNames)
71 {
72 }
73
74 MDSModule::~MDSModule ()
75 {
76 }