CFURLConnection.h
1 #ifndef __CFURLCONNECTION__ 2 #define __CFURLCONNECTION__ 3 4 #include "CFURLAuthChallenge.h" 5 #include "CFURLProtectionSpace.h" 6 #include "CFURLRequest.h" 7 #include "CFURLResponse.h" 8 #include "CFCachedURLResponse.h" 9 10 #if PRAGMA_ONCE 11 #pragma once 12 #endif 13 14 __BEGIN_DECLS 15 16 typedef const struct _CFURLConnection *CFURLConnectionRef; 17 18 typedef struct { 19 CFIndex version; 20 const void *info; 21 const void *(*retain)(const void *info); 22 void (*release)(const void *info); 23 CFStringRef (*copyDescription)(const void *info); 24 Boolean (*equal)(const void *info1, const void *info2); 25 CFHashCode (*hash)(const void *info); 26 27 Boolean (*handledByProtocol)(const void *info); 28 Boolean (*canAuth)(const void *info, CFURLProtectionSpaceRef space); 29 void (*cancelledAuthChallenge)(const void *info, CFURLAuthChallengeRef challenge); 30 void (*failed)(const void *info, CFErrorRef error); 31 void (*receivedAuthChallenge)(const void *info, CFURLAuthChallengeRef challenge); 32 void (*sendRequestForAuthChallenge)(const void *info, CFURLAuthChallengeRef challenge); 33 Boolean (*useCredentialStorage)(const void *info); 34 35 } CFURLConnectionContext; 36 37 typedef struct { 38 CFIndex version; 39 const void *info; 40 const void *(*retain)(const void *info); 41 void (*release)(const void *info); 42 CFStringRef (*copyDescription)(const void *info); 43 Boolean (*equal)(const void *info1, const void *info2); 44 CFHashCode (*hash)(const void *info); 45 46 CFURLRequestRef (*redirect)(const void *info, CFURLRequestRef request, CFURLResponseRef response); 47 void (*response)(const void *info, CFURLResponseRef response); 48 void (*data)(const void *info, CFDataRef data); 49 CFReadStreamRef (*newBodyStream)(const void *info, CFURLRequestRef request); 50 void (*sent)(const void *info, CFIndex bytesWritten, CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite); 51 void (*finished)(const void *info); 52 CFCachedURLResponseRef (*cache)(const void *info, CFCachedURLResponseRef cachedResponse); 53 } CFURLConnectionHandlerContext; 54 55 CFURLConnectionRef CFURLConnectionCreate(CFAllocatorRef allocator, CFURLRequestRef request, const CFURLConnectionContext *ctx); 56 Boolean CFURLConnectionGetResponse(CFURLConnectionRef connection, CFURLResponseRef *response, CFErrorRef *error); 57 void CFURLConnectionSetHandler(CFURLConnectionRef connection, const CFURLConnectionHandlerContext *handlerContext); 58 void CFURLConnectionScheduleWithRunLoop(CFURLConnectionRef connection, CFRunLoopRef runLoop, CFStringRef runLoopMode); 59 void CFURLConnectionUnscheduleFromRunLoop(CFURLConnectionRef connection, CFRunLoopRef runLoop, CFStringRef runLoopMode); 60 Boolean CFURLConnectionSendSynchronousRequest(CFURLRequestRef request, CFDataRef *data, CFURLResponseRef *response, CFErrorRef *error); 61 void CFURLConnectionSendAsynchronousRequest(CFURLRequestRef request, void (^)(CFURLResponseRef, CFDataRef, CFErrorRef)); 62 void CFURLConnectionStart(CFURLConnectionRef connection); 63 void CFURLConnectionCancel(CFURLConnectionRef connection); 64 65 __END_DECLS 66 67 #endif