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 Contains: Internal representation of one MDS info file.
24 Copyright: (c) 2001 Apple Computer, Inc., all rights reserved.
27 #ifndef _MDS_DICTIONARY_H_
28 #define _MDS_DICTIONARY_H_ 1
30 #include <Security/cssmtype.h>
31 #include <Security/MDSSession.h>
32 #include <Security/MDSAttrStrings.h>
33 #include <CoreFoundation/CoreFoundation.h>
41 /* heavyweight constructor from file */
44 const char *fullPath
);
46 /* lightweight constructor from existing CFDictionary */
48 CFDictionaryRef theDict
);
53 * Lookup by either C string or CFStringRef. Optionally checks for
54 * CFTypeID of resulting value. Both return NULL on error (either key not
55 * found or wrong CFTypeID).
59 bool checkType
= false, // since we really don't know if 0 is a valid type
63 bool checkType
= false,
67 * Common means to perform a lookup in a dictionary given a C-string key and
68 * placing the value - if present - in a CSSM_DB_ATTRIBUTE_DATA. Any errors
69 * are only logged via MPDebug. Returns true if the value was found and
70 * successfully placed in supplied CSSM_DB_ATTRIBUTE_DATA.
72 * For now we assume that the key in the dictionary is the same as the key
73 * in the DB to which we're writing.
75 * A MDSNameValuePair array may be specified to facilitate conversion of
76 * values which appears in the dictionary as strings but which are stored
77 * in the DB as integers.
79 * We're also assuming that all DB keys are of format
80 * CSSM_DB_ATTRIBUTE_NAME_AS_STRING.
84 CSSM_DB_ATTRIBUTE_DATA
&attr
,
85 CSSM_DB_ATTRIBUTE_FORMAT attrFormat
,
86 const MDSNameValuePair
*nameValues
= NULL
);
89 * Given a RelationInfo and an array of CSSM_DB_ATTRIBUTE_DATAs, fill in
90 * the CSSM_DB_ATTRIBUTE_DATA array with as many fields as we can find in
91 * the dictionary. All fields are treated as optional.
93 void lookupAttributes(
94 const RelationInfo
*relInfo
,
95 CSSM_DB_ATTRIBUTE_DATA_PTR outAttrs
, // filled in on return
96 uint32
&numAttrs
); // RETURNED
98 CFDictionaryRef
dict() { return mDict
; }
99 const char *urlPath() { return mUrlPath
; }
100 const char *fileDesc() { return mFileDesc
; }
103 * Lookup with file-based indirection. Allows multiple mdsinfo file to share
104 * commmon info from a separate plist file.
106 const CFPropertyListRef
lookupWithIndirect(
109 CFTypeID desiredType
,
110 bool &fetchedFromDisk
); // true --> caller must CFRelease the returned
112 // false -> it's part of this dictionary
114 CFDictionaryRef mDict
;
120 } // end namespace Security
122 #endif /* _MDS_DICTIONARY_H_ */