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#if defined(_WIN32) || defined(WIN32)
21 #ifdef WINDOWS_UWP
22 #include <winsock2.h>
23 #else
24 #include <winsock.h>
25 #define _TIMEVAL_DEFINED
26 #endif
27#endif
28#include <stdlib.h>
29#include <string.h>
30#include <memory.h>
31#include <stdio.h>
32#include <ctype.h>
33#include <time.h>
34
35// Generic types
36typedef unsigned int UINT32;
37typedef int INT32;
38
39// Sockets (Winsock wrapper)
40#define HTTP_ECONNRESET (WSAECONNRESET)
41#define HTTP_EINPROGRESS (WSAEINPROGRESS)
42#define HTTP_EWOULDBLOCK (WSAEWOULDBLOCK)
43#endif
44
45
46///////////////////////////////////////////////////////////////////////////////
47//
48// Section : Functions that are not supported by the AMT stdc framework
49// So they had to be specificaly added.
50// Last updated : 01/09/2005
51//
52///////////////////////////////////////////////////////////////////////////////
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57 // STDC Wrapper implimentation
58 int HTTPWrapperIsAscii (int c);
59 int HTTPWrapperToUpper (int c);
60 int HTTPWrapperToLower (int c);
61 int HTTPWrapperIsAlpha (int c);
62 int HTTPWrapperIsAlNum (int c);
63 char* HTTPWrapperItoa (char *buff,int i);
68 unsigned long HTTPWrapperGetHostByName (char *name,unsigned long *address);
69 int HTTPWrapperShutDown (int s,int in);
70 // SSL Wrapper prototypes
71 int HTTPWrapperSSLConnect (int s,const struct sockaddr *name,int namelen,char *hostname);
72 int HTTPWrapperSSLNegotiate (int s,const struct sockaddr *name,int namelen,char *hostname);
73 int HTTPWrapperSSLSend (int s,char *buf, int len,int flags);
74 int HTTPWrapperSSLRecv (int s,char *buf, int len,int flags);
77 // Global wrapper Functions
78#define IToA HTTPWrapperItoa
79#define GetUpTime HTTPWrapperGetUpTime
80#define SocketGetErr HTTPWrapperGetSocketError
81#define HostByName HTTPWrapperGetHostByName
82#define InitRandomeNumber HTTPWrapperInitRandomeNumber
83#define GetRandomeNumber HTTPWrapperGetRandomeNumber
84
85#ifdef __cplusplus
86}
87#endif
88
89///////////////////////////////////////////////////////////////////////////////
90//
91// Section : Global type definitions
92// Last updated : 01/09/2005
93//
94///////////////////////////////////////////////////////////////////////////////
95
96#define VOID void
97#ifndef NULL
98#define NULL 0
99#endif
100#define TRUE 1
101#define FALSE 0
102typedef char CHAR;
103typedef unsigned short UINT16;
104typedef int BOOL;
105typedef unsigned long ULONG;
106
107// Global socket structures and definitions
108#define HTTP_INVALID_SOCKET (-1)
109typedef struct sockaddr_in HTTP_SOCKADDR_IN;
110typedef struct timeval HTTP_TIMEVAL;
111typedef struct hostent HTTP_HOSTNET;
112typedef struct sockaddr HTTP_SOCKADDR;
113typedef struct in_addr HTTP_INADDR;
114
115
116#endif // HTTP_CLIENT_WRAPPER
int BOOL
Definition: HTTPClientWrapper.h:104
int HTTPWrapperShutDown(int s, int in)
unsigned short UINT16
Definition: HTTPClientWrapper.h:103
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:113
int HTTPWrapperSSLRecv(int s, char *buf, int len, int flags)
struct timeval HTTP_TIMEVAL
Definition: HTTPClientWrapper.h:110
int HTTPWrapperSSLNegotiate(int s, const struct sockaddr *name, int namelen, char *hostname)
struct hostent HTTP_HOSTNET
Definition: HTTPClientWrapper.h:111
int INT32
Definition: HTTPClientWrapper.h:37
int HTTPWrapperSSLClose(int s)
int HTTPWrapperSSLConnect(int s, const struct sockaddr *name, int namelen, char *hostname)
struct sockaddr HTTP_SOCKADDR
Definition: HTTPClientWrapper.h:112
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:109
unsigned int UINT32
Definition: HTTPClientWrapper.h:36
char CHAR
Definition: HTTPClientWrapper.h:102
int HTTPWrapperIsAlpha(int c)
unsigned long ULONG
Definition: HTTPClientWrapper.h:105
long HTTPWrapperGetUpTime()