XmlRpcClient.cpp
Go to the documentation of this file.
1 
3 
5 #include "xmlrpcpp/XmlRpcUtil.h"
6 #include "xmlrpcpp/XmlRpcValue.h"
7 
8 #include <stdio.h>
9 #include <stdlib.h>
10 #ifndef _WINDOWS
11  # include <strings.h>
12 #endif
13 #include <string.h>
14 
15 
16 using namespace XmlRpc;
17 
18 // Static data
19 const char XmlRpcClient::REQUEST_BEGIN[] =
20  "<?xml version=\"1.0\"?>\r\n"
21  "<methodCall><methodName>";
22 const char XmlRpcClient::REQUEST_END_METHODNAME[] = "</methodName>\r\n";
23 const char XmlRpcClient::PARAMS_TAG[] = "<params>";
24 const char XmlRpcClient::PARAMS_ETAG[] = "</params>";
25 const char XmlRpcClient::PARAM_TAG[] = "<param>";
26 const char XmlRpcClient::PARAM_ETAG[] = "</param>";
27 const char XmlRpcClient::REQUEST_END[] = "</methodCall>\r\n";
28 const char XmlRpcClient::METHODRESPONSE_TAG[] = "<methodResponse>";
29 const char XmlRpcClient::FAULT_TAG[] = "<fault>";
30 
31 
33  switch(state) {
34  case NO_CONNECTION:
35  return "NO_CONNECTION";
36  case CONNECTING:
37  return "CONNECTING";
38  case WRITE_REQUEST:
39  return "WRITE_REQUEST";
40  case READ_HEADER:
41  return "READ_HEADER";
42  case READ_RESPONSE:
43  return "READ_RESPONSE";
44  case IDLE:
45  return "IDLE";
46  default:
47  return "UNKNOWN";
48  }
49 }
50 
51 XmlRpcClient::XmlRpcClient(const char* host, int port, const char* uri/*=0*/)
52  : _connectionState(NO_CONNECTION),
53  _host(host),
54  _port(port),
55  _sendAttempts(0),
56  _bytesWritten(0),
57  _executing(false),
58  _eof(false),
59  _isFault(false),
60  _contentLength(0)
61 {
62  XmlRpcUtil::log(1, "XmlRpcClient new client: host %s, port %d.", host, port);
63 
64  if (uri)
65  _uri = uri;
66  else
67  _uri = "/RPC2";
68 
69  // Default to keeping the connection open until an explicit close is done
70  setKeepOpen();
71 }
72 
73 
75 {
76  this->close();
77 }
78 
79 // Close the owned fd
80 void
82 {
83  XmlRpcUtil::log(4, "XmlRpcClient::close: fd %d.", getfd());
85  _disp.exit();
86  _disp.removeSource(this);
88 }
89 
90 
91 // Clear the referenced flag even if exceptions or errors occur.
93  ClearFlagOnExit(bool& flag) : _flag(flag) {}
94  ~ClearFlagOnExit() { _flag = false; }
95  bool& _flag;
96 };
97 
98 // Execute the named procedure on the remote server.
99 // Params should be an array of the arguments for the method.
100 // Returns true if the request was sent and a result received (although the result
101 // might be a fault).
102 bool
103 XmlRpcClient::execute(const char* method, XmlRpcValue const& params, XmlRpcValue& result)
104 {
105  XmlRpcUtil::log(1, "XmlRpcClient::execute: method %s (_connectionState %s).", method, connectionStateStr(_connectionState));
106 
107  // This is not a thread-safe operation, if you want to do multithreading, use separate
108  // clients for each thread. If you want to protect yourself from multiple threads
109  // accessing the same client, replace this code with a real mutex.
110  if (_executing)
111  return false;
112 
113  _executing = true;
115 
116  _sendAttempts = 0;
117  _isFault = false;
118 
119  if ( ! setupConnection())
120  return false;
121 
122  if ( ! generateRequest(method, params))
123  return false;
124 
125  result.clear();
126  double msTime = -1.0; // Process until exit is called
127  _disp.work(msTime);
128 
129  if (_connectionState != IDLE || ! parseResponse(result))
130  return false;
131 
132  XmlRpcUtil::log(1, "XmlRpcClient::execute: method %s completed.", method);
133  _response = "";
134  return true;
135 }
136 
137 // Execute the named procedure on the remote server, non-blocking.
138 // Params should be an array of the arguments for the method.
139 // Returns true if the request was sent and a result received (although the result
140 // might be a fault).
141 bool
142 XmlRpcClient::executeNonBlock(const char* method, XmlRpcValue const& params)
143 {
144  XmlRpcUtil::log(1, "XmlRpcClient::executeNonBlock: method %s (_connectionState %s).", method, connectionStateStr(_connectionState));
145 
146  // This is not a thread-safe operation, if you want to do multithreading, use separate
147  // clients for each thread. If you want to protect yourself from multiple threads
148  // accessing the same client, replace this code with a real mutex.
149  if (_executing)
150  return false;
151 
152  _executing = true;
154 
155  _sendAttempts = 0;
156  _isFault = false;
157 
158  if ( ! setupConnection())
159  return false;
160 
161  if ( ! generateRequest(method, params))
162  return false;
163 
164  return true;
165 }
166 
167 bool
169 {
170  result.clear();
171  // Are we done yet?
172  // If we lost connection, the call failed.
174  return true;
175  }
176 
177  // Otherwise, assume the call is still in progress.
178  if (_connectionState != IDLE) {
179  return false;
180  }
181 
182  if (! parseResponse(result))
183  {
184  // Hopefully the caller can determine that parsing failed.
185  }
186  //XmlRpcUtil::log(1, "XmlRpcClient::execute: method %s completed.", method);
187  _response = "";
188  return true;
189 }
190 
191 // XmlRpcSource interface implementation
192 // Handle server responses. Called by the event dispatcher during execute.
193 unsigned
194 XmlRpcClient::handleEvent(unsigned eventType)
195 {
196  if (eventType == XmlRpcDispatch::Exception)
197  {
199  XmlRpcUtil::error("Error in XmlRpcClient::handleEvent: could not connect to server (%s).",
200  XmlRpcSocket::getErrorMsg().c_str());
201  else
202  XmlRpcUtil::error("Error in XmlRpcClient::handleEvent (state %s): %s.",
204  XmlRpcSocket::getErrorMsg().c_str());
205  return 0;
206  }
207 
209  if ( ! writeRequest()) return 0;
210 
212  if ( ! readHeader()) return 0;
213 
215  if ( ! readResponse()) return 0;
216 
217  // This should probably always ask for Exception events too
218  return (_connectionState == WRITE_REQUEST)
220 }
221 
222 
223 // Create the socket connection to the server if necessary
224 bool
226 {
227  // If an error occurred last time through, or if the server closed the connection, close our end
229  close();
230 
231  _eof = false;
233  if (! doConnect())
234  return false;
235 
236  // Prepare to write the request
238  _bytesWritten = 0;
239 
240  // Notify the dispatcher to listen on this source (calls handleEvent when the socket is writable)
241  _disp.removeSource(this); // Make sure nothing is left over
243 
244  return true;
245 }
246 
247 
248 // Connect to the xmlrpc server
249 bool
251 {
252  int fd = XmlRpcSocket::socket();
253  if (fd < 0)
254  {
255  XmlRpcUtil::error("Error in XmlRpcClient::doConnect: Could not create socket (%s).", XmlRpcSocket::getErrorMsg().c_str());
256  return false;
257  }
258 
259  XmlRpcUtil::log(3, "XmlRpcClient::doConnect: fd %d.", fd);
260  this->setfd(fd);
261 
262  // Don't block on connect/reads/writes
263  if ( ! XmlRpcSocket::setNonBlocking(fd))
264  {
265  this->close();
266  XmlRpcUtil::error("Error in XmlRpcClient::doConnect: Could not set socket to non-blocking IO mode (%s).", XmlRpcSocket::getErrorMsg().c_str());
267  return false;
268  }
269 
270  if ( ! XmlRpcSocket::connect(fd, _host, _port))
271  {
272  this->close();
273  XmlRpcUtil::error("Error in XmlRpcClient::doConnect: Could not connect to server (%s).", XmlRpcSocket::getErrorMsg().c_str());
274  return false;
275  }
276 
277  return true;
278 }
279 
280 // Encode the request to call the specified method with the specified parameters into xml
281 bool
282 XmlRpcClient::generateRequest(const char* methodName, XmlRpcValue const& params)
283 {
284  std::string body = REQUEST_BEGIN;
285  body += methodName;
286  body += REQUEST_END_METHODNAME;
287 
288  // If params is an array, each element is a separate parameter
289  if (params.valid()) {
290  body += PARAMS_TAG;
291  if (params.getType() == XmlRpcValue::TypeArray)
292  {
293  for (int i=0; i<params.size(); ++i) {
294  body += PARAM_TAG;
295  body += params[i].toXml();
296  body += PARAM_ETAG;
297  }
298  }
299  else
300  {
301  body += PARAM_TAG;
302  body += params.toXml();
303  body += PARAM_ETAG;
304  }
305 
306  body += PARAMS_ETAG;
307  }
308  body += REQUEST_END;
309 
310  std::string header = generateHeader(body.length());
311  XmlRpcUtil::log(4, "XmlRpcClient::generateRequest: header is %d bytes, content-length is %d.",
312  header.length(), body.length());
313 
314  _request = header + body;
315  // Limit the size of the request to avoid integer overruns
316  if (_request.length() > size_t(__INT_MAX__)) {
317  XmlRpcUtil::error("XmlRpcClient::generateRequest: request length (%u) exceeds maximum allowed size (%u).",
318  _request.length(), __INT_MAX__);
319  _request.clear();
320  return false;
321  }
322  return true;
323 }
324 
325 // Prepend http headers
326 std::string
327 XmlRpcClient::generateHeader(size_t length) const
328 {
329  std::string header =
330  "POST " + _uri + " HTTP/1.1\r\n"
331  "User-Agent: ";
333  header += "\r\nHost: ";
334  header += _host;
335 
336  char buff[40];
337  std::snprintf(buff,40,":%d\r\n", _port);
338 
339  header += buff;
340  header += "Content-Type: text/xml\r\nContent-length: ";
341 
342  std::snprintf(buff,40,"%zu\r\n\r\n", length);
343 
344  return header + buff;
345 }
346 
347 bool
349 {
350  if (_bytesWritten == 0)
351  XmlRpcUtil::log(5, "XmlRpcClient::writeRequest (attempt %d):\n%s\n", _sendAttempts+1, _request.c_str());
352 
353  // Try to write the request
354  if ( ! XmlRpcSocket::nbWrite(this->getfd(), _request, &_bytesWritten)) {
355  XmlRpcUtil::error("Error in XmlRpcClient::writeRequest: write error (%s).",XmlRpcSocket::getErrorMsg().c_str());
356  // If the write fails, we had an unrecoverable error. Close the socket.
357  close();
358  return false;
359  }
360 
361  XmlRpcUtil::log(3, "XmlRpcClient::writeRequest: wrote %d of %d bytes.", _bytesWritten, _request.length());
362 
363  // Wait for the result
364  if (_bytesWritten == int(_request.length())) {
365  _header = "";
366  _response = "";
368  } else {
369  // On partial write, remove the portion of the output that was written from
370  // the request buffer.
371  _request = _request.substr(_bytesWritten);
372  _bytesWritten = 0;
373  }
374  return true;
375 }
376 
377 
378 // Read the header from the response
379 bool
381 {
382  // Read available data
383  if ( ! XmlRpcSocket::nbRead(this->getfd(), _header, &_eof) ||
384  (_eof && _header.length() == 0)) {
385 
386  // If we haven't read any data yet and this is a keep-alive connection, the server may
387  // have timed out, so we try one more time.
388  if (getKeepOpen() && _header.length() == 0 && _sendAttempts++ == 0) {
389  XmlRpcUtil::log(4, "XmlRpcClient::readHeader: re-trying connection");
392  _eof = false;
393  return setupConnection();
394  }
395 
396  XmlRpcUtil::error("Error in XmlRpcClient::readHeader: error while reading "
397  "header (%s) on fd %d.",
398  XmlRpcSocket::getErrorMsg().c_str(), getfd());
399  // Read failed; this means the socket is in an unrecoverable state.
400  // Close the socket.
401  close();
402  return false;
403  }
404 
405  XmlRpcUtil::log(4, "XmlRpcClient::readHeader: client has read %d bytes", _header.length());
406 
407  char *hp = (char*)_header.c_str(); // Start of header
408  char *ep = hp + _header.length(); // End of string
409  char *bp = 0; // Start of body
410  char *lp = 0; // Start of content-length value
411 
412  for (char *cp = hp; (bp == 0) && (cp < ep); ++cp) {
413  if ((ep - cp > 16) && (strncasecmp(cp, "Content-length: ", 16) == 0))
414  lp = cp + 16;
415  else if ((ep - cp > 4) && (strncmp(cp, "\r\n\r\n", 4) == 0))
416  bp = cp + 4;
417  else if ((ep - cp > 2) && (strncmp(cp, "\n\n", 2) == 0))
418  bp = cp + 2;
419  }
420 
421  // If we haven't gotten the entire header yet, return (keep reading)
422  if (bp == 0) {
423  if (_eof) // EOF in the middle of a response is an error
424  {
425  XmlRpcUtil::error("Error in XmlRpcClient::readHeader: EOF while reading header");
426  close();
427  return false; // Close the connection
428  }
429 
430  return true; // Keep reading
431  }
432 
433  // Decode content length
434  if (lp == 0) {
435  XmlRpcUtil::error("Error XmlRpcClient::readHeader: No Content-length specified");
436  // Close the socket because we can't make further use of it.
437  close();
438  return false; // We could try to figure it out by parsing as we read, but for now...
439  }
440 
441  // avoid overly large or improperly formatted content-length
442  long int clength = 0;
443  clength = strtol(lp, nullptr, 10);
444  if ((clength <= 0) || (clength > __INT_MAX__)) {
445  XmlRpcUtil::error("Error in XmlRpcClient::readHeader: Invalid Content-length specified.");
446  // Close the socket because we can't make further use of it.
447  close();
448  return false;
449  }
450  _contentLength = int(clength);
451 
452  XmlRpcUtil::log(4, "client read content length: %d", _contentLength);
453 
454  // Otherwise copy non-header data to response buffer and set state to read response.
455  _response = bp;
456  _header = ""; // should parse out any interesting bits from the header (connection, etc)...
458  return true; // Continue monitoring this source
459 }
460 
461 
462 bool
464 {
465  // If we dont have the entire response yet, read available data
466  if (int(_response.length()) < _contentLength) {
467  std::string buff;
468  if ( ! XmlRpcSocket::nbRead(this->getfd(), buff, &_eof)) {
469  XmlRpcUtil::error("Error in XmlRpcClient::readResponse: read error (%s).",XmlRpcSocket::getErrorMsg().c_str());
470  // nbRead returned an error, indicating that the socket is in a bad state.
471  // close it and stop monitoring this client.
472  close();
473  return false;
474  }
475  _response += buff;
476 
477  // Avoid an overly large response
478  if (_response.length() > size_t(__INT_MAX__)) {
479  XmlRpcUtil::error("XmlRpcClient::readResponse: response length (%u) exceeds the maximum allowed size (%u).",
480  _response.length(), __INT_MAX__);
481  _response.clear();
482  close();
483  return false;
484  }
485  // If we haven't gotten the entire _response yet, return (keep reading)
486  if (int(_response.length()) < _contentLength) {
487  if (_eof) {
488  XmlRpcUtil::error("Error in XmlRpcClient::readResponse: EOF while reading response");
489  // nbRead returned an eof, indicating that the socket is disconnected.
490  // close it and stop monitoring this client.
491  close();
492  return false;
493  }
494  return true;
495  }
496  }
497 
498  // Otherwise, parse and return the result
499  XmlRpcUtil::log(3, "XmlRpcClient::readResponse (read %d bytes)", _response.length());
500  XmlRpcUtil::log(5, "response:\n%s", _response.c_str());
501 
503 
504  return false; // Stop monitoring this source (causes return from work)
505 }
506 
507 
508 // Convert the response xml into a result value
509 bool
511 {
512  // Parse response xml into result
513  int offset = 0;
515  XmlRpcUtil::error("Error in XmlRpcClient::parseResponse: Invalid response - no methodResponse. Response:\n%s", _response.c_str());
516  return false;
517  }
518 
519  // Expect either <params><param>... or <fault>...
522  (XmlRpcUtil::nextTagIs(FAULT_TAG,_response,&offset) && (_isFault = true)))
523  {
524  if ( ! result.fromXml(_response, &offset)) {
525  XmlRpcUtil::error("Error in XmlRpcClient::parseResponse: Invalid response value. Response:\n%s", _response.c_str());
526  _response = "";
527  return false;
528  }
529  } else {
530  XmlRpcUtil::error("Error in XmlRpcClient::parseResponse: Invalid response - no param or fault tag. Response:\n%s", _response.c_str());
531  _response = "";
532  return false;
533  }
534 
535  _response = "";
536  return result.valid();
537 }
538 
XmlRpc::XmlRpcValue::size
int size() const
Return the size for string, base64, array, and struct values.
Definition: XmlRpcValue.cpp:210
XmlRpc::XmlRpcValue::toXml
std::string toXml() const
Encode the Value in xml.
Definition: XmlRpcValue.cpp:274
XmlRpcClient.h
XmlRpc::XmlRpcClient::connectionStateStr
static const char * connectionStateStr(ClientConnectionState state)
Definition: XmlRpcClient.cpp:32
XmlRpc::XmlRpcDispatch::WritableEvent
@ WritableEvent
connected/data can be written without blocking
Definition: XmlRpcDispatch.h:34
XmlRpc::XmlRpcSocket::socket
static int socket()
Creates a stream (TCP) socket. Returns -1 on failure.
Definition: XmlRpcSocket.cpp:99
XmlRpc::XmlRpcClient::IDLE
@ IDLE
Definition: XmlRpcClient.h:90
XmlRpc::XmlRpcClient::_header
std::string _header
Definition: XmlRpcClient.h:106
ClearFlagOnExit
Definition: XmlRpcClient.cpp:92
XmlRpc::XmlRpcClient::~XmlRpcClient
virtual ~XmlRpcClient()
Destructor.
Definition: XmlRpcClient.cpp:74
XmlRpc::XmlRpcClient::generateHeader
virtual std::string generateHeader(size_t length) const
Definition: XmlRpcClient.cpp:327
XmlRpc::XmlRpcClient::doConnect
virtual bool doConnect()
Definition: XmlRpcClient.cpp:250
XmlRpc::XmlRpcValue::fromXml
bool fromXml(std::string const &valueXml, int *offset)
Decode xml. Destroys any existing value.
Definition: XmlRpcValue.cpp:231
XmlRpc::XmlRpcSource::setfd
void setfd(int fd)
Specify the file descriptor to monitor.
Definition: XmlRpcSource.h:29
XmlRpc::XmlRpcClient::executeNonBlock
bool executeNonBlock(const char *method, XmlRpcValue const &params)
Definition: XmlRpcClient.cpp:142
XmlRpc::XmlRpcClient::_executing
bool _executing
Definition: XmlRpcClient.h:119
XmlRpc::XmlRpcClient::_response
std::string _response
Definition: XmlRpcClient.h:107
XmlRpc::XmlRpcUtil::log
static void log(int level, const char *fmt,...)
Dump messages somewhere.
Definition: XmlRpcUtil.cpp:80
XmlRpc::XmlRpcClient::PARAM_TAG
static const char PARAM_TAG[]
Definition: XmlRpcClient.h:33
ClearFlagOnExit::~ClearFlagOnExit
~ClearFlagOnExit()
Definition: XmlRpcClient.cpp:94
XmlRpc::XmlRpcClient::_isFault
bool _isFault
Definition: XmlRpcClient.h:125
XmlRpc::XmlRpcClient::_bytesWritten
int _bytesWritten
Definition: XmlRpcClient.h:115
XmlRpc::XmlRpcClient::handleEvent
virtual unsigned handleEvent(unsigned eventType)
Definition: XmlRpcClient.cpp:194
XmlRpcValue.h
XmlRpc::XmlRpcSource::setKeepOpen
void setKeepOpen(bool b=true)
Specify whether the file descriptor should be kept open if it is no longer monitored.
Definition: XmlRpcSource.h:34
XmlRpc::XmlRpcClient::execute
bool execute(const char *method, XmlRpcValue const &params, XmlRpcValue &result)
Definition: XmlRpcClient.cpp:103
XmlRpc::XmlRpcClient::METHODRESPONSE_TAG
static const char METHODRESPONSE_TAG[]
Definition: XmlRpcClient.h:37
XmlRpc
Definition: XmlRpcClient.h:20
XmlRpc::XmlRpcClient::WRITE_REQUEST
@ WRITE_REQUEST
Definition: XmlRpcClient.h:90
XmlRpc::XmlRpcClient::writeRequest
virtual bool writeRequest()
Definition: XmlRpcClient.cpp:348
XmlRpc::XmlRpcClient::executeCheckDone
bool executeCheckDone(XmlRpcValue &result)
Definition: XmlRpcClient.cpp:168
ClearFlagOnExit::ClearFlagOnExit
ClearFlagOnExit(bool &flag)
Definition: XmlRpcClient.cpp:93
XmlRpc::XmlRpcClient::NO_CONNECTION
@ NO_CONNECTION
Definition: XmlRpcClient.h:90
XmlRpc::XmlRpcDispatch::exit
void exit()
Exit from work routine.
Definition: XmlRpcDispatch.cpp:253
XmlRpc::XmlRpcDispatch::ReadableEvent
@ ReadableEvent
data available to read
Definition: XmlRpcDispatch.h:33
XmlRpc::XmlRpcSource::close
virtual void close()
Close the owned fd. If deleteOnClose was specified at construction, the object is deleted.
Definition: XmlRpcSource.cpp:20
XmlRpc::XmlRpcValue::clear
void clear()
Erase the current value.
Definition: XmlRpcValue.h:79
XmlRpc::XmlRpcDispatch::addSource
void addSource(XmlRpcSource *source, unsigned eventMask)
Definition: XmlRpcDispatch.cpp:96
XmlRpc::XmlRpcClient::parseResponse
virtual bool parseResponse(XmlRpcValue &result)
Definition: XmlRpcClient.cpp:510
XmlRpc::XmlRpcUtil::findTag
static bool findTag(const char *tag, std::string const &xml, int *offset)
Returns true if the tag is found and updates offset to the char after the tag.
Definition: XmlRpcUtil.cpp:129
XmlRpc::XmlRpcSocket::setNonBlocking
static bool setNonBlocking(int socket)
Sets a stream (TCP) socket to perform non-blocking IO. Returns false on failure.
Definition: XmlRpcSocket.cpp:121
XmlRpc::XmlRpcClient::FAULT_TAG
static const char FAULT_TAG[]
Definition: XmlRpcClient.h:38
XmlRpc::XmlRpcClient::generateRequest
virtual bool generateRequest(const char *method, XmlRpcValue const &params)
Definition: XmlRpcClient.cpp:282
XmlRpc::XmlRpcClient::readResponse
virtual bool readResponse()
Definition: XmlRpcClient.cpp:463
XmlRpc::XmlRpcUtil::nextTagIs
static bool nextTagIs(const char *tag, std::string const &xml, int *offset)
Definition: XmlRpcUtil.cpp:145
XmlRpc::XmlRpcClient::READ_RESPONSE
@ READ_RESPONSE
Definition: XmlRpcClient.h:90
XmlRpc::XmlRpcUtil::error
static void error(const char *fmt,...)
Dump error messages somewhere.
Definition: XmlRpcUtil.cpp:95
XmlRpc::XmlRpcClient::setupConnection
virtual bool setupConnection()
Definition: XmlRpcClient.cpp:225
XmlRpc::XmlRpcClient::REQUEST_END
static const char REQUEST_END[]
Definition: XmlRpcClient.h:35
XmlRpcSocket.h
XmlRpc::XmlRpcDispatch::removeSource
void removeSource(XmlRpcSource *source)
Definition: XmlRpcDispatch.cpp:103
XmlRpc::XmlRpcClient::_sendAttempts
int _sendAttempts
Definition: XmlRpcClient.h:110
XmlRpc::XmlRpcSource::getfd
int getfd() const
Return the file descriptor being monitored.
Definition: XmlRpcSource.h:27
XmlRpc::XmlRpcClient::ClientConnectionState
ClientConnectionState
Definition: XmlRpcClient.h:90
XmlRpc::XmlRpcValue::getType
const Type & getType() const
Return the type of the value stored.
Definition: XmlRpcValue.h:124
ClearFlagOnExit::_flag
bool & _flag
Definition: XmlRpcClient.cpp:95
XmlRpc::XmlRpcValue::TypeArray
@ TypeArray
Definition: XmlRpcValue.h:36
XmlRpc::XmlRpcClient::_uri
std::string _uri
Definition: XmlRpcClient.h:97
XmlRpc::XmlRpcClient::REQUEST_BEGIN
static const char REQUEST_BEGIN[]
Definition: XmlRpcClient.h:29
XmlRpc::XmlRpcDispatch::work
void work(double msTime)
Definition: XmlRpcDispatch.cpp:130
XmlRpc::XmlRpcClient::_eof
bool _eof
Definition: XmlRpcClient.h:122
XmlRpc::XmlRpcSource::getKeepOpen
bool getKeepOpen() const
Return whether the file descriptor should be kept open if it is no longer monitored.
Definition: XmlRpcSource.h:32
XmlRpc::XmlRpcClient::PARAMS_TAG
static const char PARAMS_TAG[]
Definition: XmlRpcClient.h:31
XmlRpc::XmlRpcValue::valid
bool valid() const
Return true if the value has been set to something.
Definition: XmlRpcValue.h:121
XmlRpc::XmlRpcClient::READ_HEADER
@ READ_HEADER
Definition: XmlRpcClient.h:90
XmlRpc::XmlRpcSocket::nbWrite
static bool nbWrite(int socket, const std::string &s, int *bytesSoFar)
Write text to the specified socket. Returns false on error.
Definition: XmlRpcSocket.cpp:333
XmlRpc::XmlRpcClient::_request
std::string _request
Definition: XmlRpcClient.h:105
XmlRpc::XmlRpcClient::readHeader
virtual bool readHeader()
Definition: XmlRpcClient.cpp:380
XmlRpc::XmlRpcSocket::getErrorMsg
static std::string getErrorMsg()
Returns message corresponding to last error.
Definition: XmlRpcSocket.cpp:381
XmlRpc::XmlRpcClient::CONNECTING
@ CONNECTING
Definition: XmlRpcClient.h:90
XmlRpc::XmlRpcSocket::nbRead
static bool nbRead(int socket, std::string &s, bool *eof)
Read text from the specified socket. Returns false on error.
Definition: XmlRpcSocket.cpp:293
XmlRpc::XmlRpcClient::PARAM_ETAG
static const char PARAM_ETAG[]
Definition: XmlRpcClient.h:34
XmlRpc::XmlRpcClient::REQUEST_END_METHODNAME
static const char REQUEST_END_METHODNAME[]
Definition: XmlRpcClient.h:30
XmlRpc::XmlRpcClient::_connectionState
ClientConnectionState _connectionState
Definition: XmlRpcClient.h:91
XmlRpc::XMLRPC_VERSION
const XMLRPCPP_DECL char XMLRPC_VERSION[]
Version identifier.
Definition: XmlRpcUtil.cpp:24
XmlRpc::XmlRpcClient::_contentLength
int _contentLength
Definition: XmlRpcClient.h:128
header
const std::string header
Definition: test_client.cpp:640
XmlRpc::XmlRpcClient::PARAMS_ETAG
static const char PARAMS_ETAG[]
Definition: XmlRpcClient.h:32
XmlRpc::XmlRpcDispatch::Exception
@ Exception
out-of-band data has arrived
Definition: XmlRpcDispatch.h:35
XmlRpc::XmlRpcClient::close
virtual void close()
Close the connection.
Definition: XmlRpcClient.cpp:81
XmlRpc::XmlRpcClient::_port
int _port
Definition: XmlRpcClient.h:98
XmlRpc::XmlRpcClient::_disp
XmlRpcDispatch _disp
Definition: XmlRpcClient.h:131
XmlRpcUtil.h
XmlRpc::XmlRpcClient::_host
std::string _host
Definition: XmlRpcClient.h:96
XmlRpc::XmlRpcValue
RPC method arguments and results are represented by Values.
Definition: XmlRpcValue.h:24
XmlRpc::XmlRpcSocket::connect
static bool connect(int socket, const std::string &host, int port)
Connect a socket to a server (from a client)
Definition: XmlRpcSocket.cpp:200
XmlRpc::XmlRpcClient::XmlRpcClient
XmlRpcClient(const char *host, int port, const char *uri=0)
Definition: XmlRpcClient.cpp:51


xmlrpcpp
Author(s): Chris Morley, Konstantin Pilipchuk, Morgan Quigley, Austin Hendrix, Dirk Thomas
autogenerated on Sat Oct 17 2020 19:28:46