2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
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
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.
22 // Declarations of structures which define the schema, including attributes
23 // and indexes, for the standard tables that are part of the MDS database.
29 #include <Security/cssmtype.h>
30 #include <Security/MDSAttrStrings.h>
35 // Structure used to store information which is needed to create
36 // a relation with indexes. The info in one of these structs maps to one
37 // record type in a CSSM_DBINFO - both record attribute info and index info.
38 // The nameValues field refers to an array of MDSNameValuePair array pointers
39 // which are used to convert attribute values from strings to uint32s via
40 // MDS_StringToUint32. The nameValues array is parallel to the AttributeInfo
43 CSSM_DB_RECORDTYPE DataRecordType
;
44 const char *relationName
;
45 uint32 NumberOfAttributes
;
46 const CSSM_DB_ATTRIBUTE_INFO
*AttributeInfo
;
47 const MDSNameValuePair
**nameValues
;
48 uint32 NumberOfIndexes
;
49 const CSSM_DB_INDEX_INFO
*IndexInfo
;
52 // Macros used to simplify declarations of attributes and indexes.
54 // declare a CSSM_DB_ATTRIBUTE_INFO
55 #define DB_ATTRIBUTE(name, type) \
56 { CSSM_DB_ATTRIBUTE_NAME_AS_STRING, \
58 CSSM_DB_ATTRIBUTE_FORMAT_ ## type \
61 // declare a CSSM_DB_INDEX_INFO
62 #define UNIQUE_INDEX_ATTRIBUTE(name, type) \
63 { CSSM_DB_INDEX_UNIQUE, \
64 CSSM_DB_INDEX_ON_ATTRIBUTE, \
65 { CSSM_DB_ATTRIBUTE_NAME_AS_STRING, \
67 CSSM_DB_ATTRIBUTE_FORMAT_ ## type \
71 // declare a RelationInfo
72 #define RELATION_INFO(relationId, attributes, nameValues, indexes) \
75 sizeof(attributes) / sizeof(CSSM_DB_ATTRIBUTE_INFO), \
78 sizeof(indexes) / sizeof(CSSM_DB_INDEX_INFO), \
81 // Object directory DB - one built-in schema.
82 extern const RelationInfo kObjectRelation
;
84 // list of all built-in schema for the CDSA Directory DB.
85 extern const RelationInfo kMDSRelationInfo
[];
86 extern const unsigned kNumMdsRelations
; // size of kMDSRelationInfo[]
88 // special case "subschema" for parsing CSPCapabilities.
89 extern const RelationInfo CSPCapabilitiesDict1RelInfo
;
90 extern const RelationInfo CSPCapabilitiesDict2RelInfo
;
91 extern const RelationInfo CSPCapabilitiesDict3RelInfo
;
93 // special case "subschema" for parsing TPPolicyOids.
94 extern const RelationInfo TpPolicyOidsDict1RelInfo
;
95 extern const RelationInfo TpPolicyOidsDict2RelInfo
;
97 // Map a CSSM_DB_RECORDTYPE to a RelationInfo *.
98 extern const RelationInfo
*MDSRecordTypeToRelation(
99 CSSM_DB_RECORDTYPE recordType
);
101 // same as above, based on record type as string.
102 extern const RelationInfo
*MDSRecordTypeNameToRelation(
103 const char *recordTypeName
);
105 } // end namespace Security
107 #endif // _MDSSCHEMA_H