HTTPClientWrapper.h
Go to the documentation of this file.
#ifndef HTTP_CLIENT_WRAPPER
#define HTTP_CLIENT_WRAPPER
// Compilation mode
#define _HTTP_BUILD_WIN32 // Set Windows Build flag
///////////////////////////////////////////////////////////////////////////////
//
// Section : Microsoft Windows Support
// Last updated : 01/09/2005
//
///////////////////////////////////////////////////////////////////////////////
#ifdef _HTTP_BUILD_WIN32
#if defined(_MSC_VER)
#pragma warning (disable: 4996) // 'function': was declared deprecated (VS 2005)
#endif
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#if defined(_WIN32) || defined(WIN32)
#ifdef WINDOWS_UWP
#include <winsock2.h>
#else
#include <winsock.h>
#endif
#endif
// Generic types
typedef unsigned int UINT32;
typedef int INT32;
// Sockets (Winsock wrapper)
#define HTTP_ECONNRESET (WSAECONNRESET)
#define HTTP_EINPROGRESS (WSAEINPROGRESS)
#define HTTP_EWOULDBLOCK (WSAEWOULDBLOCK)
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Section : Functions that are not supported by the AMT stdc framework
// So they had to be specificaly added.
// Last updated : 01/09/2005
//
///////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C" {
#endif
// STDC Wrapper implimentation
int HTTPWrapperIsAscii (int c);
int HTTPWrapperToUpper (int c);
int HTTPWrapperToLower (int c);
int HTTPWrapperIsAlpha (int c);
int HTTPWrapperIsAlNum (int c);
char* HTTPWrapperItoa (char *buff,int i);
void HTTPWrapperInitRandomeNumber ();
long HTTPWrapperGetUpTime ();
int HTTPWrapperGetRandomeNumber ();
int HTTPWrapperGetSocketError (int s);
unsigned long HTTPWrapperGetHostByName (char *name,unsigned long *address);
int HTTPWrapperShutDown (int s,int in);
// SSL Wrapper prototypes
int HTTPWrapperSSLConnect (int s,const struct sockaddr *name,int namelen,char *hostname);
int HTTPWrapperSSLNegotiate (int s,const struct sockaddr *name,int namelen,char *hostname);
int HTTPWrapperSSLSend (int s,char *buf, int len,int flags);
int HTTPWrapperSSLRecv (int s,char *buf, int len,int flags);
int HTTPWrapperSSLClose (int s);
int HTTPWrapperSSLRecvPending (int s);
// Global wrapper Functions
#define IToA HTTPWrapperItoa
#define GetUpTime HTTPWrapperGetUpTime
#define SocketGetErr HTTPWrapperGetSocketError
#define HostByName HTTPWrapperGetHostByName
#define InitRandomeNumber HTTPWrapperInitRandomeNumber
#define GetRandomeNumber HTTPWrapperGetRandomeNumber
#ifdef __cplusplus
}
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Section : Global type definitions
// Last updated : 01/09/2005
//
///////////////////////////////////////////////////////////////////////////////
#define VOID void
#ifndef NULL
#define NULL 0
#endif
#define TRUE 1
#define FALSE 0
typedef char CHAR;
typedef unsigned short UINT16;
typedef int BOOL;
typedef unsigned long ULONG;
// Global socket structures and definitions
#define HTTP_INVALID_SOCKET (-1)
typedef struct sockaddr_in HTTP_SOCKADDR_IN;
typedef struct timeval HTTP_TIMEVAL;
typedef struct hostent HTTP_HOSTNET;
typedef struct sockaddr HTTP_SOCKADDR;
typedef struct in_addr HTTP_INADDR;
#endif // HTTP_CLIENT_WRAPPER
BOOL
int BOOL
Definition HTTPClientWrapper.h:103
HTTPWrapperShutDown
int HTTPWrapperShutDown(int s, int in)
UINT16
unsigned short UINT16
Definition HTTPClientWrapper.h:102
HTTPWrapperGetHostByName
unsigned long HTTPWrapperGetHostByName(char *name, unsigned long *address)
HTTPWrapperGetRandomeNumber
int HTTPWrapperGetRandomeNumber()
HTTPWrapperInitRandomeNumber
void HTTPWrapperInitRandomeNumber()
HTTPWrapperToLower
int HTTPWrapperToLower(int c)
HTTPWrapperToUpper
int HTTPWrapperToUpper(int c)
HTTP_INADDR
struct in_addr HTTP_INADDR
Definition HTTPClientWrapper.h:112
HTTPWrapperSSLRecv
int HTTPWrapperSSLRecv(int s, char *buf, int len, int flags)
HTTP_TIMEVAL
struct timeval HTTP_TIMEVAL
Definition HTTPClientWrapper.h:109
HTTPWrapperSSLNegotiate
int HTTPWrapperSSLNegotiate(int s, const struct sockaddr *name, int namelen, char *hostname)
HTTP_HOSTNET
struct hostent HTTP_HOSTNET
Definition HTTPClientWrapper.h:110
INT32
int INT32
Definition HTTPClientWrapper.h:36
HTTPWrapperSSLClose
int HTTPWrapperSSLClose(int s)
HTTPWrapperSSLConnect
int HTTPWrapperSSLConnect(int s, const struct sockaddr *name, int namelen, char *hostname)
HTTP_SOCKADDR
struct sockaddr HTTP_SOCKADDR
Definition HTTPClientWrapper.h:111
HTTPWrapperSSLRecvPending
int HTTPWrapperSSLRecvPending(int s)
HTTPWrapperSSLSend
int HTTPWrapperSSLSend(int s, char *buf, int len, int flags)
HTTPWrapperItoa
char * HTTPWrapperItoa(char *buff, int i)
HTTPWrapperIsAlNum
int HTTPWrapperIsAlNum(int c)
HTTPWrapperIsAscii
int HTTPWrapperIsAscii(int c)
HTTPWrapperGetSocketError
int HTTPWrapperGetSocketError(int s)
HTTP_SOCKADDR_IN
struct sockaddr_in HTTP_SOCKADDR_IN
Definition HTTPClientWrapper.h:108
UINT32
unsigned int UINT32
Definition HTTPClientWrapper.h:35
CHAR
char CHAR
Definition HTTPClientWrapper.h:101
HTTPWrapperIsAlpha
int HTTPWrapperIsAlpha(int c)
ULONG
unsigned long ULONG
Definition HTTPClientWrapper.h:104
HTTPWrapperGetUpTime
long HTTPWrapperGetUpTime()