mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 01:26:58 +00:00
FS-2746 --resolve large xmlrpc update thanks garmt
This commit is contained in:
@@ -21,6 +21,7 @@ extern "C" {
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/inttypes.h>
|
||||
|
||||
/****************************************************************************
|
||||
@@ -33,9 +34,11 @@ typedef int abyss_bool;
|
||||
GLOBAL (STATIC) PROGRAM STUFF
|
||||
****************************************************************************/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
AbyssInit(const char ** const errorP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
AbyssTerm(void);
|
||||
|
||||
@@ -45,23 +48,29 @@ AbyssTerm(void);
|
||||
|
||||
typedef struct MIMEType MIMEType;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
MIMEType *
|
||||
MIMETypeCreate(void);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
MIMETypeDestroy(MIMEType * const MIMETypeP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
MIMETypeInit(void);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
MIMETypeTerm(void);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
MIMETypeAdd2(MIMEType * const MIMETypeP,
|
||||
const char * const type,
|
||||
const char * const ext);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
MIMETypeAdd(const char * const type,
|
||||
const char * const ext);
|
||||
@@ -81,9 +90,11 @@ typedef struct _TSocket TSocket;
|
||||
#include <xmlrpc-c/abyss_unixsock.h>
|
||||
#endif
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ChanSwitchInit(const char ** const errorP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ChanSwitchTerm(void);
|
||||
|
||||
@@ -92,18 +103,23 @@ ChanSwitchTerm(void);
|
||||
in abyss_unixsock.h, etc.
|
||||
*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ChanSwitchDestroy(TChanSwitch * const chanSwitchP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ChannelInit(const char ** const errorP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ChannelTerm(void);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ChannelDestroy(TChannel * const channelP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
SocketDestroy(TSocket * const socketP);
|
||||
|
||||
@@ -120,6 +136,7 @@ typedef struct {
|
||||
|
||||
typedef struct _TSession TSession;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ServerCreate(TServer * const serverP,
|
||||
const char * const name,
|
||||
@@ -127,11 +144,13 @@ ServerCreate(TServer * const serverP,
|
||||
const char * const filespath,
|
||||
const char * const logfilename);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerCreateSwitch(TServer * const serverP,
|
||||
TChanSwitch * const chanSwitchP,
|
||||
const char ** const errorP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ServerCreateSocket(TServer * const serverP,
|
||||
const char * const name,
|
||||
@@ -140,71 +159,87 @@ ServerCreateSocket(TServer * const serverP,
|
||||
const char * const logfilename);
|
||||
|
||||
#define HAVE_SERVER_CREATE_SOCKET_2
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerCreateSocket2(TServer * const serverP,
|
||||
TSocket * const socketP,
|
||||
const char ** const errorP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ServerCreateNoAccept(TServer * const serverP,
|
||||
const char * const name,
|
||||
const char * const filespath,
|
||||
const char * const logfilename);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerFree(TServer * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerSetName(TServer * const serverP,
|
||||
const char * const name);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerSetFilesPath(TServer * const serverP,
|
||||
const char * const filesPath);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerSetLogFileName(TServer * const serverP,
|
||||
const char * const logFileName);
|
||||
|
||||
#define HAVE_SERVER_SET_KEEPALIVE_TIMEOUT 1
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerSetKeepaliveTimeout(TServer * const serverP,
|
||||
xmlrpc_uint32_t const keepaliveTimeout);
|
||||
|
||||
#define HAVE_SERVER_SET_KEEPALIVE_MAX_CONN 1
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerSetKeepaliveMaxConn(TServer * const serverP,
|
||||
xmlrpc_uint32_t const keepaliveMaxConn);
|
||||
|
||||
#define HAVE_SERVER_SET_TIMEOUT 1
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerSetTimeout(TServer * const serverP,
|
||||
xmlrpc_uint32_t const timeout);
|
||||
|
||||
#define HAVE_SERVER_SET_ADVERTISE 1
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerSetAdvertise(TServer * const serverP,
|
||||
abyss_bool const advertise);
|
||||
|
||||
#define HAVE_SERVER_SET_MIME_TYPE 1
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerSetMimeType(TServer * const serverP,
|
||||
MIMEType * const MIMETypeP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
int
|
||||
ServerInit(TServer * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerRun(TServer * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerRunOnce(TServer * const serverP);
|
||||
|
||||
/* ServerRunOnce2() is obsolete. See user's guide. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerRunOnce2(TServer * const serverP,
|
||||
enum abyss_foreback const foregroundBackground);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerRunChannel(TServer * const serverP,
|
||||
TChannel * const channelP,
|
||||
@@ -212,24 +247,30 @@ ServerRunChannel(TServer * const serverP,
|
||||
const char ** const errorP);
|
||||
|
||||
#define HAVE_SERVER_RUN_CONN_2
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerRunConn2(TServer * const serverP,
|
||||
TSocket * const connectedSocketP,
|
||||
const char ** const errorP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerRunConn(TServer * const serverP,
|
||||
TOsSocket const connectedSocket);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerDaemonize(TServer * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerTerminate(TServer * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerResetTerminate(TServer * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerUseSigchld(TServer * const serverP);
|
||||
|
||||
@@ -242,15 +283,31 @@ typedef abyss_bool (*URIHandler) (TSession *); /* deprecated */
|
||||
|
||||
struct URIHandler2;
|
||||
|
||||
typedef void (*initHandlerFn)(struct URIHandler2 *,
|
||||
abyss_bool *);
|
||||
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 */
|
||||
};
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerAddHandler3(TServer * const serverP,
|
||||
const struct ServerReqHandler3 * const handlerP,
|
||||
abyss_bool * const successP);
|
||||
|
||||
typedef struct URIHandler2 {
|
||||
initHandlerFn init;
|
||||
termHandlerFn term;
|
||||
@@ -259,11 +316,13 @@ typedef struct URIHandler2 {
|
||||
void * userdata;
|
||||
} URIHandler2;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerAddHandler2(TServer * const srvP,
|
||||
URIHandler2 * const handlerP,
|
||||
abyss_bool * const successP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ServerAddHandler(TServer * const srvP,
|
||||
URIHandler const handler);
|
||||
@@ -274,6 +333,7 @@ typedef abyss_bool (*THandlerDflt) (TSession *);
|
||||
for the same type
|
||||
*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ServerDefaultHandler(TServer * const srvP,
|
||||
THandlerDflt const handler);
|
||||
@@ -283,10 +343,12 @@ ServerDefaultHandler(TServer * const srvP,
|
||||
inappropriate for an API.
|
||||
*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ConfReadServerFile(const char * const filename,
|
||||
TServer * const srvP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
LogWrite(TServer * const srvP,
|
||||
const char * const c);
|
||||
@@ -309,7 +371,7 @@ typedef struct {
|
||||
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
|
||||
/* NOT the value of the host: header field. 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.
|
||||
@@ -319,7 +381,7 @@ typedef struct {
|
||||
const char * referer;
|
||||
const char * requestline;
|
||||
const char * user;
|
||||
/* Requesting user (from authorization: header). NULL if
|
||||
/* Requesting user (from authorization: header field). NULL if
|
||||
request doesn't specify or handler has not authenticated it.
|
||||
*/
|
||||
xmlrpc_uint16_t port;
|
||||
@@ -329,98 +391,157 @@ typedef struct {
|
||||
abyss_bool keepalive;
|
||||
} TRequestInfo;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
SessionRefillBuffer(TSession * const sessionP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
size_t
|
||||
SessionReadDataAvail(TSession * const sessionP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
SessionGetReadData(TSession * const sessionP,
|
||||
size_t const max,
|
||||
const char ** const outStartP,
|
||||
size_t * const outLenP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
SessionGetRequestInfo(TSession * const sessionP,
|
||||
const TRequestInfo ** const requestInfoPP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
SessionGetChannelInfo(TSession * const sessionP,
|
||||
void ** const channelInfoPP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void *
|
||||
SessionGetDefaultHandlerCtx(TSession * const sessionP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
char *
|
||||
RequestHeaderValue(TSession * const sessionP,
|
||||
const char * const name);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ResponseAddField(TSession * const sessionP,
|
||||
const char * const name,
|
||||
const char * const value);
|
||||
|
||||
void
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ResponseWriteStart(TSession * const sessionP);
|
||||
|
||||
/* For backward compatibility: */
|
||||
#define ResponseWrite ResponseWriteStart
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ResponseWriteBody(TSession * const sessionP,
|
||||
const char * const data,
|
||||
xmlrpc_uint32_t const len);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ResponseWriteEnd(TSession * const sessionP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ResponseChunked(TSession * const sessionP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_uint16_t
|
||||
ResponseStatusFromErrno(int const errnoArg);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ResponseStatus(TSession * const sessionP,
|
||||
xmlrpc_uint16_t const code);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ResponseStatusErrno(TSession * const sessionP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ResponseContentType(TSession * const serverP,
|
||||
const char * const type);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
ResponseContentLength(TSession * const sessionP,
|
||||
xmlrpc_uint64_t const len);
|
||||
|
||||
typedef struct {
|
||||
/*----------------------------------------------------------------------------
|
||||
These are parameters to control the HTTP "Access Control functions. That's
|
||||
where the client asks whether it is OK to send a request that some other
|
||||
server asked the client to send (e.g. a person web browses a page at
|
||||
a.example.com, and it sends a script that executes on the user's computer
|
||||
and tries to perform an XML-RPC RPC on b.example.com. The user's browser
|
||||
first asks b.example.com if it is OK to do an RPC that is really initiated
|
||||
by a.example.com.
|
||||
-----------------------------------------------------------------------------*/
|
||||
const char * allowOrigin;
|
||||
/* This tells what original servers (a.example.com in the example
|
||||
above) are allowed to submit RPCs indirectly to us. The value is a
|
||||
verbatim value for an HTTP Access-Control-Allow-Origin header field
|
||||
(just the value part of the field, not the whole field). "*"
|
||||
therefore means everyone is allowed. "" means no one.
|
||||
|
||||
NULL means not to say anything about access control to the client.
|
||||
*/
|
||||
abyss_bool expires;
|
||||
/* The permissions herein expire after a certain period from now.
|
||||
'maxAge' is that period.
|
||||
*/
|
||||
unsigned int maxAge;
|
||||
/* Meaningful only when 'expires' is true. The expiration period
|
||||
in seconds. Zero is valid.
|
||||
*/
|
||||
} ResponseAccessCtl;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ResponseAccessControl(TSession * const abyssSessionP,
|
||||
ResponseAccessCtl const accessControl);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ResponseError2(TSession * const sessionP,
|
||||
const char * const explanation);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ResponseError(TSession * const sessionP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
MIMETypeFromExt(const char * const ext);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
MIMETypeFromExt2(MIMEType * const MIMETypeP,
|
||||
const char * const ext);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
MIMETypeFromFileName2(MIMEType * const MIMETypeP,
|
||||
const char * const fileName);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
MIMETypeFromFileName(const char * const fileName);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
MIMETypeGuessFromFile2(MIMEType * const MIMETypeP,
|
||||
const char * const fileName);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
MIMETypeGuessFromFile(const char * const filename);
|
||||
|
||||
@@ -460,7 +581,7 @@ MIMETypeGuessFromFile(const char * const filename);
|
||||
** Maximum number of simultaneous connections
|
||||
*********************************************************************/
|
||||
|
||||
#define MAX_CONN 100000
|
||||
#define MAX_CONN 16
|
||||
|
||||
/*********************************************************************
|
||||
** General purpose definitions
|
||||
@@ -482,26 +603,21 @@ MIMETypeGuessFromFile(const char * const filename);
|
||||
** Range
|
||||
*********************************************************************/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool
|
||||
RangeDecode(char * const str,
|
||||
xmlrpc_uint64_t const filesize,
|
||||
xmlrpc_uint64_t * const start,
|
||||
xmlrpc_uint64_t * const end);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool DateInit(void);
|
||||
|
||||
/*********************************************************************
|
||||
** Base64
|
||||
*********************************************************************/
|
||||
|
||||
void
|
||||
Base64Encode(const char * const chars,
|
||||
char * const base64);
|
||||
|
||||
/*********************************************************************
|
||||
** Session
|
||||
*********************************************************************/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
abyss_bool SessionLog(TSession * const s);
|
||||
|
||||
|
||||
|
@@ -7,17 +7,19 @@ struct abyss_win_chaninfo {
|
||||
struct sockaddr peerAddr;
|
||||
};
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ChanSwitchWinCreate(unsigned short const portNumber,
|
||||
TChanSwitch ** const chanSwitchPP,
|
||||
const char ** const errorP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ChanSwitchWinCreateWinsock(SOCKET const winsock,
|
||||
TChanSwitch ** const chanSwitchPP,
|
||||
const char ** const errorP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
ChannelWinCreateWinsock(SOCKET const fd,
|
||||
TChannel ** const channelPP,
|
||||
|
@@ -6,26 +6,40 @@
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/util.h>
|
||||
#include <xmlrpc-c/config.h>
|
||||
/* Defines XMLRPC_HAVE_WCHAR, XMLRPC_INT64 */
|
||||
/* 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
|
||||
**=======================================================================*/
|
||||
|
||||
/* These are for backward compatibility -- they can't be exported from a
|
||||
Windows DLL. xmlrpc_server_version() is preferred.
|
||||
*/
|
||||
extern unsigned int const xmlrpc_version_major;
|
||||
extern unsigned int const xmlrpc_version_minor;
|
||||
extern unsigned int const xmlrpc_version_point;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_version(unsigned int * const majorP,
|
||||
unsigned int * const minorP,
|
||||
unsigned int * const pointP);
|
||||
|
||||
/*=========================================================================
|
||||
** C types equivalent to XML-RPC types
|
||||
**=======================================================================*/
|
||||
@@ -50,6 +64,19 @@ typedef double xmlrpc_double;
|
||||
so it's probably clearer just to use that. This typedef is here
|
||||
for mathematical completeness.
|
||||
*/
|
||||
typedef struct {
|
||||
/* A datetime of the type defined by XML-RPC <dateTime.iso8601> with
|
||||
a few extensions. I.e. in the range 1-9999 AD with microsecond
|
||||
resolution.
|
||||
*/
|
||||
unsigned int Y; /* 1-? */
|
||||
unsigned int M; /* 1-12 */
|
||||
unsigned int D; /* 1-31 */
|
||||
unsigned int h; /* 0-23 */
|
||||
unsigned int m; /* 0-59 */
|
||||
unsigned int s; /* 0-59 */
|
||||
unsigned int u; /* 0-999999 */
|
||||
} xmlrpc_datetime;
|
||||
|
||||
/* 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
|
||||
@@ -89,12 +116,13 @@ typedef enum {
|
||||
|
||||
#define XMLRPC_HAVE_I8 1
|
||||
|
||||
/* These are *always* allocated on the heap. No exceptions. */
|
||||
typedef struct _xmlrpc_value xmlrpc_value;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
xmlrpc_type_name(xmlrpc_type const type);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_abort_if_array_bad(xmlrpc_value * const arrayP);
|
||||
|
||||
@@ -102,109 +130,193 @@ xmlrpc_abort_if_array_bad(xmlrpc_value * const arrayP);
|
||||
xmlrpc_abort_if_array_bad(val)
|
||||
|
||||
/* Increment the reference count of an xmlrpc_value. */
|
||||
extern void xmlrpc_INCREF (xmlrpc_value* const value);
|
||||
XMLRPC_DLLEXPORT
|
||||
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);
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void xmlrpc_DECREF(xmlrpc_value* const value);
|
||||
|
||||
/* Get the type of an XML-RPC value. */
|
||||
XMLRPC_DLLEXPORT
|
||||
extern xmlrpc_type xmlrpc_value_type (xmlrpc_value* const value);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_int(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
int * const intValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_i8_new(xmlrpc_env * const envP,
|
||||
xmlrpc_int64 const value);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_i8(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
xmlrpc_int64 * const intValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_bool_new(xmlrpc_env * const envP,
|
||||
xmlrpc_bool const boolValue);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_bool(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
xmlrpc_bool * const boolValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_double_new(xmlrpc_env * const envP,
|
||||
double const doubleValue);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_double(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
xmlrpc_double * const doubleValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_datetime_new(xmlrpc_env * const envP,
|
||||
xmlrpc_datetime const dt);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_datetime_new_str(xmlrpc_env * const envP,
|
||||
const char * const value);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_datetime_new_sec(xmlrpc_env * const envP,
|
||||
time_t const value);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value*
|
||||
xmlrpc_datetime_new_usec(xmlrpc_env * const envP,
|
||||
time_t const secs,
|
||||
unsigned int const usecs);
|
||||
|
||||
#if XMLRPC_HAVE_TIMEVAL
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_datetime_new_timeval(xmlrpc_env * const envP,
|
||||
struct timeval const value);
|
||||
#endif
|
||||
|
||||
#if XMLRPC_HAVE_TIMESPEC
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_datetime_new_timespec(xmlrpc_env * const envP,
|
||||
struct timespec const value);
|
||||
#endif
|
||||
|
||||
void
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_read_datetime(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
xmlrpc_datetime * const dtP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_datetime_str(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
const char ** const stringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_datetime_sec(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
time_t * const timeValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_datetime_timeval(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
struct timeval * const timeValueP);
|
||||
#endif
|
||||
|
||||
#if XMLRPC_HAVE_TIMESPEC
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_datetime_timespec(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
struct timespec * const timeValueP);
|
||||
#endif
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_new(xmlrpc_env * const envP,
|
||||
const char * const stringValue);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_new_lp(xmlrpc_env * const envP,
|
||||
size_t const length,
|
||||
const char * const stringValue);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_new_va(xmlrpc_env * const envP,
|
||||
const char * const format,
|
||||
va_list args);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_new_f(xmlrpc_env * const envP,
|
||||
const char * const format,
|
||||
...);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_new_lp_cr(xmlrpc_env * const envP,
|
||||
size_t const length,
|
||||
const char * const value);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_new_cr(xmlrpc_env * const envP,
|
||||
const char * const value);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
const char ** const stringValueP);
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_crlf(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
const char ** const stringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_lp_crlf(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
size_t * const lengthP,
|
||||
const char ** const stringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_lp(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
@@ -212,80 +324,93 @@ xmlrpc_read_string_lp(xmlrpc_env * const envP,
|
||||
const char ** const stringValueP);
|
||||
|
||||
#if XMLRPC_HAVE_WCHAR
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_w_new(xmlrpc_env * const envP,
|
||||
const wchar_t * const stringValue);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_w_new_lp(xmlrpc_env * const envP,
|
||||
size_t const length,
|
||||
const wchar_t * const stringValue);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_w(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const valueP,
|
||||
const wchar_t ** const stringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_w_crlf(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const valueP,
|
||||
const wchar_t ** const stringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_w_lp(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const valueP,
|
||||
size_t * const lengthP,
|
||||
const wchar_t ** const stringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_w_new_lp_cr(xmlrpc_env * const envP,
|
||||
size_t const length,
|
||||
const wchar_t * const value);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_string_w_new_cr(xmlrpc_env * const envP,
|
||||
const wchar_t * const value);
|
||||
|
||||
#endif /* XMLRPC_HAVE_WCHAR */
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_base64_new(xmlrpc_env * const envP,
|
||||
size_t const length,
|
||||
const unsigned char * const value);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_base64(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
size_t * const lengthP,
|
||||
const unsigned char ** const bytestringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_base64_size(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
size_t * const lengthP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
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);
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_array_append_item(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const arrayP,
|
||||
xmlrpc_value * const valueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_array_read_item(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const arrayP,
|
||||
@@ -299,30 +424,35 @@ xmlrpc_array_read_item(xmlrpc_env * const envP,
|
||||
Sets XMLRPC_TYPE_ERROR if 'array' is not an array.
|
||||
Sets XMLRPC_INDEX_ERROR if 'index' is out of bounds.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
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_DLLEXPORT
|
||||
int
|
||||
xmlrpc_array_set_item(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const arrayP,
|
||||
unsigned int const index,
|
||||
xmlrpc_value * const valueP);
|
||||
*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
int
|
||||
xmlrpc_struct_size (xmlrpc_env * env,
|
||||
xmlrpc_value * strct);
|
||||
xmlrpc_struct_size (xmlrpc_env * const env,
|
||||
xmlrpc_value * const strct);
|
||||
|
||||
/* Returns true iff 'strct' contains 'key'.
|
||||
** Sets XMLRPC_TYPE_ERROR if 'strct' is not a struct. */
|
||||
XMLRPC_DLLEXPORT
|
||||
int
|
||||
xmlrpc_struct_has_key(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const strctP,
|
||||
@@ -332,6 +462,7 @@ xmlrpc_struct_has_key(xmlrpc_env * const envP,
|
||||
Deprecated. xmlrpc_struct_get_value_v() is more general, and this
|
||||
case is not common enough to warrant a shortcut.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
int
|
||||
xmlrpc_struct_has_key_n(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const strctP,
|
||||
@@ -340,6 +471,7 @@ xmlrpc_struct_has_key_n(xmlrpc_env * const envP,
|
||||
|
||||
#if 0
|
||||
/* Not implemented yet, but needed for completeness. */
|
||||
XMLRPC_DLLEXPORT
|
||||
int
|
||||
xmlrpc_struct_has_key_v(xmlrpc_env * env,
|
||||
xmlrpc_value * strct,
|
||||
@@ -347,6 +479,7 @@ xmlrpc_struct_has_key_v(xmlrpc_env * env,
|
||||
#endif
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_struct_find_value(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const structP,
|
||||
@@ -354,18 +487,21 @@ xmlrpc_struct_find_value(xmlrpc_env * const envP,
|
||||
xmlrpc_value ** const valuePP);
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_struct_find_value_v(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const structP,
|
||||
xmlrpc_value * const keyP,
|
||||
xmlrpc_value ** const valuePP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_struct_read_value(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const structP,
|
||||
const char * const key,
|
||||
xmlrpc_value ** const valuePP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_struct_read_value_v(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const structP,
|
||||
@@ -375,6 +511,7 @@ xmlrpc_struct_read_value_v(xmlrpc_env * const envP,
|
||||
/* The "get_value" functions are deprecated. Use the "find_value"
|
||||
and "read_value" functions instead.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_struct_get_value(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const strctP,
|
||||
@@ -384,6 +521,7 @@ xmlrpc_struct_get_value(xmlrpc_env * const envP,
|
||||
Deprecated. xmlrpc_struct_get_value_v() is more general, and this
|
||||
case is not common enough to warrant a shortcut.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_struct_get_value_n(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const strctP,
|
||||
@@ -393,6 +531,7 @@ xmlrpc_struct_get_value_n(xmlrpc_env * const envP,
|
||||
/* Set the value associated with 'key' in 'strct' to 'value'.
|
||||
Sets XMLRPC_TYPE_ERROR if 'strct' is not a struct.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_struct_set_value(xmlrpc_env * const env,
|
||||
xmlrpc_value * const strct,
|
||||
@@ -403,6 +542,7 @@ xmlrpc_struct_set_value(xmlrpc_env * const env,
|
||||
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.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_struct_set_value_n(xmlrpc_env * const env,
|
||||
xmlrpc_value * const strct,
|
||||
@@ -412,6 +552,7 @@ xmlrpc_struct_set_value_n(xmlrpc_env * const env,
|
||||
|
||||
/* The same as above, but the key must be an XML-RPC string.
|
||||
** Fails with XMLRPC_TYPE_ERROR if 'keyval' is not a string. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_struct_set_value_v(xmlrpc_env * const env,
|
||||
xmlrpc_value * const strct,
|
||||
@@ -423,6 +564,7 @@ xmlrpc_struct_set_value_v(xmlrpc_env * const env,
|
||||
** Fails with XMLRPC_TYPE_ERROR if 'struct' is not a struct.
|
||||
** Fails with XMLRPC_INDEX_ERROR if 'index' is out of bounds. */
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_struct_read_member(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const structP,
|
||||
@@ -436,6 +578,7 @@ xmlrpc_struct_read_member(xmlrpc_env * const envP,
|
||||
|
||||
Deprecated. Use xmlrpc_struct_read_member() instead.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_struct_get_key_and_value(xmlrpc_env * const env,
|
||||
xmlrpc_value * const strct,
|
||||
@@ -443,38 +586,55 @@ xmlrpc_struct_get_key_and_value(xmlrpc_env * const env,
|
||||
xmlrpc_value ** const out_keyval,
|
||||
xmlrpc_value ** const out_value);
|
||||
|
||||
/* The "C pointer" type has no relation to XML-RPC. It is here for the
|
||||
convenience of programs that use xmlrpc_value for XML-RPC purposes
|
||||
and can benefit from using it for non-XML-RPC purposes as well.
|
||||
|
||||
Also, some people use libxmlrpc for xmlrpc_value alone, because sometimes
|
||||
you need to work with basic data types in richer ways than the C types
|
||||
(int, time_t, etc) allow.
|
||||
*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_cptr_new(xmlrpc_env * const envP,
|
||||
void * const value);
|
||||
|
||||
typedef void (*xmlrpc_cptr_dtor_fn)(void *, void *);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_cptr_new_dtor(xmlrpc_env * const envP,
|
||||
void * const value,
|
||||
xmlrpc_cptr_dtor_fn const dtor,
|
||||
void * const dtorContext);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_cptr(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
void ** const ptrValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_nil_new(xmlrpc_env * const envP);
|
||||
|
||||
|
||||
/* Build an xmlrpc_value from a format string. */
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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 */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_build_value_va(xmlrpc_env * const env,
|
||||
const char * const format,
|
||||
@@ -482,12 +642,14 @@ xmlrpc_build_value_va(xmlrpc_env * const env,
|
||||
xmlrpc_value ** const valPP,
|
||||
const char ** const tailP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_decompose_value(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const value,
|
||||
const char * const format,
|
||||
...);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_decompose_value_va(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const value,
|
||||
@@ -501,6 +663,7 @@ xmlrpc_decompose_value_va(xmlrpc_env * const envP,
|
||||
|
||||
These are deprecated. Use xmlrpc_decompose_value... instead.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_parse_value(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const value,
|
||||
@@ -508,6 +671,7 @@ xmlrpc_parse_value(xmlrpc_env * const envP,
|
||||
...);
|
||||
|
||||
/* The same as the above, but using a va_list. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_parse_value_va(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const value,
|
||||
@@ -523,28 +687,33 @@ typedef enum xmlrpc_dialect {
|
||||
xmlrpc_dialect_apache
|
||||
} xmlrpc_dialect;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_serialize_value2(xmlrpc_env * const envP,
|
||||
xmlrpc_mem_block * const outputP,
|
||||
xmlrpc_value * const valueP,
|
||||
xmlrpc_dialect const dialect);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_serialize_value(xmlrpc_env * const envP,
|
||||
xmlrpc_mem_block * const outputP,
|
||||
xmlrpc_value * const valueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_serialize_params2(xmlrpc_env * const envP,
|
||||
xmlrpc_mem_block * const outputP,
|
||||
xmlrpc_value * const paramArrayP,
|
||||
xmlrpc_dialect const dialect);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_serialize_params(xmlrpc_env * const envP,
|
||||
xmlrpc_mem_block * const outputP,
|
||||
xmlrpc_value * const paramArrayP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_serialize_call2(xmlrpc_env * const envP,
|
||||
xmlrpc_mem_block * const outputP,
|
||||
@@ -552,23 +721,27 @@ xmlrpc_serialize_call2(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const paramArrayP,
|
||||
xmlrpc_dialect const dialect);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_serialize_call(xmlrpc_env * const envP,
|
||||
xmlrpc_mem_block * const outputP,
|
||||
const char * const methodName,
|
||||
xmlrpc_value * const paramArrayP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_serialize_response2(xmlrpc_env * const envP,
|
||||
xmlrpc_mem_block * const outputP,
|
||||
xmlrpc_value * const valueP,
|
||||
xmlrpc_dialect const dialect);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_serialize_response(xmlrpc_env * const envP,
|
||||
xmlrpc_mem_block * const outputP,
|
||||
xmlrpc_value * const valueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_serialize_fault(xmlrpc_env * const envP,
|
||||
xmlrpc_mem_block * const outputP,
|
||||
@@ -579,17 +752,22 @@ xmlrpc_serialize_fault(xmlrpc_env * const envP,
|
||||
** 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). */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_parse_value_xml(xmlrpc_env * const envP,
|
||||
const char * const xmlData,
|
||||
size_t const xmlDataLen,
|
||||
xmlrpc_value ** const valuePP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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);
|
||||
const char * const xmlData,
|
||||
size_t const xmlDataLen,
|
||||
const char ** const methodNameP,
|
||||
xmlrpc_value ** const paramArrayP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_parse_response2(xmlrpc_env * const envP,
|
||||
const char * const xmlData,
|
||||
@@ -601,6 +779,7 @@ xmlrpc_parse_response2(xmlrpc_env * const envP,
|
||||
|
||||
/* xmlrpc_parse_response() is for backward compatibility */
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_parse_response(xmlrpc_env * const envP,
|
||||
const char * const xmlData,
|
||||
@@ -616,23 +795,26 @@ xmlrpc_parse_response(xmlrpc_env * const envP,
|
||||
|
||||
/* This routine inserts newlines every 76 characters, as required by the
|
||||
** Base64 specification. */
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_mem_block *
|
||||
xmlrpc_base64_encode(xmlrpc_env * env,
|
||||
unsigned char * bin_data,
|
||||
size_t bin_len);
|
||||
xmlrpc_base64_encode(xmlrpc_env * const envP,
|
||||
const unsigned char * const binData,
|
||||
size_t const binLen);
|
||||
|
||||
/* This routine encodes everything in one line. This is needed for HTTP
|
||||
** authentication and similar tasks. */
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_mem_block *
|
||||
xmlrpc_base64_encode_without_newlines(xmlrpc_env * env,
|
||||
unsigned char * bin_data,
|
||||
size_t bin_len);
|
||||
xmlrpc_base64_encode_without_newlines(xmlrpc_env * const envP,
|
||||
const unsigned char * const binData,
|
||||
size_t const binLen);
|
||||
|
||||
/* This decodes Base64 data with or without newlines. */
|
||||
XMLRPC_DLLEXPORT
|
||||
extern xmlrpc_mem_block *
|
||||
xmlrpc_base64_decode(xmlrpc_env * const envP,
|
||||
const char * const ascii_data,
|
||||
size_t const ascii_len);
|
||||
const char * const asciiData,
|
||||
size_t const asciiLen);
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
@@ -645,10 +827,12 @@ xmlrpc_base64_decode(xmlrpc_env * const envP,
|
||||
** a cookie replacement of basic authentication.)
|
||||
**/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void xmlrpc_authcookie_set(xmlrpc_env * const env,
|
||||
const char * const username,
|
||||
const char * const password);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
char *xmlrpc_authcookie(void);
|
||||
|
||||
/*=========================================================================
|
||||
@@ -677,9 +861,11 @@ char *xmlrpc_authcookie(void);
|
||||
#define XMLRPC_XML_SIZE_LIMIT_DEFAULT (512*1024)
|
||||
|
||||
/* Set a specific limit to the specified value. */
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void xmlrpc_limit_set (int const limit_id, size_t const value);
|
||||
|
||||
/* Get the value of a specified limit. */
|
||||
XMLRPC_DLLEXPORT
|
||||
extern size_t xmlrpc_limit_get (int const limit_id);
|
||||
|
||||
|
||||
|
@@ -1,19 +1,24 @@
|
||||
#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/c_util.h>
|
||||
#include <xmlrpc-c/base.h>
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
|
||||
class value {
|
||||
class XMLRPC_DLLEXPORT value {
|
||||
// This is a handle. You don't want to create a pointer to this;
|
||||
// it is in fact a pointer itself.
|
||||
public:
|
||||
@@ -26,6 +31,8 @@ public:
|
||||
~value();
|
||||
|
||||
enum type_t {
|
||||
// These are designed to be identical to the values for
|
||||
// enum xmlrpc_type in the C library.
|
||||
TYPE_INT = 0,
|
||||
TYPE_BOOLEAN = 1,
|
||||
TYPE_DOUBLE = 2,
|
||||
@@ -62,6 +69,8 @@ public:
|
||||
|
||||
xmlrpc_value *
|
||||
cValue() const;
|
||||
// Not to be confused with public 'cvalue' method that all the derived
|
||||
// classes have.
|
||||
|
||||
value(xmlrpc_value * const valueP);
|
||||
|
||||
@@ -72,33 +81,42 @@ public:
|
||||
|
||||
xmlrpc_value * cValueP;
|
||||
// NULL means this is merely a placeholder object.
|
||||
|
||||
protected:
|
||||
void
|
||||
validateInstantiated() const;
|
||||
};
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& out,
|
||||
xmlrpc_c::value::type_t const& type);
|
||||
|
||||
class value_int : public value {
|
||||
|
||||
class XMLRPC_DLLEXPORT value_int : public value {
|
||||
public:
|
||||
value_int(int const cvalue);
|
||||
|
||||
value_int(xmlrpc_c::value const baseValue);
|
||||
|
||||
operator int() const;
|
||||
|
||||
int cvalue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class value_boolean : public value {
|
||||
class XMLRPC_DLLEXPORT value_boolean : public value {
|
||||
public:
|
||||
value_boolean(bool const cvalue);
|
||||
|
||||
value_boolean(xmlrpc_c::value const baseValue);
|
||||
|
||||
operator bool() const;
|
||||
|
||||
bool cvalue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class value_string : public value {
|
||||
class XMLRPC_DLLEXPORT value_string : public value {
|
||||
public:
|
||||
enum nlCode {nlCode_all, nlCode_lf};
|
||||
|
||||
@@ -113,103 +131,274 @@ public:
|
||||
crlfValue() const;
|
||||
|
||||
operator std::string() const;
|
||||
|
||||
std::string cvalue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class value_double : public value {
|
||||
class XMLRPC_DLLEXPORT value_double : public value {
|
||||
public:
|
||||
value_double(double const cvalue);
|
||||
|
||||
value_double(xmlrpc_c::value const baseValue);
|
||||
|
||||
operator double() const;
|
||||
|
||||
double cvalue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class value_datetime : public value {
|
||||
class XMLRPC_DLLEXPORT 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;
|
||||
|
||||
time_t cvalue() const;
|
||||
};
|
||||
|
||||
|
||||
typedef std::vector<unsigned char> cbytestring;
|
||||
|
||||
class value_bytestring : public value {
|
||||
class XMLRPC_DLLEXPORT value_bytestring : public value {
|
||||
public:
|
||||
value_bytestring(std::vector<unsigned char> const& cvalue);
|
||||
value_bytestring(cbytestring 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>
|
||||
cbytestring
|
||||
vectorUcharValue() const;
|
||||
|
||||
cbytestring cvalue() const;
|
||||
|
||||
size_t
|
||||
length() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class value_struct : public value {
|
||||
typedef std::map<std::string, xmlrpc_c::value> cstruct;
|
||||
|
||||
class XMLRPC_DLLEXPORT value_struct : public value {
|
||||
public:
|
||||
value_struct(std::map<std::string, xmlrpc_c::value> const& cvalue);
|
||||
value_struct(cstruct const& cvalue);
|
||||
|
||||
value_struct(xmlrpc_c::value const baseValue);
|
||||
|
||||
operator std::map<std::string, xmlrpc_c::value>() const;
|
||||
operator cstruct() const;
|
||||
|
||||
cstruct cvalue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class value_array : public value {
|
||||
typedef std::vector<xmlrpc_c::value> carray;
|
||||
|
||||
class XMLRPC_DLLEXPORT value_array : public value {
|
||||
public:
|
||||
value_array(std::vector<xmlrpc_c::value> const& cvalue);
|
||||
value_array(carray const& cvalue);
|
||||
|
||||
value_array(xmlrpc_c::value const baseValue);
|
||||
|
||||
std::vector<xmlrpc_c::value>
|
||||
// You can't cast to a vector because the compiler can't tell which
|
||||
// constructor to use (complains about ambiguity). So we have this:
|
||||
carray
|
||||
vectorValueValue() const;
|
||||
|
||||
carray cvalue() const;
|
||||
|
||||
size_t
|
||||
size() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class value_nil : public value {
|
||||
template<class InputIterator> xmlrpc_c::value_array
|
||||
arrayValueSlice(InputIterator begin,
|
||||
InputIterator end) {
|
||||
/*----------------------------------------------------------------------------
|
||||
convert C++ iterator pair to XML-RPC array
|
||||
-----------------------------------------------------------------------------*/
|
||||
carray ret;
|
||||
for (InputIterator p = begin; p != end; ++p) {
|
||||
ret.push_back(toValue(*p));
|
||||
}
|
||||
return xmlrpc_c::value_array(ret);
|
||||
}
|
||||
|
||||
template<class MemberClass> inline xmlrpc_c::value_array
|
||||
arrayValueArray(const MemberClass * const in,
|
||||
size_t const size) {
|
||||
/*----------------------------------------------------------------------------
|
||||
convert C++ array to XML-RPC array
|
||||
-----------------------------------------------------------------------------*/
|
||||
return arrayValueSlice(in, in + size);
|
||||
}
|
||||
|
||||
class XMLRPC_DLLEXPORT value_nil : public value {
|
||||
public:
|
||||
value_nil();
|
||||
|
||||
value_nil(xmlrpc_c::value const baseValue);
|
||||
|
||||
void * cvalue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class value_i8 : public value {
|
||||
class XMLRPC_DLLEXPORT value_i8 : public value {
|
||||
public:
|
||||
value_i8(xmlrpc_int64 const cvalue);
|
||||
|
||||
value_i8(xmlrpc_c::value const baseValue);
|
||||
|
||||
operator xmlrpc_int64() const;
|
||||
|
||||
xmlrpc_int64 cvalue() const;
|
||||
};
|
||||
|
||||
|
||||
inline xmlrpc_c::value_string
|
||||
toValue(const char * const x) {
|
||||
return xmlrpc_c::value_string(x);
|
||||
}
|
||||
|
||||
class fault {
|
||||
inline xmlrpc_c::value_string
|
||||
toValue(std::string const& x) {
|
||||
return xmlrpc_c::value_string(x);
|
||||
}
|
||||
|
||||
inline xmlrpc_c::value_int
|
||||
toValue(int const x) {
|
||||
return xmlrpc_c::value_int(x);
|
||||
}
|
||||
|
||||
inline xmlrpc_c::value_boolean
|
||||
toValue(bool const x) {
|
||||
return xmlrpc_c::value_boolean(x);
|
||||
}
|
||||
|
||||
inline xmlrpc_c::value_double
|
||||
toValue(double const x) {
|
||||
return xmlrpc_c::value_double(x);
|
||||
}
|
||||
|
||||
inline xmlrpc_c::value_bytestring
|
||||
toValue(cbytestring const& x) {
|
||||
return xmlrpc_c::value_bytestring(x);
|
||||
}
|
||||
|
||||
inline const xmlrpc_c::value &
|
||||
toValue(xmlrpc_c::value const& v) {
|
||||
/*----------------------------------------------------------------------------
|
||||
This does a null conversion; you use it to catch all the XML-RPC types that
|
||||
have no usable C++ equivalent, so you can do a toValue() of any XML-RPC
|
||||
type at all. In particular: 'value_datetime', 'value_nil'.
|
||||
-----------------------------------------------------------------------------*/
|
||||
return v;
|
||||
}
|
||||
|
||||
template<class K, class V> xmlrpc_c::value_struct
|
||||
toValue(std::map<K, V> const& in) {
|
||||
/*----------------------------------------------------------------------------
|
||||
convert C++ map to XML-RPC structure
|
||||
-----------------------------------------------------------------------------*/
|
||||
cstruct ret;
|
||||
for (typename std::map<std::string, V>::const_iterator p = in.begin();
|
||||
p != in.end();
|
||||
++p) {
|
||||
ret[p->first] = toValue(p->second);
|
||||
}
|
||||
return xmlrpc_c::value_struct(ret);
|
||||
}
|
||||
|
||||
template<class T> inline xmlrpc_c::value_array
|
||||
toValue(std::vector<T> const& in) {
|
||||
/*----------------------------------------------------------------------------
|
||||
convert C++ vector to XML-RPC array
|
||||
-----------------------------------------------------------------------------*/
|
||||
return arrayValueSlice(in.begin(), in.end());
|
||||
}
|
||||
|
||||
// fromValue() returns via reference argument instead of by return value
|
||||
// so the compiler can tell which version of it to invoke based on the
|
||||
// desired output type.
|
||||
|
||||
inline void
|
||||
fromValue(std::string & y, xmlrpc_c::value const& x) {
|
||||
y = xmlrpc_c::value_string(x);
|
||||
}
|
||||
|
||||
inline void
|
||||
fromValue(int & y, xmlrpc_c::value const& x) {
|
||||
y = xmlrpc_c::value_int(x);
|
||||
}
|
||||
|
||||
inline void
|
||||
fromValue(bool & y, xmlrpc_c::value const& x) {
|
||||
y = xmlrpc_c::value_boolean(x);
|
||||
}
|
||||
|
||||
inline void
|
||||
fromValue(double & y, xmlrpc_c::value const& x) {
|
||||
y = xmlrpc_c::value_double(x);
|
||||
}
|
||||
|
||||
inline void
|
||||
fromValue(cbytestring & y, xmlrpc_c::value const& x) {
|
||||
y = xmlrpc_c::value_bytestring(x).vectorUcharValue();
|
||||
}
|
||||
|
||||
inline void
|
||||
fromValue(xmlrpc_c::value & y, xmlrpc_c::value const& x) {
|
||||
/*----------------------------------------------------------------------------
|
||||
This does a null conversion; it's so you can use fromValue() with
|
||||
an XML-RPC value or C++ value without having to know which it is.
|
||||
One reason you would have an XML-RPC value lying around with C++ values
|
||||
is that some XML-RPC values don't have a common C++ equivalent.
|
||||
-----------------------------------------------------------------------------*/
|
||||
y = x;
|
||||
}
|
||||
|
||||
template<class K, class V> inline void
|
||||
fromValue(std::map<K, V> & y, xmlrpc_c::value const& x) {
|
||||
/*----------------------------------------------------------------------------
|
||||
Convert XML-RPC structure to C++ map.
|
||||
-----------------------------------------------------------------------------*/
|
||||
cstruct m = xmlrpc_c::value_struct(x);
|
||||
y.clear();
|
||||
for (std::map<std::string, xmlrpc_c::value>::const_iterator p = m.begin();
|
||||
p != m.end();
|
||||
++p) {
|
||||
fromValue(y[p->first], p->second);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> inline void
|
||||
fromValue(std::vector<T> & y, xmlrpc_c::value const& x) {
|
||||
/*----------------------------------------------------------------------------
|
||||
Convert XML-RPC array to C++ vector.
|
||||
-----------------------------------------------------------------------------*/
|
||||
carray v = xmlrpc_c::value_array(x).vectorValueValue();
|
||||
y.resize(v.size());
|
||||
for (unsigned int i = 0; i < v.size(); ++i) {
|
||||
fromValue(y[i], v[i]);
|
||||
}
|
||||
}
|
||||
|
||||
class XMLRPC_DLLEXPORT fault {
|
||||
/*----------------------------------------------------------------------------
|
||||
This is an XML-RPC fault.
|
||||
|
||||
@@ -253,7 +442,7 @@ private:
|
||||
std::string description;
|
||||
};
|
||||
|
||||
class rpcOutcome {
|
||||
class XMLRPC_DLLEXPORT rpcOutcome {
|
||||
/*----------------------------------------------------------------------------
|
||||
The outcome of a validly executed RPC -- either an XML-RPC fault
|
||||
or an XML-RPC value of the result.
|
||||
@@ -275,7 +464,7 @@ private:
|
||||
xmlrpc_c::fault fault; // valid if not 'succeeded'
|
||||
};
|
||||
|
||||
class paramList {
|
||||
class XMLRPC_DLLEXPORT paramList {
|
||||
/*----------------------------------------------------------------------------
|
||||
A parameter list of an XML-RPC call.
|
||||
-----------------------------------------------------------------------------*/
|
||||
@@ -288,6 +477,11 @@ public:
|
||||
paramList&
|
||||
addx(xmlrpc_c::value const param);
|
||||
|
||||
template<class T > paramList& addc(const T & x) {
|
||||
xmlrpc_c::paramList::add(toValue(x));
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
size() const;
|
||||
|
||||
@@ -316,15 +510,15 @@ public:
|
||||
std::string
|
||||
getString(unsigned int const paramNumber) const;
|
||||
|
||||
std::vector<unsigned char>
|
||||
cbytestring
|
||||
getBytestring(unsigned int const paramNumber) const;
|
||||
|
||||
std::vector<xmlrpc_c::value>
|
||||
carray
|
||||
getArray(unsigned int const paramNumber,
|
||||
unsigned int const minSize = 0,
|
||||
unsigned int const maxSize = UINT_MAX) const;
|
||||
|
||||
std::map<std::string, xmlrpc_c::value>
|
||||
cstruct
|
||||
getStruct(unsigned int const paramNumber) const;
|
||||
|
||||
void
|
||||
|
@@ -4,18 +4,21 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
|
||||
enum newlineCtl {NEWLINE_NO, NEWLINE_YES};
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
std::string
|
||||
base64FromBytes(
|
||||
std::vector<unsigned char> const& bytes,
|
||||
xmlrpc_c::newlineCtl const newlineCtl = xmlrpc_c::NEWLINE_YES);
|
||||
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
std::vector<unsigned char>
|
||||
bytesFromBase64(std::string const& base64);
|
||||
|
||||
|
11
libs/xmlrpc-c/include/xmlrpc-c/base64_int.h
Normal file
11
libs/xmlrpc-c/include/xmlrpc-c/base64_int.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef BASE64_INT_H_INCLUDED
|
||||
#define BASE64_INT_H_INCLUDED
|
||||
|
||||
#include "xmlrpc-c/c_util.h"
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_base64Encode(const char * const chars,
|
||||
char * const base64);
|
||||
|
||||
#endif
|
@@ -18,14 +18,14 @@
|
||||
#include "bool.h"
|
||||
#include "int.h"
|
||||
|
||||
#include <xmlrpc-c/base.h>
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/util_int.h>
|
||||
#include <xmlrpc-c/base.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
struct _xmlrpc_value {
|
||||
xmlrpc_type _type;
|
||||
int _refcount;
|
||||
@@ -36,8 +36,13 @@ struct _xmlrpc_value {
|
||||
xmlrpc_int64 i8;
|
||||
xmlrpc_bool b;
|
||||
double d;
|
||||
/* time_t t */
|
||||
void * c_ptr;
|
||||
xmlrpc_datetime dt;
|
||||
/* NOTE: may be invalid! e.g. February 30 */
|
||||
struct {
|
||||
void * objectP;
|
||||
xmlrpc_cptr_dtor_fn dtor; // NULL if none
|
||||
void * dtorContext;
|
||||
} cptr;
|
||||
} _value;
|
||||
|
||||
/* Other data types use a memory block.
|
||||
@@ -77,6 +82,15 @@ struct _xmlrpc_value {
|
||||
This member is always NULL on a system that does not have
|
||||
Unicode wchar functions.
|
||||
*/
|
||||
void * _cache;
|
||||
/* This is a hack to support the old style memory management in which
|
||||
one gets a pointer into memory that belongs to the xmlrpc_value
|
||||
object; i.e. the caller of xmlrpc_read_datetime_str_old() doesn't
|
||||
get memory that he is responsible for freeing.
|
||||
|
||||
This is essentially a cached value of the result of a
|
||||
xmlrpc_read_datetime_str_old(). NULL means nothing cached.
|
||||
*/
|
||||
};
|
||||
|
||||
#define XMLRPC_ASSERT_VALUE_OK(val) \
|
||||
@@ -97,24 +111,34 @@ typedef struct {
|
||||
} _struct_member;
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_createXmlrpcValue(xmlrpc_env * const envP,
|
||||
xmlrpc_value ** const valPP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
xmlrpc_typeName(xmlrpc_type const type);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_traceXml(const char * const label,
|
||||
const char * const xml,
|
||||
unsigned int const xmlLength);
|
||||
size_t const xmlLength);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_destroyString(xmlrpc_value * const stringP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_destroyDatetime(xmlrpc_value * const datetimeP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_destroyStruct(xmlrpc_value * const structP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_destroyArrayContents(xmlrpc_value * const arrayP);
|
||||
|
||||
@@ -130,16 +154,19 @@ xmlrpc_destroyArrayContents(xmlrpc_value * const arrayP);
|
||||
new memory for them.
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_datetime_str_old(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
const char ** const stringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_old(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
const char ** const stringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_lp_old(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
@@ -147,11 +174,13 @@ xmlrpc_read_string_lp_old(xmlrpc_env * const envP,
|
||||
const char ** const stringValueP);
|
||||
|
||||
#if XMLRPC_HAVE_WCHAR
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_w_old(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const valueP,
|
||||
const wchar_t ** const stringValueP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_string_w_lp_old(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const valueP,
|
||||
@@ -159,6 +188,7 @@ xmlrpc_read_string_w_lp_old(xmlrpc_env * const envP,
|
||||
const wchar_t ** const stringValueP);
|
||||
#endif
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_read_base64_old(xmlrpc_env * const envP,
|
||||
const xmlrpc_value * const valueP,
|
||||
|
@@ -1,14 +1,31 @@
|
||||
#ifndef XMLRPC_C_C_UTIL_H_INCLUDED
|
||||
#define XMLRPC_C_C_UTIL_H_INCLUDED
|
||||
|
||||
/* GNU_PRINTF_ATTR lets the GNU compiler check printf-type
|
||||
/* C language stuff. Doesn't involve any libraries that aren't part of
|
||||
the compiler.
|
||||
*/
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
/* XMLRPC_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)))
|
||||
#define XMLRPC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
|
||||
#define XMLRPC_NORETURN_ATTR __attribute__((noreturn))
|
||||
#else
|
||||
#define GNU_PRINTF_ATTR(a,b)
|
||||
#define XMLRPC_PRINTF_ATTR(a,b)
|
||||
#define XMLRPC_NORETURN_ATTR
|
||||
#endif
|
||||
|
||||
/* XMLRPC_DLLEXPORT is an attribute of an external symbols that says it
|
||||
is to be exported from a library that contains it.
|
||||
*/
|
||||
#if defined(_DLL) && defined(_MSC_VER) && _MSC_VER >= 1500
|
||||
#define XMLRPC_DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define XMLRPC_DLLEXPORT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -10,6 +10,8 @@
|
||||
#ifndef XMLRPC_CLIENT_H_INCLUDED
|
||||
#define XMLRPC_CLIENT_H_INCLUDED
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/base.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -39,8 +41,11 @@ typedef struct xmlrpc_client_transport_ops xmlrpc_client_transport_ops;
|
||||
so now we just use void * as a base class pointer.
|
||||
*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
extern struct xmlrpc_client_transport_ops xmlrpc_libwww_transport_ops;
|
||||
XMLRPC_DLLEXPORT
|
||||
extern struct xmlrpc_client_transport_ops xmlrpc_wininet_transport_ops;
|
||||
XMLRPC_DLLEXPORT
|
||||
extern struct xmlrpc_client_transport_ops xmlrpc_curl_transport_ops;
|
||||
|
||||
enum xmlrpc_sslversion {
|
||||
@@ -50,6 +55,29 @@ enum xmlrpc_sslversion {
|
||||
XMLRPC_SSLVERSION_SSLv3
|
||||
};
|
||||
|
||||
|
||||
enum xmlrpc_httpauthtype {
|
||||
/* These are just constants. They can be or'ed as integers to create
|
||||
a set.
|
||||
*/
|
||||
XMLRPC_HTTPAUTH_BASIC = (1<<0),
|
||||
XMLRPC_HTTPAUTH_DIGEST = (1<<1),
|
||||
XMLRPC_HTTPAUTH_GSSNEGOTIATE = (1<<2),
|
||||
XMLRPC_HTTPAUTH_NTLM = (1<<3),
|
||||
};
|
||||
|
||||
/* The following are useful combinations of the HTTP authentication types
|
||||
above.
|
||||
*/
|
||||
#define XMLRPC_HTTPAUTH_NONE 0
|
||||
#define XMLRPC_HTTPAUTH_ANY ~0
|
||||
#define XMLRPC_HTTPAUTH_ANYSAFE (~XMLRPC_HTTPAUTH_BASIC)
|
||||
|
||||
enum xmlrpc_httpproxytype {
|
||||
XMLRPC_HTTPPROXY_HTTP = 0,
|
||||
XMLRPC_HTTPPROXY_SOCKS5 = 5
|
||||
};
|
||||
|
||||
struct xmlrpc_curl_xportparms {
|
||||
/* This is designed so that zero values are always the defaults. */
|
||||
const char * network_interface;
|
||||
@@ -71,6 +99,15 @@ struct xmlrpc_curl_xportparms {
|
||||
const char * egdsocket;
|
||||
const char * ssl_cipher_list;
|
||||
unsigned int timeout;
|
||||
xmlrpc_bool dont_advertise;
|
||||
const char * proxy;
|
||||
unsigned int proxy_port;
|
||||
enum xmlrpc_httpproxytype proxy_type;
|
||||
unsigned int proxy_auth;
|
||||
/* A set of authentication schemes -- an OR of
|
||||
enum xmlrpc_httpproxyauth values
|
||||
*/
|
||||
const char * proxy_userpwd;
|
||||
};
|
||||
|
||||
|
||||
@@ -88,6 +125,19 @@ struct xmlrpc_wininet_xportparms {
|
||||
|
||||
/* XMLRPC_WXPSIZE(xyz) is analogous to XMLRPC_CPSIZE, below */
|
||||
|
||||
struct xmlrpc_transfer_progress {
|
||||
double total;
|
||||
double now;
|
||||
};
|
||||
|
||||
struct xmlrpc_progress_data {
|
||||
struct xmlrpc_transfer_progress call;
|
||||
struct xmlrpc_transfer_progress response;
|
||||
};
|
||||
|
||||
typedef void xmlrpc_progress_fn(void * const,
|
||||
struct xmlrpc_progress_data const);
|
||||
|
||||
struct xmlrpc_clientparms {
|
||||
/* (transport, transportparmsP, transportparm_size) and
|
||||
(transportOpsP, transportP) are mutually exclusive.
|
||||
@@ -100,6 +150,7 @@ struct xmlrpc_clientparms {
|
||||
const struct xmlrpc_client_transport_ops * transportOpsP;
|
||||
xmlrpc_client_transport * transportP;
|
||||
xmlrpc_dialect dialect;
|
||||
xmlrpc_progress_fn * progressFn;
|
||||
};
|
||||
|
||||
#define XMLRPC_CPSIZE(mbrname) \
|
||||
@@ -112,23 +163,24 @@ struct xmlrpc_clientparms {
|
||||
not the caller is new enough to have supplied a certain parameter.
|
||||
*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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
|
||||
** arguments except 'userHandle' 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
|
||||
** WARNING: 'paramArray' 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);
|
||||
typedef void xmlrpc_response_handler(const char * serverUrl,
|
||||
const char * methodName,
|
||||
xmlrpc_value * paramArray,
|
||||
void * userHandle,
|
||||
xmlrpc_env * fault,
|
||||
xmlrpc_value * result);
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
@@ -147,73 +199,98 @@ typedef void (*xmlrpc_response_handler) (const char *server_url,
|
||||
typedef struct _xmlrpc_server_info xmlrpc_server_info;
|
||||
|
||||
/* Create a new server info record, pointing to the specified server. */
|
||||
XMLRPC_DLLEXPORT
|
||||
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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
extern xmlrpc_server_info *
|
||||
xmlrpc_server_info_copy(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const srcP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_free(xmlrpc_server_info * const serverP);
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_set_user(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const serverInfoP,
|
||||
const char * const username,
|
||||
const char * const password);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_set_basic_auth(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const serverP,
|
||||
const char * const username,
|
||||
const char * const password);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_allow_auth_basic(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const sP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_disallow_auth_basic(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const sP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_allow_auth_digest(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const sP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_disallow_auth_digest(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const sP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_allow_auth_negotiate(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const sP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_disallow_auth_negotiate(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const sP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_allow_auth_ntlm(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const sP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_info_disallow_auth_ntlm(xmlrpc_env * const envP,
|
||||
xmlrpc_server_info * const sP);
|
||||
|
||||
/* These are for backward compatibility -- they can't be exported from a
|
||||
Windows DLL. xmlrpc_server_version() is preferred.
|
||||
*/
|
||||
extern unsigned int const xmlrpc_client_version_major;
|
||||
extern unsigned int const xmlrpc_client_version_minor;
|
||||
extern unsigned int const xmlrpc_client_version_point;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_version(unsigned int * const majorP,
|
||||
unsigned int * const minorP,
|
||||
unsigned int * const pointP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_setup_global_const(xmlrpc_env * const envP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_teardown_global_const(void);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_create(xmlrpc_env * const envP,
|
||||
int const flags,
|
||||
@@ -223,9 +300,11 @@ xmlrpc_client_create(xmlrpc_env * const envP,
|
||||
unsigned int const parmSize,
|
||||
xmlrpc_client ** const clientPP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_destroy(xmlrpc_client * const clientP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_transport_call2(
|
||||
xmlrpc_env * const envP,
|
||||
@@ -234,6 +313,7 @@ xmlrpc_client_transport_call2(
|
||||
xmlrpc_mem_block * const callXmlP,
|
||||
xmlrpc_mem_block ** const respXmlPP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_call2(xmlrpc_env * const envP,
|
||||
struct xmlrpc_client * const clientP,
|
||||
@@ -242,6 +322,7 @@ xmlrpc_client_call2(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const paramArrayP,
|
||||
xmlrpc_value ** const resultPP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_call2f(xmlrpc_env * const envP,
|
||||
xmlrpc_client * const clientP,
|
||||
@@ -251,32 +332,58 @@ xmlrpc_client_call2f(xmlrpc_env * const envP,
|
||||
const char * const format,
|
||||
...);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_call2f_va(xmlrpc_env * const envP,
|
||||
xmlrpc_client * const clientP,
|
||||
const char * const serverUrl,
|
||||
const char * const methodName,
|
||||
const char * const format,
|
||||
xmlrpc_value ** const resultPP,
|
||||
va_list args);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_event_loop_finish(xmlrpc_client * const clientP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_event_loop_finish_timeout(xmlrpc_client * const clientP,
|
||||
unsigned long const milliseconds);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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);
|
||||
xmlrpc_client_start_rpc(xmlrpc_env * const envP,
|
||||
struct xmlrpc_client * const clientP,
|
||||
const xmlrpc_server_info * const serverInfoP,
|
||||
const char * const methodName,
|
||||
xmlrpc_value * const paramArrayP,
|
||||
xmlrpc_response_handler responseHandler,
|
||||
void * const userData);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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,
|
||||
xmlrpc_response_handler responseHandler,
|
||||
void * const userData,
|
||||
const char * const format,
|
||||
...);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_start_rpcf_va(xmlrpc_env * const envP,
|
||||
xmlrpc_client * const clientP,
|
||||
const char * const serverUrl,
|
||||
const char * const methodName,
|
||||
xmlrpc_response_handler responseHandler,
|
||||
void * const userData,
|
||||
const char * const format,
|
||||
va_list args);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_set_interrupt(xmlrpc_client * const clientP,
|
||||
int * const interruptP);
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/girerr.hpp>
|
||||
#include <xmlrpc-c/girmem.hpp>
|
||||
#include <xmlrpc-c/base.hpp>
|
||||
@@ -13,9 +14,9 @@
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
class clientTransactionPtr;
|
||||
class XMLRPC_DLLEXPORT clientTransactionPtr;
|
||||
|
||||
class clientTransaction : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT clientTransaction : public girmem::autoObject {
|
||||
|
||||
friend class clientTransactionPtr;
|
||||
|
||||
@@ -26,11 +27,14 @@ public:
|
||||
virtual void
|
||||
finishErr(girerr::error const& error) = 0;
|
||||
|
||||
virtual void
|
||||
progress(struct xmlrpc_progress_data const& progressData) const = 0;
|
||||
|
||||
protected:
|
||||
clientTransaction();
|
||||
};
|
||||
|
||||
class clientTransactionPtr : public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT clientTransactionPtr : public girmem::autoObjectPtr {
|
||||
|
||||
public:
|
||||
clientTransactionPtr();
|
||||
@@ -43,9 +47,9 @@ public:
|
||||
operator->() const;
|
||||
};
|
||||
|
||||
class clientPtr;
|
||||
class XMLRPC_DLLEXPORT clientPtr;
|
||||
|
||||
class client : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT 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.
|
||||
@@ -77,7 +81,7 @@ public:
|
||||
setInterrupt(int *);
|
||||
};
|
||||
|
||||
class clientPtr : public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT clientPtr : public girmem::autoObjectPtr {
|
||||
public:
|
||||
clientPtr();
|
||||
|
||||
@@ -90,7 +94,7 @@ public:
|
||||
get() const;
|
||||
};
|
||||
|
||||
class serverAccessor : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT serverAccessor : public girmem::autoObject {
|
||||
|
||||
public:
|
||||
serverAccessor(xmlrpc_c::clientPtr const clientP,
|
||||
@@ -106,7 +110,7 @@ private:
|
||||
xmlrpc_c::carriageParmPtr const carriageParmP;
|
||||
};
|
||||
|
||||
class serverAccessorPtr : public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT serverAccessorPtr : public girmem::autoObjectPtr {
|
||||
public:
|
||||
serverAccessorPtr();
|
||||
|
||||
@@ -120,7 +124,7 @@ public:
|
||||
get() const;
|
||||
};
|
||||
|
||||
class connection {
|
||||
class XMLRPC_DLLEXPORT connection {
|
||||
/*----------------------------------------------------------------------------
|
||||
A nexus of a particular client and a particular server, along with
|
||||
carriage parameters for performing RPCs between the two.
|
||||
@@ -140,7 +144,7 @@ public:
|
||||
xmlrpc_c::carriageParm * carriageParmP;
|
||||
};
|
||||
|
||||
class client_xml : public xmlrpc_c::client {
|
||||
class XMLRPC_DLLEXPORT 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).
|
||||
@@ -180,7 +184,7 @@ private:
|
||||
struct client_xml_impl * implP;
|
||||
};
|
||||
|
||||
class xmlTransaction_client : public xmlrpc_c::xmlTransaction {
|
||||
class XMLRPC_DLLEXPORT xmlTransaction_client : public xmlrpc_c::xmlTransaction {
|
||||
|
||||
public:
|
||||
xmlTransaction_client(xmlrpc_c::clientTransactionPtr const& tranP);
|
||||
@@ -190,11 +194,15 @@ public:
|
||||
|
||||
void
|
||||
finishErr(girerr::error const& error) const;
|
||||
|
||||
void
|
||||
progress(xmlrpc_progress_data const& progressData) const;
|
||||
|
||||
private:
|
||||
xmlrpc_c::clientTransactionPtr const tranP;
|
||||
};
|
||||
|
||||
class xmlTransaction_clientPtr : public xmlTransactionPtr {
|
||||
class XMLRPC_DLLEXPORT xmlTransaction_clientPtr : public xmlTransactionPtr {
|
||||
public:
|
||||
xmlTransaction_clientPtr();
|
||||
|
||||
@@ -206,21 +214,23 @@ public:
|
||||
|
||||
class rpcPtr;
|
||||
|
||||
class rpc : public clientTransaction {
|
||||
class XMLRPC_DLLEXPORT 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.
|
||||
|
||||
|
||||
You don't normally create or reference an object of this class directly,
|
||||
but rather via an 'rpcPtr' object. That takes care of deleting the object
|
||||
when you are done with it (but not before). This is critical if you plan
|
||||
to use the 'start' method, because without an rpcPtr reference, the system
|
||||
will destroy the object under the covers when the RPC finishes, and there
|
||||
is no way for you to guarantee you won't still access it after it finishes
|
||||
(because of accesses within Xmlrpc-c calls such as the call that finishes
|
||||
the RPC or just rpc::start).
|
||||
|
||||
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.
|
||||
class that defines a useful notifyComplete().
|
||||
-----------------------------------------------------------------------------*/
|
||||
friend class xmlrpc_c::rpcPtr;
|
||||
|
||||
@@ -248,6 +258,9 @@ public:
|
||||
virtual void
|
||||
notifyComplete();
|
||||
|
||||
virtual void
|
||||
progress(struct xmlrpc_progress_data const& progressData) const;
|
||||
|
||||
bool
|
||||
isFinished() const;
|
||||
|
||||
@@ -269,7 +282,7 @@ private:
|
||||
struct rpc_impl * implP;
|
||||
};
|
||||
|
||||
class rpcPtr : public clientTransactionPtr {
|
||||
class XMLRPC_DLLEXPORT rpcPtr : public clientTransactionPtr {
|
||||
public:
|
||||
rpcPtr();
|
||||
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#ifndef CLIENT_GLOBAL_H_INCLUDED
|
||||
#define CLIENT_GLOBAL_H_INCLUDED
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/client.h>
|
||||
|
||||
/*=========================================================================
|
||||
** Initialization and Shutdown
|
||||
**=========================================================================
|
||||
@@ -12,11 +15,13 @@
|
||||
#define XMLRPC_CLIENT_NO_FLAGS (0)
|
||||
#define XMLRPC_CLIENT_SKIP_LIBWWW_INIT (1)
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void
|
||||
xmlrpc_client_init(int const flags,
|
||||
const char * const appname,
|
||||
const char * const appversion);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_init2(xmlrpc_env * const env,
|
||||
int const flags,
|
||||
@@ -25,6 +30,7 @@ xmlrpc_client_init2(xmlrpc_env * const env,
|
||||
const struct xmlrpc_clientparms * const clientparms,
|
||||
unsigned int const parm_size);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void
|
||||
xmlrpc_client_cleanup(void);
|
||||
|
||||
@@ -35,6 +41,7 @@ xmlrpc_client_cleanup(void);
|
||||
** functions from inside an asynchronous callback!
|
||||
*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_client_call(xmlrpc_env * const envP,
|
||||
const char * const server_url,
|
||||
@@ -42,12 +49,14 @@ xmlrpc_client_call(xmlrpc_env * const envP,
|
||||
const char * const format,
|
||||
...);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_client_call_params(xmlrpc_env * const envP,
|
||||
const char * const serverUrl,
|
||||
const char * const methodName,
|
||||
xmlrpc_value * const paramArrayP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_client_call_server(xmlrpc_env * const envP,
|
||||
const xmlrpc_server_info * const server,
|
||||
@@ -55,6 +64,7 @@ xmlrpc_client_call_server(xmlrpc_env * const envP,
|
||||
const char * const format,
|
||||
...);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_value *
|
||||
xmlrpc_client_call_server_params(
|
||||
xmlrpc_env * const envP,
|
||||
@@ -62,6 +72,7 @@ xmlrpc_client_call_server_params(
|
||||
const char * const method_name,
|
||||
xmlrpc_value * const paramArrayP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_transport_call(
|
||||
xmlrpc_env * const envP,
|
||||
@@ -83,6 +94,7 @@ xmlrpc_client_transport_call(
|
||||
** 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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_call_asynch(const char * const server_url,
|
||||
const char * const method_name,
|
||||
@@ -93,6 +105,7 @@ xmlrpc_client_call_asynch(const char * const server_url,
|
||||
|
||||
/* As above, but use an xmlrpc_server_info object. The server object can be
|
||||
** safely destroyed as soon as this function returns. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_call_server_asynch(xmlrpc_server_info * const server,
|
||||
const char * const method_name,
|
||||
@@ -104,6 +117,7 @@ xmlrpc_client_call_server_asynch(xmlrpc_server_info * const server,
|
||||
/* As above, but the parameter list is supplied as an xmlrpc_value
|
||||
** containing an array.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_call_asynch_params(const char * const server_url,
|
||||
const char * const method_name,
|
||||
@@ -113,6 +127,7 @@ xmlrpc_client_call_asynch_params(const char * const server_url,
|
||||
|
||||
/* As above, but use an xmlrpc_server_info object. The server object can be
|
||||
** safely destroyed as soon as this function returns. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_client_call_server_asynch_params(
|
||||
xmlrpc_server_info * const server,
|
||||
@@ -130,11 +145,13 @@ xmlrpc_client_call_server_asynch_params(
|
||||
|
||||
/* Finish all outstanding asynchronous calls. Alternatively, the loop
|
||||
** will exit if someone calls xmlrpc_client_event_loop_end. */
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void
|
||||
xmlrpc_client_event_loop_finish_asynch(void);
|
||||
|
||||
|
||||
/* Finish all outstanding asynchronous calls. */
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void
|
||||
xmlrpc_client_event_loop_finish_asynch_timeout(unsigned long const milliseconds);
|
||||
|
||||
|
@@ -86,6 +86,35 @@ xmlrpc_client_event_loop_end (void);
|
||||
extern int
|
||||
xmlrpc_client_asynch_calls_are_unfinished (void);
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
** Interface between global client and general client functions.
|
||||
** (These are necessary because there are some global client functions
|
||||
** that don't have exported private client versions because we don't like
|
||||
** them and have them for global functions only for backward compatibility.
|
||||
** The global client functions existed before any private client ones did).
|
||||
**========================================================================= */
|
||||
void
|
||||
xmlrpc_client_call_server2_va(xmlrpc_env * const envP,
|
||||
struct xmlrpc_client * const clientP,
|
||||
const xmlrpc_server_info * const serverInfoP,
|
||||
const char * const methodName,
|
||||
const char * const format,
|
||||
va_list args,
|
||||
xmlrpc_value ** const resultPP);
|
||||
|
||||
void
|
||||
xmlrpc_client_start_rpcf_server_va(
|
||||
xmlrpc_env * const envP,
|
||||
struct xmlrpc_client * const clientP,
|
||||
const xmlrpc_server_info * const serverInfoP,
|
||||
const char * const methodName,
|
||||
xmlrpc_response_handler responseHandler,
|
||||
void * const userData,
|
||||
const char * const format,
|
||||
va_list args);
|
||||
|
||||
/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -3,13 +3,13 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/base.hpp>
|
||||
#include <xmlrpc-c/client.hpp>
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
|
||||
class clientSimple {
|
||||
class XMLRPC_DLLEXPORT clientSimple {
|
||||
|
||||
public:
|
||||
clientSimple();
|
||||
|
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/util.h>
|
||||
#include <xmlrpc-c/client.h>
|
||||
#include <xmlrpc-c/girerr.hpp>
|
||||
@@ -11,9 +13,9 @@
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
class carriageParmPtr;
|
||||
class XMLRPC_DLLEXPORT carriageParmPtr;
|
||||
|
||||
class carriageParm : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT 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
|
||||
@@ -30,7 +32,7 @@ protected:
|
||||
carriageParm();
|
||||
};
|
||||
|
||||
class carriageParmPtr : public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT carriageParmPtr : public girmem::autoObjectPtr {
|
||||
|
||||
public:
|
||||
carriageParmPtr();
|
||||
@@ -46,9 +48,9 @@ public:
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class xmlTransactionPtr;
|
||||
class XMLRPC_DLLEXPORT xmlTransactionPtr;
|
||||
|
||||
class xmlTransaction : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT xmlTransaction : public girmem::autoObject {
|
||||
|
||||
friend class xmlTransactionPtr;
|
||||
|
||||
@@ -59,11 +61,14 @@ public:
|
||||
virtual void
|
||||
finishErr(girerr::error const& error) const;
|
||||
|
||||
virtual void
|
||||
progress(struct xmlrpc_progress_data const& progressData) const;
|
||||
|
||||
protected:
|
||||
xmlTransaction();
|
||||
};
|
||||
|
||||
class xmlTransactionPtr : public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT xmlTransactionPtr : public girmem::autoObjectPtr {
|
||||
public:
|
||||
xmlTransactionPtr();
|
||||
|
||||
@@ -75,7 +80,7 @@ public:
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class clientXmlTransport : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT clientXmlTransport : public girmem::autoObject {
|
||||
/*----------------------------------------------------------------------------
|
||||
An object which transports XML to and from an XML-RPC server for an
|
||||
XML-RPC client.
|
||||
@@ -105,11 +110,16 @@ public:
|
||||
xmlrpc_mem_block * const responseXmlMP,
|
||||
xmlrpc_env const transportEnv);
|
||||
|
||||
static void
|
||||
progress(
|
||||
struct xmlrpc_call_info * const callInfoP,
|
||||
struct xmlrpc_progress_data const progressData);
|
||||
|
||||
virtual void
|
||||
setInterrupt(int * const interruptP);
|
||||
};
|
||||
|
||||
class clientXmlTransportPtr : public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT clientXmlTransportPtr : public girmem::autoObjectPtr {
|
||||
|
||||
public:
|
||||
clientXmlTransportPtr();
|
||||
@@ -127,7 +137,7 @@ public:
|
||||
HTTP
|
||||
===========================================================================*/
|
||||
|
||||
class carriageParm_http0 : public xmlrpc_c::carriageParm {
|
||||
class XMLRPC_DLLEXPORT carriageParm_http0 : public xmlrpc_c::carriageParm {
|
||||
|
||||
public:
|
||||
carriageParm_http0(std::string const serverUrl);
|
||||
@@ -179,7 +189,7 @@ protected:
|
||||
instantiate(std::string const serverUrl);
|
||||
};
|
||||
|
||||
class carriageParm_http0Ptr : public xmlrpc_c::carriageParmPtr {
|
||||
class XMLRPC_DLLEXPORT carriageParm_http0Ptr : public xmlrpc_c::carriageParmPtr {
|
||||
|
||||
public:
|
||||
carriageParm_http0Ptr();
|
||||
@@ -189,7 +199,7 @@ public:
|
||||
operator->() const;
|
||||
};
|
||||
|
||||
class clientXmlTransport_http : public xmlrpc_c::clientXmlTransport {
|
||||
class XMLRPC_DLLEXPORT clientXmlTransport_http : public xmlrpc_c::clientXmlTransport {
|
||||
/*----------------------------------------------------------------------------
|
||||
A base class for client XML transports that use the simple, classic
|
||||
C HTTP transports.
|
||||
@@ -230,13 +240,13 @@ protected:
|
||||
curl
|
||||
===========================================================================*/
|
||||
|
||||
class carriageParm_curl0 : public xmlrpc_c::carriageParm_http0 {
|
||||
class XMLRPC_DLLEXPORT carriageParm_curl0 : public xmlrpc_c::carriageParm_http0 {
|
||||
|
||||
public:
|
||||
carriageParm_curl0(std::string const serverUrl);
|
||||
};
|
||||
|
||||
class carriageParm_curl0Ptr : public xmlrpc_c::carriageParm_http0Ptr {
|
||||
class XMLRPC_DLLEXPORT carriageParm_curl0Ptr : public xmlrpc_c::carriageParm_http0Ptr {
|
||||
|
||||
public:
|
||||
carriageParm_curl0Ptr();
|
||||
@@ -246,16 +256,21 @@ public:
|
||||
operator->() const;
|
||||
};
|
||||
|
||||
class clientXmlTransport_curl : public xmlrpc_c::clientXmlTransport_http {
|
||||
class XMLRPC_DLLEXPORT clientXmlTransport_curl : public xmlrpc_c::clientXmlTransport_http {
|
||||
|
||||
public:
|
||||
struct constrOpt_impl;
|
||||
|
||||
class constrOpt {
|
||||
public:
|
||||
constrOpt();
|
||||
~constrOpt();
|
||||
constrOpt(constrOpt&);
|
||||
|
||||
constrOpt & network_interface (std::string const& arg);
|
||||
constrOpt & no_ssl_verifypeer (bool const& arg);
|
||||
constrOpt & no_ssl_verifyhost (bool const& arg);
|
||||
constrOpt & dont_advertise (bool const& arg);
|
||||
constrOpt & user_agent (std::string const& arg);
|
||||
constrOpt & ssl_cert (std::string const& arg);
|
||||
constrOpt & sslcerttype (std::string const& arg);
|
||||
@@ -272,49 +287,15 @@ public:
|
||||
constrOpt & egdsocket (std::string const& arg);
|
||||
constrOpt & ssl_cipher_list (std::string const& arg);
|
||||
constrOpt & timeout (unsigned int const& arg);
|
||||
constrOpt & proxy (std::string const& arg);
|
||||
constrOpt & proxy_port (unsigned int const& arg);
|
||||
constrOpt & proxy_auth (unsigned int const& arg);
|
||||
constrOpt & proxy_userpwd (std::string const& arg);
|
||||
constrOpt & proxy_type (xmlrpc_httpproxytype 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;
|
||||
private:
|
||||
struct constrOpt_impl * implP;
|
||||
friend class clientXmlTransport_curl;
|
||||
};
|
||||
|
||||
clientXmlTransport_curl(constrOpt const& opt);
|
||||
@@ -335,14 +316,14 @@ private:
|
||||
libwww
|
||||
===========================================================================*/
|
||||
|
||||
class carriageParm_libwww0 : public xmlrpc_c::carriageParm_http0 {
|
||||
class XMLRPC_DLLEXPORT carriageParm_libwww0 : public xmlrpc_c::carriageParm_http0 {
|
||||
|
||||
public:
|
||||
carriageParm_libwww0(std::string const serverUrl);
|
||||
|
||||
};
|
||||
|
||||
class carriageParm_libwww0Ptr : public xmlrpc_c::carriageParm_http0Ptr {
|
||||
class XMLRPC_DLLEXPORT carriageParm_libwww0Ptr : public xmlrpc_c::carriageParm_http0Ptr {
|
||||
|
||||
public:
|
||||
carriageParm_libwww0Ptr();
|
||||
@@ -352,7 +333,7 @@ public:
|
||||
operator->() const;
|
||||
};
|
||||
|
||||
class clientXmlTransport_libwww : public xmlrpc_c::clientXmlTransport_http {
|
||||
class XMLRPC_DLLEXPORT clientXmlTransport_libwww : public xmlrpc_c::clientXmlTransport_http {
|
||||
|
||||
public:
|
||||
clientXmlTransport_libwww(std::string const appname = "",
|
||||
@@ -365,14 +346,14 @@ public:
|
||||
wininet
|
||||
===========================================================================*/
|
||||
|
||||
class carriageParm_wininet0 : public xmlrpc_c::carriageParm_http0 {
|
||||
class XMLRPC_DLLEXPORT carriageParm_wininet0 : public xmlrpc_c::carriageParm_http0 {
|
||||
|
||||
public:
|
||||
carriageParm_wininet0(std::string const serverUrl);
|
||||
|
||||
};
|
||||
|
||||
class carriageParm_wininet0Ptr : public xmlrpc_c::carriageParm_http0Ptr {
|
||||
class XMLRPC_DLLEXPORT carriageParm_wininet0Ptr : public xmlrpc_c::carriageParm_http0Ptr {
|
||||
|
||||
public:
|
||||
carriageParm_wininet0Ptr();
|
||||
@@ -382,7 +363,7 @@ public:
|
||||
operator->() const;
|
||||
};
|
||||
|
||||
class clientXmlTransport_wininet : public xmlrpc_c::clientXmlTransport_http {
|
||||
class XMLRPC_DLLEXPORT clientXmlTransport_wininet : public xmlrpc_c::clientXmlTransport_http {
|
||||
|
||||
public:
|
||||
clientXmlTransport_wininet(bool const allowInvalidSslCerts = false);
|
||||
@@ -394,15 +375,15 @@ public:
|
||||
pstream
|
||||
===========================================================================*/
|
||||
|
||||
class packetSocket;
|
||||
class XMLRPC_DLLEXPORT packetSocket;
|
||||
|
||||
class carriageParm_pstream : public xmlrpc_c::carriageParm {
|
||||
class XMLRPC_DLLEXPORT 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 {
|
||||
class XMLRPC_DLLEXPORT carriageParm_pstreamPtr : public xmlrpc_c::carriageParmPtr {
|
||||
|
||||
public:
|
||||
carriageParm_pstreamPtr();
|
||||
@@ -413,21 +394,22 @@ public:
|
||||
operator->() const;
|
||||
};
|
||||
|
||||
class clientXmlTransport_pstream : public xmlrpc_c::clientXmlTransport {
|
||||
class XMLRPC_DLLEXPORT clientXmlTransport_pstream : public xmlrpc_c::clientXmlTransport {
|
||||
|
||||
public:
|
||||
struct constrOpt_impl;
|
||||
|
||||
class constrOpt {
|
||||
public:
|
||||
constrOpt();
|
||||
~constrOpt();
|
||||
constrOpt(constrOpt&);
|
||||
|
||||
constrOpt & fd (int const& arg);
|
||||
|
||||
struct {
|
||||
int fd;
|
||||
} value;
|
||||
struct {
|
||||
bool fd;
|
||||
} present;
|
||||
private:
|
||||
struct constrOpt_impl * implP;
|
||||
friend class clientXmlTransport_pstream;
|
||||
};
|
||||
|
||||
clientXmlTransport_pstream(constrOpt const& opt);
|
||||
|
@@ -1,37 +0,0 @@
|
||||
#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 @HAVE_WCHAR_H_DEFINE@
|
||||
#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
|
@@ -4,11 +4,13 @@
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
|
||||
#define HAVE_GIRERR_ERROR
|
||||
|
||||
namespace girerr {
|
||||
|
||||
class error : public std::exception {
|
||||
class XMLRPC_DLLEXPORT error : public std::exception {
|
||||
public:
|
||||
error(std::string const& what_arg) : _what(what_arg) {}
|
||||
|
||||
@@ -23,8 +25,11 @@ private:
|
||||
|
||||
// throwf() always throws a girerr::error .
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
throwf(const char * const format, ...);
|
||||
throwf(const char * const format, ...)
|
||||
XMLRPC_PRINTF_ATTR(1,2)
|
||||
XMLRPC_NORETURN_ATTR;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
#ifndef GIRMEM_HPP_INCLUDED
|
||||
#define GIRMEM_HPP_INCLUDED
|
||||
|
||||
#include <xmlrpc-c/config.h>
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
|
||||
/* 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
|
||||
@@ -15,7 +17,7 @@
|
||||
a pthread_mutex_t member, and on Windows, there's no such type.
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
#if XMLRPC_HAVE_PTHREAD
|
||||
# include <pthread.h>
|
||||
typedef pthread_mutex_t girmem_lock;
|
||||
#else
|
||||
@@ -25,9 +27,9 @@
|
||||
|
||||
namespace girmem {
|
||||
|
||||
class autoObjectPtr;
|
||||
class XMLRPC_DLLEXPORT autoObjectPtr;
|
||||
|
||||
class autoObject {
|
||||
class XMLRPC_DLLEXPORT autoObject {
|
||||
friend class autoObjectPtr;
|
||||
|
||||
public:
|
||||
@@ -43,7 +45,7 @@ private:
|
||||
unsigned int refcount;
|
||||
};
|
||||
|
||||
class autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT autoObjectPtr {
|
||||
public:
|
||||
autoObjectPtr();
|
||||
autoObjectPtr(girmem::autoObject * objectP);
|
||||
|
@@ -9,6 +9,9 @@ typedef unsigned __int64 xmlrpc_uint64_t;
|
||||
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
#ifdef __INTERIX
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef uint16_t xmlrpc_uint16_t;
|
||||
typedef uint32_t xmlrpc_uint32_t;
|
||||
|
39
libs/xmlrpc-c/include/xmlrpc-c/json.h
Normal file
39
libs/xmlrpc-c/include/xmlrpc-c/json.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef XMLRPC_JSON_H_INCLUDED
|
||||
#define XMLRPC_JSON_H_INCLUDED
|
||||
|
||||
#include <xmlrpc-c/base.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
Parse a given string as JSON and return its value as an XML-RPC value
|
||||
object.
|
||||
|
||||
@param envP xmlrpc environment for error handling
|
||||
@param buf holds a pointer to a ziro terminated string
|
||||
@return the value generated or NULL (check error)
|
||||
*/
|
||||
xmlrpc_value *
|
||||
xmlrpc_parse_json(xmlrpc_env * const envP,
|
||||
const char * const json);
|
||||
|
||||
|
||||
/*
|
||||
Serialize an XML-RPC value object into JSON.
|
||||
|
||||
@param envP holds the xmlrpc execution environment
|
||||
@param valP holds the value to serialize
|
||||
@param out holds a mem block containing the result
|
||||
*/
|
||||
void
|
||||
xmlrpc_serialize_json(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const valP,
|
||||
xmlrpc_mem_block * const jsonP);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* XMLRPC_JSON_H_INCLUDED */
|
@@ -27,17 +27,18 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#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 {
|
||||
class XMLRPC_DLLEXPORT XmlRpcFault {
|
||||
|
||||
private:
|
||||
xmlrpc_env mFault;
|
||||
@@ -51,9 +52,9 @@ public:
|
||||
XmlRpcFault (const xmlrpc_env *env);
|
||||
~XmlRpcFault (void);
|
||||
|
||||
int getFaultCode (void) const;
|
||||
std::string getFaultString (void) const;
|
||||
xmlrpc_env *getFaultEnv (void);
|
||||
inline int getFaultCode (void) const;
|
||||
std::string getFaultString (void) const;
|
||||
inline xmlrpc_env * getFaultEnv (void);
|
||||
};
|
||||
|
||||
inline int XmlRpcFault::getFaultCode (void) const {
|
||||
@@ -74,7 +75,7 @@ inline xmlrpc_env *XmlRpcFault::getFaultEnv (void) {
|
||||
// xmlrpc_parse_value(env, v, "(i)", &i);
|
||||
// env.throwIfFaultOccurred();
|
||||
|
||||
class XmlRpcEnv {
|
||||
class XMLRPC_DLLEXPORT XmlRpcEnv {
|
||||
|
||||
private:
|
||||
xmlrpc_env mEnv;
|
||||
@@ -128,7 +129,7 @@ inline void XmlRpcEnv::throwIfFaultOccurred (void) const {
|
||||
//
|
||||
// So reference counting for the xmlrpc_value is quite a nightmare.
|
||||
|
||||
class XmlRpcValue {
|
||||
class XMLRPC_DLLEXPORT XmlRpcValue {
|
||||
|
||||
private:
|
||||
xmlrpc_value *mValue;
|
||||
@@ -257,7 +258,7 @@ inline xmlrpc_value *XmlRpcValue::borrowReference (void) const {
|
||||
// XmlRpcClient
|
||||
//=========================================================================
|
||||
|
||||
class XmlRpcClient {
|
||||
class XMLRPC_DLLEXPORT XmlRpcClient {
|
||||
|
||||
private:
|
||||
std::string mServerUrl;
|
||||
@@ -344,7 +345,7 @@ inline XmlRpcValue XmlRpcClient::call (std::string method_name,
|
||||
// XmlRpcGenSrv
|
||||
//=========================================================================
|
||||
|
||||
class XmlRpcGenSrv {
|
||||
class XMLRPC_DLLEXPORT XmlRpcGenSrv {
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -15,20 +15,21 @@
|
||||
#include <string>
|
||||
#include <queue>
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/girmem.hpp>
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
class packet : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT packet : public girmem::autoObject {
|
||||
|
||||
public:
|
||||
packet();
|
||||
|
||||
packet(const unsigned char * const data,
|
||||
size_t const dataLength);
|
||||
size_t const dataLength);
|
||||
|
||||
packet(const char * const data,
|
||||
size_t const dataLength);
|
||||
size_t const dataLength);
|
||||
|
||||
~packet();
|
||||
|
||||
@@ -54,7 +55,7 @@ private:
|
||||
|
||||
|
||||
|
||||
class packetPtr: public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT packetPtr: public girmem::autoObjectPtr {
|
||||
|
||||
public:
|
||||
packetPtr();
|
||||
@@ -67,7 +68,9 @@ public:
|
||||
|
||||
|
||||
|
||||
class packetSocket {
|
||||
class XMLRPC_DLLEXPORT packetSocket_impl;
|
||||
|
||||
class XMLRPC_DLLEXPORT packetSocket {
|
||||
/*----------------------------------------------------------------------------
|
||||
This is an Internet communication vehicle that transmits individual
|
||||
variable-length packets of text.
|
||||
@@ -106,56 +109,7 @@ public:
|
||||
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();
|
||||
|
||||
packetSocket_impl * implP;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -1,10 +1,12 @@
|
||||
#ifndef REGISTRY_HPP_INCLUDED
|
||||
#define REGISTRY_HPP_INCLUDED
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/server.h>
|
||||
#include <xmlrpc-c/girmem.hpp>
|
||||
#include <xmlrpc-c/base.hpp>
|
||||
@@ -12,7 +14,20 @@
|
||||
namespace xmlrpc_c {
|
||||
|
||||
|
||||
class method : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT callInfo {
|
||||
/*----------------------------------------------------------------------------
|
||||
Information about how an XML-RPC call arrived.
|
||||
|
||||
This base class carries no information; Servers that don't have any
|
||||
call information to provide might use this. Servers that do have call
|
||||
information to provide define a derived class of this that contains
|
||||
information pertinent to that kind of server.
|
||||
-----------------------------------------------------------------------------*/
|
||||
public:
|
||||
virtual ~callInfo() {}; // This makes it polymorphic
|
||||
};
|
||||
|
||||
class XMLRPC_DLLEXPORT method : public girmem::autoObject {
|
||||
/*----------------------------------------------------------------------------
|
||||
An XML-RPC method.
|
||||
|
||||
@@ -68,7 +83,34 @@ protected:
|
||||
*/
|
||||
|
||||
|
||||
class methodPtr : public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT method2 : public method {
|
||||
/*----------------------------------------------------------------------------
|
||||
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.
|
||||
|
||||
This differs from class 'method' in that the execute() method gets
|
||||
call information ('callInfo').
|
||||
-----------------------------------------------------------------------------*/
|
||||
public:
|
||||
method2();
|
||||
|
||||
virtual ~method2();
|
||||
|
||||
virtual void
|
||||
execute(xmlrpc_c::paramList const& paramList,
|
||||
const xmlrpc_c::callInfo * const callInfoP,
|
||||
xmlrpc_c::value * const resultP) = 0;
|
||||
|
||||
void
|
||||
execute(xmlrpc_c::paramList const& paramList,
|
||||
xmlrpc_c::value * const resultP);
|
||||
|
||||
};
|
||||
|
||||
class XMLRPC_DLLEXPORT methodPtr : public girmem::autoObjectPtr {
|
||||
|
||||
public:
|
||||
methodPtr(xmlrpc_c::method * const methodP);
|
||||
@@ -77,7 +119,7 @@ public:
|
||||
operator->() const;
|
||||
};
|
||||
|
||||
class defaultMethod : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT defaultMethod : public girmem::autoObject {
|
||||
|
||||
public:
|
||||
virtual ~defaultMethod();
|
||||
@@ -88,7 +130,7 @@ public:
|
||||
xmlrpc_c::value * const resultP) = 0;
|
||||
};
|
||||
|
||||
class defaultMethodPtr : public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT defaultMethodPtr : public girmem::autoObjectPtr {
|
||||
|
||||
public:
|
||||
defaultMethodPtr();
|
||||
@@ -102,9 +144,9 @@ public:
|
||||
get() const;
|
||||
};
|
||||
|
||||
struct registry_impl;
|
||||
|
||||
|
||||
class registry : public girmem::autoObject {
|
||||
class XMLRPC_DLLEXPORT 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
|
||||
@@ -126,7 +168,7 @@ public:
|
||||
void
|
||||
disableIntrospection();
|
||||
|
||||
class shutdown {
|
||||
class XMLRPC_DLLEXPORT shutdown {
|
||||
public:
|
||||
virtual ~shutdown() = 0;
|
||||
virtual void
|
||||
@@ -141,36 +183,24 @@ public:
|
||||
setDialect(xmlrpc_dialect const dialect);
|
||||
|
||||
void
|
||||
processCall(std::string const& body,
|
||||
std::string * const responseP) const;
|
||||
processCall(std::string const& callXml,
|
||||
std::string * const responseXmlP) const;
|
||||
|
||||
xmlrpc_registry *
|
||||
c_registry() const;
|
||||
/* This is meant to be private except to other objects in the
|
||||
Xmlrpc-c library.
|
||||
*/
|
||||
void
|
||||
processCall(std::string const& callXml,
|
||||
const xmlrpc_c::callInfo * const callInfoP,
|
||||
std::string * const responseXmlP) const;
|
||||
|
||||
size_t
|
||||
maxStackSize() const;
|
||||
|
||||
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.
|
||||
registry_impl * implP;
|
||||
};
|
||||
|
||||
|
||||
class registryPtr : public girmem::autoObjectPtr {
|
||||
class XMLRPC_DLLEXPORT registryPtr : public girmem::autoObjectPtr {
|
||||
|
||||
public:
|
||||
registryPtr();
|
||||
|
@@ -1,11 +1,12 @@
|
||||
#ifndef SELECT_INT_H_INCLUDED
|
||||
#define SELECT_INT_H_INCLUDED
|
||||
|
||||
#ifndef WIN32
|
||||
#if HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
|
||||
#include "xmlrpc-c/c_util.h"
|
||||
#include "xmlrpc-c/time_int.h"
|
||||
#ifdef WIN32
|
||||
#ifndef sigset_t
|
||||
@@ -13,6 +14,7 @@ typedef int sigset_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
int
|
||||
xmlrpc_pselect(int const n,
|
||||
fd_set * const readfdsP,
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#ifndef XMLRPC_SERVER_H_INCLUDED
|
||||
#define XMLRPC_SERVER_H_INCLUDED
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/base.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -37,19 +38,32 @@ typedef xmlrpc_value *
|
||||
xmlrpc_value * const paramArrayP,
|
||||
void * const serverInfo);
|
||||
|
||||
/* These are for backward compatibility -- they can't be exported from a
|
||||
Windows DLL. xmlrpc_server_version() is preferred.
|
||||
*/
|
||||
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_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_version(unsigned int * const majorP,
|
||||
unsigned int * const minorP,
|
||||
unsigned int * const pointP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_registry *
|
||||
xmlrpc_registry_new(xmlrpc_env * const envP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_free(xmlrpc_registry * const registryP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_disable_introspection(xmlrpc_registry * const registryP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_add_method(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP,
|
||||
@@ -58,6 +72,7 @@ xmlrpc_registry_add_method(xmlrpc_env * const envP,
|
||||
xmlrpc_method const method,
|
||||
void * const serverInfo);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_add_method_w_doc(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP,
|
||||
@@ -68,6 +83,7 @@ xmlrpc_registry_add_method_w_doc(xmlrpc_env * const envP,
|
||||
const char * const signatureString,
|
||||
const char * const help);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_add_method2(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP,
|
||||
@@ -77,12 +93,30 @@ xmlrpc_registry_add_method2(xmlrpc_env * const envP,
|
||||
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;
|
||||
};
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_add_method3(
|
||||
xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP,
|
||||
const struct xmlrpc_method_info3 * const infoP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_set_default_method(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP,
|
||||
xmlrpc_default_method const handler,
|
||||
void * const userData);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_set_preinvoke_method(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP,
|
||||
@@ -95,11 +129,13 @@ typedef void xmlrpc_server_shutdown_fn(xmlrpc_env * const envP,
|
||||
const char * const comment,
|
||||
void * const callInfo);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_set_shutdown(xmlrpc_registry * const registryP,
|
||||
xmlrpc_server_shutdown_fn * const shutdownFn,
|
||||
void * const context);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_set_dialect(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP,
|
||||
@@ -109,6 +145,7 @@ xmlrpc_registry_set_dialect(xmlrpc_env * const envP,
|
||||
Lower interface -- services to be used by an HTTP request handler
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_registry_process_call2(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP,
|
||||
@@ -117,6 +154,7 @@ xmlrpc_registry_process_call2(xmlrpc_env * const envP,
|
||||
void * const callInfo,
|
||||
xmlrpc_mem_block ** const outputPP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_mem_block *
|
||||
xmlrpc_registry_process_call(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP,
|
||||
@@ -124,6 +162,10 @@ xmlrpc_registry_process_call(xmlrpc_env * const envP,
|
||||
const char * const xmlData,
|
||||
size_t const xmlLen);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
size_t
|
||||
xmlrpc_registry_max_stackSize(xmlrpc_registry * const registryP);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include <xmlrpc-c/config.h> /* For XMLRPC_SOCKET */
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/abyss.h>
|
||||
#include <xmlrpc-c/server.h>
|
||||
|
||||
@@ -33,9 +34,11 @@ extern "C" {
|
||||
** of your program, when it is only one thread.
|
||||
**=======================================================================*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_global_init(xmlrpc_env * const envP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_global_term(void);
|
||||
|
||||
@@ -68,6 +71,9 @@ typedef struct {
|
||||
const char * uri_path;
|
||||
xmlrpc_bool chunk_response;
|
||||
xmlrpc_bool enable_shutdown;
|
||||
const char * allow_origin;
|
||||
xmlrpc_bool access_ctl_expires;
|
||||
unsigned int access_ctl_max_age;
|
||||
} xmlrpc_server_abyss_parms;
|
||||
|
||||
|
||||
@@ -85,10 +91,11 @@ typedef struct {
|
||||
** Simple server with Abyss under the covers
|
||||
**=======================================================================*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss(xmlrpc_env * const envP,
|
||||
const xmlrpc_server_abyss_parms * const parms,
|
||||
unsigned int const parm_size);
|
||||
unsigned int const parmSize);
|
||||
|
||||
/*=========================================================================
|
||||
** Object-oriented XML-RPC server with Abyss under the covers
|
||||
@@ -96,39 +103,47 @@ xmlrpc_server_abyss(xmlrpc_env * const envP,
|
||||
|
||||
typedef struct xmlrpc_server_abyss xmlrpc_server_abyss_t;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_destroy(xmlrpc_server_abyss_t * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_run_server(xmlrpc_env * const envP,
|
||||
xmlrpc_server_abyss_t * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_terminate(xmlrpc_env * const envP,
|
||||
xmlrpc_server_abyss_t * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_reset_terminate(xmlrpc_env * const envP,
|
||||
xmlrpc_server_abyss_t * const serverP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_use_sigchld(xmlrpc_server_abyss_t * const serverP);
|
||||
|
||||
|
||||
typedef struct xmlrpc_server_abyss_sig xmlrpc_server_abyss_sig;
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_setup_sig(
|
||||
xmlrpc_env * const envP,
|
||||
xmlrpc_server_abyss_t * const serverP,
|
||||
xmlrpc_server_abyss_sig ** const oldHandlersPP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_restore_sig(
|
||||
const xmlrpc_server_abyss_sig * const oldHandlersP);
|
||||
@@ -139,21 +154,78 @@ xmlrpc_server_abyss_restore_sig(
|
||||
** Functions to make an XML-RPC server out of your own Abyss server
|
||||
**=======================================================================*/
|
||||
|
||||
typedef void
|
||||
xmlrpc_call_processor(xmlrpc_env * const envP,
|
||||
void * const processorArg,
|
||||
const char * const callXml,
|
||||
size_t const callXmlLen,
|
||||
TSession * const abyssSessionP,
|
||||
xmlrpc_mem_block ** const responseXmlPP);
|
||||
|
||||
typedef struct {
|
||||
xmlrpc_call_processor * xml_processor;
|
||||
void * xml_processor_arg;
|
||||
size_t xml_processor_max_stack;
|
||||
const char * uri_path;
|
||||
xmlrpc_bool chunk_response;
|
||||
const char * allow_origin;
|
||||
/* NULL means don't answer HTTP access control query */
|
||||
xmlrpc_bool access_ctl_expires;
|
||||
unsigned int access_ctl_max_age;
|
||||
} xmlrpc_server_abyss_handler_parms;
|
||||
|
||||
#define XMLRPC_AHPSIZE(MBRNAME) \
|
||||
XMLRPC_STRUCTSIZE(xmlrpc_server_abyss_handler_parms, MBRNAME)
|
||||
|
||||
/* XMLRPC_AHPSIZE(xyz) is the minimum size a struct
|
||||
xmlrpc_server_abyss_handler_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.
|
||||
*/
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_set_handler3(
|
||||
xmlrpc_env * const envP,
|
||||
TServer * const srvP,
|
||||
const xmlrpc_server_abyss_handler_parms * const parms,
|
||||
unsigned int const parmSize);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_set_handler2(
|
||||
TServer * const srvP,
|
||||
const char * const uriPath,
|
||||
xmlrpc_call_processor xmlProcessor,
|
||||
void * const xmlProcessorArg,
|
||||
size_t const xmlProcessorMaxStackSize,
|
||||
xmlrpc_bool const chunkResponse);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_set_handlers2(TServer * const srvP,
|
||||
const char * const filename,
|
||||
xmlrpc_registry * const registryP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_set_handlers(TServer * const serverP,
|
||||
xmlrpc_registry * const registryP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_set_handler(xmlrpc_env * const envP,
|
||||
TServer * const serverP,
|
||||
const char * const filename,
|
||||
xmlrpc_registry * const registryP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_set_default_handler(TServer * const serverP);
|
||||
|
||||
/*=========================================================================
|
||||
** Handy Abyss Extensions
|
||||
**=======================================================================*/
|
||||
@@ -171,6 +243,7 @@ xmlrpc_server_abyss_set_handler(xmlrpc_env * const envP,
|
||||
** Once you call this routine, it is illegal to modify the server any
|
||||
** more, including changing any method registry.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_run(void);
|
||||
|
||||
@@ -180,6 +253,7 @@ xmlrpc_server_abyss_run(void);
|
||||
** function. 'runfirstArg' is the argument the server passes to the runfirst
|
||||
** function.
|
||||
**/
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_run_first(runfirstFn const runfirst,
|
||||
void * const runfirstArg);
|
||||
@@ -200,29 +274,34 @@ xmlrpc_server_abyss_run_first(runfirstFn const runfirst,
|
||||
** Or use a regular method registry and call
|
||||
** xmlrpc_server_abyss_set_handlers().
|
||||
**/
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_abyss_init(int const flags,
|
||||
const char * const config_file);
|
||||
|
||||
/* This is called automatically by xmlrpc_server_abyss_init. */
|
||||
XMLRPC_DLLEXPORT
|
||||
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.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void
|
||||
xmlrpc_server_abyss_add_method_w_doc (char * const method_name,
|
||||
xmlrpc_method const method,
|
||||
|
@@ -5,18 +5,25 @@
|
||||
#include <winsock.h> // For XMLRPC_SOCKET (= SOCKET)
|
||||
#endif
|
||||
|
||||
#include "xmlrpc-c/config.h" // For XMLRPC_SOCKET
|
||||
#include "xmlrpc-c/base.hpp"
|
||||
#include "abyss.h"
|
||||
#include <xmlrpc-c/config.h> // For XMLRPC_SOCKET
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/base.hpp>
|
||||
#include <xmlrpc-c/registry.hpp>
|
||||
#include <xmlrpc-c/abyss.h>
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
class serverAbyss {
|
||||
struct serverAbyss_impl;
|
||||
|
||||
class XMLRPC_DLLEXPORT serverAbyss {
|
||||
|
||||
public:
|
||||
class constrOpt {
|
||||
struct constrOpt_impl;
|
||||
|
||||
class XMLRPC_DLLEXPORT constrOpt {
|
||||
public:
|
||||
constrOpt();
|
||||
~constrOpt();
|
||||
|
||||
constrOpt & registryPtr (xmlrpc_c::registryPtr const& arg);
|
||||
constrOpt & registryP (const xmlrpc_c::registry * const& arg);
|
||||
@@ -29,33 +36,14 @@ public:
|
||||
constrOpt & dontAdvertise (bool const& arg);
|
||||
constrOpt & uriPath (std::string const& arg);
|
||||
constrOpt & chunkResponse (bool const& arg);
|
||||
constrOpt & allowOrigin (std::string const& arg);
|
||||
constrOpt & accessCtlMaxAge (unsigned int const& arg);
|
||||
constrOpt & serverOwnsSignals (bool const& arg);
|
||||
constrOpt & expectSigchld (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;
|
||||
private:
|
||||
struct constrOpt_impl * implP;
|
||||
friend class serverAbyss;
|
||||
};
|
||||
|
||||
serverAbyss(constrOpt const& opt);
|
||||
@@ -82,10 +70,15 @@ public:
|
||||
void
|
||||
runConn(int const socketFd);
|
||||
|
||||
#ifndef WIN32
|
||||
void
|
||||
sigchld(pid_t pid);
|
||||
#endif
|
||||
|
||||
void
|
||||
terminate();
|
||||
|
||||
class shutdown : public xmlrpc_c::registry::shutdown {
|
||||
class XMLRPC_DLLEXPORT shutdown : public xmlrpc_c::registry::shutdown {
|
||||
public:
|
||||
shutdown(xmlrpc_c::serverAbyss * const severAbyssP);
|
||||
virtual ~shutdown();
|
||||
@@ -95,35 +88,64 @@ public:
|
||||
};
|
||||
|
||||
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);
|
||||
serverAbyss_impl * implP;
|
||||
|
||||
void
|
||||
initialize(constrOpt const& opt);
|
||||
};
|
||||
|
||||
class XMLRPC_DLLEXPORT callInfo_serverAbyss : public xmlrpc_c::callInfo {
|
||||
/*----------------------------------------------------------------------------
|
||||
This is information about how an XML-RPC call arrived via an Abyss server.
|
||||
It is available to the user's XML-RPC method execute() method, so for
|
||||
example an XML-RPC method might execute differently depending upon the
|
||||
IP address of the client.
|
||||
|
||||
This is for a user of a xmlrpc_c::serverAbyss server.
|
||||
-----------------------------------------------------------------------------*/
|
||||
public:
|
||||
callInfo_serverAbyss(xmlrpc_c::serverAbyss * const abyssServerP,
|
||||
TSession * const abyssSessionP);
|
||||
|
||||
xmlrpc_c::serverAbyss * const serverAbyssP;
|
||||
// The server that is processing the RPC.
|
||||
TSession * const abyssSessionP;
|
||||
// The HTTP transaction that embodies the RPC. You can ask this
|
||||
// object things like what the IP address of the client is.
|
||||
};
|
||||
|
||||
class XMLRPC_DLLEXPORT callInfo_abyss : public xmlrpc_c::callInfo {
|
||||
/*----------------------------------------------------------------------------
|
||||
This is information about how an XML-RPC call arrived via an Abyss server.
|
||||
It is available to the user's XML-RPC method execute() method, so for
|
||||
example an XML-RPC method might execute differently depending upon the
|
||||
IP address of the client.
|
||||
|
||||
This is for a user with his own Abyss server, using
|
||||
the "set_handlers" routines to make it into an XML-RPC server.
|
||||
-----------------------------------------------------------------------------*/
|
||||
public:
|
||||
callInfo_abyss(TSession * const abyssSessionP);
|
||||
|
||||
TSession * abyssSessionP;
|
||||
// The HTTP transaction that embodies the RPC. You can ask this
|
||||
// object things like what the IP address of the client is.
|
||||
};
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
server_abyss_set_handlers(TServer * const srvP,
|
||||
xmlrpc_c::registry const& registry,
|
||||
std::string const& uriPath = "/RPC2");
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
server_abyss_set_handlers(TServer * const srvP,
|
||||
const xmlrpc_c::registry * const registryP,
|
||||
std::string const& uriPath = "/RPC2");
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
server_abyss_set_handlers(TServer * const srvP,
|
||||
xmlrpc_c::registryPtr const registryPtr,
|
||||
|
@@ -6,38 +6,45 @@
|
||||
#ifndef XMLRPC_CGI_H_INCLUDED
|
||||
#define XMLRPC_CGI_H_INCLUDED
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/server.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_cgi_process_call(xmlrpc_registry * const registryP);
|
||||
|
||||
#define XMLRPC_CGI_NO_FLAGS (0)
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void
|
||||
xmlrpc_cgi_init (int flags);
|
||||
xmlrpc_cgi_init(int const flags);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
extern xmlrpc_registry *
|
||||
xmlrpc_cgi_registry (void);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_cgi_add_method(const char * const method_name,
|
||||
xmlrpc_method const method,
|
||||
void * const user_data);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
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);
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void
|
||||
xmlrpc_cgi_process_call (void);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
extern void
|
||||
xmlrpc_cgi_cleanup (void);
|
||||
|
||||
|
45
libs/xmlrpc-c/include/xmlrpc-c/server_cgi.hpp
Normal file
45
libs/xmlrpc-c/include/xmlrpc-c/server_cgi.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef SERVER_CGI_HPP_INCLUDED
|
||||
#define SERVER_CGI_HPP_INCLUDED
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/registry.hpp>
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
class XMLRPC_DLLEXPORT serverCgi {
|
||||
|
||||
public:
|
||||
|
||||
class XMLRPC_DLLEXPORT constrOpt {
|
||||
public:
|
||||
constrOpt();
|
||||
|
||||
constrOpt & registryPtr (xmlrpc_c::registryPtr const& arg);
|
||||
constrOpt & registryP (const xmlrpc_c::registry * const& arg);
|
||||
|
||||
struct value {
|
||||
xmlrpc_c::registryPtr registryPtr;
|
||||
const xmlrpc_c::registry * registryP;
|
||||
} value;
|
||||
struct {
|
||||
bool registryPtr;
|
||||
bool registryP;
|
||||
} present;
|
||||
};
|
||||
|
||||
serverCgi(constrOpt const& opt);
|
||||
|
||||
~serverCgi();
|
||||
|
||||
void
|
||||
processCall();
|
||||
|
||||
private:
|
||||
|
||||
struct serverCgi_impl * implP;
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
@@ -3,42 +3,47 @@
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock.h> /* For XMLRPC_SOCKET (= SOCKET) */
|
||||
typedef int socklen_t;
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#include <xmlrpc-c/config.h> /* For XMLRPC_SOCKET */
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/registry.hpp>
|
||||
#include <xmlrpc-c/packetsocket.hpp>
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
class serverPstreamConn {
|
||||
class XMLRPC_DLLEXPORT serverPstreamConn {
|
||||
|
||||
public:
|
||||
|
||||
class constrOpt {
|
||||
struct constrOpt_impl;
|
||||
|
||||
class XMLRPC_DLLEXPORT constrOpt {
|
||||
public:
|
||||
constrOpt();
|
||||
~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;
|
||||
private:
|
||||
struct constrOpt_impl * implP;
|
||||
friend class serverPstreamConn;
|
||||
};
|
||||
|
||||
serverPstreamConn(constrOpt const& opt);
|
||||
|
||||
~serverPstreamConn();
|
||||
|
||||
void
|
||||
runOnce(xmlrpc_c::callInfo * const callInfoP,
|
||||
volatile const int * const interruptP,
|
||||
bool * const eofP);
|
||||
|
||||
void
|
||||
runOnce(volatile const int * const interruptP,
|
||||
bool * const eofP);
|
||||
@@ -46,27 +51,111 @@ public:
|
||||
void
|
||||
runOnce(bool * const eofP);
|
||||
|
||||
void
|
||||
runOnceNoWait(callInfo * const callInfoP,
|
||||
bool * const eofP,
|
||||
bool * const didOneP);
|
||||
|
||||
void
|
||||
runOnceNoWait(bool * const eofP,
|
||||
bool * const didOneP);
|
||||
|
||||
void
|
||||
runOnceNoWait(bool * const eofP);
|
||||
|
||||
void
|
||||
run(xmlrpc_c::callInfo * const callInfoP,
|
||||
volatile const int * const interruptP);
|
||||
|
||||
void
|
||||
run(volatile const int * const interruptP);
|
||||
|
||||
void
|
||||
run();
|
||||
|
||||
private:
|
||||
struct serverPstreamConn_impl * implP;
|
||||
};
|
||||
|
||||
// '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;
|
||||
class XMLRPC_DLLEXPORT serverPstream {
|
||||
|
||||
packetSocket * packetSocketP;
|
||||
// The packet socket over which we received RPCs.
|
||||
// This is permanently connected to our fixed client.
|
||||
public:
|
||||
|
||||
struct constrOpt_impl;
|
||||
|
||||
class XMLRPC_DLLEXPORT constrOpt {
|
||||
public:
|
||||
constrOpt();
|
||||
~constrOpt();
|
||||
|
||||
constrOpt & registryPtr (xmlrpc_c::registryPtr const& arg);
|
||||
constrOpt & registryP (const xmlrpc_c::registry * const& arg);
|
||||
constrOpt & socketFd (XMLRPC_SOCKET const& arg);
|
||||
|
||||
private:
|
||||
struct constrOpt_impl * implP;
|
||||
friend class serverPstream;
|
||||
};
|
||||
|
||||
serverPstream(constrOpt const& opt);
|
||||
|
||||
virtual ~serverPstream(); // This makes it polymorphic
|
||||
|
||||
void
|
||||
establishRegistry(constrOpt const& opt);
|
||||
runSerial(volatile const int * const interruptP);
|
||||
|
||||
void
|
||||
establishPacketSocket(constrOpt const& opt);
|
||||
runSerial();
|
||||
|
||||
void
|
||||
terminate();
|
||||
|
||||
class shutdown : public xmlrpc_c::registry::shutdown {
|
||||
public:
|
||||
shutdown(xmlrpc_c::serverPstream * const severAbyssP);
|
||||
virtual ~shutdown();
|
||||
void doit(std::string const& comment, void * const callInfo) const;
|
||||
private:
|
||||
xmlrpc_c::serverPstream * const serverPstreamP;
|
||||
};
|
||||
|
||||
private:
|
||||
struct serverPstream_impl * implP;
|
||||
};
|
||||
|
||||
// Note: there is no xmlrpc_c::callInfo_serverPstreamConn . That's
|
||||
// because the serverPstreamConn server is so low-level that the user
|
||||
// defines his own derived class of xmlrpc_c::callInfo. He creates an
|
||||
// object of that class and passes it to the 'runOnce' method. The
|
||||
// server then passes it on through to the user's XML-RPC method
|
||||
// execute() method.
|
||||
|
||||
class XMLRPC_DLLEXPORT callInfo_serverPstream : public xmlrpc_c::callInfo {
|
||||
/*----------------------------------------------------------------------------
|
||||
This is information about how an XML-RPC call arrived to the server. It is
|
||||
available to the user's XML-RPC method execute() method, so for example an
|
||||
XML-RPC method might execute differently depending upon the IP address of
|
||||
the client.
|
||||
|
||||
This is for a user of a xmlrpc_c::serverPstream server.
|
||||
-----------------------------------------------------------------------------*/
|
||||
public:
|
||||
callInfo_serverPstream(
|
||||
xmlrpc_c::serverPstream * const serverP,
|
||||
struct sockaddr const clientAddr,
|
||||
socklen_t const clientAddrSize);
|
||||
|
||||
xmlrpc_c::serverPstream * const serverP;
|
||||
// The server that is processing the RPC.
|
||||
struct sockaddr const clientAddr;
|
||||
// The address (typically, IP address and TCP port) of the XML-RPC
|
||||
// client. This is a Unix OS type.
|
||||
socklen_t const clientAddrSize;
|
||||
// Size in bytes of the valid part of 'clientAddr'. (Usually implied
|
||||
// by type of socket, as well as the address type member of
|
||||
// 'clientAddr', but here because it's technically part of the POSIX
|
||||
// socket interface).
|
||||
};
|
||||
|
||||
|
||||
|
@@ -38,6 +38,7 @@
|
||||
#ifndef _XMLRPC_SERVER_HTTPSYS_H_
|
||||
#define _XMLRPC_SERVER_HTTPSYS_H_ 1
|
||||
|
||||
#include "c_util.h"
|
||||
#include "transport_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -81,6 +82,7 @@ typedef struct {
|
||||
not the caller is new enough to have supplied a certain parameter.
|
||||
*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_server_httpsys(
|
||||
xmlrpc_env * const envP,
|
||||
@@ -92,4 +94,4 @@ xmlrpc_server_httpsys(
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -1,7 +1,18 @@
|
||||
#ifndef SLEEP_INT_H_INCLUDED
|
||||
#define SLEEP_INT_H_INCLUDED
|
||||
|
||||
#include "xmlrpc-c/c_util.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_millisecond_sleep(unsigned int const milliseconds);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -13,22 +13,37 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char * const xmlrpc_strsol;
|
||||
XMLRPC_DLLEXPORT
|
||||
bool
|
||||
xmlrpc_strnomem(const char * const string);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
xmlrpc_strnomemval(void);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_vasprintf(const char ** const retvalP,
|
||||
const char * const fmt,
|
||||
va_list varargs);
|
||||
|
||||
void GNU_PRINTF_ATTR(2,3)
|
||||
XMLRPC_DLLEXPORT
|
||||
void XMLRPC_PRINTF_ATTR(2,3)
|
||||
xmlrpc_asprintf(const char ** const retvalP, const char * const fmt, ...);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
xmlrpc_strdupnull(const char * const string);
|
||||
xmlrpc_strdupsol(const char * const string);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_strfree(const char * const string);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
xmlrpc_strdupnull(const char * const string);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_strfreenull(const char * const string);
|
||||
|
||||
@@ -46,6 +61,11 @@ xmlrpc_memeq(const void * const a,
|
||||
return (memcmp(a, b, size) == 0);
|
||||
}
|
||||
|
||||
/* strcasecmp doesn't exist on some systems without _BSD_SOURCE, so
|
||||
xmlrpc_strcaseeq() can't either.
|
||||
*/
|
||||
#ifdef _BSD_SOURCE
|
||||
|
||||
static __inline__ bool
|
||||
xmlrpc_strcaseeq(const char * const a,
|
||||
const char * const b) {
|
||||
@@ -59,6 +79,7 @@ xmlrpc_strcaseeq(const char * const a,
|
||||
#error "This platform has no known case-independent string compare fn"
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static __inline__ bool
|
||||
xmlrpc_strneq(const char * const a,
|
||||
@@ -67,16 +88,42 @@ xmlrpc_strneq(const char * const a,
|
||||
return (strncmp(a, b, len) == 0);
|
||||
}
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
xmlrpc_makePrintable(const char * const input);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
xmlrpc_makePrintable_lp(const char * const input,
|
||||
size_t const inputLength);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
const char *
|
||||
xmlrpc_makePrintableChar(char const input);
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/* Standard string functions with destination array size checking */
|
||||
/*----------------------------------------------------------------*/
|
||||
#define STRSCPY(A,B) \
|
||||
(strncpy((A), (B), sizeof(A)), *((A)+sizeof(A)-1) = '\0')
|
||||
#define STRSCMP(A,B) \
|
||||
(strncmp((A), (B), sizeof(A)))
|
||||
#define STRSCAT(A,B) \
|
||||
(strncat((A), (B), sizeof(A)-strlen(A)), *((A)+sizeof(A)-1) = '\0')
|
||||
|
||||
/* We could do this, but it works only in GNU C
|
||||
#define SSPRINTF(TARGET, REST...) \
|
||||
(snprintf(TARGET, sizeof(TARGET) , ## REST))
|
||||
|
||||
Or this, but it works only in C99 compilers, which leaves out MSVC
|
||||
before 2005 and can't handle the zero variable argument case except
|
||||
by an MSVC extension:
|
||||
|
||||
#define SSPRINTF(TARGET, ...) \
|
||||
(snprintf(TARGET, sizeof(TARGET) , __VA_ARGS__))
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
21
libs/xmlrpc-c/include/xmlrpc-c/string_number.h
Normal file
21
libs/xmlrpc-c/include/xmlrpc-c/string_number.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef STRING_NUMBER_H_INCLUDED
|
||||
#define STRING_NUMBER_H_INCLUDED
|
||||
|
||||
#include <xmlrpc-c/config.h>
|
||||
#include <xmlrpc-c/util.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_parse_int64(xmlrpc_env * const envP,
|
||||
const char * const str,
|
||||
xmlrpc_int64 * const i64P);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -16,18 +16,22 @@
|
||||
} xmlrpc_timespec;
|
||||
#endif
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_gettimeofday(xmlrpc_timespec * const todP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_timegm(const struct tm * const brokenTime,
|
||||
time_t * const timeValueP,
|
||||
const char ** const errorP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_localtime(time_t const datetime,
|
||||
struct tm * const tmP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_gmtime(time_t const datetime,
|
||||
struct tm * const resultP);
|
||||
|
@@ -1,13 +1,16 @@
|
||||
#ifndef XMLRPC_TIMEOUT_H_INCLUDED
|
||||
#define XMLRPC_TIMEOUT_H_INCLUDED
|
||||
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
|
||||
namespace xmlrpc_c {
|
||||
|
||||
struct timeout {
|
||||
struct XMLRPC_DLLEXPORT timeout {
|
||||
|
||||
timeout() : finite(false) {}
|
||||
|
||||
timeout(unsigned int const duration) : duration(duration) {}
|
||||
timeout(unsigned int const duration) :
|
||||
finite(true), duration(duration) {}
|
||||
// 'duration' is the timeout time in milliseconds
|
||||
|
||||
bool finite;
|
||||
|
@@ -38,12 +38,17 @@ typedef void (*xmlrpc_transport_asynch_complete)(
|
||||
xmlrpc_mem_block * const responseXmlP,
|
||||
xmlrpc_env const env);
|
||||
|
||||
typedef void (*xmlrpc_transport_progress)(
|
||||
struct xmlrpc_call_info * const callInfoP,
|
||||
struct xmlrpc_progress_data const data);
|
||||
|
||||
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,
|
||||
xmlrpc_transport_progress progress,
|
||||
struct xmlrpc_call_info * const callInfoP);
|
||||
|
||||
typedef void (*xmlrpc_transport_call)(
|
||||
|
@@ -1,42 +0,0 @@
|
||||
/* Copyright information is at the end of the file */
|
||||
#ifndef XMLRPC_TRANSPORT_INT_H_INCLUDED
|
||||
#define XMLRPC_TRANSPORT_INT_H_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "pthreadx.h" /* For threading helpers. */
|
||||
|
||||
/*=========================================================================
|
||||
** Transport Helper Functions and declarations.
|
||||
**=========================================================================
|
||||
*/
|
||||
typedef struct _running_thread_info
|
||||
{
|
||||
struct _running_thread_info * Next;
|
||||
struct _running_thread_info * Last;
|
||||
|
||||
pthread_t _thread;
|
||||
} running_thread_info;
|
||||
|
||||
|
||||
/* list of running Async callback functions. */
|
||||
typedef struct _running_thread_list
|
||||
{
|
||||
running_thread_info * AsyncThreadHead;
|
||||
running_thread_info * AsyncThreadTail;
|
||||
} running_thread_list;
|
||||
|
||||
/* MRB-WARNING: Only call when you have successfully
|
||||
** acquired the Lock/Unlock mutex! */
|
||||
void register_asynch_thread (running_thread_list *list, pthread_t *thread);
|
||||
|
||||
/* MRB-WARNING: Only call when you have successfully
|
||||
** acquired the Lock/Unlock mutex! */
|
||||
void unregister_asynch_thread (running_thread_list *list, pthread_t *thread);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -4,7 +4,10 @@
|
||||
|
||||
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.
|
||||
exists primarily because other Xmlrpc-c libraries use the utilities,
|
||||
but the utilities are also documented for use by Xmlrpc-c users.
|
||||
For use by Xmlrpc-c users, they are considered to be part of the
|
||||
libxmlrpc library. libxmlrpc_util is a prerequisite of libxmlrpc.
|
||||
|
||||
By Bryan Henderson, San Jose, CA 05.09.21.
|
||||
|
||||
@@ -18,7 +21,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <xmlrpc-c/config.h> /* Defines XMLRPC_HAVE_WCHAR */
|
||||
#include <xmlrpc-c/c_util.h> /* for GNU_PRINTF_ATTR */
|
||||
#include <xmlrpc-c/c_util.h> /* for XMLRPC_PRINTF_ATTR */
|
||||
|
||||
#if XMLRPC_HAVE_WCHAR
|
||||
#include <wchar.h>
|
||||
@@ -28,7 +31,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
** C struct size computations
|
||||
**=======================================================================*/
|
||||
@@ -40,7 +42,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
#define _XMLRPC_STRUCT_MEMBER_OFFSET(TYPE, MBRNAME) \
|
||||
((unsigned long)(char*)&((TYPE *)0)->MBRNAME)
|
||||
((size_t)(char*)&((TYPE *)0)->MBRNAME)
|
||||
#define _XMLRPC_STRUCT_MEMBER_SIZE(TYPE, MBRNAME) \
|
||||
sizeof(((TYPE *)0)->MBRNAME)
|
||||
#define XMLRPC_STRUCTSIZE(TYPE, MBRNAME) \
|
||||
@@ -71,6 +73,7 @@ extern "C" {
|
||||
#define XMLRPC_ASSERT(cond) while (0) {}
|
||||
#endif
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_assertion_failed(const char * const fileName,
|
||||
int const lineNumber);
|
||||
@@ -124,38 +127,44 @@ typedef struct _xmlrpc_env {
|
||||
|
||||
/* Initialize and destroy the contents of the provided xmlrpc_env object.
|
||||
** These functions will never fail. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void xmlrpc_env_init (xmlrpc_env* env);
|
||||
XMLRPC_DLLEXPORT
|
||||
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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_env_set_fault(xmlrpc_env * const env,
|
||||
int const faultCode,
|
||||
const char * const faultDescription);
|
||||
|
||||
/* The same as the above, but using varargs */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_set_fault_formatted_v(xmlrpc_env * const envP,
|
||||
int const code,
|
||||
const char * const format,
|
||||
va_list const args);
|
||||
va_list args);
|
||||
|
||||
/* The same as the above, but using a printf-style format string. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_env_set_fault_formatted(xmlrpc_env * const envP,
|
||||
int const code,
|
||||
const char * const format,
|
||||
...) GNU_PRINTF_ATTR(3,4);
|
||||
...) XMLRPC_PRINTF_ATTR(3,4);
|
||||
|
||||
/* This one infers XMLRPC_INTERNAL_ERROR and has a shorter name.
|
||||
So a call takes up less source code space.
|
||||
*/
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_faultf(xmlrpc_env * const envP,
|
||||
const char * const format,
|
||||
...) GNU_PRINTF_ATTR(2,3);
|
||||
...) XMLRPC_PRINTF_ATTR(2,3);
|
||||
|
||||
/* A simple debugging assertion. */
|
||||
#define XMLRPC_ASSERT_ENV_OK(envP) \
|
||||
@@ -223,32 +232,40 @@ typedef struct _xmlrpc_mem_block {
|
||||
} xmlrpc_mem_block;
|
||||
|
||||
/* Allocate a new xmlrpc_mem_block. */
|
||||
XMLRPC_DLLEXPORT
|
||||
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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void xmlrpc_mem_block_free (xmlrpc_mem_block* const block);
|
||||
|
||||
/* Initialize the contents of the provided xmlrpc_mem_block. */
|
||||
XMLRPC_DLLEXPORT
|
||||
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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void xmlrpc_mem_block_clean (xmlrpc_mem_block* const block);
|
||||
|
||||
/* Get the size and contents of the xmlrpc_mem_block. */
|
||||
XMLRPC_DLLEXPORT
|
||||
size_t
|
||||
xmlrpc_mem_block_size(const xmlrpc_mem_block * const block);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void *
|
||||
xmlrpc_mem_block_contents(const xmlrpc_mem_block * const block);
|
||||
|
||||
/* Resize an xmlrpc_mem_block, preserving as much of the contents as
|
||||
** possible. */
|
||||
XMLRPC_DLLEXPORT
|
||||
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. */
|
||||
XMLRPC_DLLEXPORT
|
||||
void xmlrpc_mem_block_append
|
||||
(xmlrpc_env* const env, xmlrpc_mem_block* const block, const void * const data, size_t const len);
|
||||
|
||||
@@ -295,12 +312,14 @@ void xmlrpc_mem_block_append
|
||||
** UTF-8 Encoding and Decoding
|
||||
**=======================================================================*/
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_validate_utf8(xmlrpc_env * const envP,
|
||||
const char * const utf8Data,
|
||||
size_t const utf8Len);
|
||||
|
||||
/* Decode a UTF-8 string. */
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_mem_block *
|
||||
xmlrpc_utf8_to_wcs(xmlrpc_env * const envP,
|
||||
const char * const utf8_data,
|
||||
@@ -309,15 +328,18 @@ xmlrpc_utf8_to_wcs(xmlrpc_env * const envP,
|
||||
/* Encode a UTF-8 string. */
|
||||
|
||||
#if XMLRPC_HAVE_WCHAR
|
||||
XMLRPC_DLLEXPORT
|
||||
xmlrpc_mem_block *
|
||||
xmlrpc_wcs_to_utf8(xmlrpc_env * const envP,
|
||||
const wchar_t * const wcsData,
|
||||
size_t const wcsLen);
|
||||
#endif
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_force_to_utf8(char * const buffer);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
xmlrpc_force_to_xml_chars(char * const buffer);
|
||||
|
||||
|
@@ -1,14 +1,19 @@
|
||||
#ifndef XMLRPC_C_UTIL_INT_H_INCLUDED
|
||||
#define XMLRPC_C_UTIL_INT_H_INCLUDED
|
||||
|
||||
/* This file contains facilities for use by Xmlrpc-c code, but not intended
|
||||
to be included in a user compilation.
|
||||
|
||||
Names in here might conflict with other names in a user's compilation
|
||||
if included in a user compilation.
|
||||
|
||||
The facilities may change in future releases.
|
||||
*/
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/* When we deallocate a pointer in a struct, we often replace it with
|
||||
** this and throw in a few assertions here and there. */
|
||||
|
@@ -2,31 +2,53 @@
|
||||
#define XML_HPP_INCLUDED
|
||||
|
||||
#include <string>
|
||||
#include <xmlrpc-c/c_util.h>
|
||||
#include <xmlrpc-c/base.hpp>
|
||||
|
||||
namespace xmlrpc_c {
|
||||
namespace xml {
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
generateCall(std::string const& methodName,
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
std::string * const callXmlP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
generateCall(std::string const& methodName,
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
xmlrpc_dialect const dialect,
|
||||
std::string * const callXmlP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
parseCall(std::string const& callXml,
|
||||
std::string * const methodNameP,
|
||||
xmlrpc_c::paramList * const paramListP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
generateResponse(xmlrpc_c::rpcOutcome const& outcome,
|
||||
xmlrpc_dialect const dialect,
|
||||
std::string * const respXmlP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
generateResponse(xmlrpc_c::rpcOutcome const& outcome,
|
||||
std::string * const respXmlP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
parseSuccessfulResponse(std::string const& responseXml,
|
||||
xmlrpc_c::value * const resultP);
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
parseResponse(std::string const& responseXml,
|
||||
xmlrpc_c::rpcOutcome * const outcomeP);
|
||||
|
||||
|
||||
XMLRPC_DLLEXPORT
|
||||
void
|
||||
trace(std::string const& label,
|
||||
std::string const& xml);
|
||||
|
Reference in New Issue
Block a user