2 * Copyright (c) 2000-2004,2011,2014 Apple 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.
20 // mds_standard - standard-defined MDS record types.
22 // These are the C++ record types corresponding to standard and Apple-defined
23 // MDS relations. Note that not all standard fields are included; only those
24 // of particular interest to the implementation. Feel free to add field functions
28 #ifndef _H_CDSA_CLIENT_MDS_STANDARD
29 #define _H_CDSA_CLIENT_MDS_STANDARD
31 #include <security_cdsa_client/mdsclient.h>
39 // The CDSA Common table (one record per module)
41 class Common
: public Record
{
44 static const CSSM_DB_RECORDTYPE recordType
= MDS_CDSADIR_COMMON_RECORDTYPE
;
46 string
moduleID() const;
47 string
moduleName() const;
49 string
description() const;
51 bool singleThreaded() const;
52 CSSM_SERVICE_MASK
serviceMask() const;
56 // "Link in" a Common into another record, whose attributes()[0] is the ModuleID
62 string
moduleName() const { return common().moduleName(); }
63 string
path() const { return common().path(); }
64 string
description() const { return common().description(); }
65 bool dynamic() const { return common().dynamic(); }
66 bool singleThreaded() const { return common().singleThreaded(); }
67 CSSM_SERVICE_MASK
serviceMask() const { return common().serviceMask(); }
70 mutable RefPointer
<Common
> mCommon
;
72 Common
&common() const;
78 // PrimaryRecord shapes the "common head" of all MDS primary relations
80 class PrimaryRecord
: public Record
, public Common::Carrier
{
82 PrimaryRecord(const char * const * names
);
84 string
moduleID() const;
85 uint32
subserviceID() const;
86 string
moduleName() const;
87 string
productVersion() const;
88 string
vendor() const;
93 // The CSP Primary relation
95 class CSP
: public PrimaryRecord
{
98 static const CSSM_DB_RECORDTYPE recordType
= MDS_CDSADIR_CSP_PRIMARY_RECORDTYPE
;
100 uint32
cspType() const;
101 CSSM_CSP_FLAGS
cspFlags() const;
106 // The CSP Capabilities relation
108 class CSPCapabilities
: public Record
, public Common::Carrier
{
111 static const CSSM_DB_RECORDTYPE recordType
= MDS_CDSADIR_CSP_CAPABILITY_RECORDTYPE
;
113 string
moduleID() const;
114 uint32
subserviceID() const;
115 uint32
contextType() const;
116 uint32
algorithm() const;
117 uint32
group() const;
118 uint32
attribute() const;
119 string
description() const;
124 // The CSP "smartcard token" relation
126 class SmartcardInfo
: public Record
, public Common::Carrier
{
129 static const CSSM_DB_RECORDTYPE recordType
= MDS_CDSADIR_CSP_SC_INFO_RECORDTYPE
;
131 string
moduleID() const;
132 uint32
subserviceID() const;
133 string
description() const;
134 string
vendor() const;
135 string
version() const;
136 string
firmware() const;
137 CSSM_SC_FLAGS
flags() const;
138 CSSM_SC_FLAGS
customFlags() const;
139 string
serial() const;
144 // The DL Primary relation
146 class DL
: public PrimaryRecord
{
149 static const CSSM_DB_RECORDTYPE recordType
= MDS_CDSADIR_DL_PRIMARY_RECORDTYPE
;
151 uint32
dlType() const;
152 uint32
queryLimits() const;
157 // The CL Primary relation
159 class CL
: public PrimaryRecord
{
162 static const CSSM_DB_RECORDTYPE recordType
= MDS_CDSADIR_CL_PRIMARY_RECORDTYPE
;
164 uint32
certTypeFormat() const;
165 uint32
certType() const { return certTypeFormat() >> 16; }
166 uint32
certEncoding() const { return certTypeFormat() & 0xFFFF; }
167 uint32
crlTypeFormat() const;
168 uint32
crlType() const { return crlTypeFormat() >> 16; }
169 uint32
crlEncoding() const { return crlTypeFormat() & 0xFFFF; }
174 // The TP Primary relation
176 class TP
: public PrimaryRecord
{
179 static const CSSM_DB_RECORDTYPE recordType
= MDS_CDSADIR_TP_PRIMARY_RECORDTYPE
;
181 uint32
certTypeFormat() const;
182 uint32
certType() const { return certTypeFormat() >> 16; }
183 uint32
certEncoding() const { return certTypeFormat() & 0xFFFF; }
188 // The TP Policy-OIDS relation
190 class PolicyOids
: public Record
{
193 static const CSSM_DB_RECORDTYPE recordType
= MDS_CDSADIR_TP_OIDS_RECORDTYPE
;
195 string
moduleID() const;
196 uint32
subserviceID() const;
197 CssmData
oid() const;
198 CssmData
value() const;
202 } // end namespace MDSClient
203 } // end namespace Security
205 #endif // _H_CDSA_CLIENT_MDS_STANDARD