00001
00002 #ifndef HTTP_CLIENT_WRAPPER
00003 #define HTTP_CLIENT_WRAPPER
00004
00005
00006 #define _HTTP_BUILD_WIN32 // Set Windows Build flag
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifdef _HTTP_BUILD_WIN32
00016
00017 #if defined(_MSC_VER)
00018 #pragma warning (disable: 4996) // 'function': was declared deprecated (VS 2005)
00019 #endif
00020 #include <stdlib.h>
00021 #include <string.h>
00022 #include <memory.h>
00023 #include <stdio.h>
00024 #include <ctype.h>
00025 #include <time.h>
00026 #if defined(_WIN32) || defined(WIN32)
00027 #include <winsock.h>
00028 #endif
00029
00030
00031 typedef unsigned int UINT32;
00032 typedef int INT32;
00033
00034
00035 #define HTTP_ECONNRESET (WSAECONNRESET)
00036 #define HTTP_EINPROGRESS (WSAEINPROGRESS)
00037 #define HTTP_EWOULDBLOCK (WSAEWOULDBLOCK)
00038 #endif
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif
00051
00052
00053 int HTTPWrapperIsAscii (int c);
00054 int HTTPWrapperToUpper (int c);
00055 int HTTPWrapperToLower (int c);
00056 int HTTPWrapperIsAlpha (int c);
00057 int HTTPWrapperIsAlNum (int c);
00058 char* HTTPWrapperItoa (char *buff,int i);
00059 void HTTPWrapperInitRandomeNumber ();
00060 long HTTPWrapperGetUpTime ();
00061 int HTTPWrapperGetRandomeNumber ();
00062 int HTTPWrapperGetSocketError (int s);
00063 unsigned long HTTPWrapperGetHostByName (char *name,unsigned long *address);
00064 int HTTPWrapperShutDown (int s,int in);
00065
00066 int HTTPWrapperSSLConnect (int s,const struct sockaddr *name,int namelen,char *hostname);
00067 int HTTPWrapperSSLNegotiate (int s,const struct sockaddr *name,int namelen,char *hostname);
00068 int HTTPWrapperSSLSend (int s,char *buf, int len,int flags);
00069 int HTTPWrapperSSLRecv (int s,char *buf, int len,int flags);
00070 int HTTPWrapperSSLClose (int s);
00071 int HTTPWrapperSSLRecvPending (int s);
00072
00073 #define IToA HTTPWrapperItoa
00074 #define GetUpTime HTTPWrapperGetUpTime
00075 #define SocketGetErr HTTPWrapperGetSocketError
00076 #define HostByName HTTPWrapperGetHostByName
00077 #define InitRandomeNumber HTTPWrapperInitRandomeNumber
00078 #define GetRandomeNumber HTTPWrapperGetRandomeNumber
00079
00080 #ifdef __cplusplus
00081 }
00082 #endif
00083
00084
00085
00086
00087
00088
00089
00090
00091 #define VOID void
00092 #ifndef NULL
00093 #define NULL 0
00094 #endif
00095 #define TRUE 1
00096 #define FALSE 0
00097 typedef char CHAR;
00098 typedef unsigned short UINT16;
00099 typedef int BOOL;
00100 typedef unsigned long ULONG;
00101
00102
00103 #define HTTP_INVALID_SOCKET (-1)
00104 typedef struct sockaddr_in HTTP_SOCKADDR_IN;
00105 typedef struct timeval HTTP_TIMEVAL;
00106 typedef struct hostent HTTP_HOSTNET;
00107 typedef struct sockaddr HTTP_SOCKADDR;
00108 typedef struct in_addr HTTP_INADDR;
00109
00110
00111 #endif // HTTP_CLIENT_WRAPPER