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 #ifdef WINDOWS_UWP
00028 #include <winsock2.h>
00029 #else
00030 #include <winsock.h>
00031 #endif
00032 #endif
00033
00034
00035 typedef unsigned int UINT32;
00036 typedef int INT32;
00037
00038
00039 #define HTTP_ECONNRESET (WSAECONNRESET)
00040 #define HTTP_EINPROGRESS (WSAEINPROGRESS)
00041 #define HTTP_EWOULDBLOCK (WSAEWOULDBLOCK)
00042 #endif
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055
00056
00057 int HTTPWrapperIsAscii (int c);
00058 int HTTPWrapperToUpper (int c);
00059 int HTTPWrapperToLower (int c);
00060 int HTTPWrapperIsAlpha (int c);
00061 int HTTPWrapperIsAlNum (int c);
00062 char* HTTPWrapperItoa (char *buff,int i);
00063 void HTTPWrapperInitRandomeNumber ();
00064 long HTTPWrapperGetUpTime ();
00065 int HTTPWrapperGetRandomeNumber ();
00066 int HTTPWrapperGetSocketError (int s);
00067 unsigned long HTTPWrapperGetHostByName (char *name,unsigned long *address);
00068 int HTTPWrapperShutDown (int s,int in);
00069
00070 int HTTPWrapperSSLConnect (int s,const struct sockaddr *name,int namelen,char *hostname);
00071 int HTTPWrapperSSLNegotiate (int s,const struct sockaddr *name,int namelen,char *hostname);
00072 int HTTPWrapperSSLSend (int s,char *buf, int len,int flags);
00073 int HTTPWrapperSSLRecv (int s,char *buf, int len,int flags);
00074 int HTTPWrapperSSLClose (int s);
00075 int HTTPWrapperSSLRecvPending (int s);
00076
00077 #define IToA HTTPWrapperItoa
00078 #define GetUpTime HTTPWrapperGetUpTime
00079 #define SocketGetErr HTTPWrapperGetSocketError
00080 #define HostByName HTTPWrapperGetHostByName
00081 #define InitRandomeNumber HTTPWrapperInitRandomeNumber
00082 #define GetRandomeNumber HTTPWrapperGetRandomeNumber
00083
00084 #ifdef __cplusplus
00085 }
00086 #endif
00087
00088
00089
00090
00091
00092
00093
00094
00095 #define VOID void
00096 #ifndef NULL
00097 #define NULL 0
00098 #endif
00099 #define TRUE 1
00100 #define FALSE 0
00101 typedef char CHAR;
00102 typedef unsigned short UINT16;
00103 typedef int BOOL;
00104 typedef unsigned long ULONG;
00105
00106
00107 #define HTTP_INVALID_SOCKET (-1)
00108 typedef struct sockaddr_in HTTP_SOCKADDR_IN;
00109 typedef struct timeval HTTP_TIMEVAL;
00110 typedef struct hostent HTTP_HOSTNET;
00111 typedef struct sockaddr HTTP_SOCKADDR;
00112 typedef struct in_addr HTTP_INADDR;
00113
00114
00115 #endif // HTTP_CLIENT_WRAPPER