CFHTTPConnectionInternal.h [plain text]
#include <CoreFoundation/CoreFoundation.h>
#include <CFNetwork/CFHTTPConnectionPriv.h>
#include "CFNetConnection.h"
struct _CFHTTPConnectionInfo {
CFStringRef host;
SInt32 port;
UInt32 type;
CFDictionaryRef streamProperties;
CFMutableSetRef authentications;
};
typedef struct _CFHTTPConnectionInfo _CFHTTPConnectionInfo;
#define HAVE_SENT_REQUEST_HEADERS (0)
#define HAVE_SENT_REQUEST_PAYLOAD (1)
#define HAVE_CHECKED_RESPONSE_HEADERS (2)
#define FORCE_EOF (3)
#define PAYLOAD_IS_DATA (4)
#define OPEN_SIGNALLED (5)
#define HAS_PAYLOAD (6)
#define IS_ZOMBIE (7)
#define MIN_STATE_BIT (8)
#define MAX_STATE_BIT (11)
#define IN_READ_CALLBACK (12)
#define HAVE_READ_MARK (13)
struct _CFHTTPStreamInfo {
CFOptionFlags flags;
CFHTTPMessageRef request;
CFHTTPMessageRef responseHeaders;
CFReadStreamRef requestPayload; CFDataRef requestFragment; long long requestBytesWritten;
CFArrayRef peerCertificates; CFArrayRef clientCertificates; CFNumberRef clientCertificateState;
_CFNetConnectionRef conn;
CFReadStreamRef stream; CFRunLoopSourceRef stateChangeSource; };
typedef struct _CFHTTPStreamInfo _CFHTTPStreamInfo;
static const void *httpConnectionCreate(CFAllocatorRef alloc, const void *info);
static void httpConnectionFinalize(CFAllocatorRef alloc, const void *info);
static CFStreamError httpConnectionCreateStreams(CFAllocatorRef allocator, const void *info, CFWriteStreamRef *requestStream, CFReadStreamRef *responseStream);
static void httpConnectionStateChanged(void *request, int newState, CFStreamError *err, _CFNetConnectionRef connection, const void *info);
static void httpConnectionTransmitRequest(void *request, _CFNetConnectionRef connection, const void *info);
static void httpConnectionReceiveResponse(void *request, _CFNetConnectionRef connection, const void *info);
static void httpConnectionResponseStreamCB(void *request, CFReadStreamRef stream, CFStreamEventType eventType, _CFNetConnectionRef conn, const void *info);
static void httpConnectionRequestStreamCB(void *request, CFWriteStreamRef stream, CFStreamEventType eventType, _CFNetConnectionRef conn, const void *info);
static CFArrayRef httpConnectionRLArrayForRequest(void *request, _CFNetConnectionRef conn, const void *info);
static void *httpStreamCreate(CFReadStreamRef stream, void *info);
static void httpStreamFinalize(CFReadStreamRef stream, void *info);
static CFStringRef httpStreamCopyDescription(CFReadStreamRef stream, void *info);
static Boolean httpStreamOpen(CFReadStreamRef stream, CFStreamError *error, Boolean *openComplete, void *info);
static Boolean httpStreamOpenCompleted(CFReadStreamRef stream, CFStreamError *error, void *info);
static CFIndex httpStreamRead(CFReadStreamRef stream, UInt8 *buffer, CFIndex bufferLength, CFStreamError *error, Boolean *atEOF, void *info);
static Boolean httpStreamCanRead(CFReadStreamRef stream, void *info);
static void httpStreamClose(CFReadStreamRef stream, void *info);
static CFTypeRef httpStreamCopyProperty(CFReadStreamRef stream, CFStringRef propertyName, void *info);
static Boolean httpStreamSetProperty(CFReadStreamRef stream, CFStringRef propertyName, CFTypeRef propertyValue, void *info);
static void httpStreamSchedule(CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *info);
static void httpStreamUnschedule(CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *info);
static void httpRequestPayloadCallBack(CFReadStreamRef stream, CFStreamEventType type, void *info);
static void dequeueFromConnection(_CFHTTPStreamInfo *streamInfo);
static void destroyStreamInfo(CFAllocatorRef alloc, _CFHTTPStreamInfo *streamInfo);
static _CFHTTPStreamInfo *createZombieDouble(CFAllocatorRef alloc, _CFHTTPStreamInfo *orig, _CFNetConnectionRef conn);