From 922cb5559b9f2f97279fa24cc9c5862c8b666495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 8 Mar 2005 10:23:43 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r2603, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/iem/iemxmlrpc/; revision=2604 --- xmlrpc++/src/XmlRpcSource.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 xmlrpc++/src/XmlRpcSource.h (limited to 'xmlrpc++/src/XmlRpcSource.h') diff --git a/xmlrpc++/src/XmlRpcSource.h b/xmlrpc++/src/XmlRpcSource.h new file mode 100644 index 0000000..135dce4 --- /dev/null +++ b/xmlrpc++/src/XmlRpcSource.h @@ -0,0 +1,55 @@ + +#ifndef _XMLRPCSOURCE_H_ +#define _XMLRPCSOURCE_H_ +// +// XmlRpc++ Copyright (c) 2002-2003 by Chris Morley +// +#if defined(_MSC_VER) +# pragma warning(disable:4786) // identifier was truncated in debug info +#endif + +namespace XmlRpc { + + //! An RPC source represents a file descriptor to monitor + class XmlRpcSource { + public: + //! Constructor + //! @param fd The socket file descriptor to monitor. + //! @param deleteOnClose If true, the object deletes itself when close is called. + XmlRpcSource(int fd = -1, bool deleteOnClose = false); + + //! Destructor + virtual ~XmlRpcSource(); + + //! Return the file descriptor being monitored. + int getfd() const { return _fd; } + //! Specify the file descriptor to monitor. + void setfd(int fd) { _fd = fd; } + + //! Return whether the file descriptor should be kept open if it is no longer monitored. + bool getKeepOpen() const { return _keepOpen; } + //! Specify whether the file descriptor should be kept open if it is no longer monitored. + void setKeepOpen(bool b=true) { _keepOpen = b; } + + //! Close the owned fd. If deleteOnClose was specified at construction, the object is deleted. + virtual void close(); + + //! Return true to continue monitoring this source + virtual unsigned handleEvent(unsigned eventType) = 0; + + private: + + // Socket. This should really be a SOCKET (an alias for unsigned int*) on windows... + int _fd; + + // In the server, a new source (XmlRpcServerConnection) is created + // for each connected client. When each connection is closed, the + // corresponding source object is deleted. + bool _deleteOnClose; + + // In the client, keep connections open if you intend to make multiple calls. + bool _keepOpen; + }; +} // namespace XmlRpc + +#endif //_XMLRPCSOURCE_H_ -- cgit v1.2.1