Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
XmlRpc::XmlRpcClient Class Reference

A class to send XML RPC requests to a server and return the results. More...

#include <XmlRpcClient.h>

Inheritance diagram for XmlRpc::XmlRpcClient:
Inheritance graph
[legend]

Public Member Functions

virtual void close ()
 Close the connection. More...
 
bool execute (const char *method, XmlRpcValue const &params, XmlRpcValue &result)
 
bool executeCheckDone (XmlRpcValue &result)
 
bool executeNonBlock (const char *method, XmlRpcValue const &params)
 
const std::string & getHost ()
 
int getPort () const
 
const std::string & getUri ()
 
virtual unsigned handleEvent (unsigned eventType)
 
bool isFault () const
 Returns true if the result of the last execute() was a fault response. More...
 
 XmlRpcClient (const char *host, int port, const char *uri=0)
 
virtual ~XmlRpcClient ()
 Destructor. More...
 
- Public Member Functions inherited from XmlRpc::XmlRpcSource
int getfd () const
 Return the file descriptor being monitored. More...
 
bool getKeepOpen () const
 Return whether the file descriptor should be kept open if it is no longer monitored. More...
 
void setfd (int fd)
 Specify the file descriptor to monitor. More...
 
void setKeepOpen (bool b=true)
 Specify whether the file descriptor should be kept open if it is no longer monitored. More...
 
 XmlRpcSource (int fd=-1, bool deleteOnClose=false)
 
virtual ~XmlRpcSource ()
 Destructor. More...
 

Public Attributes

int _bytesWritten
 
int _contentLength
 
XmlRpcDispatch _disp
 
bool _eof
 
bool _executing
 
std::string _header
 
bool _isFault
 
std::string _request
 
std::string _response
 
int _sendAttempts
 

Static Public Attributes

static const char FAULT_TAG [] = "<fault>"
 
static const char METHODRESPONSE_TAG [] = "<methodResponse>"
 
static const char PARAM_ETAG [] = "</param>"
 
static const char PARAM_TAG [] = "<param>"
 
static const char PARAMS_ETAG [] = "</params>"
 
static const char PARAMS_TAG [] = "<params>"
 
static const char REQUEST_BEGIN []
 
static const char REQUEST_END [] = "</methodCall>\r\n"
 
static const char REQUEST_END_METHODNAME [] = "</methodName>\r\n"
 

Protected Types

enum  ClientConnectionState {
  NO_CONNECTION, CONNECTING, WRITE_REQUEST, READ_HEADER,
  READ_RESPONSE, IDLE
}
 

Protected Member Functions

virtual bool doConnect ()
 
virtual std::string generateHeader (size_t length) const
 
virtual bool generateRequest (const char *method, XmlRpcValue const &params)
 
virtual bool parseResponse (XmlRpcValue &result)
 
virtual bool readHeader ()
 
virtual bool readResponse ()
 
virtual bool setupConnection ()
 
virtual bool writeRequest ()
 

Static Protected Member Functions

static const char * connectionStateStr (ClientConnectionState state)
 

Protected Attributes

ClientConnectionState _connectionState
 
std::string _host
 
int _port
 
std::string _uri
 

Detailed Description

A class to send XML RPC requests to a server and return the results.

Definition at line 26 of file XmlRpcClient.h.

Member Enumeration Documentation

◆ ClientConnectionState

Enumerator
NO_CONNECTION 
CONNECTING 
WRITE_REQUEST 
READ_HEADER 
READ_RESPONSE 
IDLE 

Definition at line 90 of file XmlRpcClient.h.

Constructor & Destructor Documentation

◆ XmlRpcClient()

XmlRpcClient::XmlRpcClient ( const char *  host,
int  port,
const char *  uri = 0 
)

Construct a client to connect to the server at the specified host:port address

Parameters
hostThe name of the remote machine hosting the server
portThe port on the remote machine where the server is listening
uriAn optional string to be sent as the URI in the HTTP GET header

