Guitar
Classes | Macros | Typedefs | Functions
webclient.cpp File Reference
#include "inetresolver.h"
#include <inet/webclient.h>
#include <algorithm>
#include <condition_variable>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <mutex>
#include <thread>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
#include <netdb.h>
#include <set>
#include <cassert>
#include "base64.h"
Include dependency graph for webclient.cpp:

Classes

struct  WebContext::Private
 
struct  WebClient::Private
 
class  ResponseHeader
 

Macros

#define closesocket(S)   ::close(S)
 
#define INVALID_SOCKET   (-1)
 
#define SOCKET_ERROR   (-1)
 
#define USER_AGENT   "Generic Web Client"
 
#define ASSERT_REPORT(msg)   assert(false && (msg))
 
#define ASSERT_EQ(a, b)   do { auto const &_a = (a); auto const &_b = (b); if (!(_a == _b)) ASSERT_REPORT("ASSERT_EQ failed: " #a " == " #b); } while (0)
 
#define ASSERT_NE(a, b)   do { auto const &_a = (a); auto const &_b = (b); if (_a == _b) ASSERT_REPORT("ASSERT_NE failed: " #a " != " #b); } while (0)
 
#define ASSERT_TRUE(a)   do { bool _v = (a); if (!_v) ASSERT_REPORT("ASSERT_TRUE failed: " #a); } while (0)
 
#define ASSERT_FALSE(a)   do { bool _v = (a); if (_v) ASSERT_REPORT("ASSERT_FALSE failed: " #a); } while (0)
 

Typedefs

using socket_t = int
 
typedef void SSL
 
typedef void SSL_CTX
 

Functions

static std::string to_s (size_t n)
 
static void send_ (socket_t s, char const *ptr, int len)
 
static char * stristr (char *str1, char const *str2)
 
static socket_t inet_connect (std::string const &hostname, int port)
 
bool decode_chunked (char const *begin, char const *end, std::vector< char > *out)
 

Macro Definition Documentation

◆ ASSERT_EQ

#define ASSERT_EQ (   a,
 
)    do { auto const &_a = (a); auto const &_b = (b); if (!(_a == _b)) ASSERT_REPORT("ASSERT_EQ failed: " #a " == " #b); } while (0)

◆ ASSERT_FALSE

#define ASSERT_FALSE (   a)    do { bool _v = (a); if (_v) ASSERT_REPORT("ASSERT_FALSE failed: " #a); } while (0)

◆ ASSERT_NE

#define ASSERT_NE (   a,
 
)    do { auto const &_a = (a); auto const &_b = (b); if (_a == _b) ASSERT_REPORT("ASSERT_NE failed: " #a " != " #b); } while (0)

◆ ASSERT_REPORT

#define ASSERT_REPORT (   msg)    assert(false && (msg))

◆ ASSERT_TRUE

#define ASSERT_TRUE (   a)    do { bool _v = (a); if (!_v) ASSERT_REPORT("ASSERT_TRUE failed: " #a); } while (0)

◆ closesocket

#define closesocket (   S)    ::close(S)

◆ INVALID_SOCKET

#define INVALID_SOCKET   (-1)

◆ SOCKET_ERROR

#define SOCKET_ERROR   (-1)

◆ USER_AGENT

#define USER_AGENT   "Generic Web Client"

Typedef Documentation

◆ socket_t

using socket_t = int

◆ SSL

typedef void SSL

◆ SSL_CTX

typedef void SSL_CTX

Function Documentation

◆ decode_chunked()

bool decode_chunked ( char const *  begin,
char const *  end,
std::vector< char > *  out 
)

◆ inet_connect()

static socket_t inet_connect ( std::string const &  hostname,
int  port 
)
static
Here is the call graph for this function:

◆ send_()

static void send_ ( socket_t  s,
char const *  ptr,
int  len 
)
static

◆ stristr()

static char* stristr ( char *  str1,
char const *  str2 
)
static

◆ to_s()

static std::string to_s ( size_t  n)
inlinestatic