00001 00002 #ifndef _XMLRPCSOURCE_H_ 00003 #define _XMLRPCSOURCE_H_ 00004 // 00005 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley 00006 // 00007 #if defined(_MSC_VER) 00008 # pragma warning(disable:4786) // identifier was truncated in debug info 00009 #endif 00010 00011 namespace XmlRpc { 00012 00014 class XmlRpcSource { 00015 public: 00019 XmlRpcSource(int fd = -1, bool deleteOnClose = false); 00020 00022 virtual ~XmlRpcSource(); 00023 00025 int getfd() const { return _fd; } 00027 void setfd(int fd) { _fd = fd; } 00028 00030 bool getKeepOpen() const { return _keepOpen; } 00032 void setKeepOpen(bool b=true) { _keepOpen = b; } 00033 00035 virtual void close(); 00036 00038 virtual unsigned handleEvent(unsigned eventType) = 0; 00039 00040 private: 00041 00042 // Socket. This should really be a SOCKET (an alias for unsigned int*) on windows... 00043 int _fd; 00044 00045 // In the server, a new source (XmlRpcServerConnection) is created 00046 // for each connected client. When each connection is closed, the 00047 // corresponding source object is deleted. 00048 bool _deleteOnClose; 00049 00050 // In the client, keep connections open if you intend to make multiple calls. 00051 bool _keepOpen; 00052 }; 00053 } // namespace XmlRpc 00054 00055 #endif //_XMLRPCSOURCE_H_