diff options
Diffstat (limited to 'vendor/voclient/include/xmlrpc-c')
29 files changed, 5205 insertions, 0 deletions
diff --git a/vendor/voclient/include/xmlrpc-c/abyss.h b/vendor/voclient/include/xmlrpc-c/abyss.h new file mode 100644 index 00000000..ec76a442 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/abyss.h @@ -0,0 +1,560 @@ +/***************************************************************************** + abyss.h +****************************************************************************** + + This file is the interface header for the Abyss HTTP server component of + XML-RPC For C/C++ (Xmlrpc-c). + + The Abyss component of Xmlrpc-c is based on the independently developed + and distributed Abyss web server package from 2001. + + Copyright information is at the end of the file. +****************************************************************************/ + +#ifndef XMLRPC_ABYSS_H_INCLUDED +#define XMLRPC_ABYSS_H_INCLUDED + + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/types.h> + +#include <xmlrpc-c/inttypes.h> + +/**************************************************************************** + STUFF FOR THE OUTER CONTROL PROGRAM TO USE +****************************************************************************/ + +typedef int abyss_bool; + +/**************************************************************************** + GLOBAL (STATIC) PROGRAM STUFF +****************************************************************************/ + +void +AbyssInit(const char ** const errorP); + +void +AbyssTerm(void); + +/********************************************************************* +** MIMEType +*********************************************************************/ + +typedef struct MIMEType MIMEType; + +MIMEType * +MIMETypeCreate(void); + +void +MIMETypeDestroy(MIMEType * const MIMETypeP); + +void +MIMETypeInit(void); + +void +MIMETypeTerm(void); + +abyss_bool +MIMETypeAdd2(MIMEType * const MIMETypeP, + const char * const type, + const char * const ext); + +abyss_bool +MIMETypeAdd(const char * const type, + const char * const ext); + + +enum abyss_foreback {ABYSS_FOREGROUND, ABYSS_BACKGROUND}; + +#define HAVE_CHANSWITCH + +typedef struct _TChanSwitch TChanSwitch; +typedef struct _TChannel TChannel; +typedef struct _TSocket TSocket; + +#ifdef WIN32 + #include <xmlrpc-c/abyss_winsock.h> +#else + #include <xmlrpc-c/abyss_unixsock.h> +#endif + +void +ChanSwitchInit(const char ** const errorP); + +void +ChanSwitchTerm(void); + +/* If you're wondering where the constructors for TChanSwitch, + TChannel, and TSocket are: They're implementation-specific, so look + in abyss_unixsock.h, etc. +*/ + +void +ChanSwitchDestroy(TChanSwitch * const chanSwitchP); + +void +ChannelInit(const char ** const errorP); + +void +ChannelTerm(void); + +void +ChannelDestroy(TChannel * const channelP); + +void +SocketDestroy(TSocket * const socketP); + + +typedef struct { + /* Before Xmlrpc-c 1.04, the internal server representation, + struct _TServer, was exposed to users and was the only way to + set certain parameters of the server. Now, use the (new) + ServerSet...() functions. Use the HAVE_ macros to determine + which method you have to use. + */ + struct _TServer * srvP; +} TServer; + +typedef struct _TSession TSession; + +abyss_bool +ServerCreate(TServer * const serverP, + const char * const name, + xmlrpc_uint16_t const port, + const char * const filespath, + const char * const logfilename); + +void +ServerCreateSwitch(TServer * const serverP, + TChanSwitch * const chanSwitchP, + const char ** const errorP); + +abyss_bool +ServerCreateSocket(TServer * const serverP, + const char * const name, + TOsSocket const socketFd, + const char * const filespath, + const char * const logfilename); + +#define HAVE_SERVER_CREATE_SOCKET_2 +void +ServerCreateSocket2(TServer * const serverP, + TSocket * const socketP, + const char ** const errorP); + +abyss_bool +ServerCreateNoAccept(TServer * const serverP, + const char * const name, + const char * const filespath, + const char * const logfilename); + +void +ServerFree(TServer * const serverP); + +void +ServerSetName(TServer * const serverP, + const char * const name); + +void +ServerSetFilesPath(TServer * const serverP, + const char * const filesPath); + +void +ServerSetLogFileName(TServer * const serverP, + const char * const logFileName); + +#define HAVE_SERVER_SET_KEEPALIVE_TIMEOUT 1 +void +ServerSetKeepaliveTimeout(TServer * const serverP, + xmlrpc_uint32_t const keepaliveTimeout); + +#define HAVE_SERVER_SET_KEEPALIVE_MAX_CONN 1 +void +ServerSetKeepaliveMaxConn(TServer * const serverP, + xmlrpc_uint32_t const keepaliveMaxConn); + +#define HAVE_SERVER_SET_TIMEOUT 1 +void +ServerSetTimeout(TServer * const serverP, + xmlrpc_uint32_t const timeout); + +#define HAVE_SERVER_SET_ADVERTISE 1 +void +ServerSetAdvertise(TServer * const serverP, + abyss_bool const advertise); + +#define HAVE_SERVER_SET_MIME_TYPE 1 +void +ServerSetMimeType(TServer * const serverP, + MIMEType * const MIMETypeP); + +void +ServerInit(TServer * const serverP); + +void +ServerRun(TServer * const serverP); + +void +ServerRunOnce(TServer * const serverP); + +/* ServerRunOnce2() is obsolete. See user's guide. */ +void +ServerRunOnce2(TServer * const serverP, + enum abyss_foreback const foregroundBackground); + +void +ServerRunChannel(TServer * const serverP, + TChannel * const channelP, + void * const channelInfoP, + const char ** const errorP); + +#define HAVE_SERVER_RUN_CONN_2 +void +ServerRunConn2(TServer * const serverP, + TSocket * const connectedSocketP, + const char ** const errorP); + +void +ServerRunConn(TServer * const serverP, + TOsSocket const connectedSocket); + +void +ServerDaemonize(TServer * const serverP); + +void +ServerTerminate(TServer * const serverP); + +void +ServerResetTerminate(TServer * const serverP); + +void +ServerUseSigchld(TServer * const serverP); + +#ifndef WIN32 +void +ServerHandleSigchld(pid_t const pid); +#endif + +typedef abyss_bool (*URIHandler) (TSession *); /* deprecated */ + +struct URIHandler2; + +typedef void (*initHandlerFn)(struct URIHandler2 *, abyss_bool *); + +typedef void (*termHandlerFn)(void *); + +typedef void (*handleReq3Fn)(void *, + TSession *, + abyss_bool *); + +typedef void (*handleReq2Fn)(struct URIHandler2 *, + TSession *, + abyss_bool *); + +struct ServerReqHandler3 { + termHandlerFn term; + handleReq3Fn handleReq; + void * userdata; + size_t handleReqStackSize; /* zero = default */ +}; + +void +ServerAddHandler3(TServer * const serverP, + const struct ServerReqHandler3 * const handlerP, + abyss_bool * const successP); + +typedef struct URIHandler2 { + initHandlerFn init; + termHandlerFn term; + handleReq2Fn handleReq2; + URIHandler handleReq1; /* deprecated */ + void * userdata; +} URIHandler2; + +void +ServerAddHandler2(TServer * const srvP, + URIHandler2 * const handlerP, + abyss_bool * const successP); + +abyss_bool +ServerAddHandler(TServer * const srvP, + URIHandler const handler); + +typedef abyss_bool (*THandlerDflt) (TSession *); + +/* Note: 'handler' used to be URIHandler; THandlerDflt is a newer name + for the same type +*/ + +void +ServerDefaultHandler(TServer * const srvP, + THandlerDflt const handler); + +/* ConfReadServerFile() is inappropriately named; it was a mistake. + But then, so is having this function at all. The config file is + inappropriate for an API. +*/ + +abyss_bool +ConfReadServerFile(const char * const filename, + TServer * const srvP); + +void +LogWrite(TServer * const srvP, + const char * const c); + +/**************************************************************************** + STUFF FOR HTTP REQUEST HANDLERS TO USE +****************************************************************************/ + +typedef enum { + m_unknown, m_get, m_put, m_head, m_post, m_delete, m_trace, m_options +} TMethod; + +typedef struct { + TMethod method; + const char * uri; + /* This is NOT the URI. It is the pathname part of the URI. + We really should fix that and put the pathname in another + member. If the URI does not contain a pathname, this is "*". + */ + const char * query; + /* The query part of the URI (stuff after '?'). NULL if none. */ + const char * host; + /* NOT the value of the host: header. Rather, the name of the + target host (could be part of the host: value; could be from the + URI). No port number. NULL if request does not specify a host + name. + */ + const char * from; + const char * useragent; + const char * referer; + const char * requestline; + const char * user; + /* Requesting user (from authorization: header). NULL if + request doesn't specify or handler has not authenticated it. + */ + xmlrpc_uint16_t port; + /* The port number from the URI, or default 80 if the URI doesn't + specify a port. + */ + abyss_bool keepalive; +} TRequestInfo; + +abyss_bool +SessionRefillBuffer(TSession * const sessionP); + +size_t +SessionReadDataAvail(TSession * const sessionP); + +void +SessionGetReadData(TSession * const sessionP, + size_t const max, + const char ** const outStartP, + size_t * const outLenP); + +void +SessionGetRequestInfo(TSession * const sessionP, + const TRequestInfo ** const requestInfoPP); + +void +SessionGetChannelInfo(TSession * const sessionP, + void ** const channelInfoPP); + +void * +SessionGetDefaultHandlerCtx(TSession * const sessionP); + +char * +RequestHeaderValue(TSession * const sessionP, + const char * const name); + +abyss_bool +ResponseAddField(TSession * const sessionP, + const char * const name, + const char * const value); + +void +ResponseWriteStart(TSession * const sessionP); + +/* For backward compatibility: */ +#define ResponseWrite ResponseWriteStart + +abyss_bool +ResponseWriteBody(TSession * const sessionP, + const char * const data, + xmlrpc_uint32_t const len); + +abyss_bool +ResponseWriteEnd(TSession * const sessionP); + +abyss_bool +ResponseChunked(TSession * const sessionP); + +xmlrpc_uint16_t +ResponseStatusFromErrno(int const errnoArg); + +void +ResponseStatus(TSession * const sessionP, + xmlrpc_uint16_t const code); + +void +ResponseStatusErrno(TSession * const sessionP); + +abyss_bool +ResponseContentType(TSession * const serverP, + const char * const type); + +abyss_bool +ResponseContentLength(TSession * const sessionP, + xmlrpc_uint64_t const len); + +void +ResponseError2(TSession * const sessionP, + const char * const explanation); + +void +ResponseError(TSession * const sessionP); + +const char * +MIMETypeFromExt(const char * const ext); + +const char * +MIMETypeFromExt2(MIMEType * const MIMETypeP, + const char * const ext); + +const char * +MIMETypeFromFileName2(MIMEType * const MIMETypeP, + const char * const fileName); + +const char * +MIMETypeFromFileName(const char * const fileName); + +const char * +MIMETypeGuessFromFile2(MIMEType * const MIMETypeP, + const char * const fileName); + +const char * +MIMETypeGuessFromFile(const char * const filename); + + +/**************************************************************************** + STUFF THAT PROBABLY DOESN'T BELONG IN THIS FILE BECAUSE IT IS INTERNAL + + Some day, we sort this out. +****************************************************************************/ + + +#define CR '\r' +#define LF '\n' +#define CRLF "\r\n" + +/********************************************************************* +** Paths and so on... +*********************************************************************/ + +#ifdef WIN32 +#define DEFAULT_ROOT "c:\\abyss" +#define DEFAULT_DOCS DEFAULT_ROOT"\\htdocs" +#define DEFAULT_CONF_FILE DEFAULT_ROOT"\\conf\\abyss.conf" +#define DEFAULT_LOG_FILE DEFAULT_ROOT"\\log\\abyss.log" +#else +#ifdef __rtems__ +#define DEFAULT_ROOT "/abyss" +#else +#define DEFAULT_ROOT "/usr/local/abyss" +#endif +#define DEFAULT_DOCS DEFAULT_ROOT"/htdocs" +#define DEFAULT_CONF_FILE DEFAULT_ROOT"/conf/abyss.conf" +#define DEFAULT_LOG_FILE DEFAULT_ROOT"/log/abyss.log" +#endif + +/********************************************************************* +** Maximum number of simultaneous connections +*********************************************************************/ + +#define MAX_CONN 16 + +/********************************************************************* +** General purpose definitions +*********************************************************************/ + +#ifndef NULL +#define NULL ((void *)0) +#endif /* NULL */ + +#ifndef TRUE +#define TRUE 1 +#endif /* TRUE */ + +#ifndef FALSE +#define FALSE 0 +#endif /* FALSE */ + +/********************************************************************* +** Range +*********************************************************************/ + +abyss_bool +RangeDecode(char * const str, + xmlrpc_uint64_t const filesize, + xmlrpc_uint64_t * const start, + xmlrpc_uint64_t * const end); + +abyss_bool DateInit(void); + +/********************************************************************* +** Base64 +*********************************************************************/ + +void +Base64Encode(const char * const chars, + char * const base64); + +/********************************************************************* +** Session +*********************************************************************/ + +abyss_bool SessionLog(TSession * const s); + + +#ifdef __cplusplus +} + + +#endif + +/***************************************************************************** +** Here is the copyright notice from the Abyss web server project file from +** which this file is derived. +** +** Copyright (C) 2000 by Moez Mahfoudh <mmoez@bigfoot.com>. +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +** +******************************************************************************/ +#endif /* _ABYSS_H_ */ diff --git a/vendor/voclient/include/xmlrpc-c/abyss_unixsock.h b/vendor/voclient/include/xmlrpc-c/abyss_unixsock.h new file mode 100644 index 00000000..023f9580 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/abyss_unixsock.h @@ -0,0 +1,42 @@ +/* This is just a sub-file for abyss.h */ + +#include <sys/socket.h> + +struct abyss_unix_chaninfo { + size_t peerAddrLen; + struct sockaddr peerAddr; +}; + +void +ChanSwitchUnixCreate(unsigned short const portNumber, + TChanSwitch ** const chanSwitchPP, + const char ** const errorP); + +void +ChanSwitchUnixCreateFd(int const fd, + TChanSwitch ** const chanSwitchPP, + const char ** const errorP); + +void +ChannelUnixCreateFd(int const fd, + TChannel ** const channelPP, + struct abyss_unix_chaninfo ** const channelInfoPP, + const char ** const errorP); + +void +ChannelUnixGetPeerName(TChannel * const channelP, + struct sockaddr ** const sockaddrPP, + size_t * const sockaddrLenP, + const char ** const errorP); + +void +SocketUnixCreateFd(int const fd, + TSocket ** const socketPP); + +typedef int TOsSocket; + /* TOsSocket is the type of a conventional socket offered by our OS. + This is for backward compatibility; everyone should use TChanSwitch + and TChannel instead today. + */ + + diff --git a/vendor/voclient/include/xmlrpc-c/abyss_winsock.h b/vendor/voclient/include/xmlrpc-c/abyss_winsock.h new file mode 100644 index 00000000..f376446b --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/abyss_winsock.h @@ -0,0 +1,27 @@ +/* This is just a sub-file for abyss.h */ + +#include <winsock.h> + +struct abyss_win_chaninfo { + size_t peerAddrLen; + struct sockaddr peerAddr; +}; + + +void +ChanSwitchWinCreate(unsigned short const portNumber, + TChanSwitch ** const chanSwitchPP, + const char ** const errorP); + +void +ChanSwitchWinCreateWinsock(SOCKET const winsock, + TChanSwitch ** const chanSwitchPP, + const char ** const errorP); + +void +ChannelWinCreateWinsock(SOCKET const fd, + TChannel ** const channelPP, + struct abyss_win_chaninfo ** const channelInfoPP, + const char ** const errorP); + +typedef SOCKET TOsSocket; diff --git a/vendor/voclient/include/xmlrpc-c/base.h b/vendor/voclient/include/xmlrpc-c/base.h new file mode 100644 index 00000000..4778f80d --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/base.h @@ -0,0 +1,757 @@ +/* Copyright and license information is at the end of the file */ + +#ifndef XMLRPC_H_INCLUDED +#define XMLRPC_H_INCLUDED + +#include <stddef.h> +#include <stdarg.h> +#include <time.h> +#include <xmlrpc-c/util.h> +#include <xmlrpc-c/config.h> + /* Defines XMLRPC_HAVE_WCHAR, XMLRPC_INT64, XMLRPC_HAVE_TIMEVAL */ + +#if XMLRPC_HAVE_WCHAR +#include <wchar.h> +#endif + +#if XMLRPC_HAVE_TIMEVAL +#include <sys/time.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/*========================================================================= +** Version of libxmlrpc +**=======================================================================*/ +extern unsigned int const xmlrpc_version_major; +extern unsigned int const xmlrpc_version_minor; +extern unsigned int const xmlrpc_version_point; + +/*========================================================================= +** C types equivalent to XML-RPC types +**=======================================================================*/ + +/* We define names for these types, because they may change from platform + to platform. +*/ + +typedef signed int xmlrpc_int; + /* An integer of the type defined by XML-RPC <int>; i.e. 32 bit */ +typedef XMLRPC_INT32 xmlrpc_int32; + /* An integer of the type defined by XML-RPC <i4>; i.e. 32 bit */ +typedef XMLRPC_INT64 xmlrpc_int64; + /* An integer of the type defined by "XML-RPC" <i8>; i.e. 64 bit */ +typedef int xmlrpc_bool; + /* A boolean (of the type defined by XML-RPC <boolean>, but there's + really only one kind) + */ +typedef double xmlrpc_double; + /* A double precision floating point number as defined by + XML-RPC <float>. But the C "double" type is universally the same, + so it's probably clearer just to use that. This typedef is here + for mathematical completeness. + */ + +/* xmlrpc_socket is just for backward compatibility, in case someone decided + to use this in user code. New code should use the native type for a + socket (e.g. int or SOCKET). (We stopped using this because for winsock + users, we would have to #include <winsock.h> in every file that + #includes <xmlrpc-c/base.h> and we don't want that). +*/ +typedef int xmlrpc_socket; + +#define XMLRPC_INT32_MAX 0x7fffffff +#define XMLRPC_INT32_MIN (-XMLRPC_INT32_MAX - 1) + +#define XMLRPC_INT64_MAX 0x7fffffffffffffffll +#define XMLRPC_INT64_MIN (-XMLRPC_INT64_MAX - 1) + + +/*========================================================================= +** xmlrpc_value +**========================================================================= +** An XML-RPC value (of any type). +*/ + +typedef enum { + XMLRPC_TYPE_INT = 0, + XMLRPC_TYPE_BOOL = 1, + XMLRPC_TYPE_DOUBLE = 2, + XMLRPC_TYPE_DATETIME = 3, + XMLRPC_TYPE_STRING = 4, + XMLRPC_TYPE_BASE64 = 5, + XMLRPC_TYPE_ARRAY = 6, + XMLRPC_TYPE_STRUCT = 7, + XMLRPC_TYPE_C_PTR = 8, + XMLRPC_TYPE_NIL = 9, + XMLRPC_TYPE_I8 = 10, + XMLRPC_TYPE_DEAD = 0xDEAD +} xmlrpc_type; + +#define XMLRPC_HAVE_I8 1 + +/* These are *always* allocated on the heap. No exceptions. */ +typedef struct _xmlrpc_value xmlrpc_value; + +const char * +xmlrpc_type_name(xmlrpc_type const type); + +void +xmlrpc_abort_if_array_bad(xmlrpc_value * const arrayP); + +#define XMLRPC_ASSERT_ARRAY_OK(val) \ + xmlrpc_abort_if_array_bad(val) + +/* Increment the reference count of an xmlrpc_value. */ +extern void xmlrpc_INCREF (xmlrpc_value* const value); + +/* Decrement the reference count of an xmlrpc_value. If there +** are no more references, free it. */ +extern void xmlrpc_DECREF (xmlrpc_value* const value); + +/* Get the type of an XML-RPC value. */ +extern xmlrpc_type xmlrpc_value_type (xmlrpc_value* const value); + +xmlrpc_value * +xmlrpc_int_new(xmlrpc_env * const envP, + int const intValue); + +xmlrpc_value * +xmlrpc_i8_new(xmlrpc_env * const envP, + xmlrpc_int64 const value); + +void +xmlrpc_read_int(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + int * const intValueP); + +xmlrpc_value * +xmlrpc_bool_new(xmlrpc_env * const envP, + xmlrpc_bool const boolValue); + +void +xmlrpc_read_bool(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + xmlrpc_bool * const boolValueP); + +xmlrpc_value * +xmlrpc_double_new(xmlrpc_env * const envP, + double const doubleValue); + +void +xmlrpc_read_double(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + xmlrpc_double * const doubleValueP); + +xmlrpc_value * +xmlrpc_datetime_new_str(xmlrpc_env * const envP, + const char * const value); + +xmlrpc_value * +xmlrpc_datetime_new_sec(xmlrpc_env * const envP, + time_t const value); + +xmlrpc_value* +xmlrpc_datetime_new_usec(xmlrpc_env * const envP, + time_t const secs, + unsigned int const usecs); + +#if XMLRPC_HAVE_TIMEVAL +xmlrpc_value * +xmlrpc_datetime_new_timeval(xmlrpc_env * const envP, + struct timeval const value); +#endif + +#if XMLRPC_HAVE_TIMESPEC +xmlrpc_value * +xmlrpc_datetime_new_timespec(xmlrpc_env * const envP, + struct timespec const value); +#endif + +void +xmlrpc_read_datetime_str(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + const char ** const stringValueP); + +void +xmlrpc_read_datetime_sec(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + time_t * const timeValueP); + +void +xmlrpc_read_datetime_usec(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + time_t * const secsP, + unsigned int * const usecsP); + +#if XMLRPC_HAVE_TIMEVAL +void +xmlrpc_read_datetime_timeval(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + struct timeval * const timeValueP); +#endif + +#if XMLRPC_HAVE_TIMESPEC +void +xmlrpc_read_datetime_timespec(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + struct timespec * const timeValueP); +#endif + +xmlrpc_value * +xmlrpc_string_new(xmlrpc_env * const envP, + const char * const stringValue); + +xmlrpc_value * +xmlrpc_string_new_lp(xmlrpc_env * const envP, + size_t const length, + const char * const stringValue); + +xmlrpc_value * +xmlrpc_string_new_va(xmlrpc_env * const envP, + const char * const format, + va_list args); + +xmlrpc_value * +xmlrpc_string_new_f(xmlrpc_env * const envP, + const char * const format, + ...); + +xmlrpc_value * +xmlrpc_string_new_lp_cr(xmlrpc_env * const envP, + size_t const length, + const char * const value); + +xmlrpc_value * +xmlrpc_string_new_cr(xmlrpc_env * const envP, + const char * const value); + +void +xmlrpc_read_string(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + const char ** const stringValueP); + + +void +xmlrpc_read_string_crlf(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + const char ** const stringValueP); + +void +xmlrpc_read_string_lp_crlf(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + size_t * const lengthP, + const char ** const stringValueP); + +void +xmlrpc_read_string_lp(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + size_t * const lengthP, + const char ** const stringValueP); + +#if XMLRPC_HAVE_WCHAR +xmlrpc_value * +xmlrpc_string_w_new(xmlrpc_env * const envP, + const wchar_t * const stringValue); + +xmlrpc_value * +xmlrpc_string_w_new_lp(xmlrpc_env * const envP, + size_t const length, + const wchar_t * const stringValue); + +void +xmlrpc_read_string_w(xmlrpc_env * const envP, + xmlrpc_value * const valueP, + const wchar_t ** const stringValueP); + +void +xmlrpc_read_string_w_crlf(xmlrpc_env * const envP, + xmlrpc_value * const valueP, + const wchar_t ** const stringValueP); + +void +xmlrpc_read_string_w_lp(xmlrpc_env * const envP, + xmlrpc_value * const valueP, + size_t * const lengthP, + const wchar_t ** const stringValueP); + +void +xmlrpc_read_string_w_lp_crlf(xmlrpc_env * const envP, + xmlrpc_value * const valueP, + size_t * const lengthP, + const wchar_t ** const stringValueP); + +xmlrpc_value * +xmlrpc_string_w_new_lp_cr(xmlrpc_env * const envP, + size_t const length, + const wchar_t * const value); + +xmlrpc_value * +xmlrpc_string_w_new_cr(xmlrpc_env * const envP, + const wchar_t * const value); + +#endif /* XMLRPC_HAVE_WCHAR */ + +xmlrpc_value * +xmlrpc_base64_new(xmlrpc_env * const envP, + size_t const length, + const unsigned char * const value); + +void +xmlrpc_read_base64(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + size_t * const lengthP, + const unsigned char ** const bytestringValueP); + +void +xmlrpc_read_base64_size(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + size_t * const lengthP); + +xmlrpc_value * +xmlrpc_array_new(xmlrpc_env * const envP); + +/* Return the number of elements in an XML-RPC array. +** Sets XMLRPC_TYPE_ERROR if 'array' is not an array. */ +int +xmlrpc_array_size(xmlrpc_env * const env, + const xmlrpc_value * const array); + +/* Append an item to an XML-RPC array. +** Sets XMLRPC_TYPE_ERROR if 'array' is not an array. */ +extern void +xmlrpc_array_append_item (xmlrpc_env * const envP, + xmlrpc_value * const arrayP, + xmlrpc_value * const valueP); + +void +xmlrpc_array_read_item(xmlrpc_env * const envP, + const xmlrpc_value * const arrayP, + unsigned int const index, + xmlrpc_value ** const valuePP); + +/* Deprecated. Use xmlrpc_array_read_item() instead. + + Get an item from an XML-RPC array. + Does not increment the reference count of the returned value. + Sets XMLRPC_TYPE_ERROR if 'array' is not an array. + Sets XMLRPC_INDEX_ERROR if 'index' is out of bounds. +*/ +xmlrpc_value * +xmlrpc_array_get_item(xmlrpc_env * const envP, + const xmlrpc_value * const arrayP, + int const index); + +/* Not implemented--we don't need it yet. +extern +int xmlrpc_array_set_item (xmlrpc_env* env, +xmlrpc_value* array, +int index, + xmlrpc_value* value); +*/ + +xmlrpc_value * +xmlrpc_struct_new(xmlrpc_env * const env); + +/* Return the number of key/value pairs in a struct. +** Sets XMLRPC_TYPE_ERROR if 'strct' is not a struct. */ +int +xmlrpc_struct_size (xmlrpc_env * env, + xmlrpc_value * strct); + +/* Returns true iff 'strct' contains 'key'. +** Sets XMLRPC_TYPE_ERROR if 'strct' is not a struct. */ +int +xmlrpc_struct_has_key(xmlrpc_env * const envP, + xmlrpc_value * const strctP, + const char * const key); + +/* The same as the above, but the key may contain zero bytes. + Deprecated. xmlrpc_struct_get_value_v() is more general, and this + case is not common enough to warrant a shortcut. +*/ +int +xmlrpc_struct_has_key_n(xmlrpc_env * const envP, + xmlrpc_value * const strctP, + const char * const key, + size_t const key_len); + +#if 0 +/* Not implemented yet, but needed for completeness. */ +int +xmlrpc_struct_has_key_v(xmlrpc_env * env, + xmlrpc_value * strct, + xmlrpc_value * const keyval); +#endif + + +void +xmlrpc_struct_find_value(xmlrpc_env * const envP, + xmlrpc_value * const structP, + const char * const key, + xmlrpc_value ** const valuePP); + + +void +xmlrpc_struct_find_value_v(xmlrpc_env * const envP, + xmlrpc_value * const structP, + xmlrpc_value * const keyP, + xmlrpc_value ** const valuePP); + +void +xmlrpc_struct_read_value(xmlrpc_env * const envP, + xmlrpc_value * const structP, + const char * const key, + xmlrpc_value ** const valuePP); + +void +xmlrpc_struct_read_value_v(xmlrpc_env * const envP, + xmlrpc_value * const structP, + xmlrpc_value * const keyP, + xmlrpc_value ** const valuePP); + +/* The "get_value" functions are deprecated. Use the "find_value" + and "read_value" functions instead. +*/ +xmlrpc_value * +xmlrpc_struct_get_value(xmlrpc_env * const envP, + xmlrpc_value * const strctP, + const char * const key); + +/* The same as above, but the key may contain zero bytes. + Deprecated. xmlrpc_struct_get_value_v() is more general, and this + case is not common enough to warrant a shortcut. +*/ +xmlrpc_value * +xmlrpc_struct_get_value_n(xmlrpc_env * const envP, + xmlrpc_value * const strctP, + const char * const key, + size_t const key_len); + +/* Set the value associated with 'key' in 'strct' to 'value'. + Sets XMLRPC_TYPE_ERROR if 'strct' is not a struct. +*/ +void +xmlrpc_struct_set_value(xmlrpc_env * const env, + xmlrpc_value * const strct, + const char * const key, + xmlrpc_value * const value); + +/* The same as above, but the key may contain zero bytes. Deprecated. + The general way to set a structure value is xmlrpc_struct_set_value_v(), + and this case is not common enough to deserve a shortcut. +*/ +void +xmlrpc_struct_set_value_n(xmlrpc_env * const env, + xmlrpc_value * const strct, + const char * const key, + size_t const key_len, + xmlrpc_value * const value); + +/* The same as above, but the key must be an XML-RPC string. +** Fails with XMLRPC_TYPE_ERROR if 'keyval' is not a string. */ +void +xmlrpc_struct_set_value_v(xmlrpc_env * const env, + xmlrpc_value * const strct, + xmlrpc_value * const keyval, + xmlrpc_value * const value); + +/* Given a zero-based index, return the matching key and value. This +** is normally used in conjunction with xmlrpc_struct_size. +** Fails with XMLRPC_TYPE_ERROR if 'struct' is not a struct. +** Fails with XMLRPC_INDEX_ERROR if 'index' is out of bounds. */ + +void +xmlrpc_struct_read_member(xmlrpc_env * const envP, + xmlrpc_value * const structP, + unsigned int const index, + xmlrpc_value ** const keyvalP, + xmlrpc_value ** const valueP); + +/* The same as above, but does not increment the reference count of the + two values it returns, and return NULL for both if it fails, and + takes a signed integer for the index (but fails if it is negative). + + Deprecated. Use xmlrpc_struct_read_member() instead. +*/ +void +xmlrpc_struct_get_key_and_value(xmlrpc_env * const env, + xmlrpc_value * const strct, + int const index, + xmlrpc_value ** const out_keyval, + xmlrpc_value ** const out_value); + +void +xmlrpc_read_cptr(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + void ** const ptrValueP); + +void +xmlrpc_read_nil(xmlrpc_env * const envP, + xmlrpc_value * const valueP); + + +void +xmlrpc_read_i8(xmlrpc_env * const envP, + const xmlrpc_value * const valueP, + xmlrpc_int64 * const intValueP); + + +xmlrpc_value * +xmlrpc_cptr_new(xmlrpc_env * const envP, + void * const value); + +xmlrpc_value * +xmlrpc_nil_new(xmlrpc_env * const envP); + + +/* Build an xmlrpc_value from a format string. */ + +xmlrpc_value * +xmlrpc_build_value(xmlrpc_env * const env, + const char * const format, + ...); + +/* The same as the above, but using a va_list and more general */ +void +xmlrpc_build_value_va(xmlrpc_env * const env, + const char * const format, + va_list const args, + xmlrpc_value ** const valPP, + const char ** const tailP); + +void +xmlrpc_decompose_value(xmlrpc_env * const envP, + xmlrpc_value * const value, + const char * const format, + ...); + +void +xmlrpc_decompose_value_va(xmlrpc_env * const envP, + xmlrpc_value * const value, + const char * const format, + va_list const args); + +/* xmlrpc_parse_value... is the same as xmlrpc_decompose_value... except + that it doesn't do proper memory management -- it returns xmlrpc_value's + without incrementing the reference count and returns pointers to data + inside an xmlrpc_value structure. + + These are deprecated. Use xmlrpc_decompose_value... instead. +*/ +void +xmlrpc_parse_value(xmlrpc_env * const envP, + xmlrpc_value * const value, + const char * const format, + ...); + +/* The same as the above, but using a va_list. */ +void +xmlrpc_parse_value_va(xmlrpc_env * const envP, + xmlrpc_value * const value, + const char * const format, + va_list const args); + +/*========================================================================= +** Encoding XML +**=======================================================================*/ + +typedef enum xmlrpc_dialect { + xmlrpc_dialect_i8, + xmlrpc_dialect_apache +} xmlrpc_dialect; + +void +xmlrpc_serialize_value2(xmlrpc_env * const envP, + xmlrpc_mem_block * const outputP, + xmlrpc_value * const valueP, + xmlrpc_dialect const dialect); + +void +xmlrpc_serialize_value(xmlrpc_env * const envP, + xmlrpc_mem_block * const outputP, + xmlrpc_value * const valueP); + +void +xmlrpc_serialize_params2(xmlrpc_env * const envP, + xmlrpc_mem_block * const outputP, + xmlrpc_value * const paramArrayP, + xmlrpc_dialect const dialect); + +void +xmlrpc_serialize_params(xmlrpc_env * const envP, + xmlrpc_mem_block * const outputP, + xmlrpc_value * const paramArrayP); + +void +xmlrpc_serialize_call2(xmlrpc_env * const envP, + xmlrpc_mem_block * const outputP, + const char * const methodName, + xmlrpc_value * const paramArrayP, + xmlrpc_dialect const dialect); + +void +xmlrpc_serialize_call(xmlrpc_env * const envP, + xmlrpc_mem_block * const outputP, + const char * const methodName, + xmlrpc_value * const paramArrayP); + +void +xmlrpc_serialize_response2(xmlrpc_env * const envP, + xmlrpc_mem_block * const outputP, + xmlrpc_value * const valueP, + xmlrpc_dialect const dialect); + +void +xmlrpc_serialize_response(xmlrpc_env * const envP, + xmlrpc_mem_block * const outputP, + xmlrpc_value * const valueP); + +void +xmlrpc_serialize_fault(xmlrpc_env * const envP, + xmlrpc_mem_block * const outputP, + const xmlrpc_env * const faultP); + + +/*========================================================================= +** Decoding XML +**=======================================================================*/ + +/* Parse an XML-RPC call. If an error occurs, set a fault and set +** the output variables to NULL. +** The caller is responsible for calling free(*out_method_name) and +** xmlrpc_DECREF(*out_param_array). */ +void +xmlrpc_parse_call(xmlrpc_env * const envP, + const char * const xml_data, + size_t const xml_len, + const char ** const out_method_name, + xmlrpc_value ** const out_param_array); + +void +xmlrpc_parse_response2(xmlrpc_env * const envP, + const char * const xmlData, + size_t const xmlDataLen, + xmlrpc_value ** const resultPP, + int * const faultCodeP, + const char ** const faultStringP); + + +/* xmlrpc_parse_response() is for backward compatibility */ + +xmlrpc_value * +xmlrpc_parse_response(xmlrpc_env * const envP, + const char * const xmlData, + size_t const xmlDataLen); + + +/*========================================================================= +** XML-RPC Base64 Utilities +**========================================================================= +** Here are some lightweight utilities which can be used to encode and +** decode Base64 data. These are exported mainly for testing purposes. +*/ + +/* This routine inserts newlines every 76 characters, as required by the +** Base64 specification. */ +xmlrpc_mem_block * +xmlrpc_base64_encode(xmlrpc_env * env, + unsigned char * bin_data, + size_t bin_len); + +/* This routine encodes everything in one line. This is needed for HTTP +** authentication and similar tasks. */ +xmlrpc_mem_block * +xmlrpc_base64_encode_without_newlines(xmlrpc_env * env, + unsigned char * bin_data, + size_t bin_len); + +/* This decodes Base64 data with or without newlines. */ +extern xmlrpc_mem_block * +xmlrpc_base64_decode(xmlrpc_env * const envP, + const char * const ascii_data, + size_t const ascii_len); + + +/*========================================================================= +** Authorization Cookie Handling +**========================================================================= +** Routines to get and set values for authorizing via authorization +** cookies. Both the client and server use HTTP_COOKIE_AUTH to store +** the representation of the authorization value, which is actually +** just a base64 hash of username:password. (This entire method is +** a cookie replacement of basic authentication.) +**/ + +extern void xmlrpc_authcookie_set(xmlrpc_env * const env, + const char * const username, + const char * const password); + +char *xmlrpc_authcookie(void); + +/*========================================================================= + Resource Limits + + Ideally, there would be enough resource limits to ensure that + XML-RPC partners cannot cause libxmlrpc objects and routines to use + more resource than is available for them (either by accident or + malice). We have a long way to go to get there. + +=========================================================================*/ +/* These functions are _not_ re-entrant and the limits are per-process + (i.e. their values live in static global variables). +*/ + +/* Limit IDs. There will be more of these as time goes on. */ +#define XMLRPC_NESTING_LIMIT_ID (0) +#define XMLRPC_XML_SIZE_LIMIT_ID (1) +#define XMLRPC_LAST_LIMIT_ID (XMLRPC_XML_SIZE_LIMIT_ID) + +/* By default, deserialized data may be no more than 64 levels deep. */ +#define XMLRPC_NESTING_LIMIT_DEFAULT (64) + +/* By default, XML data from the network may be no larger than 512K. +** Some client and server modules may fail to enforce this properly. */ +#define XMLRPC_XML_SIZE_LIMIT_DEFAULT (512*1024) + +/* Set a specific limit to the specified value. */ +extern void xmlrpc_limit_set (int const limit_id, size_t const value); + +/* Get the value of a specified limit. */ +extern size_t xmlrpc_limit_get (int const limit_id); + + +#ifdef __cplusplus +} +#endif + +/* Copyright (C) 2001 by First Peer, Inc. All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. */ + +#endif + diff --git a/vendor/voclient/include/xmlrpc-c/base.hpp b/vendor/voclient/include/xmlrpc-c/base.hpp new file mode 100644 index 00000000..3eaa25ce --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/base.hpp @@ -0,0 +1,354 @@ +#ifndef XMLRPC_BASE_HPP_INCLUDED +#define XMLRPC_BASE_HPP_INCLUDED + +#include <xmlrpc-c/config.h> + +#include <climits> +#include <cfloat> +#include <ctime> +#include <vector> +#include <map> +#include <string> +#if XMLRPC_HAVE_TIMEVAL +#include <sys/time.h> +#endif + +#include <xmlrpc-c/base.h> + +namespace xmlrpc_c { + + +class value { + // This is a handle. You don't want to create a pointer to this; + // it is in fact a pointer itself. +public: + value(); + // This creates a placeholder. It can't be used for anything, but + // holds memory. instantiate() can turn it into a real object. + + value(xmlrpc_c::value const &value); // copy constructor + + ~value(); + + enum type_t { + TYPE_INT = 0, + TYPE_BOOLEAN = 1, + TYPE_DOUBLE = 2, + TYPE_DATETIME = 3, + TYPE_STRING = 4, + TYPE_BYTESTRING = 5, + TYPE_ARRAY = 6, + TYPE_STRUCT = 7, + TYPE_C_PTR = 8, + TYPE_NIL = 9, + TYPE_I8 = 10, + TYPE_DEAD = 0xDEAD + }; + + type_t type() const; + + xmlrpc_c::value& + operator=(xmlrpc_c::value const&); + + bool + isInstantiated() const; + + // The following are not meant to be public to users, but just to + // other Xmlrpc-c library modules. If we ever go to a pure C++ + // implementation, not based on C xmlrpc_value objects, this shouldn't + // be necessary. + + void + appendToCArray(xmlrpc_value * const arrayP) const; + + void + addToCStruct(xmlrpc_value * const structP, + std::string const key) const; + + xmlrpc_value * + cValue() const; + + value(xmlrpc_value * const valueP); + + void + instantiate(xmlrpc_value * const valueP); + // Works only on a placeholder object created by the no-argument + // constructor. + + xmlrpc_value * cValueP; + // NULL means this is merely a placeholder object. +}; + + + +class value_int : public value { +public: + value_int(int const cvalue); + + value_int(xmlrpc_c::value const baseValue); + + operator int() const; +}; + + + +class value_boolean : public value { +public: + value_boolean(bool const cvalue); + + value_boolean(xmlrpc_c::value const baseValue); + + operator bool() const; +}; + + + +class value_string : public value { +public: + enum nlCode {nlCode_all, nlCode_lf}; + + value_string(std::string const& cppvalue, + nlCode const nlCode); + + value_string(std::string const& cppvalue); + + value_string(xmlrpc_c::value const baseValue); + + std::string + crlfValue() const; + + operator std::string() const; +}; + + + +class value_double : public value { +public: + value_double(double const cvalue); + + value_double(xmlrpc_c::value const baseValue); + + operator double() const; +}; + + + +class value_datetime : public value { +public: + value_datetime(std::string const cvalue); + value_datetime(time_t const cvalue); +#if XMLRPC_HAVE_TIMEVAL + value_datetime(struct timeval const& cvalue); + operator timeval() const; +#endif +#if XMLRPC_HAVE_TIMESPEC + value_datetime(struct timespec const& cvalue); + operator timespec() const; +#endif + + value_datetime(xmlrpc_c::value const baseValue); + + operator time_t() const; +}; + + + +class value_bytestring : public value { +public: + value_bytestring(std::vector<unsigned char> const& cvalue); + + value_bytestring(xmlrpc_c::value const baseValue); + + // You can't cast to a vector because the compiler can't tell which + // constructor to use (complains about ambiguity). So we have this: + std::vector<unsigned char> + vectorUcharValue() const; + + size_t + length() const; +}; + + + +class value_struct : public value { +public: + value_struct(std::map<std::string, xmlrpc_c::value> const& cvalue); + + value_struct(xmlrpc_c::value const baseValue); + + operator std::map<std::string, xmlrpc_c::value>() const; +}; + + + +class value_array : public value { +public: + value_array(std::vector<xmlrpc_c::value> const& cvalue); + + value_array(xmlrpc_c::value const baseValue); + + std::vector<xmlrpc_c::value> + vectorValueValue() const; + + size_t + size() const; +}; + + + +class value_nil : public value { +public: + value_nil(); + + value_nil(xmlrpc_c::value const baseValue); +}; + + + +class value_i8 : public value { +public: + value_i8(xmlrpc_int64 const cvalue); + + value_i8(xmlrpc_c::value const baseValue); + + operator xmlrpc_int64() const; +}; + + + +class fault { +/*---------------------------------------------------------------------------- + This is an XML-RPC fault. + + This object is not intended to be used to represent a fault in the + execution of XML-RPC client/server software -- just a fault in an + XML-RPC RPC as described by the XML-RPC spec. + + There is no way to represent "no fault" with this object. The object is + meaningful only in the context of some fault. +-----------------------------------------------------------------------------*/ +public: + enum code_t { + CODE_UNSPECIFIED = 0, + CODE_INTERNAL = -500, + CODE_TYPE = -501, + CODE_INDEX = -502, + CODE_PARSE = -503, + CODE_NETWORK = -504, + CODE_TIMEOUT = -505, + CODE_NO_SUCH_METHOD = -506, + CODE_REQUEST_REFUSED = -507, + CODE_INTROSPECTION_DISABLED = -508, + CODE_LIMIT_EXCEEDED = -509, + CODE_INVALID_UTF8 = -510 + }; + + fault(); + + fault(std::string const _faultString, + xmlrpc_c::fault::code_t const _faultCode + = xmlrpc_c::fault::CODE_UNSPECIFIED + ); + + xmlrpc_c::fault::code_t getCode() const; + + std::string getDescription() const; + +private: + bool valid; + xmlrpc_c::fault::code_t code; + std::string description; +}; + +class rpcOutcome { +/*---------------------------------------------------------------------------- + The outcome of a validly executed RPC -- either an XML-RPC fault + or an XML-RPC value of the result. +-----------------------------------------------------------------------------*/ +public: + rpcOutcome(); + rpcOutcome(xmlrpc_c::value const result); + rpcOutcome(xmlrpc_c::fault const fault); + bool succeeded() const; + xmlrpc_c::fault getFault() const; + xmlrpc_c::value getResult() const; +private: + bool valid; + // This is false in a placeholder variable -- i.e. an object you + // create with the no-argument constructor, which is waiting to be + // assigned a value. When false, nothing below is valid. + bool _succeeded; + xmlrpc_c::value result; // valid if 'succeeded' + xmlrpc_c::fault fault; // valid if not 'succeeded' +}; + +class paramList { +/*---------------------------------------------------------------------------- + A parameter list of an XML-RPC call. +-----------------------------------------------------------------------------*/ +public: + paramList(unsigned int const paramCount = 0); + + paramList& + add(xmlrpc_c::value const param); + + paramList& + addx(xmlrpc_c::value const param); + + unsigned int + size() const; + + xmlrpc_c::value operator[](unsigned int const subscript) const; + + int + getInt(unsigned int const paramNumber, + int const minimum = INT_MIN, + int const maximum = INT_MAX) const; + + bool + getBoolean(unsigned int const paramNumber) const; + + double + getDouble(unsigned int const paramNumber, + double const minimum = -DBL_MAX, + double const maximum = DBL_MAX) const; + + enum timeConstraint {TC_ANY, TC_NO_PAST, TC_NO_FUTURE}; + + time_t + getDatetime_sec(unsigned int const paramNumber, + timeConstraint const constraint + = paramList::TC_ANY) const; + + std::string + getString(unsigned int const paramNumber) const; + + std::vector<unsigned char> + getBytestring(unsigned int const paramNumber) const; + + std::vector<xmlrpc_c::value> + getArray(unsigned int const paramNumber, + unsigned int const minSize = 0, + unsigned int const maxSize = UINT_MAX) const; + + std::map<std::string, xmlrpc_c::value> + getStruct(unsigned int const paramNumber) const; + + void + getNil(unsigned int const paramNumber) const; + + xmlrpc_int64 + getI8(unsigned int const paramNumber, + xmlrpc_int64 const minimum = XMLRPC_INT64_MIN, + xmlrpc_int64 const maximum = XMLRPC_INT64_MAX) const; + + void + verifyEnd(unsigned int const paramNumber) const; + +private: + std::vector<xmlrpc_c::value> paramVector; +}; + +} // namespace + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/c_util.h b/vendor/voclient/include/xmlrpc-c/c_util.h new file mode 100644 index 00000000..a1ede08a --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/c_util.h @@ -0,0 +1,20 @@ +#ifndef XMLRPC_C_C_UTIL_H_INCLUDED +#define XMLRPC_C_C_UTIL_H_INCLUDED + +/* C language stuff. Doesn't involve any libraries that aren't part of + the compiler. +*/ + +#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) + +/* GNU_PRINTF_ATTR lets the GNU compiler check printf-type + calls to be sure the arguments match the format string, thus preventing + runtime segmentation faults and incorrect messages. +*/ +#ifdef __GNUC__ +#define GNU_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b))) +#else +#define GNU_PRINTF_ATTR(a,b) +#endif + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/client.h b/vendor/voclient/include/xmlrpc-c/client.h new file mode 100644 index 00000000..c2e2e619 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/client.h @@ -0,0 +1,316 @@ +/*============================================================================ + xmlrpc_client.h +============================================================================== + This header file defines the interface between xmlrpc.c and its users, + related to clients. + + Copyright information is at the end of the file. +============================================================================*/ + +#ifndef XMLRPC_CLIENT_H_INCLUDED +#define XMLRPC_CLIENT_H_INCLUDED + +#include <xmlrpc-c/base.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +struct xmlrpc_client; +struct xmlrpc_client_transport; +struct xmlrpc_client_transport_ops; +#ifndef __cplusplus +typedef struct xmlrpc_client xmlrpc_client; +typedef struct xmlrpc_client_transport xmlrpc_client_transport; +typedef struct xmlrpc_client_transport_ops xmlrpc_client_transport_ops; +#endif + +/* libxmlrpc_client typically does _not_ actually include all of the + XML transports declared here by xmlrpc_*_transport_ops. + + Use 'xmlrpc-c-config --features' to determine which features are + installed. +*/ + +/* Before Xmlrpc-c 1.13 (December 2007), we declared struct + xmlrpc_xportparms, as a sort of "base class." The struct was never + complete -- you just cast pointer to it it to pointers to other + types. It turned out not to be really helpful and casts are ugly, + so now we just use void * as a base class pointer. +*/ + +extern struct xmlrpc_client_transport_ops xmlrpc_libwww_transport_ops; +extern struct xmlrpc_client_transport_ops xmlrpc_wininet_transport_ops; +extern struct xmlrpc_client_transport_ops xmlrpc_curl_transport_ops; + +enum xmlrpc_sslversion { + XMLRPC_SSLVERSION_DEFAULT, + XMLRPC_SSLVERSION_TLSv1, + XMLRPC_SSLVERSION_SSLv2, + XMLRPC_SSLVERSION_SSLv3 +}; + +struct xmlrpc_curl_xportparms { + /* This is designed so that zero values are always the defaults. */ + const char * network_interface; + xmlrpc_bool no_ssl_verifypeer; + xmlrpc_bool no_ssl_verifyhost; + const char * user_agent; + const char * ssl_cert; + const char * sslcerttype; + const char * sslcertpasswd; + const char * sslkey; + const char * sslkeytype; + const char * sslkeypasswd; + const char * sslengine; + xmlrpc_bool sslengine_default; + enum xmlrpc_sslversion sslversion; + const char * cainfo; + const char * capath; + const char * randomfile; + const char * egdsocket; + const char * ssl_cipher_list; + unsigned int timeout; +}; + + +#define XMLRPC_CXPSIZE(mbrname) \ + XMLRPC_STRUCTSIZE(struct xmlrpc_curl_xportparms, mbrname) + +/* XMLRPC_CXPSIZE(xyz) is analogous to XMLRPC_CPSIZE, below */ + +struct xmlrpc_wininet_xportparms { + int allowInvalidSSLCerts; +}; + +#define XMLRPC_WXPSIZE(mbrname) \ + XMLRPC_STRUCTSIZE(struct xmlrpc_wininet_xportparms, mbrname) + +/* XMLRPC_WXPSIZE(xyz) is analogous to XMLRPC_CPSIZE, below */ + +struct xmlrpc_clientparms { + /* (transport, transportparmsP, transportparm_size) and + (transportOpsP, transportP) are mutually exclusive. + */ + const char * transport; + const void * transportparmsP; + /* This should be type "const struct ..._xportparms *" */ + size_t transportparm_size; + + const struct xmlrpc_client_transport_ops * transportOpsP; + xmlrpc_client_transport * transportP; + xmlrpc_dialect dialect; +}; + +#define XMLRPC_CPSIZE(mbrname) \ + XMLRPC_STRUCTSIZE(struct xmlrpc_clientparms, mbrname) + +/* XMLRPC_CPSIZE(xyz) is the minimum size a struct xmlrpc_clientparms + must be to include the 'xyz' member. This is essential to forward and + backward compatbility, as new members will be added to the end of the + struct in future releases. This is how the callee knows whether or + not the caller is new enough to have supplied a certain parameter. +*/ + +const char * +xmlrpc_client_get_default_transport(xmlrpc_env * const env); + +/* A callback function to handle the response to an asynchronous call. +** If 'fault->fault_occurred' is true, then response will be NULL. All +** arguments except 'user_data' will be deallocated internally; please do +** not free any of them yourself. +** WARNING: param_array may (or may not) be NULL if fault->fault_occurred +** is true, and you set up the call using xmlrpc_client_call_asynch. +** WARNING: If asynchronous calls are still pending when the library is +** shut down, your handler may (or may not) be called with a fault. */ +typedef void (*xmlrpc_response_handler) (const char *server_url, + const char *method_name, + xmlrpc_value *param_array, + void *user_data, + xmlrpc_env *fault, + xmlrpc_value *result); + + +/*========================================================================= + xmlrpc_server_info +=========================================================================== + We normally refer to servers by URL. But sometimes we need to do extra + setup for particular servers. In that case, we can create an + xmlrpc_server_info object, configure it in various ways, and call the + remote server. + + (This interface is also designed to discourage further multiplication + of xmlrpc_client_call APIs. We have enough of those already. Please + add future options and flags using xmlrpc_server_info.) +=========================================================================*/ + +typedef struct _xmlrpc_server_info xmlrpc_server_info; + +/* Create a new server info record, pointing to the specified server. */ +xmlrpc_server_info * +xmlrpc_server_info_new(xmlrpc_env * const envP, + const char * const serverUrl); + +/* Create a new server info record, with a copy of the old server. */ +extern xmlrpc_server_info * +xmlrpc_server_info_copy(xmlrpc_env * const envP, + xmlrpc_server_info * const srcP); + +void +xmlrpc_server_info_free(xmlrpc_server_info * const serverP); + + +void +xmlrpc_server_info_set_user(xmlrpc_env * const envP, + xmlrpc_server_info * const serverInfoP, + const char * const username, + const char * const password); + +void +xmlrpc_server_info_set_basic_auth(xmlrpc_env * const envP, + xmlrpc_server_info * const serverP, + const char * const username, + const char * const password); + +void +xmlrpc_server_info_allow_auth_basic(xmlrpc_env * const envP, + xmlrpc_server_info * const sP); + +void +xmlrpc_server_info_disallow_auth_basic(xmlrpc_env * const envP, + xmlrpc_server_info * const sP); + +void +xmlrpc_server_info_allow_auth_digest(xmlrpc_env * const envP, + xmlrpc_server_info * const sP); + +void +xmlrpc_server_info_disallow_auth_digest(xmlrpc_env * const envP, + xmlrpc_server_info * const sP); + +void +xmlrpc_server_info_allow_auth_negotiate(xmlrpc_env * const envP, + xmlrpc_server_info * const sP); + +void +xmlrpc_server_info_disallow_auth_negotiate(xmlrpc_env * const envP, + xmlrpc_server_info * const sP); + +void +xmlrpc_server_info_allow_auth_ntlm(xmlrpc_env * const envP, + xmlrpc_server_info * const sP); + +void +xmlrpc_server_info_disallow_auth_ntlm(xmlrpc_env * const envP, + xmlrpc_server_info * const sP); + +extern unsigned int const xmlrpc_client_version_major; +extern unsigned int const xmlrpc_client_version_minor; +extern unsigned int const xmlrpc_client_version_point; + +void +xmlrpc_client_setup_global_const(xmlrpc_env * const envP); + +void +xmlrpc_client_teardown_global_const(void); + +void +xmlrpc_client_create(xmlrpc_env * const envP, + int const flags, + const char * const appname, + const char * const appversion, + const struct xmlrpc_clientparms * const clientparmsP, + unsigned int const parmSize, + xmlrpc_client ** const clientPP); + +void +xmlrpc_client_destroy(xmlrpc_client * const clientP); + +void +xmlrpc_client_transport_call2( + xmlrpc_env * const envP, + xmlrpc_client * const clientP, + const xmlrpc_server_info * const serverP, + xmlrpc_mem_block * const callXmlP, + xmlrpc_mem_block ** const respXmlPP); + +void +xmlrpc_client_call2(xmlrpc_env * const envP, + struct xmlrpc_client * const clientP, + const xmlrpc_server_info * const serverInfoP, + const char * const methodName, + xmlrpc_value * const paramArrayP, + xmlrpc_value ** const resultPP); + +void +xmlrpc_client_call2f(xmlrpc_env * const envP, + xmlrpc_client * const clientP, + const char * const serverUrl, + const char * const methodName, + xmlrpc_value ** const resultPP, + const char * const format, + ...); + +void +xmlrpc_client_event_loop_finish(xmlrpc_client * const clientP); + +void +xmlrpc_client_event_loop_finish_timeout(xmlrpc_client * const clientP, + unsigned long const milliseconds); + +void +xmlrpc_client_start_rpc(xmlrpc_env * const envP, + struct xmlrpc_client * const clientP, + xmlrpc_server_info * const serverInfoP, + const char * const methodName, + xmlrpc_value * const argP, + xmlrpc_response_handler responseHandler, + void * const userData); + +void +xmlrpc_client_start_rpcf(xmlrpc_env * const envP, + xmlrpc_client * const clientP, + const char * const serverUrl, + const char * const methodName, + xmlrpc_response_handler callback, + void * const userData, + const char * const format, + ...); + +void +xmlrpc_client_set_interrupt(xmlrpc_client * const clientP, + int * const interruptP); + +#include <xmlrpc-c/client_global.h> + +/* Copyright (C) 2001 by First Peer, Inc. All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _XMLRPC_CLIENT_H_ */ diff --git a/vendor/voclient/include/xmlrpc-c/client.hpp b/vendor/voclient/include/xmlrpc-c/client.hpp new file mode 100644 index 00000000..de6d0730 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/client.hpp @@ -0,0 +1,286 @@ +#ifndef CLIENT_HPP_INCLUDED +#define CLIENT_HPP_INCLUDED + +#include <string> +#include <vector> +#include <memory> + +#include <xmlrpc-c/girerr.hpp> +#include <xmlrpc-c/girmem.hpp> +#include <xmlrpc-c/base.hpp> +#include <xmlrpc-c/timeout.hpp> +#include <xmlrpc-c/client_transport.hpp> + +namespace xmlrpc_c { + +class clientTransactionPtr; + +class clientTransaction : public girmem::autoObject { + + friend class clientTransactionPtr; + +public: + virtual void + finish(xmlrpc_c::rpcOutcome const& outcome) = 0; + + virtual void + finishErr(girerr::error const& error) = 0; + +protected: + clientTransaction(); +}; + +class clientTransactionPtr : public girmem::autoObjectPtr { + +public: + clientTransactionPtr(); + + clientTransactionPtr(clientTransaction * const transP); + + virtual ~clientTransactionPtr(); + + virtual xmlrpc_c::clientTransaction * + operator->() const; +}; + +class clientPtr; + +class client : public girmem::autoObject { +/*---------------------------------------------------------------------------- + A generic client -- a means of performing an RPC. This is so generic + that it can be used for clients that are not XML-RPC. + + This is a base class. Derived classes define things such as that + XML and HTTP get used to perform the RPC. +-----------------------------------------------------------------------------*/ + friend class clientTransactionPtr; + +public: + virtual ~client(); + + virtual void + call(xmlrpc_c::carriageParm * const carriageParmP, + std::string const& methodName, + xmlrpc_c::paramList const& paramList, + xmlrpc_c::rpcOutcome * const outcomeP) = 0; + + virtual void + start(xmlrpc_c::carriageParm * const carriageParmP, + std::string const& methodName, + xmlrpc_c::paramList const& paramList, + xmlrpc_c::clientTransactionPtr const& tranP); + + void + finishAsync(xmlrpc_c::timeout const timeout); + + virtual void + setInterrupt(int *); +}; + +class clientPtr : public girmem::autoObjectPtr { +public: + clientPtr(); + + explicit clientPtr(xmlrpc_c::client * const clientP); + + xmlrpc_c::client * + operator->() const; + + xmlrpc_c::client * + get() const; +}; + +class serverAccessor : public girmem::autoObject { + +public: + serverAccessor(xmlrpc_c::clientPtr const clientP, + xmlrpc_c::carriageParmPtr const carriageParmP); + + void + call(std::string const& methodName, + xmlrpc_c::paramList const& paramList, + xmlrpc_c::rpcOutcome * const outcomeP) const; + +private: + xmlrpc_c::clientPtr const clientP; + xmlrpc_c::carriageParmPtr const carriageParmP; +}; + +class serverAccessorPtr : public girmem::autoObjectPtr { +public: + serverAccessorPtr(); + + explicit + serverAccessorPtr(xmlrpc_c::serverAccessor * const serverAccessorP); + + xmlrpc_c::serverAccessor * + operator->() const; + + xmlrpc_c::serverAccessor * + get() const; +}; + +class connection { +/*---------------------------------------------------------------------------- + A nexus of a particular client and a particular server, along with + carriage parameters for performing RPCs between the two. + + This is a minor convenience for client programs that always talk to + the same server the same way. + + Use this as a parameter to rpc.call(). +-----------------------------------------------------------------------------*/ +public: + connection(xmlrpc_c::client * const clientP, + xmlrpc_c::carriageParm * const carriageParmP); + + ~connection(); + + xmlrpc_c::client * clientP; + xmlrpc_c::carriageParm * carriageParmP; +}; + +class client_xml : public xmlrpc_c::client { +/*---------------------------------------------------------------------------- + A client that uses XML-RPC XML in the RPC. This class does not define + how the XML gets transported, though (i.e. does not require HTTP). +-----------------------------------------------------------------------------*/ +public: + client_xml(xmlrpc_c::clientXmlTransport * const transportP); + + client_xml(xmlrpc_c::clientXmlTransport * const transportP, + xmlrpc_dialect const dialect); + + client_xml(xmlrpc_c::clientXmlTransportPtr const transportP); + + client_xml(xmlrpc_c::clientXmlTransportPtr const transportP, + xmlrpc_dialect const dialect); + + ~client_xml(); + + void + call(carriageParm * const carriageParmP, + std::string const& methodName, + xmlrpc_c::paramList const& paramList, + xmlrpc_c::rpcOutcome * const outcomeP); + + void + start(xmlrpc_c::carriageParm * const carriageParmP, + std::string const& methodName, + xmlrpc_c::paramList const& paramList, + xmlrpc_c::clientTransactionPtr const& tranP); + + void + finishAsync(xmlrpc_c::timeout const timeout); + + virtual void + setInterrupt(int * interruptP); + +private: + struct client_xml_impl * implP; +}; + +class xmlTransaction_client : public xmlrpc_c::xmlTransaction { + +public: + xmlTransaction_client(xmlrpc_c::clientTransactionPtr const& tranP); + + void + finish(std::string const& responseXml) const; + + void + finishErr(girerr::error const& error) const; +private: + xmlrpc_c::clientTransactionPtr const tranP; +}; + +class xmlTransaction_clientPtr : public xmlTransactionPtr { +public: + xmlTransaction_clientPtr(); + + xmlTransaction_clientPtr(xmlrpc_c::clientTransactionPtr const& tranP); + + xmlrpc_c::xmlTransaction_client * + operator->() const; +}; + +class rpcPtr; + +class rpc : public clientTransaction { +/*---------------------------------------------------------------------------- + An RPC. An RPC consists of method name, parameters, and result. It + does not specify in any way how the method name and parameters get + turned into a result. It does not presume XML or HTTP. + + You don't create an object of this class directly. All references to + an rpc object should be by an rpcPtr object. Create a new RPC by + creating a new rpcPtr. Accordingly, our constructors and destructors + are protected, but available to our friend class rpcPtr. + + In order to do asynchronous RPCs, you normally have to create a derived + class that defines a useful notifyComplete(). If you do that, you'll + want to make sure the derived class objects get accessed only via rpcPtrs + as well. +-----------------------------------------------------------------------------*/ + friend class xmlrpc_c::rpcPtr; + +public: + void + call(xmlrpc_c::client * const clientP, + xmlrpc_c::carriageParm * const carriageParmP); + + void + call(xmlrpc_c::connection const& connection); + + void + start(xmlrpc_c::client * const clientP, + xmlrpc_c::carriageParm * const carriageParmP); + + void + start(xmlrpc_c::connection const& connection); + + void + finish(xmlrpc_c::rpcOutcome const& outcome); + + void + finishErr(girerr::error const& error); + + virtual void + notifyComplete(); + + bool + isFinished() const; + + bool + isSuccessful() const; + + xmlrpc_c::value + getResult() const; + + xmlrpc_c::fault + getFault() const; + + rpc(std::string const methodName, + xmlrpc_c::paramList const& paramList); + + virtual ~rpc(); + +private: + struct rpc_impl * implP; +}; + +class rpcPtr : public clientTransactionPtr { +public: + rpcPtr(); + + explicit rpcPtr(xmlrpc_c::rpc * const rpcP); + + rpcPtr(std::string const methodName, + xmlrpc_c::paramList const& paramList); + + xmlrpc_c::rpc * + operator->() const; +}; + +} // namespace +#endif diff --git a/vendor/voclient/include/xmlrpc-c/client_global.h b/vendor/voclient/include/xmlrpc-c/client_global.h new file mode 100644 index 00000000..4f388fcc --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/client_global.h @@ -0,0 +1,141 @@ +#ifndef CLIENT_GLOBAL_H_INCLUDED +#define CLIENT_GLOBAL_H_INCLUDED + +/*========================================================================= +** Initialization and Shutdown +**========================================================================= +** These routines initialize and terminate the XML-RPC client. If you're +** already using libwww on your own, you can pass +** XMLRPC_CLIENT_SKIP_LIBWWW_INIT to avoid initializing it twice. +*/ + +#define XMLRPC_CLIENT_NO_FLAGS (0) +#define XMLRPC_CLIENT_SKIP_LIBWWW_INIT (1) + +extern void +xmlrpc_client_init(int const flags, + const char * const appname, + const char * const appversion); + +void +xmlrpc_client_init2(xmlrpc_env * const env, + int const flags, + const char * const appname, + const char * const appversion, + const struct xmlrpc_clientparms * const clientparms, + unsigned int const parm_size); + +extern void +xmlrpc_client_cleanup(void); + +/*========================================================================= +** xmlrpc_client_call +**========================================================================= +** A synchronous XML-RPC client. Do not attempt to call any of these +** functions from inside an asynchronous callback! +*/ + +xmlrpc_value * +xmlrpc_client_call(xmlrpc_env * const envP, + const char * const server_url, + const char * const method_name, + const char * const format, + ...); + +xmlrpc_value * +xmlrpc_client_call_params(xmlrpc_env * const envP, + const char * const serverUrl, + const char * const methodName, + xmlrpc_value * const paramArrayP); + +xmlrpc_value * +xmlrpc_client_call_server(xmlrpc_env * const envP, + const xmlrpc_server_info * const server, + const char * const method_name, + const char * const format, + ...); + +xmlrpc_value * +xmlrpc_client_call_server_params( + xmlrpc_env * const envP, + const xmlrpc_server_info * const serverP, + const char * const method_name, + xmlrpc_value * const paramArrayP); + +void +xmlrpc_client_transport_call( + xmlrpc_env * const envP, + void * const reserved, /* for client handle */ + const xmlrpc_server_info * const serverP, + xmlrpc_mem_block * const callXmlP, + xmlrpc_mem_block ** const respXmlPP); + + +/*========================================================================= +** xmlrpc_client_call_asynch +**========================================================================= +** An asynchronous XML-RPC client. +*/ + +/* Make an asynchronous XML-RPC call. We make internal copies of all +** arguments except user_data, so you can deallocate them safely as soon +** as you return. Errors will be passed to the callback. You will need +** to run the event loop somehow; see below. +** WARNING: If an error occurs while building the argument, the +** response handler will be called with a NULL param_array. */ +void +xmlrpc_client_call_asynch(const char * const server_url, + const char * const method_name, + xmlrpc_response_handler callback, + void * const user_data, + const char * const format, + ...); + +/* As above, but use an xmlrpc_server_info object. The server object can be +** safely destroyed as soon as this function returns. */ +void +xmlrpc_client_call_server_asynch(xmlrpc_server_info * const server, + const char * const method_name, + xmlrpc_response_handler callback, + void * const user_data, + const char * const format, + ...); + +/* As above, but the parameter list is supplied as an xmlrpc_value +** containing an array. +*/ +void +xmlrpc_client_call_asynch_params(const char * const server_url, + const char * const method_name, + xmlrpc_response_handler callback, + void * const user_data, + xmlrpc_value * const paramArrayP); + +/* As above, but use an xmlrpc_server_info object. The server object can be +** safely destroyed as soon as this function returns. */ +void +xmlrpc_client_call_server_asynch_params( + xmlrpc_server_info * const server, + const char * const method_name, + xmlrpc_response_handler callback, + void * const user_data, + xmlrpc_value * const paramArrayP); + +/*========================================================================= +** Event Loop Interface +**========================================================================= +** These functions can be used to run the XML-RPC event loop. If you +** don't like these, you can also run the libwww event loop directly. +*/ + +/* Finish all outstanding asynchronous calls. Alternatively, the loop +** will exit if someone calls xmlrpc_client_event_loop_end. */ +extern void +xmlrpc_client_event_loop_finish_asynch(void); + + +/* Finish all outstanding asynchronous calls. */ +extern void +xmlrpc_client_event_loop_finish_asynch_timeout(unsigned long const milliseconds); + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/client_simple.hpp b/vendor/voclient/include/xmlrpc-c/client_simple.hpp new file mode 100644 index 00000000..52e6c2b6 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/client_simple.hpp @@ -0,0 +1,44 @@ +#ifndef CLIENT_SIMPLE_HPP_INCLUDED +#define CLIENT_SIMPLE_HPP_INCLUDED + +#include <string> + +#include <xmlrpc-c/base.hpp> +#include <xmlrpc-c/client.hpp> + +namespace xmlrpc_c { + + +class clientSimple { + +public: + clientSimple(); + + void + call(std::string const serverUrl, + std::string const methodName, + xmlrpc_c::value * const resultP); + + void + call(std::string const serverUrl, + std::string const methodName, + std::string const format, + xmlrpc_c::value * const resultP, + ...); + + void + call(std::string const serverUrl, + std::string const methodName, + xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const resultP); + +private: + xmlrpc_c::clientPtr clientP; +}; + +} // namespace +#endif + + + + diff --git a/vendor/voclient/include/xmlrpc-c/client_transport.hpp b/vendor/voclient/include/xmlrpc-c/client_transport.hpp new file mode 100644 index 00000000..8d6053d5 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/client_transport.hpp @@ -0,0 +1,448 @@ +#ifndef CLIENT_TRANSPORT_HPP_INCLUDED +#define CLIENT_TRANSPORT_HPP_INCLUDED + +#include <string> +#include <vector> +#include <xmlrpc-c/util.h> +#include <xmlrpc-c/client.h> +#include <xmlrpc-c/girerr.hpp> +#include <xmlrpc-c/girmem.hpp> +#include <xmlrpc-c/timeout.hpp> + +namespace xmlrpc_c { + +class carriageParmPtr; + +class carriageParm : public girmem::autoObject { +/*---------------------------------------------------------------------------- + The parameter to a client for an individual RPC. It tells specifics + of how to carry the call to the server and the response back. For + example, it may identify the server. It may identify communication + protocols to use. It may indicate permission and accounting + information. + + This is a base class; the carriage parameter is specific to the + class of client. For example, an HTTP-based client would have a + URL and HTTP basic authentication info as parameter. +-----------------------------------------------------------------------------*/ +protected: + virtual ~carriageParm(); + carriageParm(); +}; + +class carriageParmPtr : public girmem::autoObjectPtr { + +public: + carriageParmPtr(); + + explicit carriageParmPtr(xmlrpc_c::carriageParm * const carriageParmP); + + xmlrpc_c::carriageParm * + operator->() const; + + xmlrpc_c::carriageParm * + get() const; +}; + +//---------------------------------------------------------------------------- + +class xmlTransactionPtr; + +class xmlTransaction : public girmem::autoObject { + + friend class xmlTransactionPtr; + +public: + virtual void + finish(std::string const& responseXml) const; + + virtual void + finishErr(girerr::error const& error) const; + +protected: + xmlTransaction(); +}; + +class xmlTransactionPtr : public girmem::autoObjectPtr { +public: + xmlTransactionPtr(); + + xmlTransactionPtr(xmlTransaction * xmlTransP); + + xmlrpc_c::xmlTransaction * + operator->() const; +}; + +//---------------------------------------------------------------------------- + +class clientXmlTransport : public girmem::autoObject { +/*---------------------------------------------------------------------------- + An object which transports XML to and from an XML-RPC server for an + XML-RPC client. + + This is a base class. Derived classes define methods to perform the + transportation in particular ways. +-----------------------------------------------------------------------------*/ +public: + virtual ~clientXmlTransport(); + + virtual void + call(xmlrpc_c::carriageParm * const carriageParmP, + std::string const& callXml, + std::string * const responseXmlP) = 0; + + virtual void + start(xmlrpc_c::carriageParm * const carriageParmP, + std::string const& callXml, + xmlrpc_c::xmlTransactionPtr const& xmlTranP); + + virtual void + finishAsync(xmlrpc_c::timeout const timeout); + + static void + asyncComplete( + struct xmlrpc_call_info * const callInfoP, + xmlrpc_mem_block * const responseXmlMP, + xmlrpc_env const transportEnv); + + virtual void + setInterrupt(int * const interruptP); +}; + +class clientXmlTransportPtr : public girmem::autoObjectPtr { + +public: + clientXmlTransportPtr(); + + clientXmlTransportPtr(xmlrpc_c::clientXmlTransport * const transportP); + + xmlrpc_c::clientXmlTransport * + operator->() const; + + xmlrpc_c::clientXmlTransport * + get() const; +}; + +/*=========================================================================== + HTTP +===========================================================================*/ + +class carriageParm_http0 : public xmlrpc_c::carriageParm { + +public: + carriageParm_http0(std::string const serverUrl); + + ~carriageParm_http0(); + + void + setUser(std::string const userid, + std::string const password); + + void + allowAuthBasic(); + + void + disallowAuthBasic(); + + void + allowAuthDigest(); + + void + disallowAuthDigest(); + + void + allowAuthNegotiate(); + + void + disallowAuthNegotiate(); + + void + allowAuthNtlm(); + + void + disallowAuthNtlm(); + + void + setBasicAuth(std::string const userid, + std::string const password); + + xmlrpc_server_info * c_serverInfoP; + +protected: + // Only a derived class is allowed to create an object with no + // server URL, and the derived class is expected to follow it up + // with an instantiate() to establish the server URL. + + carriageParm_http0(); + + void + instantiate(std::string const serverUrl); +}; + +class carriageParm_http0Ptr : public xmlrpc_c::carriageParmPtr { + +public: + carriageParm_http0Ptr(); + carriageParm_http0Ptr(xmlrpc_c::carriageParm_http0 * const carriageParmP); + + xmlrpc_c::carriageParm_http0 * + operator->() const; +}; + +class clientXmlTransport_http : public xmlrpc_c::clientXmlTransport { +/*---------------------------------------------------------------------------- + A base class for client XML transports that use the simple, classic + C HTTP transports. +-----------------------------------------------------------------------------*/ +public: + virtual ~clientXmlTransport_http(); + + void + call(xmlrpc_c::carriageParm * const carriageParmP, + std::string const& callXml, + std::string * const responseXmlP); + + void + start(xmlrpc_c::carriageParm * const carriageParmP, + std::string const& callXml, + xmlrpc_c::xmlTransactionPtr const& xmlTranP); + + virtual void + finishAsync(xmlrpc_c::timeout const timeout); + + virtual void + setInterrupt(int * const interruptP); + + static std::vector<std::string> + availableTypes(); + + static clientXmlTransportPtr + create(); + +protected: + clientXmlTransport_http() {} // ensure no one can create + struct xmlrpc_client_transport * c_transportP; + const struct xmlrpc_client_transport_ops * c_transportOpsP; +}; + + +/*=========================================================================== + curl +===========================================================================*/ + +class carriageParm_curl0 : public xmlrpc_c::carriageParm_http0 { + +public: + carriageParm_curl0(std::string const serverUrl); +}; + +class carriageParm_curl0Ptr : public xmlrpc_c::carriageParm_http0Ptr { + +public: + carriageParm_curl0Ptr(); + carriageParm_curl0Ptr(xmlrpc_c::carriageParm_curl0 * const carriageParmP); + + xmlrpc_c::carriageParm_curl0 * + operator->() const; +}; + +class clientXmlTransport_curl : public xmlrpc_c::clientXmlTransport_http { + +public: + class constrOpt { + public: + constrOpt(); + + constrOpt & network_interface (std::string const& arg); + constrOpt & no_ssl_verifypeer (bool const& arg); + constrOpt & no_ssl_verifyhost (bool const& arg); + constrOpt & user_agent (std::string const& arg); + constrOpt & ssl_cert (std::string const& arg); + constrOpt & sslcerttype (std::string const& arg); + constrOpt & sslcertpasswd (std::string const& arg); + constrOpt & sslkey (std::string const& arg); + constrOpt & sslkeytype (std::string const& arg); + constrOpt & sslkeypasswd (std::string const& arg); + constrOpt & sslengine (std::string const& arg); + constrOpt & sslengine_default (bool const& arg); + constrOpt & sslversion (xmlrpc_sslversion const& arg); + constrOpt & cainfo (std::string const& arg); + constrOpt & capath (std::string const& arg); + constrOpt & randomfile (std::string const& arg); + constrOpt & egdsocket (std::string const& arg); + constrOpt & ssl_cipher_list (std::string const& arg); + constrOpt & timeout (unsigned int const& arg); + + struct { + std::string network_interface; + bool no_ssl_verifypeer; + bool no_ssl_verifyhost; + std::string user_agent; + std::string ssl_cert; + std::string sslcerttype; + std::string sslcertpasswd; + std::string sslkey; + std::string sslkeytype; + std::string sslkeypasswd; + std::string sslengine; + bool sslengine_default; + xmlrpc_sslversion sslversion; + std::string cainfo; + std::string capath; + std::string randomfile; + std::string egdsocket; + std::string ssl_cipher_list; + unsigned int timeout; + } value; + struct { + bool network_interface; + bool no_ssl_verifypeer; + bool no_ssl_verifyhost; + bool user_agent; + bool ssl_cert; + bool sslcerttype; + bool sslcertpasswd; + bool sslkey; + bool sslkeytype; + bool sslkeypasswd; + bool sslengine; + bool sslengine_default; + bool sslversion; + bool cainfo; + bool capath; + bool randomfile; + bool egdsocket; + bool ssl_cipher_list; + bool timeout; + } present; + }; + + clientXmlTransport_curl(constrOpt const& opt); + + clientXmlTransport_curl(std::string const networkInterface = "", + bool const noSslVerifyPeer = false, + bool const noSslVerifyHost = false, + std::string const userAgent = ""); + + ~clientXmlTransport_curl(); + +private: + void + initialize(constrOpt const& opt); +}; + +/*=========================================================================== + libwww +===========================================================================*/ + +class carriageParm_libwww0 : public xmlrpc_c::carriageParm_http0 { + +public: + carriageParm_libwww0(std::string const serverUrl); + +}; + +class carriageParm_libwww0Ptr : public xmlrpc_c::carriageParm_http0Ptr { + +public: + carriageParm_libwww0Ptr(); + carriageParm_libwww0Ptr(xmlrpc_c::carriageParm_libwww0 * const); + + xmlrpc_c::carriageParm_libwww0 * + operator->() const; +}; + +class clientXmlTransport_libwww : public xmlrpc_c::clientXmlTransport_http { + +public: + clientXmlTransport_libwww(std::string const appname = "", + std::string const appversion = ""); + + ~clientXmlTransport_libwww(); +}; + +/*=========================================================================== + wininet +===========================================================================*/ + +class carriageParm_wininet0 : public xmlrpc_c::carriageParm_http0 { + +public: + carriageParm_wininet0(std::string const serverUrl); + +}; + +class carriageParm_wininet0Ptr : public xmlrpc_c::carriageParm_http0Ptr { + +public: + carriageParm_wininet0Ptr(); + carriageParm_wininet0Ptr(xmlrpc_c::carriageParm_wininet0 * const); + + xmlrpc_c::carriageParm_wininet0 * + operator->() const; +}; + +class clientXmlTransport_wininet : public xmlrpc_c::clientXmlTransport_http { + +public: + clientXmlTransport_wininet(bool const allowInvalidSslCerts = false); + + ~clientXmlTransport_wininet(); +}; + +/*=========================================================================== + pstream +===========================================================================*/ + +class packetSocket; + +class carriageParm_pstream : public xmlrpc_c::carriageParm { + + // There are no parameters for carrying an RPC on a packet stream. + // There's only one way to carry it. +}; + +class carriageParm_pstreamPtr : public xmlrpc_c::carriageParmPtr { + +public: + carriageParm_pstreamPtr(); + carriageParm_pstreamPtr( + xmlrpc_c::carriageParm_pstream * const carriageParmP); + + xmlrpc_c::carriageParm_pstream * + operator->() const; +}; + +class clientXmlTransport_pstream : public xmlrpc_c::clientXmlTransport { + +public: + class constrOpt { + public: + constrOpt(); + + constrOpt & fd (int const& arg); + + struct { + int fd; + } value; + struct { + bool fd; + } present; + }; + + clientXmlTransport_pstream(constrOpt const& opt); + + ~clientXmlTransport_pstream(); + + void + call(xmlrpc_c::carriageParm * const carriageParmP, + std::string const& callXml, + std::string * const responseXmlP); + +private: + packetSocket * packetSocketP; +}; + + +} // namespace +#endif diff --git a/vendor/voclient/include/xmlrpc-c/config.h b/vendor/voclient/include/xmlrpc-c/config.h new file mode 100644 index 00000000..1c1b6b65 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/config.h @@ -0,0 +1,37 @@ +#ifndef XMLRPC_C_CONFIG_H_INCLUDED +#define XMLRPC_C_CONFIG_H_INCLUDED + +/* This file, part of XML-RPC For C/C++, is meant to + define characteristics of this particular installation + that the other <xmlrpc-c/...> header files need in + order to compile correctly when #included in Xmlrpc-c + user code. + + Those header files #include this one. + + This file was created by a make rule. +*/ +#define XMLRPC_HAVE_WCHAR 1 +#ifdef WIN32 + /* SOCKET is a type defined by <winsock.h>. Anyone who + uses XMLRPC_SOCKET on a WIN32 system must #include + <winsock.h> + */ + #define XMLRPC_SOCKET SOCKET + #define XMLRPC_HAVE_TIMEVAL 0 + #define XMLRPC_HAVE_TIMESPEC 0 +#else + #define XMLRPC_SOCKET int + #define XMLRPC_HAVE_TIMEVAL 1 + #define XMLRPC_HAVE_TIMESPEC 1 +#endif + +#if defined(_MSC_VER) + /* Newer MSVC has long long, but MSVC 6 does not */ + #define XMLRPC_INT64 __int64 + #define XMLRPC_INT32 __int32 +#else + #define XMLRPC_INT64 long long + #define XMLRPC_INT32 int +#endif +#endif diff --git a/vendor/voclient/include/xmlrpc-c/girerr.hpp b/vendor/voclient/include/xmlrpc-c/girerr.hpp new file mode 100644 index 00000000..1008722c --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/girerr.hpp @@ -0,0 +1,31 @@ +#ifndef GIRERR_HPP_INCLUDED +#define GIRERR_HPP_INCLUDED + +#include <string> +#include <exception> + +#define HAVE_GIRERR_ERROR + +namespace girerr { + +class error : public std::exception { +public: + error(std::string const& what_arg) : _what(what_arg) {} + + ~error() throw() {} + + virtual const char * + what() const throw() { return this->_what.c_str(); }; + +private: + std::string _what; +}; + +// throwf() always throws a girerr::error . + +void +throwf(const char * const format, ...); + +} // namespace + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/girmem.hpp b/vendor/voclient/include/xmlrpc-c/girmem.hpp new file mode 100644 index 00000000..2eed4084 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/girmem.hpp @@ -0,0 +1,75 @@ +#ifndef GIRMEM_HPP_INCLUDED +#define GIRMEM_HPP_INCLUDED + + +/* The following pthread crap mirrors what is in pthreadx.h, which is + what girmem.cpp uses to declare the lock interface. We can't simply + include pthreadx.h here, because it's an internal Xmlrpc-c header file, + and this is an external one. + + This is a stopgap measure until we do something cleaner, such as expose + pthreadx.h as an external interface (class girlock, maybe?) or create + a lock class with virtual methods. + + The problem we're solving is that class autoObject contains + a pthread_mutex_t member, and on Windows, there's no such type. +*/ + +#ifndef WIN32 +# include <pthread.h> + typedef pthread_mutex_t girmem_lock; +#else +# include <windows.h> + typedef CRITICAL_SECTION girmem_lock; +#endif + +namespace girmem { + +class autoObjectPtr; + +class autoObject { + friend class autoObjectPtr; + +public: + void incref(); + void decref(bool * const unreferencedP); + +protected: + autoObject(); + virtual ~autoObject(); + +private: + girmem_lock refcountLock; + unsigned int refcount; +}; + +class autoObjectPtr { +public: + autoObjectPtr(); + autoObjectPtr(girmem::autoObject * objectP); + autoObjectPtr(girmem::autoObjectPtr const& autoObjectPtr); + + ~autoObjectPtr(); + + void + point(girmem::autoObject * const objectP); + + void + unpoint(); + + autoObjectPtr + operator=(girmem::autoObjectPtr const& objectPtr); + + girmem::autoObject * + operator->() const; + + girmem::autoObject * + get() const; + +protected: + girmem::autoObject * objectP; +}; + +} // namespace + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/inttypes.h b/vendor/voclient/include/xmlrpc-c/inttypes.h new file mode 100644 index 00000000..fe1feb53 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/inttypes.h @@ -0,0 +1,19 @@ +#ifndef XMLRPC_INTTYPES_H_INCLUDED +#define XMLRPC_INTTYPES_H_INCLUDED + +#ifdef _MSC_VER + +typedef unsigned short xmlrpc_uint16_t; +typedef unsigned int xmlrpc_uint32_t; +typedef unsigned __int64 xmlrpc_uint64_t; + +#else +#include <inttypes.h> + +typedef uint16_t xmlrpc_uint16_t; +typedef uint32_t xmlrpc_uint32_t; +typedef uint64_t xmlrpc_uint64_t; + +#endif + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/oldcppwrapper.hpp b/vendor/voclient/include/xmlrpc-c/oldcppwrapper.hpp new file mode 100644 index 00000000..78a9c514 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/oldcppwrapper.hpp @@ -0,0 +1,419 @@ +// -*- C++ -*- <-- an Emacs control + +// Copyright information is at the bottom of the file. + +//========================================================================= +// XML-RPC C++ API +//========================================================================= + + +#ifndef XMLRPCCPP_H_INCLUDED +#define XMLRPCCPP_H_INCLUDED + +// There used to be a "using namespace std" here and some confusing old +// comments about it having something to do with what header file you +// include to get string functions. +// +// "using namespace std" was under "#if defined(__GNUC__) && (__GNUC__ >= 3)" +// until December 2003, and then unconditional until Release 1.1 (March 2005). +// Older GNU Compilers apparently imply namespace std, so they don't need it. +// +// But "using namespace std" is a bad idea. This is an interface header +// file, and we don't want to suck all of namespace std into the user's +// namespace just because he's using Xmlrpc-c. So we took it out. +// We refer to std names like std::string. +// -Bryan 2005.03.12. + + +#include <cstdlib> +#include <string> +#include <xmlrpc-c/base.h> +#include <xmlrpc-c/client.h> +#include <xmlrpc-c/server.h> + + +//========================================================================= +// XmlRpcFault +//========================================================================= +// A C++ exception class representing an XML-RPC fault. + +class XmlRpcFault { + +private: + xmlrpc_env mFault; + + XmlRpcFault& operator= (XmlRpcFault const& f) + { if (true || f.getFaultCode()) abort(); return (XmlRpcFault&) f; } + +public: + XmlRpcFault (const XmlRpcFault &fault); + XmlRpcFault (const int faultCode, const std::string faultString); + XmlRpcFault (const xmlrpc_env *env); + ~XmlRpcFault (void); + + int getFaultCode (void) const; + std::string getFaultString (void) const; + xmlrpc_env *getFaultEnv (void); +}; + +inline int XmlRpcFault::getFaultCode (void) const { + return mFault.fault_code; +} + +inline xmlrpc_env *XmlRpcFault::getFaultEnv (void) { + return &mFault; +} + + +//========================================================================= +// XmlRpcEnv +//========================================================================= +// This class can be used to wrap xmlrpc_env object. Use it as follows: +// +// XmlRpcEnv env; +// xmlrpc_parse_value(env, v, "(i)", &i); +// env.throwIfFaultOccurred(); + +class XmlRpcEnv { + +private: + xmlrpc_env mEnv; + + void throwMe (void) const; + XmlRpcEnv& operator= (XmlRpcEnv const& e) + { if (true || e.faultOccurred()) abort(); return (XmlRpcEnv&) e;} + +public: + XmlRpcEnv (const XmlRpcEnv &env); + XmlRpcEnv (void) { xmlrpc_env_init(&mEnv); } + ~XmlRpcEnv (void) { xmlrpc_env_clean(&mEnv); } + + bool faultOccurred (void) const {return (mEnv.fault_occurred != 0);}; + bool hasFaultOccurred (void) const { return faultOccurred(); }; + /* hasFaultOccurred() is for backward compatibility. + faultOccurred() is a superior name for this. + */ + std::string getFaultString() const { return mEnv.fault_string; }; + XmlRpcFault getFault (void) const; + + void throwIfFaultOccurred (void) const; + + operator xmlrpc_env * (void) { return &mEnv; } +}; + +inline void XmlRpcEnv::throwIfFaultOccurred (void) const { + if (faultOccurred()) + throwMe(); +} + + +//========================================================================= +// XmlRpcValue +//========================================================================= +// An object in this class is an XML-RPC value. +// +// We have a complex structure to allow C code mixed in with C++ code +// which uses this class to refer to the same XML-RPC value object. +// This is especially important because there aren't proper C++ facilities +// for much of Xmlrpc-c; you have to use the C facilities even if you'd +// rather use proper C++. +// +// The XmlRpcValue object internally represents the value as an +// xmlrpc_value. It holds one reference to the xmlrpc_value. Users +// of XmlRpcValue never see that xmlrpc_value, but C code can. the +// C code might create the xmlrpc_value and then bind it to an XmlRpcValue, +// or it might get the xmlrpc_value handle from the XmlRpcValue. Finally, +// C code can simply use the XmlRpcValue where an xmlrpc_value handle is +// required and it gets converted automatically. +// +// So reference counting for the xmlrpc_value is quite a nightmare. + +class XmlRpcValue { + +private: + xmlrpc_value *mValue; + +public: + enum ReferenceBehavior { + MAKE_REFERENCE, + CONSUME_REFERENCE + }; + + typedef xmlrpc_int32 int32; + + XmlRpcValue (void); + XmlRpcValue (xmlrpc_value *value, + ReferenceBehavior behavior = MAKE_REFERENCE); + XmlRpcValue (const XmlRpcValue& value); + ~XmlRpcValue (void); + + XmlRpcValue& operator= (const XmlRpcValue& value); + + // Accessing the value's type (think of this as lightweight RTTI). + xmlrpc_type getType(void) const; + + // We don't supply an automatic conversion operator--you need to say + // whether you want to make or borrow this object's reference. + // XXX - Is it really OK for these to be const? + xmlrpc_value *makeReference (void) const; + xmlrpc_value *borrowReference (void) const; + + // Some static "constructor" functions. + static XmlRpcValue makeInt (const XmlRpcValue::int32 i); + static XmlRpcValue makeBool (const bool b); + static XmlRpcValue makeDouble (const double d); + static XmlRpcValue makeDateTime (const std::string& dateTime); + static XmlRpcValue makeString (const std::string& str); + static XmlRpcValue makeString (const char *const str); + static XmlRpcValue makeString (const char *const str, size_t len); + static XmlRpcValue makeArray (void); + static XmlRpcValue makeStruct (void); + static XmlRpcValue makeBase64 (const unsigned char *const data, + size_t len); + /* + // An interface to xmlrpc_build_value. + static XmlRpcValue buildValue (const char *const format, ...); + */ + + // Some functions to get the underlying data. + // These will throw an XmlRpcFault if the data is the wrong type. + XmlRpcValue::int32 getInt (void) const; + bool getBool (void) const; + double getDouble (void) const; + std::string getRawDateTime (void) const; + std::string getString (void) const; + XmlRpcValue getArray (void) const; + XmlRpcValue getStruct (void) const; + + // This returns an internal pointer which will become invalid when + // all references to the underlying value are destroyed. + void getBase64 (const unsigned char *& out_data, + size_t& out_len) const; + + /* + // An interface to xmlrpc_parse_value. + void parseValue (const char *const format, ...); + */ + + // Array functions. These will throw an XmlRpcFault if the value + // isn't an array. + size_t arraySize (void) const; + void arrayAppendItem (const XmlRpcValue& value); + XmlRpcValue arrayGetItem (int index) const; + + // Struct functions. These will throw an XmlRpcFault if the value + // isn't a struct. + size_t structSize (void) const; + bool structHasKey (const std::string& key) const; + XmlRpcValue structGetValue (const std::string& key) const; + void structSetValue (const std::string& key, + const XmlRpcValue& value); + void structGetKeyAndValue (const int index, + std::string& out_key, + XmlRpcValue& out_value) const; +}; + +inline XmlRpcValue::XmlRpcValue (xmlrpc_value *value, + ReferenceBehavior behavior) +{ + mValue = value; + + if (behavior == MAKE_REFERENCE) + xmlrpc_INCREF(value); +} + +inline XmlRpcValue::XmlRpcValue (const XmlRpcValue& value) { + mValue = value.mValue; + xmlrpc_INCREF(mValue); +} + +inline XmlRpcValue::~XmlRpcValue (void) { + xmlrpc_DECREF(mValue); +} + +inline XmlRpcValue& XmlRpcValue::operator= (const XmlRpcValue& value) { + // Must increment before we decrement, in case of assignment to self. + xmlrpc_INCREF(value.mValue); + xmlrpc_DECREF(mValue); + mValue = value.mValue; + return *this; +} + +inline xmlrpc_type XmlRpcValue::getType (void) const { + return xmlrpc_value_type(mValue); +} + +inline xmlrpc_value *XmlRpcValue::makeReference (void) const { + xmlrpc_INCREF(mValue); + return mValue; +} + +inline xmlrpc_value *XmlRpcValue::borrowReference (void) const { + return mValue; +} + + +//========================================================================= +// XmlRpcClient +//========================================================================= + +class XmlRpcClient { + +private: + std::string mServerUrl; + +public: + static void Initialize (std::string appname, std::string appversion); + static void Terminate (void); + + XmlRpcClient (const std::string& server_url) : mServerUrl(server_url) {} + ~XmlRpcClient (void) {} + + XmlRpcClient (const XmlRpcClient& client); + XmlRpcClient& operator= (const XmlRpcClient& client); + + XmlRpcValue call (std::string method_name, XmlRpcValue param_array); + void call_asynch (std::string method_name, + XmlRpcValue param_array, + xmlrpc_response_handler callback, + void* user_data); + void event_loop_asynch (unsigned long milliseconds); +}; + +inline void XmlRpcClient::call_asynch(std::string method_name, + XmlRpcValue param_array, + xmlrpc_response_handler callback, + void* user_data) +{ + xmlrpc_client_call_asynch_params( + mServerUrl.c_str(), + method_name.c_str(), + callback, + user_data, + param_array.borrowReference()); +} + +inline void XmlRpcClient::event_loop_asynch(unsigned long milliseconds) +{ + xmlrpc_client_event_loop_finish_asynch_timeout(milliseconds); +} + + +//========================================================================= +// XmlRpcClient Methods +//========================================================================= +// These are inline for now, so we don't need to screw with linker issues +// and build a separate client library. + +inline XmlRpcClient::XmlRpcClient (const XmlRpcClient& client) + : mServerUrl(client.mServerUrl) +{ +} + +inline XmlRpcClient& XmlRpcClient::operator= (const XmlRpcClient& client) { + if (this != &client) + mServerUrl = client.mServerUrl; + return *this; +} + +inline void XmlRpcClient::Initialize (std::string appname, + std::string appversion) { + xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, + appname.c_str(), + appversion.c_str()); +} + +inline void XmlRpcClient::Terminate (void) { + xmlrpc_client_cleanup(); +} + +inline XmlRpcValue XmlRpcClient::call (std::string method_name, + XmlRpcValue param_array) +{ + XmlRpcEnv env; + xmlrpc_value *result = + xmlrpc_client_call_params(env, + mServerUrl.c_str(), + method_name.c_str(), + param_array.borrowReference()); + env.throwIfFaultOccurred(); + return XmlRpcValue(result, XmlRpcValue::CONSUME_REFERENCE); +} + +//========================================================================= +// XmlRpcGenSrv +//========================================================================= + +class XmlRpcGenSrv { + +private: + + xmlrpc_registry* mRegistry; + + xmlrpc_mem_block* alloc (XmlRpcEnv& env, const std::string& body) const; + +public: + + XmlRpcGenSrv (int flags); + ~XmlRpcGenSrv (void); + + xmlrpc_registry* getRegistry (void) const; + + XmlRpcGenSrv& addMethod (const std::string& name, + xmlrpc_method method, + void *data); + XmlRpcGenSrv& addMethod (const std::string& name, + xmlrpc_method method, + void* data, + const std::string& signature, + const std::string& help); + + std::string handle (const std::string& body) const; +}; + +inline XmlRpcGenSrv::XmlRpcGenSrv (int) { + + XmlRpcEnv env; + + mRegistry = xmlrpc_registry_new (env); + env.throwIfFaultOccurred(); +} + +inline XmlRpcGenSrv::~XmlRpcGenSrv (void) { + + xmlrpc_registry_free (mRegistry); +} + +inline xmlrpc_registry* XmlRpcGenSrv::getRegistry () const { + + return mRegistry; +} + + +// Copyright (C) 2001 by Eric Kidd. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. + + +#endif /* _XMLRPCCPP_H_ */ diff --git a/vendor/voclient/include/xmlrpc-c/oldxmlrpc.h b/vendor/voclient/include/xmlrpc-c/oldxmlrpc.h new file mode 100644 index 00000000..2a5d3bf4 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/oldxmlrpc.h @@ -0,0 +1,2 @@ +#include <xmlrpc-c/base.h> +#include <xmlrpc-c/server.h> diff --git a/vendor/voclient/include/xmlrpc-c/packetsocket.hpp b/vendor/voclient/include/xmlrpc-c/packetsocket.hpp new file mode 100644 index 00000000..64b72215 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/packetsocket.hpp @@ -0,0 +1,165 @@ +#ifndef PACKETSOCKET_HPP_INCLUDED +#define PACKETSOCKET_HPP_INCLUDED + +/*============================================================================ + packetsocket +============================================================================== + This is a facility for communicating socket-style, with defined + packets like a datagram socket but with reliable delivery like a + stream socket. It's like a POSIX "sequential packet" socket, except + it is built on top of a stream socket, so it is usable on the many + systems that have stream sockets but not sequential packet sockets. +============================================================================*/ + +#include <sys/types.h> +#include <string> +#include <queue> + +#include <xmlrpc-c/girmem.hpp> + +namespace xmlrpc_c { + +class packet : public girmem::autoObject { + +public: + packet(); + + packet(const unsigned char * const data, + size_t const dataLength); + + packet(const char * const data, + size_t const dataLength); + + ~packet(); + + unsigned char * + getBytes() const { return this->bytes; } + + size_t + getLength() const { return this->length; } + + void + addData(const unsigned char * const data, + size_t const dataLength); + +private: + unsigned char * bytes; // malloc'ed + size_t length; + size_t allocSize; + + void + initialize(const unsigned char * const data, + size_t const dataLength); +}; + + + +class packetPtr: public girmem::autoObjectPtr { + +public: + packetPtr(); + + explicit packetPtr(packet * const packetP); + + packet * + operator->() const; +}; + + + +class packetSocket { +/*---------------------------------------------------------------------------- + This is an Internet communication vehicle that transmits individual + variable-length packets of text. + + It is based on a stream socket. + + It would be much better to use a kernel SOCK_SEQPACKET socket, but + Linux 2.4 does not have them. +-----------------------------------------------------------------------------*/ +public: + packetSocket(int sockFd); + + ~packetSocket(); + + void + writeWait(packetPtr const& packetPtr) const; + + void + read(bool * const eofP, + bool * const gotPacketP, + packetPtr * const packetPP); + + void + readWait(volatile const int * const interruptP, + bool * const eofP, + bool * const gotPacketP, + packetPtr * const packetPP); + + void + readWait(volatile const int * const interruptP, + bool * const eofP, + packetPtr * const packetPP); + + void + readWait(bool * const eofP, + packetPtr * const packetPP); + +private: + int sockFd; + // The kernel stream socket we use. + bool eof; + // The packet socket is at end-of-file for reads. + // 'readBuffer' is empty and there won't be any more data to fill + // it because the underlying stream socket is closed. + std::queue<packetPtr> readBuffer; + packetPtr packetAccumP; + // The receive packet we're currently accumulating; it will join + // 'readBuffer' when we've received the whole packet (and we've + // seen the END escape sequence so we know we've received it all). + // If we're not currently accumulating a packet (haven't seen a + // PKT escape sequence), this points to nothing. + bool inEscapeSeq; + // In our trek through the data read from the underlying stream + // socket, we are after an ESC character and before the end of the + // escape sequence. 'escAccum' shows what of the escape sequence + // we've seen so far. + bool inPacket; + // We're now receiving packet data from the underlying stream + // socket. We've seen a complete PKT escape sequence, but have not + // seen a complete END escape sequence since. + struct { + unsigned char bytes[3]; + size_t len; + } escAccum; + + void + bufferFinishedPacket(); + + void + takeSomeEscapeSeq(const unsigned char * const buffer, + size_t const length, + size_t * const bytesTakenP); + + void + takeSomePacket(const unsigned char * const buffer, + size_t const length, + size_t * const bytesTakenP); + + void + verifyNothingAccumulated(); + + void + processBytesRead(const unsigned char * const buffer, + size_t const bytesRead); + + void + readFromFile(); + +}; + + + +} // namespace + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/registry.hpp b/vendor/voclient/include/xmlrpc-c/registry.hpp new file mode 100644 index 00000000..1182b864 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/registry.hpp @@ -0,0 +1,189 @@ +#ifndef REGISTRY_HPP_INCLUDED +#define REGISTRY_HPP_INCLUDED + +#include <string> +#include <vector> +#include <list> + +#include <xmlrpc-c/server.h> +#include <xmlrpc-c/girmem.hpp> +#include <xmlrpc-c/base.hpp> + +namespace xmlrpc_c { + + +class method : public girmem::autoObject { +/*---------------------------------------------------------------------------- + An XML-RPC method. + + This base class is abstract. You can't create an object in it. + Define a useful method with this as a base class, with an + execute() method. +-----------------------------------------------------------------------------*/ +public: + method(); + + virtual ~method(); + + virtual void + execute(xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const resultP) = 0; + + std::string signature() const { return _signature; }; + std::string help() const { return _help; }; + +protected: + std::string _signature; + std::string _help; +}; + +/* Example of a specific method class: + + class sample_add : public xmlrpc_c::method { + public: + sample_add() { + this->_signature = "ii"; + this->_help = "This method adds two integers together"; + } + void + execute(xmlrpc_c::param_list const paramList, + const xmlrpc_c::value * const retvalP) { + + int const addend(paramList.getInt(0)); + int const adder(paramList.getInt(1)); + + *retvalP = xmlrpc_c::value(addend, adder); + } + }; + + + Example of creating such a method: + + methodPtr const sampleAddMethodP(new sample_add); + + You pass around, copy, etc. the handle sampleAddMethodP and when + the last copy of the handle is gone, the sample_add object itself + gets deleted. + +*/ + + +class methodPtr : public girmem::autoObjectPtr { + +public: + methodPtr(xmlrpc_c::method * const methodP); + + xmlrpc_c::method * + operator->() const; +}; + +class defaultMethod : public girmem::autoObject { + +public: + virtual ~defaultMethod(); + + virtual void + execute(std::string const& methodName, + xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const resultP) = 0; +}; + +class defaultMethodPtr : public girmem::autoObjectPtr { + +public: + defaultMethodPtr(); + + defaultMethodPtr(xmlrpc_c::defaultMethod * const methodP); + + xmlrpc_c::defaultMethod * + operator->() const; + + xmlrpc_c::defaultMethod * + get() const; +}; + + + +class registry : public girmem::autoObject { +/*---------------------------------------------------------------------------- + An Xmlrpc-c server method registry. An Xmlrpc-c server transport + (e.g. an HTTP server) uses this object to process an incoming + Xmlrpc-c call. +-----------------------------------------------------------------------------*/ + +public: + + registry(); + ~registry(); + + void + addMethod(std::string const name, + xmlrpc_c::methodPtr const methodP); + + void + setDefaultMethod(xmlrpc_c::defaultMethodPtr const methodP); + + void + disableIntrospection(); + + class shutdown { + public: + virtual ~shutdown() = 0; + virtual void + doit(std::string const& comment, + void * const callInfo) const = 0; + }; + + void + setShutdown(const shutdown * const shutdownP); + + void + setDialect(xmlrpc_dialect const dialect); + + void + processCall(std::string const& body, + std::string * const responseP) const; + + xmlrpc_registry * + c_registry() const; + /* This is meant to be private except to other objects in the + Xmlrpc-c library. + */ + +private: + + xmlrpc_registry * c_registryP; + // Pointer to the C registry object we use to implement this + // object. + + std::list<xmlrpc_c::methodPtr> methodList; + // This is a list of all the method objects (actually, pointers + // to them). But since the real registry is the C registry object, + // all this list is for is to maintain references to the objects + // to which the C registry points so that they continue to exist. + + xmlrpc_c::defaultMethodPtr defaultMethodP; + // The real identifier of the default method is the C registry + // object; this member exists only to maintain a reference to the + // object to which the C registry points so that it will continue + // to exist. +}; + + +class registryPtr : public girmem::autoObjectPtr { + +public: + registryPtr(); + + registryPtr(xmlrpc_c::registry * const registryP); + + xmlrpc_c::registry * + operator->() const; + + xmlrpc_c::registry * + get() const; +}; + +} // namespace + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/server.h b/vendor/voclient/include/xmlrpc-c/server.h new file mode 100644 index 00000000..28773c61 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/server.h @@ -0,0 +1,173 @@ +/* Copyright and license information is at the end of the file */ + +#ifndef XMLRPC_SERVER_H_INCLUDED +#define XMLRPC_SERVER_H_INCLUDED + +#include <xmlrpc-c/base.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct xmlrpc_registry xmlrpc_registry; + +typedef void +(*xmlrpc_preinvoke_method)(xmlrpc_env * const envP, + const char * const methodName, + xmlrpc_value * const paramArrayP, + void * const userData); + +typedef xmlrpc_value * +(*xmlrpc_method1)(xmlrpc_env * const envP, + xmlrpc_value * const paramArrayP, + void * const serverInfo); + +typedef xmlrpc_value * +(*xmlrpc_method2)(xmlrpc_env * const envP, + xmlrpc_value * const paramArrayP, + void * const serverInfo, + void * const callInfo); + +typedef xmlrpc_method1 xmlrpc_method; /* backward compatibility */ + +typedef xmlrpc_value * +(*xmlrpc_default_method)(xmlrpc_env * const envP, + const char * const callInfoP, + const char * const methodName, + xmlrpc_value * const paramArrayP, + void * const serverInfo); + +extern unsigned int const xmlrpc_server_version_major; +extern unsigned int const xmlrpc_server_version_minor; +extern unsigned int const xmlrpc_server_version_point; + +xmlrpc_registry * +xmlrpc_registry_new(xmlrpc_env * const envP); + +void +xmlrpc_registry_free(xmlrpc_registry * const registryP); + +void +xmlrpc_registry_disable_introspection(xmlrpc_registry * const registryP); + +void +xmlrpc_registry_add_method(xmlrpc_env * const envP, + xmlrpc_registry * const registryP, + const char * const host, + const char * const methodName, + xmlrpc_method const method, + void * const serverInfo); + +void +xmlrpc_registry_add_method_w_doc(xmlrpc_env * const envP, + xmlrpc_registry * const registryP, + const char * const host, + const char * const methodName, + xmlrpc_method const method, + void * const serverInfo, + const char * const signatureString, + const char * const help); + +void +xmlrpc_registry_add_method2(xmlrpc_env * const envP, + xmlrpc_registry * const registryP, + const char * const methodName, + xmlrpc_method2 method, + const char * const signatureString, + const char * const help, + void * const serverInfo); + +struct xmlrpc_method_info3 { + const char * methodName; + xmlrpc_method2 methodFunction; + void * serverInfo; + size_t stackSize; + const char * signatureString; + const char * help; +}; + +void +xmlrpc_registry_add_method3( + xmlrpc_env * const envP, + xmlrpc_registry * const registryP, + const struct xmlrpc_method_info3 * const infoP); + +void +xmlrpc_registry_set_default_method(xmlrpc_env * const envP, + xmlrpc_registry * const registryP, + xmlrpc_default_method const handler, + void * const userData); + +void +xmlrpc_registry_set_preinvoke_method(xmlrpc_env * const envP, + xmlrpc_registry * const registryP, + xmlrpc_preinvoke_method const method, + void * const userData); + + +typedef void xmlrpc_server_shutdown_fn(xmlrpc_env * const envP, + void * const context, + const char * const comment, + void * const callInfo); + +void +xmlrpc_registry_set_shutdown(xmlrpc_registry * const registryP, + xmlrpc_server_shutdown_fn * const shutdownFn, + void * const context); + +void +xmlrpc_registry_set_dialect(xmlrpc_env * const envP, + xmlrpc_registry * const registryP, + xmlrpc_dialect const dialect); + +/*---------------------------------------------------------------------------- + Lower interface -- services to be used by an HTTP request handler +-----------------------------------------------------------------------------*/ + +void +xmlrpc_registry_process_call2(xmlrpc_env * const envP, + xmlrpc_registry * const registryP, + const char * const xmlData, + size_t const xmlLen, + void * const callInfo, + xmlrpc_mem_block ** const outputPP); + +xmlrpc_mem_block * +xmlrpc_registry_process_call(xmlrpc_env * const envP, + xmlrpc_registry * const registryP, + const char * const host, + const char * const xmlData, + size_t const xmlLen); + +size_t +xmlrpc_registry_max_stackSize(xmlrpc_registry * const registryP); + +#ifdef __cplusplus +} +#endif + +/* Copyright (C) 2001 by First Peer, Inc. All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. */ +#endif diff --git a/vendor/voclient/include/xmlrpc-c/server_abyss.h b/vendor/voclient/include/xmlrpc-c/server_abyss.h new file mode 100644 index 00000000..975fa0ee --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/server_abyss.h @@ -0,0 +1,276 @@ +/*============================================================================ + server_abyss.h +============================================================================== + This declares the user interface to libxmlrpc_server_abyss, which + provides facilities for running an XML-RPC server based on the Xmlrpc-c + Abyss HTTP server. +============================================================================*/ + +/* Copyright and license information is at the end of the file */ + +#ifndef XMLRPC_SERVER_ABYSS_H_INCLUDED +#define XMLRPC_SERVER_ABYSS_H_INCLUDED + +#ifdef WIN32 +#include <winsock.h> /* For XMLRPC_SOCKET (= SOCKET) */ +#endif + +#include <xmlrpc-c/config.h> /* For XMLRPC_SOCKET */ +#include <xmlrpc-c/abyss.h> +#include <xmlrpc-c/server.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define XMLRPC_SERVER_ABYSS_NO_FLAGS (0) + + +/*========================================================================= +** Global Initialization/Termination. +** +** These are not thread-safe. You call them at the beginning and end +** of your program, when it is only one thread. +**=======================================================================*/ + +void +xmlrpc_server_abyss_global_init(xmlrpc_env * const envP); + +void +xmlrpc_server_abyss_global_term(void); + +/*========================================================================= +** Basic Abyss Server Functions +**=======================================================================*/ + +typedef void ((*runfirstFn)(void *)); + +typedef struct { + const char * config_file_name; + /* NULL to use preferred proper API-level interface */ + + xmlrpc_registry * registryP; + + /* runfirstFn and runfirst_arg are meaningless when + config_file_name is NULL + */ + runfirstFn runfirst; + void * runfirst_arg; + + unsigned int port_number; + const char * log_file_name; + unsigned int keepalive_timeout; + unsigned int keepalive_max_conn; + unsigned int timeout; + xmlrpc_bool dont_advertise; + xmlrpc_bool socket_bound; + XMLRPC_SOCKET socket_handle; + const char * uri_path; + xmlrpc_bool chunk_response; + xmlrpc_bool enable_shutdown; +} xmlrpc_server_abyss_parms; + + +#define XMLRPC_APSIZE(MBRNAME) \ + XMLRPC_STRUCTSIZE(xmlrpc_server_abyss_parms, MBRNAME) + +/* XMLRPC_APSIZE(xyz) is the minimum size a struct xmlrpc_server_abyss_parms + must be to include the 'xyz' member. This is essential to forward and + backward compatibility, as new members will be added to the end of the + struct in future releases. This is how the callee knows whether or + not the caller is new enough to have supplied a certain parameter. +*/ + +/*========================================================================= +** Simple server with Abyss under the covers +**=======================================================================*/ + +void +xmlrpc_server_abyss(xmlrpc_env * const envP, + const xmlrpc_server_abyss_parms * const parms, + unsigned int const parm_size); + +/*========================================================================= +** Object-oriented XML-RPC server with Abyss under the covers +**=======================================================================*/ + +typedef struct xmlrpc_server_abyss xmlrpc_server_abyss_t; + +void +xmlrpc_server_abyss_create(xmlrpc_env * const envP, + const xmlrpc_server_abyss_parms * const parmsP, + unsigned int const parmSize, + xmlrpc_server_abyss_t ** const serverPP); + +void +xmlrpc_server_abyss_destroy(xmlrpc_server_abyss_t * const serverP); + +void +xmlrpc_server_abyss_run_server(xmlrpc_env * const envP, + xmlrpc_server_abyss_t * const serverP); + +void +xmlrpc_server_abyss_terminate(xmlrpc_env * const envP, + xmlrpc_server_abyss_t * const serverP); + +void +xmlrpc_server_abyss_reset_terminate(xmlrpc_env * const envP, + xmlrpc_server_abyss_t * const serverP); + +void +xmlrpc_server_abyss_use_sigchld(xmlrpc_server_abyss_t * const serverP); + + +typedef struct xmlrpc_server_abyss_sig xmlrpc_server_abyss_sig; + +void +xmlrpc_server_abyss_setup_sig( + xmlrpc_env * const envP, + xmlrpc_server_abyss_t * const serverP, + xmlrpc_server_abyss_sig ** const oldHandlersPP); + +void +xmlrpc_server_abyss_restore_sig( + const xmlrpc_server_abyss_sig * const oldHandlersP); + + + +/*========================================================================= +** Functions to make an XML-RPC server out of your own Abyss server +**=======================================================================*/ + +void +xmlrpc_server_abyss_set_handlers2(TServer * const srvP, + const char * const filename, + xmlrpc_registry * const registryP); + +void +xmlrpc_server_abyss_set_handlers(TServer * const serverP, + xmlrpc_registry * const registryP); + +void +xmlrpc_server_abyss_set_handler(xmlrpc_env * const envP, + TServer * const serverP, + const char * const filename, + xmlrpc_registry * const registryP); + +/*========================================================================= +** Handy Abyss Extensions +**=======================================================================*/ + +/* These are functions that have nothing to do with Xmlrpc-c, but provide + convenient Abyss services beyond those provided by the Abyss library. +*/ + +/* Start an Abyss webserver running (previously created and +** initialized). Under Unix, this routine will attempt to do a +** detaching fork, drop root privileges (if any) and create a pid +** file. Under Windows, this routine merely starts the server. This +** routine never returns. +** +** Once you call this routine, it is illegal to modify the server any +** more, including changing any method registry. +*/ +void +xmlrpc_server_abyss_run(void); + +/* Same as xmlrpc_server_abyss_run(), except you get to specify a "runfirst" +** function. The server runs this just before executing the actual server +** function, after any daemonizing. NULL for 'runfirst' means no runfirst +** function. 'runfirstArg' is the argument the server passes to the runfirst +** function. +**/ +void +xmlrpc_server_abyss_run_first(runfirstFn const runfirst, + void * const runfirstArg); + +/*========================================================================= +** Method Registry +**========================================================================= + These functions are for the built-in xmlrpc_server_abyss registry. + It's usually simpler to skip all this and use the regular method + registry services (from xmlrpc_server.h) to build a registry and + pass it to xmlrpc_server_abyss. +*/ + +/* Call this function to create a new Abyss webserver with the default +** options and the built-in method registry. If you've already +** initialized Abyss using Abyss functions, you can instead call +** xmlrpc_server_abyss_init_registry() to make it an Xmlrpc-c server. +** Or use a regular method registry and call +** xmlrpc_server_abyss_set_handlers(). +**/ +void +xmlrpc_server_abyss_init(int const flags, + const char * const config_file); + +/* This is called automatically by xmlrpc_server_abyss_init. */ +void xmlrpc_server_abyss_init_registry (void); + +/* Fetch the internal registry, if you happen to need it. + If you're using this, you really shouldn't be using the built-in + registry at all. It exists today only for backward compatibilty. +*/ +extern xmlrpc_registry * +xmlrpc_server_abyss_registry (void); + +/* A quick & easy shorthand for adding a method. Depending on +** how you've configured your copy of Abyss, it's probably not safe to +** call this method after calling xmlrpc_server_abyss_run. */ +void xmlrpc_server_abyss_add_method (char * const method_name, + xmlrpc_method const method, + void * const user_data); + +/* As above, but provide documentation (see xmlrpc_registry_add_method_w_doc +** for more information). You should really use this one. */ +extern void +xmlrpc_server_abyss_add_method_w_doc (char * const method_name, + xmlrpc_method const method, + void * const user_data, + char * const signature, + char * const help); + +/*========================================================================= +** Content Handlers +**=======================================================================*/ +/* Abyss contents handlers xmlrpc_server_abyss_rpc2_handler() + and xmlrpc_server_abyss_default_handler() were available in older + Xmlrpc-c, but starting with Release 1.01, they are not. Instead, + call xmlrpc_server_abyss_set_handlers() to install them. + + Alternatively, you can write your own handlers that do the same thing. + It's not hard, and if you're writing low enough level Abyss code that + you can't use xmlrpc_server_abyss_set_handlers(), you probably want to + anyway. +*/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/* Copyright (C) 2001 by First Peer, Inc. All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. */ + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/server_abyss.hpp b/vendor/voclient/include/xmlrpc-c/server_abyss.hpp new file mode 100644 index 00000000..1ff9043e --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/server_abyss.hpp @@ -0,0 +1,134 @@ +#ifndef SERVER_ABYSS_HPP_INCLUDED +#define SERVER_ABYSS_HPP_INCLUDED + +#ifdef WIN32 +#include <winsock.h> // For XMLRPC_SOCKET (= SOCKET) +#endif + +#include "xmlrpc-c/config.h" // For XMLRPC_SOCKET +#include "xmlrpc-c/base.hpp" +#include "abyss.h" + +namespace xmlrpc_c { + +class serverAbyss { + +public: + class constrOpt { + public: + constrOpt(); + + constrOpt & registryPtr (xmlrpc_c::registryPtr const& arg); + constrOpt & registryP (const xmlrpc_c::registry * const& arg); + constrOpt & socketFd (XMLRPC_SOCKET const& arg); + constrOpt & portNumber (unsigned int const& arg); + constrOpt & logFileName (std::string const& arg); + constrOpt & keepaliveTimeout (unsigned int const& arg); + constrOpt & keepaliveMaxConn (unsigned int const& arg); + constrOpt & timeout (unsigned int const& arg); + constrOpt & dontAdvertise (bool const& arg); + constrOpt & uriPath (std::string const& arg); + constrOpt & chunkResponse (bool const& arg); + + struct value { + xmlrpc_c::registryPtr registryPtr; + const xmlrpc_c::registry * registryP; + XMLRPC_SOCKET socketFd; + unsigned int portNumber; + std::string logFileName; + unsigned int keepaliveTimeout; + unsigned int keepaliveMaxConn; + unsigned int timeout; + bool dontAdvertise; + std::string uriPath; + bool chunkResponse; + } value; + struct { + bool registryPtr; + bool registryP; + bool socketFd; + bool portNumber; + bool logFileName; + bool keepaliveTimeout; + bool keepaliveMaxConn; + bool timeout; + bool dontAdvertise; + bool uriPath; + bool chunkResponse; + } present; + }; + + serverAbyss(constrOpt const& opt); + + serverAbyss( + xmlrpc_c::registry const& registry, + unsigned int const portNumber = 8080, + std::string const& logFileName = "", + unsigned int const keepaliveTimeout = 0, + unsigned int const keepaliveMaxConn = 0, + unsigned int const timeout = 0, + bool const dontAdvertise = false, + bool const socketBound = false, + XMLRPC_SOCKET const socketFd = 0 + ); + ~serverAbyss(); + + void + run(); + + void + runOnce(); + + void + runConn(int const socketFd); + + void + terminate(); + + class shutdown : public xmlrpc_c::registry::shutdown { + public: + shutdown(xmlrpc_c::serverAbyss * const severAbyssP); + virtual ~shutdown(); + void doit(std::string const& comment, void * const callInfo) const; + private: + xmlrpc_c::serverAbyss * const serverAbyssP; + }; + +private: + // The user has the choice of supplying the registry by plain pointer + // (and managing the object's existence himself) or by autoObjectPtr + // (with automatic management). 'registryPtr' exists here only to + // maintain a reference count in the case that the user supplied an + // autoObjectPtr. The object doesn't reference the C++ registry + // object except during construction, because the C registry is the + // real registry. + xmlrpc_c::registryPtr registryPtr; + + TServer cServer; + + void + setAdditionalServerParms(constrOpt const& opt); + + void + initialize(constrOpt const& opt); +}; + + +void +server_abyss_set_handlers(TServer * const srvP, + xmlrpc_c::registry const& registry, + std::string const& uriPath = "/RPC2"); + +void +server_abyss_set_handlers(TServer * const srvP, + const xmlrpc_c::registry * const registryP, + std::string const& uriPath = "/RPC2"); + +void +server_abyss_set_handlers(TServer * const srvP, + xmlrpc_c::registryPtr const registryPtr, + std::string const& uriPath = "/RPC2"); + +} // namespace + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/server_cgi.h b/vendor/voclient/include/xmlrpc-c/server_cgi.h new file mode 100644 index 00000000..ad926aa3 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/server_cgi.h @@ -0,0 +1,49 @@ +/* Interface header file for libxmlrpc_server_cgi. + + By Bryan Henderson, 05.04.27. Contributed to the public domain. +*/ + +#ifndef XMLRPC_CGI_H_INCLUDED +#define XMLRPC_CGI_H_INCLUDED + +#include <xmlrpc-c/server.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +void +xmlrpc_server_cgi_process_call(xmlrpc_registry * const registryP); + +#define XMLRPC_CGI_NO_FLAGS (0) + +extern void +xmlrpc_cgi_init (int flags); + +extern xmlrpc_registry * +xmlrpc_cgi_registry (void); + +void +xmlrpc_cgi_add_method(const char * const method_name, + xmlrpc_method const method, + void * const user_data); + +void +xmlrpc_cgi_add_method_w_doc(const char * const method_name, + xmlrpc_method const method, + void * const user_data, + const char * const signature, + const char * const help); +extern void +xmlrpc_cgi_process_call (void); + +extern void +xmlrpc_cgi_cleanup (void); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/server_pstream.hpp b/vendor/voclient/include/xmlrpc-c/server_pstream.hpp new file mode 100644 index 00000000..b542532a --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/server_pstream.hpp @@ -0,0 +1,75 @@ +#ifndef SERVER_PSTREAM_HPP_INCLUDED +#define SERVER_PSTREAM_HPP_INCLUDED + +#ifdef WIN32 +#include <winsock.h> /* For XMLRPC_SOCKET (= SOCKET) */ +#endif + +#include <xmlrpc-c/config.h> /* For XMLRPC_SOCKET */ +#include <xmlrpc-c/registry.hpp> +#include <xmlrpc-c/packetsocket.hpp> + +namespace xmlrpc_c { + +class serverPstreamConn { + +public: + + class constrOpt { + public: + constrOpt(); + + constrOpt & registryPtr (xmlrpc_c::registryPtr const& arg); + constrOpt & registryP (const xmlrpc_c::registry * const& arg); + constrOpt & socketFd (XMLRPC_SOCKET const& arg); + + struct value { + xmlrpc_c::registryPtr registryPtr; + const xmlrpc_c::registry * registryP; + XMLRPC_SOCKET socketFd; + } value; + struct { + bool registryPtr; + bool registryP; + bool socketFd; + } present; + }; + + serverPstreamConn(constrOpt const& opt); + + ~serverPstreamConn(); + + void + runOnce(volatile const int * const interruptP, + bool * const eofP); + + void + runOnce(bool * const eofP); + +private: + + // 'registryP' is what we actually use; 'registryHolder' just holds a + // reference to 'registryP' so the registry doesn't disappear while + // this server exists. But note that if the creator doesn't supply + // a registryPtr, 'registryHolder' is just a placeholder variable and + // the creator is responsible for making sure the registry doesn't + // go anywhere while the server exists. + + registryPtr registryHolder; + const registry * registryP; + + packetSocket * packetSocketP; + // The packet socket over which we received RPCs. + // This is permanently connected to our fixed client. + + void + establishRegistry(constrOpt const& opt); + + void + establishPacketSocket(constrOpt const& opt); +}; + + +} // namespace + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/server_w32httpsys.h b/vendor/voclient/include/xmlrpc-c/server_w32httpsys.h new file mode 100644 index 00000000..085f6e30 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/server_w32httpsys.h @@ -0,0 +1,95 @@ +/* Copyright (C) 2005 by Steven A. Bone, sbone@pobox.com. All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. */ + +/* COMPILATION NOTE: + Note that the Platform SDK headers and + link libraries for Windows XP SP2 or newer are required to compile + xmlrpc-c for this module. If you are not using this server, it is + safe to exclude the xmlrpc_server_w32httpsys.c file from the xmlrpc + project and these dependencies will not be required. You can get the + latest platform SDK at + http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + Be sure after installation to choose the program to "register the PSDK + directories with Visual Studio" so the newer headers are found. +*/ + +#ifndef _XMLRPC_SERVER_HTTPSYS_H_ +#define _XMLRPC_SERVER_HTTPSYS_H_ 1 + +#include "transport_config.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/*========================================================================= +** XML-RPC Server (based on HTTP.SYS) +**========================================================================= +** A simple XML-RPC server based on the "built-in" Windows web server, +** HTTP.SYS. This is provided by Microsoft in Windows XP SP2 and +** Windows Server 2003. If errors occur during server setup, the server +** will exit. In general, if you want to use this API, you do not really +** need to be familiar with the HTTP.SYS API. +*/ + +typedef void (*authorization_function)( + xmlrpc_env * envP, + char * userid, + char * password); + +typedef struct { + xmlrpc_registry * registryP; + unsigned int portNum; + unsigned int useSSL; + /* useSSL, 0 = no SSL, 1 = use SSL */ + unsigned int logLevel; + /* logLevel, 0 = none, 1 = file, 2 = file+OutputDebugString() */ + const char * logFile; + /* logFile, NULL or filename */ + authorization_function authfn; +} xmlrpc_server_httpsys_parms; + +#define XMLRPC_HSSIZE(MBRNAME) \ + XMLRPC_STRUCTSIZE(xmlrpc_server_httpsys_parms, MBRNAME) + +/* XMLRPC_HSSIZE(xyz) is the minimum size a struct xmlrpc_server_httpsys_parms + must be to include the 'xyz' member. This is essential for forward and + backward compatbility, as new members will be added to the end of the + struct in future releases. This is how the callee knows whether or + not the caller is new enough to have supplied a certain parameter. +*/ + +void +xmlrpc_server_httpsys( + xmlrpc_env * const envP, + const xmlrpc_server_httpsys_parms * const parmsP, + unsigned int const parm_size + ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif
\ No newline at end of file diff --git a/vendor/voclient/include/xmlrpc-c/timeout.hpp b/vendor/voclient/include/xmlrpc-c/timeout.hpp new file mode 100644 index 00000000..8d0c2d6b --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/timeout.hpp @@ -0,0 +1,21 @@ +#ifndef XMLRPC_TIMEOUT_H_INCLUDED +#define XMLRPC_TIMEOUT_H_INCLUDED + +namespace xmlrpc_c { + +struct timeout { + + timeout() : finite(false) {} + + timeout(unsigned int const duration) : + finite(true), duration(duration) {} + // 'duration' is the timeout time in milliseconds + + bool finite; + unsigned int duration; // in milliseconds +}; + + +} // namespace + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/transport.h b/vendor/voclient/include/xmlrpc-c/transport.h new file mode 100644 index 00000000..13d901ff --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/transport.h @@ -0,0 +1,86 @@ +/* Copyright information is at the end of the file */ +#ifndef XMLRPC_TRANSPORT_H_INCLUDED +#define XMLRPC_TRANSPORT_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +#include <xmlrpc-c/util.h> +#include <xmlrpc-c/client.h> + +struct xmlrpc_call_info; + +struct xmlrpc_client_transport; + +/*========================================================================= +** Transport function type declarations. +**========================================================================= +*/ +typedef void (*xmlrpc_transport_setup)(xmlrpc_env * const envP); + +typedef void (*xmlrpc_transport_teardown)(void); + +typedef void (*xmlrpc_transport_create)( + xmlrpc_env * const envP, + int const flags, + const char * const appname, + const char * const appversion, + const void * const transportparmsP, + size_t const transportparm_size, + struct xmlrpc_client_transport ** const handlePP); + +typedef void (*xmlrpc_transport_destroy)( + struct xmlrpc_client_transport * const clientTransportP); + +typedef void (*xmlrpc_transport_asynch_complete)( + struct xmlrpc_call_info * const callInfoP, + xmlrpc_mem_block * const responseXmlP, + xmlrpc_env const env); + +typedef void (*xmlrpc_transport_send_request)( + xmlrpc_env * const envP, + struct xmlrpc_client_transport * const clientTransportP, + const xmlrpc_server_info * const serverP, + xmlrpc_mem_block * const xmlP, + xmlrpc_transport_asynch_complete complete, + struct xmlrpc_call_info * const callInfoP); + +typedef void (*xmlrpc_transport_call)( + xmlrpc_env * const envP, + struct xmlrpc_client_transport * const clientTransportP, + const xmlrpc_server_info * const serverP, + xmlrpc_mem_block * const xmlP, + xmlrpc_mem_block ** const responsePP); + +typedef enum {timeout_no, timeout_yes} xmlrpc_timeoutType; + +typedef unsigned long xmlrpc_timeout; + /* A timeout in milliseconds. */ + +typedef void (*xmlrpc_transport_finish_asynch)( + struct xmlrpc_client_transport * const clientTransportP, + xmlrpc_timeoutType const timeoutType, + xmlrpc_timeout const timeout); + +typedef void (*xmlrpc_transport_set_interrupt)( + struct xmlrpc_client_transport * const clientTransportP, + int * const interruptP); + +struct xmlrpc_client_transport_ops { + + xmlrpc_transport_setup setup_global_const; + xmlrpc_transport_teardown teardown_global_const; + xmlrpc_transport_create create; + xmlrpc_transport_destroy destroy; + xmlrpc_transport_send_request send_request; + xmlrpc_transport_call call; + xmlrpc_transport_finish_asynch finish_asynch; + xmlrpc_transport_set_interrupt set_interrupt; +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/util.h b/vendor/voclient/include/xmlrpc-c/util.h new file mode 100644 index 00000000..5b6e4f59 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/util.h @@ -0,0 +1,328 @@ +/*============================================================================= + xmlrpc-c/util.h +=============================================================================== + + This is the interface to the libxmlrpc_util library, which contains + utility routines that have nothing to do with XML-RPC. The library + exists because other Xmlrpc-c libraries use the utilities. + + By Bryan Henderson, San Jose, CA 05.09.21. + + Contributed to the public domain by its author. +=============================================================================*/ + +#ifndef XMLRPC_C_UTIL_H_INCLUDED +#define XMLRPC_C_UTIL_H_INCLUDED + +#include <sys/types.h> +#include <stdarg.h> + +#include <xmlrpc-c/config.h> /* Defines XMLRPC_HAVE_WCHAR */ +#include <xmlrpc-c/c_util.h> /* for GNU_PRINTF_ATTR */ + +#if XMLRPC_HAVE_WCHAR +#include <wchar.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/*========================================================================= +** C struct size computations +**=======================================================================*/ + +/* Use XMLRPC_STRUCT_MEMBER_SIZE() to determine how big a structure is + up to and including a specified member. E.g. if you have + struct mystruct {int red; int green; int blue};, then + XMLRPC_STRUCT_MEMBER_SIZE(mystruct, green) is (8). +*/ + +#define _XMLRPC_STRUCT_MEMBER_OFFSET(TYPE, MBRNAME) \ + ((size_t)(char*)&((TYPE *)0)->MBRNAME) +#define _XMLRPC_STRUCT_MEMBER_SIZE(TYPE, MBRNAME) \ + sizeof(((TYPE *)0)->MBRNAME) +#define XMLRPC_STRUCTSIZE(TYPE, MBRNAME) \ + (_XMLRPC_STRUCT_MEMBER_OFFSET(TYPE, MBRNAME) + \ + _XMLRPC_STRUCT_MEMBER_SIZE(TYPE, MBRNAME)) + +/*========================================================================= +** Assertions and Debugging +**========================================================================= +** Note that an assertion is _not_ a directive to check a condition and +** crash if it isn't true. It is an assertion that the condition _is_ +** true. This assertion helps people to read the code. The program +** may also check the assertion as it runs, and if it conflicts with reality, +** recognize that the program is incorrect and abort it. In practice, +** it does this checking when the program was compiled without the NDEBUG +** macro defined. +*/ + +#ifndef NDEBUG + +#define XMLRPC_ASSERT(cond) \ + do \ + if (!(cond)) \ + xmlrpc_assertion_failed(__FILE__, __LINE__); \ + while (0) + +#else +#define XMLRPC_ASSERT(cond) while (0) {} +#endif + +void +xmlrpc_assertion_failed(const char * const fileName, + int const lineNumber); + +/* Validate a pointer. */ +#define XMLRPC_ASSERT_PTR_OK(ptr) \ + XMLRPC_ASSERT((ptr) != NULL) + + +/*========================================================================= +** xmlrpc_env +**========================================================================= +** XML-RPC represents runtime errors as <fault> elements. These contain +** <faultCode> and <faultString> elements. +** +** Since we need as much thread-safety as possible, we borrow an idea from +** CORBA--we store exception information in an "environment" object. +** You'll pass this to many different functions, and it will get filled +** out appropriately. +** +** For example: +** +** xmlrpc_env env; +** +** xmlrpc_env_init(&env); +** +** xmlrpc_do_something(&env); +** if (env.fault_occurred) +** report_error_appropriately(); +** +** xmlrpc_env_clean(&env); +*/ + +#define XMLRPC_INTERNAL_ERROR (-500) +#define XMLRPC_TYPE_ERROR (-501) +#define XMLRPC_INDEX_ERROR (-502) +#define XMLRPC_PARSE_ERROR (-503) +#define XMLRPC_NETWORK_ERROR (-504) +#define XMLRPC_TIMEOUT_ERROR (-505) +#define XMLRPC_NO_SUCH_METHOD_ERROR (-506) +#define XMLRPC_REQUEST_REFUSED_ERROR (-507) +#define XMLRPC_INTROSPECTION_DISABLED_ERROR (-508) +#define XMLRPC_LIMIT_EXCEEDED_ERROR (-509) +#define XMLRPC_INVALID_UTF8_ERROR (-510) + +typedef struct _xmlrpc_env { + int fault_occurred; + int fault_code; + char * fault_string; +} xmlrpc_env; + +/* Initialize and destroy the contents of the provided xmlrpc_env object. +** These functions will never fail. */ +void xmlrpc_env_init (xmlrpc_env* env); +void xmlrpc_env_clean (xmlrpc_env* const env); + +/* Fill out an xmlrpc_fault with the specified values, and set the +** fault_occurred flag. This function will make a private copy of 'string', +** so you retain responsibility for your copy. */ +void +xmlrpc_env_set_fault(xmlrpc_env * const env, + int const faultCode, + const char * const faultDescription); + +/* The same as the above, but using varargs */ +void +xmlrpc_set_fault_formatted_v(xmlrpc_env * const envP, + int const code, + const char * const format, + va_list const args); + +/* The same as the above, but using a printf-style format string. */ +void +xmlrpc_env_set_fault_formatted(xmlrpc_env * const envP, + int const code, + const char * const format, + ...) GNU_PRINTF_ATTR(3,4); + +/* This one infers XMLRPC_INTERNAL_ERROR and has a shorter name. + So a call takes up less source code space. +*/ +void +xmlrpc_faultf(xmlrpc_env * const envP, + const char * const format, + ...) GNU_PRINTF_ATTR(2,3); + +/* A simple debugging assertion. */ +#define XMLRPC_ASSERT_ENV_OK(envP) \ + XMLRPC_ASSERT((envP) != NULL && \ + (envP->fault_string == NULL) && \ + !(envP)->fault_occurred) + +/* This version must *not* interpret 'str' as a format string, to avoid +** several evil attacks. */ +#define XMLRPC_FAIL(env,code,str) \ + do { xmlrpc_env_set_fault((env),(code),(str)); goto cleanup; } while (0) + +#define XMLRPC_FAIL1(env,code,str,arg1) \ + do { \ + xmlrpc_env_set_fault_formatted((env),(code),(str),(arg1)); \ + goto cleanup; \ + } while (0) + +#define XMLRPC_FAIL2(env,code,str,arg1,arg2) \ + do { \ + xmlrpc_env_set_fault_formatted((env),(code),(str),(arg1),(arg2)); \ + goto cleanup; \ + } while (0) + +#define XMLRPC_FAIL3(env,code,str,arg1,arg2,arg3) \ + do { \ + xmlrpc_env_set_fault_formatted((env),(code), \ + (str),(arg1),(arg2),(arg3)); \ + goto cleanup; \ + } while (0) + +#if !defined(__cplusplus) +#if defined(__GNUC__) +#define XMLRPC_FAILF( env, code, fmt, ... ) \ + do { \ + xmlrpc_env_set_fault_formatted((env), (code), (fmt), \ + ##__VA_ARGS__ ); \ + goto cleanup; \ + } while (0) +#endif +#endif + +#define XMLRPC_FAIL_IF_NULL(ptr,env,code,str) \ + do { \ + if ((ptr) == NULL) \ + XMLRPC_FAIL((env),(code),(str)); \ + } while (0) + +#define XMLRPC_FAIL_IF_FAULT(env) \ + do { if ((env)->fault_occurred) goto cleanup; } while (0) + + +/*========================================================================= +** xmlrpc_mem_block +**========================================================================= +** A resizable chunk of memory. This is mostly used internally, but it is +** also used by the public API in a few places. +** The struct fields are private! +*/ + +typedef struct _xmlrpc_mem_block { + size_t _size; + size_t _allocated; + void* _block; +} xmlrpc_mem_block; + +/* Allocate a new xmlrpc_mem_block. */ +xmlrpc_mem_block* xmlrpc_mem_block_new (xmlrpc_env* const env, size_t const size); + +/* Destroy an existing xmlrpc_mem_block, and everything it contains. */ +void xmlrpc_mem_block_free (xmlrpc_mem_block* const block); + +/* Initialize the contents of the provided xmlrpc_mem_block. */ +void xmlrpc_mem_block_init + (xmlrpc_env* const env, xmlrpc_mem_block* const block, size_t const size); + +/* Deallocate the contents of the provided xmlrpc_mem_block, but not the +** block itself. */ +void xmlrpc_mem_block_clean (xmlrpc_mem_block* const block); + +/* Get the size and contents of the xmlrpc_mem_block. */ +size_t +xmlrpc_mem_block_size(const xmlrpc_mem_block * const block); + +void * +xmlrpc_mem_block_contents(const xmlrpc_mem_block * const block); + +/* Resize an xmlrpc_mem_block, preserving as much of the contents as +** possible. */ +void xmlrpc_mem_block_resize + (xmlrpc_env* const env, xmlrpc_mem_block* const block, size_t const size); + +/* Append data to an existing xmlrpc_mem_block. */ +void xmlrpc_mem_block_append + (xmlrpc_env* const env, xmlrpc_mem_block* const block, const void * const data, size_t const len); + +#define XMLRPC_MEMBLOCK_NEW(type,env,size) \ + xmlrpc_mem_block_new((env), sizeof(type) * (size)) +#define XMLRPC_MEMBLOCK_FREE(type,block) \ + xmlrpc_mem_block_free(block) +#define XMLRPC_MEMBLOCK_INIT(type,env,block,size) \ + xmlrpc_mem_block_init((env), (block), sizeof(type) * (size)) +#define XMLRPC_MEMBLOCK_CLEAN(type,block) \ + xmlrpc_mem_block_clean(block) +#define XMLRPC_MEMBLOCK_SIZE(type,block) \ + (xmlrpc_mem_block_size(block) / sizeof(type)) +#define XMLRPC_MEMBLOCK_CONTENTS(type,block) \ + ((type*) xmlrpc_mem_block_contents(block)) +#define XMLRPC_MEMBLOCK_RESIZE(type,env,block,size) \ + xmlrpc_mem_block_resize(env, block, sizeof(type) * (size)) +#define XMLRPC_MEMBLOCK_APPEND(type,env,block,data,size) \ + xmlrpc_mem_block_append(env, block, data, sizeof(type) * (size)) + +/* Here are some backward compatibility definitions. These longer names + used to be the only ones and typed memory blocks were considered + special. +*/ +#define XMLRPC_TYPED_MEM_BLOCK_NEW(type,env,size) \ + XMLRPC_MEMBLOCK_NEW(type,env,size) +#define XMLRPC_TYPED_MEM_BLOCK_FREE(type,block) \ + XMLRPC_MEMBLOCK_FREE(type,block) +#define XMLRPC_TYPED_MEM_BLOCK_INIT(type,env,block,size) \ + XMLRPC_MEMBLOCK_INIT(type,env,block,size) +#define XMLRPC_TYPED_MEM_BLOCK_CLEAN(type,block) \ + XMLRPC_MEMBLOCK_CLEAN(type,block) +#define XMLRPC_TYPED_MEM_BLOCK_SIZE(type,block) \ + XMLRPC_MEMBLOCK_SIZE(type,block) +#define XMLRPC_TYPED_MEM_BLOCK_CONTENTS(type,block) \ + XMLRPC_MEMBLOCK_CONTENTS(type,block) +#define XMLRPC_TYPED_MEM_BLOCK_RESIZE(type,env,block,size) \ + XMLRPC_MEMBLOCK_RESIZE(type,env,block,size) +#define XMLRPC_TYPED_MEM_BLOCK_APPEND(type,env,block,data,size) \ + XMLRPC_MEMBLOCK_APPEND(type,env,block,data,size) + + +/*========================================================================= +** UTF-8 Encoding and Decoding +**=======================================================================*/ + +void +xmlrpc_validate_utf8(xmlrpc_env * const envP, + const char * const utf8Data, + size_t const utf8Len); + +/* Decode a UTF-8 string. */ +xmlrpc_mem_block * +xmlrpc_utf8_to_wcs(xmlrpc_env * const envP, + const char * const utf8_data, + size_t const utf8_len); + +/* Encode a UTF-8 string. */ + +#if XMLRPC_HAVE_WCHAR +xmlrpc_mem_block * +xmlrpc_wcs_to_utf8(xmlrpc_env * const envP, + const wchar_t * const wcsData, + size_t const wcsLen); +#endif + +void +xmlrpc_force_to_utf8(char * const buffer); + +void +xmlrpc_force_to_xml_chars(char * const buffer); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/vendor/voclient/include/xmlrpc-c/xml.hpp b/vendor/voclient/include/xmlrpc-c/xml.hpp new file mode 100644 index 00000000..a77731f9 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/xml.hpp @@ -0,0 +1,36 @@ +#ifndef XML_HPP_INCLUDED +#define XML_HPP_INCLUDED + +#include <string> +#include <xmlrpc-c/base.hpp> + +namespace xmlrpc_c { +namespace xml { + +void +generateCall(std::string const& methodName, + xmlrpc_c::paramList const& paramList, + std::string * const callXmlP); + +void +generateCall(std::string const& methodName, + xmlrpc_c::paramList const& paramList, + xmlrpc_dialect const dialect, + std::string * const callXmlP); + +void +parseSuccessfulResponse(std::string const& responseXml, + xmlrpc_c::value * const resultP); + +void +parseResponse(std::string const& responseXml, + xmlrpc_c::rpcOutcome * const outcomeP); + + +void +trace(std::string const& label, + std::string const& xml); + + +}} // namespace +#endif |