OverSim
XmlRpcSource.h
Go to the documentation of this file.
1 
2 #ifndef _XMLRPCSOURCE_H_
3 #define _XMLRPCSOURCE_H_
4 //
5 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
6 //
7 
13 #if defined(_MSC_VER)
14 # pragma warning(disable:4786) // identifier was truncated in debug info
15 #endif
16 
17 #ifdef USE_SSL
18 
19 // Deal with SSL dependencies
20 #include <openssl/crypto.h>
21 #include <openssl/x509.h>
22 #include <openssl/pem.h>
23 #include <openssl/ssl.h>
24 #include <openssl/err.h>
25 
26 #else
27 
28 #define SSL void*
29 #define SSL_CTX void*
30 #define SSL_METHOD void*
31 #define SSL_shutdown void*
32 #define SSL_free void*
33 #define SSL_connect void*
34 #define SSL_set_fd void*
35 #define SSL_new void*
36 #define SSL_load_error_strings void*
37 #define SSL_CTX_free void*
38 #define SSL_CTX_new void*
39 #define SSLeay_add_ssl_algorithms void
40 #define SSLv23_client_method *void
41 #endif
42 
43 namespace XmlRpc {
44 
46  class XmlRpcSource {
47  public:
51  XmlRpcSource(int fd = -1, bool deleteOnClose = false);
52 
54  virtual ~XmlRpcSource();
55 
57  int getfd() const { return _fd; }
59  void setfd(int fd) { _fd = fd; }
60 
62  bool getKeepOpen() const { return _keepOpen; }
64  void setKeepOpen(bool b=true) { _keepOpen = b; }
65 
67  virtual void close();
68 
70  virtual unsigned handleEvent(unsigned eventType) = 0;
71 
72  // Keep track of SSL status and other such things
73  bool _ssl;
77  private:
78 
79  // Socket. This should really be a SOCKET (an alias for unsigned int*) on windows...
80  int _fd;
81 
82  // In the server, a new source (XmlRpcServerConnection) is created
83  // for each connected client. When each connection is closed, the
84  // corresponding source object is deleted.
86 
87  // In the client, keep connections open if you intend to make multiple calls.
88  bool _keepOpen;
89  };
90 } // namespace XmlRpc
91 
92 #endif //_XMLRPCSOURCE_H_