ZenLib
HTTPClientWrapper.h
Go to the documentation of this file.
1 
2 #ifndef HTTP_CLIENT_WRAPPER
3 #define HTTP_CLIENT_WRAPPER
4 
5 // Compilation mode
6 #define _HTTP_BUILD_WIN32 // Set Windows Build flag
7 
8 ///////////////////////////////////////////////////////////////////////////////
9 //
10 // Section : Microsoft Windows Support
11 // Last updated : 01/09/2005
12 //
13 ///////////////////////////////////////////////////////////////////////////////
14 
15 #ifdef _HTTP_BUILD_WIN32
16 
17 #if defined(_MSC_VER)
18  #pragma warning (disable: 4996) // 'function': was declared deprecated (VS 2005)
19 #endif
20 #include <stdlib.h>
21 #include <string.h>
22 #include <memory.h>
23 #include <stdio.h>
24 #include <ctype.h>
25 #include <time.h>
26 #if defined(_WIN32) || defined(WIN32)
27  #include <winsock.h>
28 #endif
29 
30 // Generic types
31 typedef unsigned int UINT32;
32 typedef int INT32;
33 
34 // Sockets (Winsock wrapper)
35 #define HTTP_ECONNRESET (WSAECONNRESET)
36 #define HTTP_EINPROGRESS (WSAEINPROGRESS)
37 #define HTTP_EWOULDBLOCK (WSAEWOULDBLOCK)
38 #endif
39 
40 
41 ///////////////////////////////////////////////////////////////////////////////
42 //
43 // Section : Functions that are not supported by the AMT stdc framework
44 // So they had to be specificaly added.
45 // Last updated : 01/09/2005
46 //
47 ///////////////////////////////////////////////////////////////////////////////
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52  // STDC Wrapper implimentation
53  int HTTPWrapperIsAscii (int c);
54  int HTTPWrapperToUpper (int c);
55  int HTTPWrapperToLower (int c);
56  int HTTPWrapperIsAlpha (int c);
57  int HTTPWrapperIsAlNum (int c);
58  char* HTTPWrapperItoa (char *buff,int i);
60  long HTTPWrapperGetUpTime ();
62  int HTTPWrapperGetSocketError (int s);
63  unsigned long HTTPWrapperGetHostByName (char *name,unsigned long *address);
64  int HTTPWrapperShutDown (int s,int in);
65  // SSL Wrapper prototypes
66  int HTTPWrapperSSLConnect (int s,const struct sockaddr *name,int namelen,char *hostname);
67  int HTTPWrapperSSLNegotiate (int s,const struct sockaddr *name,int namelen,char *hostname);
68  int HTTPWrapperSSLSend (int s,char *buf, int len,int flags);
69  int HTTPWrapperSSLRecv (int s,char *buf, int len,int flags);
70  int HTTPWrapperSSLClose (int s);
71  int HTTPWrapperSSLRecvPending (int s);
72  // Global wrapper Functions
73 #define IToA HTTPWrapperItoa
74 #define GetUpTime HTTPWrapperGetUpTime
75 #define SocketGetErr HTTPWrapperGetSocketError
76 #define HostByName HTTPWrapperGetHostByName
77 #define InitRandomeNumber HTTPWrapperInitRandomeNumber
78 #define GetRandomeNumber HTTPWrapperGetRandomeNumber
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 ///////////////////////////////////////////////////////////////////////////////
85 //
86 // Section : Global type definitions
87 // Last updated : 01/09/2005
88 //
89 ///////////////////////////////////////////////////////////////////////////////
90 
91 #define VOID void
92 #ifndef NULL
93 #define NULL 0
94 #endif
95 #define TRUE 1
96 #define FALSE 0
97 typedef char CHAR;
98 typedef unsigned short UINT16;
99 typedef int BOOL;
100 typedef unsigned long ULONG;
101 
102 // Global socket structures and definitions
103 #define HTTP_INVALID_SOCKET (-1)
104 typedef struct sockaddr_in HTTP_SOCKADDR_IN;
105 typedef struct timeval HTTP_TIMEVAL;
106 typedef struct hostent HTTP_HOSTNET;
107 typedef struct sockaddr HTTP_SOCKADDR;
108 typedef struct in_addr HTTP_INADDR;
109 
110 
111 #endif // HTTP_CLIENT_WRAPPER
int HTTPWrapperShutDown(int s, int in)
struct timeval HTTP_TIMEVAL
Definition: HTTPClientWrapper.h:105
int HTTPWrapperSSLClose(int s)
long HTTPWrapperGetUpTime()
int HTTPWrapperToUpper(int c)
struct sockaddr_in HTTP_SOCKADDR_IN
Definition: HTTPClientWrapper.h:104
int HTTPWrapperIsAscii(int c)
int BOOL
Definition: HTTPClientWrapper.h:99
int HTTPWrapperSSLSend(int s, char *buf, int len, int flags)
int HTTPWrapperGetRandomeNumber()
int HTTPWrapperSSLNegotiate(int s, const struct sockaddr *name, int namelen, char *hostname)
int HTTPWrapperSSLRecv(int s, char *buf, int len, int flags)
struct in_addr HTTP_INADDR
Definition: HTTPClientWrapper.h:108
int HTTPWrapperIsAlpha(int c)
char * HTTPWrapperItoa(char *buff, int i)
int HTTPWrapperGetSocketError(int s)
unsigned long ULONG
Definition: HTTPClientWrapper.h:100
int INT32
Definition: HTTPClientWrapper.h:32
int HTTPWrapperSSLRecvPending(int s)
unsigned short UINT16
Definition: HTTPClientWrapper.h:98
int HTTPWrapperToLower(int c)
int HTTPWrapperIsAlNum(int c)
unsigned long HTTPWrapperGetHostByName(char *name, unsigned long *address)
char CHAR
Definition: HTTPClientWrapper.h:97
struct hostent HTTP_HOSTNET
Definition: HTTPClientWrapper.h:106
void HTTPWrapperInitRandomeNumber()
int HTTPWrapperSSLConnect(int s, const struct sockaddr *name, int namelen, char *hostname)
unsigned int UINT32
Definition: HTTPClientWrapper.h:31
struct sockaddr HTTP_SOCKADDR
Definition: HTTPClientWrapper.h:107