Definition at line 52 of file XmlRpcClient.cpp.

◆ ~XmlRpcClient()

XmlRpcClient::~XmlRpcClient ( )
virtual

Destructor.

Definition at line 75 of file XmlRpcClient.cpp.

Member Function Documentation

◆ close()

void XmlRpcClient::close ( )
virtual

Close the connection.

Reimplemented from XmlRpc::XmlRpcSource.

Definition at line 82 of file XmlRpcClient.cpp.

◆ connectionStateStr()

const char * XmlRpcClient::connectionStateStr ( ClientConnectionState  state)
staticprotected

Definition at line 33 of file XmlRpcClient.cpp.

◆ doConnect()

bool XmlRpcClient::doConnect ( )
protectedvirtual

Definition at line 261 of file XmlRpcClient.cpp.

◆ execute()

bool XmlRpcClient::execute ( const char *  method,
XmlRpcValue const &  params,
XmlRpcValue result 
)

Execute the named procedure on the remote server.

Parameters
methodThe name of the remote procedure to execute
paramsAn array of the arguments for the method
resultThe result value to be returned to the client
Returns
true if the request was sent and a result received (although the result might be a fault).

Currently this is a synchronous (blocking) implementation (execute does not return until it receives a response or an error). Use isFault() to determine whether the result is a fault response.

Definition at line 104 of file XmlRpcClient.cpp.

◆ executeCheckDone()

bool XmlRpcClient::executeCheckDone ( XmlRpcValue result)

Definition at line 179 of file XmlRpcClient.cpp.

◆ executeNonBlock()

bool XmlRpcClient::executeNonBlock ( const char *  method,
XmlRpcValue const &  params 
)

Definition at line 153 of file XmlRpcClient.cpp.

◆ generateHeader()

std::string XmlRpcClient::generateHeader ( size_t  length) const
protectedvirtual

Definition at line 338 of file XmlRpcClient.cpp.

◆ generateRequest()

bool XmlRpcClient::generateRequest ( const char *  method,
XmlRpcValue const &  params 
)
protectedvirtual

Definition at line 293 of file XmlRpcClient.cpp.

◆ getHost()

const std::string& XmlRpc::XmlRpcClient::getHost ( )
inline

Definition at line 100 of file XmlRpcClient.h.

◆ getPort()

int XmlRpc::XmlRpcClient::getPort ( ) const
inline

Definition at line 102 of file XmlRpcClient.h.

◆ getUri()

const std::string& XmlRpc::XmlRpcClient::getUri ( )
inline

Definition at line 101 of file XmlRpcClient.h.

◆ handleEvent()

unsigned XmlRpcClient::handleEvent ( unsigned  eventType)
virtual

Handle server responses. Called by the event dispatcher during execute.

Parameters
eventTypeThe type of event that occurred.
See also
XmlRpcDispatch::EventType

Implements XmlRpc::XmlRpcSource.

Definition at line 205 of file XmlRpcClient.cpp.

◆ isFault()

bool XmlRpc::XmlRpcClient::isFault ( ) const
inline

Returns true if the result of the last execute() was a fault response.

Definition at line 65 of file XmlRpcClient.h.

◆ parseResponse()

bool XmlRpcClient::parseResponse ( XmlRpcValue result)
protectedvirtual

Definition at line 520 of file XmlRpcClient.cpp.

◆ readHeader()

bool XmlRpcClient::readHeader ( )
protectedvirtual

Definition at line 391 of file XmlRpcClient.cpp.

◆ readResponse()

bool XmlRpcClient::readResponse ( )
protectedvirtual

Definition at line 473 of file XmlRpcClient.cpp.

◆ setupConnection()

bool XmlRpcClient::setupConnection ( )
protectedvirtual

Definition at line 236 of file XmlRpcClient.cpp.

◆ writeRequest()

bool XmlRpcClient::writeRequest ( )
protectedvirtual

