XmlRpcSource.h

Go to the documentation of this file.
00001 
00002 #ifndef _XMLRPCSOURCE_H_
00003 #define _XMLRPCSOURCE_H_
00004 //
00005 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
00006 //
00007 
00013 #if defined(_MSC_VER)
00014 # pragma warning(disable:4786)    // identifier was truncated in debug info
00015 #endif
00016 
00017 #ifdef USE_SSL
00018 
00019 // Deal with SSL dependencies
00020 #include <openssl/crypto.h>
00021 #include <openssl/x509.h>
00022 #include <openssl/pem.h>
00023 #include <openssl/ssl.h>
00024 #include <openssl/err.h>
00025 
00026 #else
00027 
00028 #define SSL void*
00029 #define SSL_CTX void*
00030 #define SSL_METHOD void*
00031 #define SSL_shutdown void*
00032 #define SSL_free void*
00033 #define SSL_connect void*
00034 #define SSL_set_fd void*
00035 #define SSL_new void*
00036 #define SSL_load_error_strings void*
00037 #define SSL_CTX_free void*
00038 #define SSL_CTX_new void*
00039 #define SSLeay_add_ssl_algorithms void
00040 #define SSLv23_client_method *void
00041 #endif
00042 
00043 namespace XmlRpc {
00044 
00046   class XmlRpcSource {
00047   public:
00051     XmlRpcSource(int fd = -1, bool deleteOnClose = false);
00052 
00054     virtual ~XmlRpcSource();
00055 
00057     int getfd() const { return _fd; }
00059     void setfd(int fd) { _fd = fd; }
00060 
00062     bool getKeepOpen() const { return _keepOpen; }
00064     void setKeepOpen(bool b=true) { _keepOpen = b; }
00065 
00067     virtual void close();
00068 
00070     virtual unsigned handleEvent(unsigned eventType) = 0;
00071 
00072     // Keep track of SSL status and other such things
00073     bool _ssl;
00074     SSL_CTX* _ssl_ctx;
00075     SSL* _ssl_ssl;
00076     SSL_METHOD* _ssl_meth;
00077   private:
00078 
00079     // Socket. This should really be a SOCKET (an alias for unsigned int*) on windows...
00080     int _fd;
00081 
00082     // In the server, a new source (XmlRpcServerConnection) is created
00083     // for each connected client. When each connection is closed, the
00084     // corresponding source object is deleted.
00085     bool _deleteOnClose;
00086 
00087     // In the client, keep connections open if you intend to make multiple calls.
00088     bool _keepOpen;
00089   };
00090 } // namespace XmlRpc
00091 
00092 #endif //_XMLRPCSOURCE_H_
Generated on Wed May 26 16:21:15 2010 for OverSim by  doxygen 1.6.3