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