Definition at line 359 of file XmlRpcClient.cpp.

Member Data Documentation

◆ _bytesWritten

int XmlRpc::XmlRpcClient::_bytesWritten

Definition at line 115 of file XmlRpcClient.h.

◆ _connectionState

ClientConnectionState XmlRpc::XmlRpcClient::_connectionState
protected

Definition at line 91 of file XmlRpcClient.h.

◆ _contentLength

int XmlRpc::XmlRpcClient::_contentLength

Definition at line 128 of file XmlRpcClient.h.

◆ _disp

XmlRpcDispatch XmlRpc::XmlRpcClient::_disp

Definition at line 131 of file XmlRpcClient.h.

◆ _eof

bool XmlRpc::XmlRpcClient::_eof

Definition at line 122 of file XmlRpcClient.h.

◆ _executing

bool XmlRpc::XmlRpcClient::_executing

Definition at line 119 of file XmlRpcClient.h.

◆ _header

std::string XmlRpc::XmlRpcClient::_header

Definition at line 106 of file XmlRpcClient.h.

◆ _host

std::string XmlRpc::XmlRpcClient::_host
protected

Definition at line 96 of file XmlRpcClient.h.

◆ _isFault

bool XmlRpc::XmlRpcClient::_isFault

Definition at line 125 of file XmlRpcClient.h.

◆ _port

int XmlRpc::XmlRpcClient::_port
protected

Definition at line 98 of file XmlRpcClient.h.

◆ _request

std::string XmlRpc::XmlRpcClient::_request

Definition at line 105 of file XmlRpcClient.h.

◆ _response

std::string XmlRpc::XmlRpcClient::_response

Definition at line 107 of file XmlRpcClient.h.

◆ _sendAttempts

int XmlRpc::XmlRpcClient::_sendAttempts

Definition at line 110 of file XmlRpcClient.h.

◆ _uri

std::string XmlRpc::XmlRpcClient::_uri
protected

Definition at line 97 of file XmlRpcClient.h.

◆ FAULT_TAG

const char XmlRpcClient::FAULT_TAG = "<fault>"
static

Definition at line 38 of file XmlRpcClient.h.

◆ METHODRESPONSE_TAG

const char XmlRpcClient::METHODRESPONSE_TAG = "<methodResponse>"
static

Definition at line 37 of file XmlRpcClient.h.

◆ PARAM_ETAG

const char XmlRpcClient::PARAM_ETAG = "</param>"
static

Definition at line 34 of file XmlRpcClient.h.

◆ PARAM_TAG

const char XmlRpcClient::PARAM_TAG = "<param>"
static

Definition at line 33 of file XmlRpcClient.h.

◆ PARAMS_ETAG

const char XmlRpcClient::PARAMS_ETAG = "</params>"
static

Definition at line 32 of file XmlRpcClient.h.

◆ PARAMS_TAG

const char XmlRpcClient::PARAMS_TAG = "<params>"
static

Definition at line 31 of file XmlRpcClient.h.

◆ REQUEST_BEGIN

const char XmlRpcClient::REQUEST_BEGIN
static
Initial value:
=
"<?xml version=\"1.0\"?>\r\n"
"<methodCall><methodName>"

Definition at line 29 of file XmlRpcClient.h.

◆ REQUEST_END

const char XmlRpcClient::REQUEST_END = "</methodCall>\r\n"
static

Definition at line 35 of file XmlRpcClient.h.

◆ REQUEST_END_METHODNAME

const char XmlRpcClient::REQUEST_END_METHODNAME = "</methodName>\r\n"
static

Definition at line 30 of file XmlRpcClient.h.


The documentation for this class was generated from the following files:


xmlrpcpp
Author(s): Chris Morley, Konstantin Pilipchuk, Morgan Quigley, Austin Hendrix, Dirk Thomas , Jacob Perron
autogenerated on Thu Nov 23 2023 04:01:41