2 * Copyright (c) 2000-2004 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.
20 // mds_standard - standard-defined MDS record types
22 #include <security_cdsa_client/mds_standard.h>
23 #include <security_cdsa_client/dlquery.h>
31 // CDSA Common relation (one record per module)
33 static const char * const commonAttributes
[] = {
43 Common::Common() : Record(commonAttributes
) { }
45 string
Common::moduleID() const { return mAttributes
[0]; }
46 string
Common::moduleName() const { return mAttributes
[1]; }
47 string
Common::path() const { return mAttributes
[2]; }
48 string
Common::description() const { return mAttributes
[3]; }
49 bool Common::dynamic() const { return mAttributes
[4]; }
50 bool Common::singleThreaded() const { return !mAttributes
[5]; }
51 CSSM_SERVICE_MASK
Common::serviceMask() const { return mAttributes
[6]; }
55 // Common::Carrier draws in the Common fields for anything with
56 // a ModuleID attribute (which must be the first attribute listed)
58 Common::Carrier::~Carrier() { }
60 Common
&Common::Carrier::common() const
63 const CssmDbRecordAttributeData
&attrs
64 = dynamic_cast<const Record
*>(this)->attributes();
65 RefPointer
<Common
> rpc
;
66 rpc
= Table
<Common
>(mds()).fetch(
67 Attribute("ModuleID") == string(attrs
[0]),
68 CSSMERR_DL_ENDOFDATA
);
76 // Attributes that are common to all primary relations
78 static const char * const primaryAttributes
[] = {
86 PrimaryRecord::PrimaryRecord(const char * const * names
)
87 : Record(primaryAttributes
)
92 string
PrimaryRecord::moduleID() const { return mAttributes
[0]; }
93 uint32
PrimaryRecord::subserviceID() const { return mAttributes
[1]; }
94 string
PrimaryRecord::moduleName() const { return mAttributes
[2]; }
95 string
PrimaryRecord::productVersion() const { return mAttributes
[3]; }
96 string
PrimaryRecord::vendor() const { return mAttributes
[4]; }
100 // CSP Primary relation (one record per CSP SSID)
102 static const char * const cspAttributes
[] = {
103 // up to Vendor is handled by PrimaryRecord
108 CSP::CSP() : PrimaryRecord(cspAttributes
) { }
110 uint32
CSP::cspType() const { return mAttributes
[5]; }
111 CSSM_CSP_FLAGS
CSP::cspFlags() const { return mAttributes
[6]; }
115 // CSP capabilities relation
117 static const char * const capAttributes
[] = {
127 CSPCapabilities::CSPCapabilities() : Record(capAttributes
) { }
129 string
CSPCapabilities::moduleID() const { return mAttributes
[0]; }
130 uint32
CSPCapabilities::subserviceID() const { return mAttributes
[1]; }
131 uint32
CSPCapabilities::contextType() const { return mAttributes
[2]; }
132 uint32
CSPCapabilities::algorithm() const { return mAttributes
[3]; }
133 uint32
CSPCapabilities::group() const { return mAttributes
[4]; }
134 uint32
CSPCapabilities::attribute() const { return mAttributes
[5]; }
135 string
CSPCapabilities::description() const { return mAttributes
[6]; }
139 // CSP SmartcardInfo relation (one record per smartcard token present)
141 static const char * const scAttributes
[] = {
153 SmartcardInfo::SmartcardInfo() : Record(scAttributes
) { }
155 string
SmartcardInfo::moduleID() const { return mAttributes
[0]; }
156 uint32
SmartcardInfo::subserviceID() const { return mAttributes
[1]; }
157 string
SmartcardInfo::description() const { return mAttributes
[2]; }
158 string
SmartcardInfo::vendor() const { return mAttributes
[3]; }
159 string
SmartcardInfo::version() const { return mAttributes
[4]; }
160 string
SmartcardInfo::firmware() const { return mAttributes
[5]; }
161 CSSM_SC_FLAGS
SmartcardInfo::flags() const { return mAttributes
[6]; }
162 CSSM_SC_FLAGS
SmartcardInfo::customFlags() const { return mAttributes
[7]; }
163 string
SmartcardInfo::serial() const { return mAttributes
[8]; }
167 // DL Primary relation (one record per DL SSID)
169 static const char * const dlAttributes
[] = {
170 // up to Vendor is handled by PrimaryRecord
175 DL::DL() : PrimaryRecord(dlAttributes
) { }
177 uint32
DL::dlType() const { return mAttributes
[5]; }
178 uint32
DL::queryLimits() const { return mAttributes
[6]; }
182 // CL Primary relation (one record per CL SSID)
184 static const char * const clAttributes
[] = {
185 // up to Vendor is handled by PrimaryRecord
190 CL::CL() : PrimaryRecord(clAttributes
) { }
192 uint32
CL::certTypeFormat() const { return mAttributes
[5]; }
193 uint32
CL::crlTypeFormat() const { return mAttributes
[6]; }
197 // TP Primary relation (one record per TP SSID)
199 static const char * const tpAttributes
[] = {
200 // up to Vendor is handled by PrimaryRecord
204 TP::TP() : PrimaryRecord(tpAttributes
) { }
206 uint32
TP::certTypeFormat() const { return mAttributes
[5]; }
210 // TP Policy-OIDS relation (one record per supported policy and TP)
212 static const char * const policyAttributes
[] = {
219 PolicyOids::PolicyOids() : Record(policyAttributes
) { }
221 string
PolicyOids::moduleID() const { return mAttributes
[0]; }
222 uint32
PolicyOids::subserviceID() const { return mAttributes
[1]; }
223 CssmData
PolicyOids::oid() const { return mAttributes
[2]; }
224 CssmData
PolicyOids::value() const { return mAttributes
[3]; }
227 } // end namespace MDSClient
228 } // end namespace Security