Classes | Typedefs | Enumerations | Functions

XMLRPC Namespace Reference

Classes

struct  URL
struct  AddressList
struct  Socket
struct  SocketReader
struct  INConnect
struct  HTTPConnection
struct  XMLRPCClient
struct  Exception
struct  LWSE
struct  ISODate
struct  Binary
struct  XMLRPCArray
struct  XMLRPCStruct
struct  XMLRPCFault
struct  XMLRPCParser
struct  XMLRPCValue
struct  XMLRPCResult
struct  XMLRPCWriter
struct  XMLRPCCall
struct  XMLRPCRequest
struct  XMLRPCResponse

Typedefs

typedef u_int SOCKET
typedef struct sockaddr_in SOCKADDR_IN
typedef unsigned int socklen_t
typedef list< XMLRPC_TYPETypeList

Enumerations

enum  XMLRPC_TYPE {
  XRT_VOID, XRT_INT, XRT_DOUBLE, XRT_BOOLEAN,
  XRT_STRING, XRT_DATE, XRT_BINARY, XRT_ARRAY,
  XRT_STRUCT
}

Functions

char * base64_encode (const void *buf, size_t size)
static int POS (char c)
void * base64_decode (const char *s, size_t &data_len)
static time_t get_time_t (const ISODate &date)

Typedef Documentation

typedef struct sockaddr_in XMLRPC::SOCKADDR_IN

Definition at line 122 of file httpclnt.h.

typedef u_int XMLRPC::SOCKET

Definition at line 116 of file httpclnt.h.

typedef unsigned int XMLRPC::socklen_t

Definition at line 142 of file httpclnt.h.

Definition at line 232 of file xmlrpc.h.


Enumeration Type Documentation

Enumerator:
XRT_VOID 
XRT_INT 
XRT_DOUBLE 
XRT_BOOLEAN 
XRT_STRING 
XRT_DATE 
XRT_BINARY 
XRT_ARRAY 
XRT_STRUCT 

Definition at line 225 of file xmlrpc.h.


Function Documentation

void * XMLRPC::base64_decode ( const char *  s,
size_t &  data_len 
)

Definition at line 80 of file base64.cpp.

References POS().

Referenced by XMLRPC::Binary::Binary().

          :  allocated data buffer
//
void* base64_decode(const char* s, size_t& data_len)
{
    size_t len = strlen(s);

    if (len % 4)
        throw Exception("invalid BASE64 string length");

    unsigned char* data = (unsigned char*) malloc(len/4*3);

    int n[4];
    unsigned char* q = (unsigned char*) data;

    for(const char*p=s; *p; ) {
        n[0] = POS(*p++);
        n[1] = POS(*p++);
        n[2] = POS(*p++);
        n[3] = POS(*p++);

        if (n[0]==-1 || n[1]==-1)
            throw Exception("invalid BASE64 encoding");

        if (n[2]==-1 && n[3]!=-1)
            throw Exception("invalid BASE64 encoding");

        q[0] = (n[0] << 2) + (n[1] >> 4);
        if (n[2] != -1) q[1] = ((n[1] & 15) << 4) + (n[2] >> 2);
        if (n[3] != -1) q[2] = ((n[2] & 3) << 6) + n[3];
        q += 3;
    }

    data_len = q-data - (n[2]==-1) - (n[3]==-1);

Here is the call graph for this function:

Here is the caller graph for this function:

char * XMLRPC::base64_encode ( const void *  buf,
size_t  size 
)

Definition at line 19 of file base64.cpp.

Referenced by XMLRPC::Binary::str().

{
    static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    char* str = (char*) malloc((size+3)*4/3 + 1);

    char* p = str;
    unsigned char* q = (unsigned char*) buf;
    size_t i = 0;

    while(i < size) {
        int c = q[i++];
        c *= 256;
        if (i < size) c += q[i];
        i++;

        c *= 256;
        if (i < size) c += q[i];
        i++;

        *p++ = base64[(c & 0x00fc0000) >> 18];
        *p++ = base64[(c & 0x0003f000) >> 12];

        if (i > size + 1)
            *p++ = '=';
        else
            *p++ = base64[(c & 0x00000fc0) >> 6];

        if (i > size)
            *p++ = '=';
        else
            *p++ = base64[c & 0x0000003f];
    }

    *p = 0;

Here is the caller graph for this function:

static time_t XMLRPC::get_time_t ( const ISODate &  date ) [static]

Definition at line 128 of file xmlrpc.cpp.

References XMLRPC::ISODate::_day, XMLRPC::ISODate::_hour, XMLRPC::ISODate::_minute, XMLRPC::ISODate::_month, XMLRPC::ISODate::_second, and XMLRPC::ISODate::_year.

Referenced by XMLRPC::ISODate::diff().

{
    struct tm t = {
        date._second,
        date._minute,
        date._hour,
        date._day,
        date._month - 1,
        date._year - 1900
    };

    return mktime(&t);
}

Here is the caller graph for this function:

static int XMLRPC::POS ( char  c ) [static]

Definition at line 61 of file base64.cpp.

Referenced by base64_decode().

{
    if (c>='A' && c<='Z') return c - 'A';
    if (c>='a' && c<='z') return c - 'a' + 26;
    if (c>='0' && c<='9') return c - '0' + 52;
    if (c == '+') return 62;
    if (c == '/') return 63;
    if (c == '=') return -1;

Here is the caller graph for this function: