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
31typedef unsigned int UINT32;
32typedef 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
49extern "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);
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);
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
97typedef char CHAR;
98typedef unsigned short UINT16;
99typedef int BOOL;
100typedef unsigned long ULONG;
101
102// Global socket structures and definitions
103#define HTTP_INVALID_SOCKET (-1)
104typedef struct sockaddr_in HTTP_SOCKADDR_IN;
105typedef struct timeval HTTP_TIMEVAL;
106typedef struct hostent HTTP_HOSTNET;
107typedef struct sockaddr HTTP_SOCKADDR;
108typedef struct in_addr HTTP_INADDR;
109
110
111#endif // HTTP_CLIENT_WRAPPER
int BOOL
Definition: HTTPClientWrapper.h:99
int HTTPWrapperShutDown(int s, int in)
unsigned short UINT16
Definition: HTTPClientWrapper.h:98
unsigned long HTTPWrapperGetHostByName(char *name, unsigned long *address)
int HTTPWrapperGetRandomeNumber()
void HTTPWrapperInitRandomeNumber()
int HTTPWrapperToLower(int c)
int HTTPWrapperToUpper(int c)
struct in_addr HTTP_INADDR
Definition: HTTPClientWrapper.h:108
int HTTPWrapperSSLRecv(int s, char *buf, int len, int flags)
struct timeval HTTP_TIMEVAL
Definition: HTTPClientWrapper.h:105
int HTTPWrapperSSLNegotiate(int s, const struct sockaddr *name, int namelen, char *hostname)
struct hostent HTTP_HOSTNET
Definition: HTTPClientWrapper.h:106
int INT32
Definition: HTTPClientWrapper.h:32
int HTTPWrapperSSLClose(int s)
int HTTPWrapperSSLConnect(int s, const struct sockaddr *name, int namelen, char *hostname)
struct sockaddr HTTP_SOCKADDR
Definition: HTTPClientWrapper.h:107
int HTTPWrapperSSLRecvPending(int s)
int HTTPWrapperSSLSend(int s, char *buf, int len, int flags)
char * HTTPWrapperItoa(char *buff, int i)
int HTTPWrapperIsAlNum(int c)
int HTTPWrapperIsAscii(int c)
int HTTPWrapperGetSocketError(int s)
struct sockaddr_in HTTP_SOCKADDR_IN
Definition: HTTPClientWrapper.h:104
unsigned int UINT32
Definition: HTTPClientWrapper.h:31
char CHAR
Definition: HTTPClientWrapper.h:97
int HTTPWrapperIsAlpha(int c)
unsigned long ULONG
Definition: HTTPClientWrapper.h:100
long HTTPWrapperGetUpTime()