1/*
2 * Copyright (c) 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/*	CFURLAccess.h
25	Copyright (c) 1998-2013, Apple Inc. All rights reserved.
26
27        CFURLAccess is deprecated as of Mac OS X 10.9 and iOS 7.0. The suggested replacement for URLs with network schemes (http, https, ftp, data) is the NSURLConnection class. The suggested replacement for URLs with the file scheme are the foundation classes NSFileManager, NSFileHandle and NSURL, or the CoreFoundation classes CFStream and CFURL.
28*/
29
30#if !defined(__COREFOUNDATION_CFURLACCESS__)
31#define __COREFOUNDATION_CFURLACCESS__ 1
32
33#include <CoreFoundation/CFBase.h>
34#include <CoreFoundation/CFArray.h>
35#include <CoreFoundation/CFData.h>
36#include <CoreFoundation/CFDictionary.h>
37#include <CoreFoundation/CFError.h>
38#include <CoreFoundation/CFString.h>
39#include <CoreFoundation/CFURL.h>
40
41CF_EXTERN_C_BEGIN
42
43
44
45/* Attempts to read the data and properties for the given URL.  If
46only interested in one of the resourceData and properties, pass NULL
47for the other.  If properties is non-NULL and desiredProperties is
48NULL, then all properties are fetched.  Returns success or failure;
49note that as much work as possible is done even if false is returned.
50So for instance if one property is not available, the others are
51fetched anyway. errorCode is set to 0 on success, and some other
52value on failure.  If non-NULL, it is the caller 's responsibility
53to release resourceData and properties.
54
55    Apple reserves for its use all negative error code values; these
56values represent errors common to any scheme.  Scheme-specific error
57codes should be positive, non-zero, and should be used only if one of
58the predefined Apple error codes does not apply.  Error codes should
59be publicized and documented with the scheme-specific properties.
60
61NOTE: When asking for the resource data, this call will allocate the entire
62resource in memory. This can be very expensive, depending on the size of the
63resource (file). Please use CFStream or other techniques if you are downloading
64large files.
65
66*/
67/* Deprecated -- see top of this file for suggested replacement classes */
68CF_EXPORT
69Boolean CFURLCreateDataAndPropertiesFromResource(CFAllocatorRef alloc, CFURLRef url, CFDataRef *resourceData, CFDictionaryRef *properties, CFArrayRef desiredProperties, SInt32 *errorCode) CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
70
71/* Attempts to write the given data and properties to the given URL.
72If dataToWrite is NULL, only properties are written out (use
73CFURLDestroyResource() to delete a resource).  Properties not present
74in propertiesToWrite are left unchanged, hence if propertiesToWrite
75is NULL or empty, the URL's properties are not changed at all.
76Returns success or failure; errorCode is set as for
77CFURLCreateDataAndPropertiesFromResource(), above.
78*/
79/* Deprecated -- see top of this file for suggested replacement classes */
80CF_EXPORT
81Boolean CFURLWriteDataAndPropertiesToResource(CFURLRef url, CFDataRef dataToWrite, CFDictionaryRef propertiesToWrite, SInt32 *errorCode) CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
82
83/* Destroys the resource indicated by url.
84Returns success or failure; errorCode set as above.
85*/
86/* Deprecated -- see top of this file for suggested replacement classes */
87CF_EXPORT
88Boolean CFURLDestroyResource(CFURLRef url, SInt32 *errorCode) CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
89
90/* Convenience method which calls through to CFURLCreateDataAndPropertiesFromResource().
91Returns NULL on error and sets errorCode accordingly.
92*/
93/* Deprecated -- see top of this file for suggested replacement classes */
94CF_EXPORT
95CFTypeRef CFURLCreatePropertyFromResource(CFAllocatorRef alloc, CFURLRef url, CFStringRef property, SInt32 *errorCode) CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
96
97
98/* Common error codes (returned only by the older APIs that predate CFError) */
99typedef CF_ENUM(CFIndex, CFURLError) {
100    kCFURLUnknownError = -10L,
101    kCFURLUnknownSchemeError = -11L,
102    kCFURLResourceNotFoundError = -12L,
103    kCFURLResourceAccessViolationError = -13L,
104    kCFURLRemoteHostUnavailableError = -14L,
105    kCFURLImproperArgumentsError = -15L,
106    kCFURLUnknownPropertyKeyError = -16L,
107    kCFURLPropertyKeyUnavailableError = -17L,
108    kCFURLTimeoutError = -18L
109} CF_ENUM_DEPRECATED(10_0, 10_9, 2_0, 7_0);
110
111/* Older property keys */
112
113CF_EXPORT
114const CFStringRef kCFURLFileExists CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
115CF_EXPORT
116const CFStringRef kCFURLFileDirectoryContents CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
117CF_EXPORT
118const CFStringRef kCFURLFileLength CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
119CF_EXPORT
120const CFStringRef kCFURLFileLastModificationTime CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
121CF_EXPORT
122const CFStringRef kCFURLFilePOSIXMode CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
123CF_EXPORT
124const CFStringRef kCFURLFileOwnerID CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
125CF_EXPORT
126const CFStringRef kCFURLHTTPStatusCode CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
127CF_EXPORT
128const CFStringRef kCFURLHTTPStatusLine CF_DEPRECATED(10_0, 10_9, 2_0, 7_0);
129
130/* The value of kCFURLFileExists is a CFBoolean */
131/* The value of kCFURLFileDirectoryContents is a CFArray containing CFURLs.  An empty array means the directory exists, but is empty */
132/* The value of kCFURLFileLength is a CFNumber giving the file's length in bytes */
133/* The value of kCFURLFileLastModificationTime is a CFDate */
134/* The value of kCFURLFilePOSIXMode is a CFNumber as given in stat.h */
135/* The value of kCFURLFileOwnerID is a CFNumber representing the owner's uid */
136
137/* Properties for the http: scheme.  Except for the common error codes, above, errorCode will be set to the HTTP response status code upon failure.  Any HTTP header name can also be used as a property */
138/* The value of kCFURLHTTPStatusCode is a CFNumber */
139/* The value of kCFURLHTTPStatusLine is a CFString */
140
141CF_EXTERN_C_END
142
143#endif /* ! __COREFOUNDATION_CFURLACCESS__ */
144
145