1/* 2 * Copyright (c) 2002-2008, 2010-2014 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24 25#ifndef _DY_FRAMEWORK_H 26#define _DY_FRAMEWORK_H 27 28#include <Availability.h> 29#include <TargetConditionals.h> 30#include <sys/cdefs.h> 31#include <mach/mach.h> 32#include <CoreFoundation/CoreFoundation.h> 33#include <IOKit/IOKitLib.h> 34#if !TARGET_OS_IPHONE 35#include <IOKit/pwr_mgt/IOPMLibPrivate.h> 36#endif // !TARGET_OS_IPHONE 37#include <Security/Security.h> 38#include <Security/SecCertificatePriv.h> 39#include <Security/SecItem.h> // only needed for Mac OS X 10.6[.x] 40 41 42__BEGIN_DECLS 43 44#pragma mark - 45#pragma mark IOKit.framework APIs 46 47CFMutableDictionaryRef 48_IOBSDNameMatching ( 49 mach_port_t masterPort, 50 uint32_t options, 51 const char *bsdName 52 ); 53#define IOBSDNameMatching _IOBSDNameMatching 54 55io_object_t 56_IOIteratorNext ( 57 io_iterator_t iterator 58 ); 59#define IOIteratorNext _IOIteratorNext 60 61kern_return_t 62_IOMasterPort ( 63 mach_port_t bootstrapPort, 64 mach_port_t *masterPort 65 ); 66#define IOMasterPort _IOMasterPort 67 68boolean_t 69_IOObjectConformsTo ( 70 io_object_t object, 71 const io_name_t className 72 ); 73#define IOObjectConformsTo _IOObjectConformsTo 74 75boolean_t 76_IOObjectGetClass ( 77 io_object_t object, 78 io_name_t className 79 ); 80#define IOObjectGetClass _IOObjectGetClass 81 82kern_return_t 83_IOObjectRelease ( 84 io_object_t object 85 ); 86#define IOObjectRelease _IOObjectRelease 87 88#if !TARGET_OS_IPHONE 89 90IOReturn 91_IOPMConnectionAcknowledgeEvent ( 92 IOPMConnection myConnection, 93 IOPMConnectionMessageToken token 94 ); 95#define IOPMConnectionAcknowledgeEvent _IOPMConnectionAcknowledgeEvent 96 97IOReturn 98_IOPMConnectionCreate ( 99 CFStringRef myName, 100 IOPMCapabilityBits interests, 101 IOPMConnection *newConnection 102 ); 103#define IOPMConnectionCreate _IOPMConnectionCreate 104 105IOPMCapabilityBits 106_IOPMConnectionGetSystemCapabilities (void); 107#define IOPMConnectionGetSystemCapabilities _IOPMConnectionGetSystemCapabilities 108 109IOReturn 110_IOPMConnectionRelease ( 111 IOPMConnection myConnection 112 ); 113#define IOPMConnectionRelease _IOPMConnectionRelease 114 115void 116_IOPMConnectionSetDispatchQueue ( 117 IOPMConnection myConnection, 118 dispatch_queue_t myQueue 119 ); 120#define IOPMConnectionSetDispatchQueue _IOPMConnectionSetDispatchQueue 121 122IOReturn 123_IOPMConnectionSetNotification ( 124 IOPMConnection myConnection, 125 void *param, 126 IOPMEventHandlerType handler 127 ); 128#define IOPMConnectionSetNotification _IOPMConnectionSetNotification 129 130#endif // !TARGET_OS_IPHONE 131 132CFTypeRef 133_IORegistryEntryCreateCFProperty ( 134 io_registry_entry_t entry, 135 CFStringRef key, 136 CFAllocatorRef allocator, 137 IOOptionBits options 138 ); 139#define IORegistryEntryCreateCFProperty _IORegistryEntryCreateCFProperty 140 141kern_return_t 142_IORegistryEntryCreateCFProperties ( 143 io_registry_entry_t entry, 144 CFMutableDictionaryRef *properties, 145 CFAllocatorRef allocator, 146 IOOptionBits options 147 ); 148#define IORegistryEntryCreateCFProperties _IORegistryEntryCreateCFProperties 149 150kern_return_t 151_IORegistryEntryCreateIterator ( 152 io_registry_entry_t entry, 153 const io_name_t plane, 154 IOOptionBits options, 155 io_iterator_t *iterator 156 ); 157#define IORegistryEntryCreateIterator _IORegistryEntryCreateIterator 158 159kern_return_t 160_IORegistryEntryGetLocationInPlane ( 161 io_registry_entry_t entry, 162 const io_name_t plane, 163 io_name_t location 164 ); 165#define IORegistryEntryGetLocationInPlane _IORegistryEntryGetLocationInPlane 166 167kern_return_t 168_IORegistryEntryGetName ( 169 io_registry_entry_t entry, 170 io_name_t name 171 ); 172#define IORegistryEntryGetName _IORegistryEntryGetName 173 174kern_return_t 175_IORegistryEntryGetNameInPlane ( 176 io_registry_entry_t entry, 177 const io_name_t plane, 178 io_name_t name 179 ); 180#define IORegistryEntryGetNameInPlane _IORegistryEntryGetNameInPlane 181 182kern_return_t 183_IORegistryEntryGetParentEntry ( 184 io_registry_entry_t entry, 185 const io_name_t plane, 186 io_registry_entry_t *parent 187 ); 188#define IORegistryEntryGetParentEntry _IORegistryEntryGetParentEntry 189 190kern_return_t 191_IORegistryEntryGetPath ( 192 io_registry_entry_t entry, 193 const io_name_t plane, 194 io_string_t path 195 ); 196#define IORegistryEntryGetPath _IORegistryEntryGetPath 197 198kern_return_t 199_IORegistryEntryGetRegistryEntryID ( 200 io_registry_entry_t entry, 201 uint64_t *entryID 202 ); 203#define IORegistryEntryGetRegistryEntryID _IORegistryEntryGetRegistryEntryID 204 205CFTypeRef 206_IORegistryEntrySearchCFProperty ( 207 io_registry_entry_t entry, 208 const io_name_t plane, 209 CFStringRef key, 210 CFAllocatorRef allocator, 211 IOOptionBits options 212 ) CF_RETURNS_RETAINED; 213#define IORegistryEntrySearchCFProperty _IORegistryEntrySearchCFProperty 214 215kern_return_t 216_IOServiceGetMatchingServices ( 217 mach_port_t masterPort, 218 CFDictionaryRef matching, 219 io_iterator_t *existing 220 ); 221#define IOServiceGetMatchingServices _IOServiceGetMatchingServices 222 223CFMutableDictionaryRef 224_IOServiceMatching ( 225 const char *name 226 ); 227#define IOServiceMatching _IOServiceMatching 228 229#pragma mark - 230#pragma mark Security.framework APIs 231 232#if !TARGET_OS_IPHONE 233 234CFTypeRef _kSecAttrService(); 235#define kSecAttrService _kSecAttrService() 236 237CFTypeRef _kSecClass(); 238#define kSecClass _kSecClass() 239 240CFTypeRef _kSecClassGenericPassword(); 241#define kSecClassGenericPassword _kSecClassGenericPassword() 242 243CFTypeRef _kSecMatchLimit(); 244#define kSecMatchLimit _kSecMatchLimit() 245 246CFTypeRef _kSecMatchLimitAll(); 247#define kSecMatchLimitAll _kSecMatchLimitAll() 248 249CFTypeRef _kSecMatchSearchList(); 250#define kSecMatchSearchList _kSecMatchSearchList() 251 252CFTypeRef _kSecReturnRef(); 253#define kSecReturnRef _kSecReturnRef() 254 255CFTypeRef _kSecGuestAttributePid(); 256#define kSecGuestAttributePid _kSecGuestAttributePid() 257 258CFTypeRef _kSecCodeInfoIdentifier(); 259#define kSecCodeInfoIdentifier _kSecCodeInfoIdentifier() 260 261CFTypeRef _kSecCodeInfoUnique(); 262#define kSecCodeInfoUnique _kSecCodeInfoUnique() 263 264OSStatus 265_AuthorizationMakeExternalForm ( 266 AuthorizationRef authorization, 267 AuthorizationExternalForm *extForm 268 ); 269#define AuthorizationMakeExternalForm _AuthorizationMakeExternalForm 270 271OSStatus 272_SecAccessCreate ( 273 CFStringRef descriptor, 274 CFArrayRef trustedlist, 275 SecAccessRef *accessRef 276 ); 277#define SecAccessCreate _SecAccessCreate 278 279#if (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070) 280OSStatus 281_SecAccessCreateFromOwnerAndACL ( 282 const CSSM_ACL_OWNER_PROTOTYPE *owner, 283 uint32 aclCount, 284 const CSSM_ACL_ENTRY_INFO *acls, 285 SecAccessRef *accessRef 286 ); 287#define SecAccessCreateFromOwnerAndACL _SecAccessCreateFromOwnerAndACL 288#else // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070) 289SecAccessRef 290_SecAccessCreateWithOwnerAndACL ( 291 uid_t userId, 292 gid_t groupId, 293 SecAccessOwnerType ownerType, 294 CFArrayRef acls, 295 CFErrorRef *error 296 ); 297#define SecAccessCreateWithOwnerAndACL _SecAccessCreateWithOwnerAndACL 298#endif // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070) 299 300OSStatus 301_SecItemCopyMatching ( 302 CFDictionaryRef query, 303 CFTypeRef *result 304 ); 305#define SecItemCopyMatching _SecItemCopyMatching 306 307OSStatus 308_SecKeychainCopyDomainDefault ( 309 SecPreferencesDomain domain, 310 SecKeychainRef *keychain 311 ); 312#define SecKeychainCopyDomainDefault _SecKeychainCopyDomainDefault 313 314OSStatus 315_SecKeychainOpen ( 316 const char *pathName, 317 SecKeychainRef *keychain 318 ); 319#define SecKeychainOpen _SecKeychainOpen 320 321OSStatus 322_SecKeychainSetDomainDefault ( 323 SecPreferencesDomain domain, 324 SecKeychainRef keychain 325 ); 326#define SecKeychainSetDomainDefault _SecKeychainSetDomainDefault 327 328OSStatus 329_SecKeychainItemCopyContent ( 330 SecKeychainItemRef itemRef, 331 SecItemClass *itemClass, 332 SecKeychainAttributeList *attrList, 333 UInt32 *length, 334 void **outData 335 ); 336#define SecKeychainItemCopyContent _SecKeychainItemCopyContent 337 338OSStatus 339_SecKeychainItemCreateFromContent ( 340 SecItemClass itemClass, 341 SecKeychainAttributeList *attrList, 342 UInt32 length, 343 const void *data, 344 SecKeychainRef keychainRef, 345 SecAccessRef initialAccess, 346 SecKeychainItemRef *itemRef 347 ); 348#define SecKeychainItemCreateFromContent _SecKeychainItemCreateFromContent 349 350OSStatus 351_SecKeychainItemDelete ( 352 SecKeychainItemRef itemRef 353 ); 354#define SecKeychainItemDelete _SecKeychainItemDelete 355 356OSStatus 357_SecKeychainItemFreeContent ( 358 SecKeychainAttributeList *attrList, 359 void *data 360 ); 361#define SecKeychainItemFreeContent _SecKeychainItemFreeContent 362 363OSStatus 364_SecKeychainItemModifyContent ( 365 SecKeychainItemRef itemRef, 366 const SecKeychainAttributeList *attrList, 367 UInt32 length, 368 const void *data 369 ); 370#define SecKeychainItemModifyContent _SecKeychainItemModifyContent 371 372 373OSStatus 374_SecTrustedApplicationCreateFromPath ( 375 const char *path, 376 SecTrustedApplicationRef *app 377 ); 378#define SecTrustedApplicationCreateFromPath _SecTrustedApplicationCreateFromPath 379 380#else // TARGET_OS_IPHONE 381 382CFStringRef _kSecPropertyKeyValue(); 383#define kSecPropertyKeyValue _kSecPropertyKeyValue() 384 385CFStringRef _kSecPropertyKeyLabel(); 386#define kSecPropertyKeyLabel _kSecPropertyKeyLabel() 387 388CFArrayRef 389_SecCertificateCopyProperties ( 390 SecCertificateRef certRef 391 ); 392#define SecCertificateCopyProperties _SecCertificateCopyProperties 393 394#endif // TARGET_OS_IPHONE 395 396SecCertificateRef 397_SecCertificateCreateWithData ( 398 CFAllocatorRef allocator, 399 CFDataRef data 400 ); 401#define SecCertificateCreateWithData _SecCertificateCreateWithData 402 403 404 405 406 407 408__END_DECLS 409 410#endif // _DY_FRAMEWORK_H 411 412