2 * Copyright (c) 2000-2001,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.
22 Contains: Internal representation of one MDS info file.
24 Copyright (c) 2001,2011,2014 Apple Inc. All Rights Reserved.
27 #ifndef _MDS_DICTIONARY_H_
28 #define _MDS_DICTIONARY_H_ 1
30 #include <Security/cssmtype.h>
31 #include "MDSSession.h"
32 #include "MDSAttrStrings.h"
33 #include <CoreFoundation/CoreFoundation.h>
41 /* heavyweight constructor from file */
45 const char *fullPath
);
47 /* lightweight constructor from existing CFDictionary */
49 CFDictionaryRef theDict
);
54 * Lookup by either C string or CFStringRef. Optionally checks for
55 * CFTypeID of resulting value. Both return NULL on error (either key not
56 * found or wrong CFTypeID).
60 bool checkType
= false, // since we really don't know if 0 is a valid type
64 bool checkType
= false,
68 * Common means to perform a lookup in a dictionary given a C-string key and
69 * placing the value - if present - in a CSSM_DB_ATTRIBUTE_DATA. Any errors
70 * are only logged via MPDebug. Returns true if the value was found and
71 * successfully placed in supplied CSSM_DB_ATTRIBUTE_DATA.
73 * For now we assume that the key in the dictionary is the same as the key
74 * in the DB to which we're writing.
76 * A MDSNameValuePair array may be specified to facilitate conversion of
77 * values which appears in the dictionary as strings but which are stored
78 * in the DB as integers.
80 * We're also assuming that all DB keys are of format
81 * CSSM_DB_ATTRIBUTE_NAME_AS_STRING.
85 CSSM_DB_ATTRIBUTE_DATA
&attr
,
86 CSSM_DB_ATTRIBUTE_FORMAT attrFormat
,
87 const MDSNameValuePair
*nameValues
= NULL
);
90 * Given a RelationInfo and an array of CSSM_DB_ATTRIBUTE_DATAs, fill in
91 * the CSSM_DB_ATTRIBUTE_DATA array with as many fields as we can find in
92 * the dictionary. All fields are treated as optional.
94 void lookupAttributes(
95 const RelationInfo
*relInfo
,
96 CSSM_DB_ATTRIBUTE_DATA_PTR outAttrs
, // filled in on return
97 uint32
&numAttrs
); // RETURNED
99 CFDictionaryRef
dict() { return mDict
; }
100 const char *urlPath() { return mUrlPath
; }
101 const char *fileDesc() { return mFileDesc
; }
104 * Lookup with file-based indirection. Allows multiple mdsinfo file to share
105 * commmon info from a separate plist file.
107 CFPropertyListRef
lookupWithIndirect(
110 CFTypeID desiredType
);
111 void setDefaults(const MDS_InstallDefaults
*defaults
);
114 CFDictionaryRef mDict
;
120 // default GUID/SSID to apply to all records as needed
121 const MDS_InstallDefaults
*mDefaults
;
124 } // end namespace Security
126 #endif /* _MDS_DICTIONARY_H_ */