An RPC source represents a file descriptor to monitor. More...
#include <XmlRpcSource.h>
Public Member Functions | |
XmlRpcSource (int fd=-1, bool deleteOnClose=false) | |
Constructor. | |
virtual | ~XmlRpcSource () |
Destructor. | |
int | getfd () const |
Return the file descriptor being monitored. | |
void | setfd (int fd) |
Specify the file descriptor to monitor. | |
bool | getKeepOpen () const |
Return whether the file descriptor should be kept open if it is no longer monitored. | |
void | setKeepOpen (bool b=true) |
Specify whether the file descriptor should be kept open if it is no longer monitored. | |
virtual void | close () |
Close the owned fd. If deleteOnClose was specified at construction, the object is deleted. | |
virtual unsigned | handleEvent (unsigned eventType)=0 |
Return true to continue monitoring this source. | |
Public Attributes | |
bool | _ssl |
SSL_CTX * | _ssl_ctx |
SSL * | _ssl_ssl |
SSL_METHOD * | _ssl_meth |
Private Attributes | |
int | _fd |
bool | _deleteOnClose |
bool | _keepOpen |
An RPC source represents a file descriptor to monitor.
Definition at line 46 of file XmlRpcSource.h.
XmlRpc::XmlRpcSource::XmlRpcSource | ( | int | fd = -1 , |
|
bool | deleteOnClose = false | |||
) |
Constructor.
fd | The socket file descriptor to monitor. | |
deleteOnClose | If true, the object deletes itself when close is called. |
Definition at line 14 of file XmlRpcSource.cc.
: _fd(fd), _deleteOnClose(deleteOnClose), _keepOpen(false) { }
XmlRpc::XmlRpcSource::~XmlRpcSource | ( | ) | [virtual] |
void XmlRpc::XmlRpcSource::close | ( | ) | [virtual] |
Close the owned fd. If deleteOnClose was specified at construction, the object is deleted.
Reimplemented in XmlRpc::XmlRpcClient.
Definition at line 25 of file XmlRpcSource.cc.
Referenced by XmlRpc::XmlRpcServer::acceptConnection(), XmlRpc::XmlRpcServer::bindAndListen(), XmlRpc::XmlRpcDispatch::waitForAndProcessEvents(), and XmlRpc::XmlRpcDispatch::work().
{ if (_fd != -1) { XmlRpcUtil::log(2,"XmlRpcSource::close: closing socket %d.", _fd); XmlRpcSocket::close(_fd); XmlRpcUtil::log(2,"XmlRpcSource::close: done closing socket %d.", _fd); _fd = -1; } if (_deleteOnClose) { XmlRpcUtil::log(2,"XmlRpcSource::close: deleting this"); _deleteOnClose = false; delete this; } #ifdef USE_SSL if (_ssl_ssl != (SSL *) NULL) { SSL_shutdown (_ssl_ssl); SSL_free (_ssl_ssl); SSL_CTX_free (_ssl_ctx); } #endif }
int XmlRpc::XmlRpcSource::getfd | ( | ) | const [inline] |
Return the file descriptor being monitored.
Definition at line 57 of file XmlRpcSource.h.
Referenced by XmlRpc::XmlRpcServer::acceptConnection(), XmlRpc::XmlRpcClient::close(), XmlRpc::XmlRpcServer::getPort(), XmlRpc::XmlRpcServerConnection::readHeader(), XmlRpc::XmlRpcClient::readHeader(), XmlRpc::XmlRpcServerConnection::readRequest(), XmlRpc::XmlRpcClient::readResponse(), XmlRpc::XmlRpcDispatch::waitForAndProcessEvents(), XmlRpc::XmlRpcClient::writeRequest(), and XmlRpc::XmlRpcServerConnection::writeResponse().
{ return _fd; }
bool XmlRpc::XmlRpcSource::getKeepOpen | ( | ) | const [inline] |
Return whether the file descriptor should be kept open if it is no longer monitored.
Definition at line 62 of file XmlRpcSource.h.
Referenced by XmlRpc::XmlRpcClient::readHeader(), and XmlRpc::XmlRpcDispatch::waitForAndProcessEvents().
{ return _keepOpen; }
virtual unsigned XmlRpc::XmlRpcSource::handleEvent | ( | unsigned | eventType | ) | [pure virtual] |
Return true to continue monitoring this source.
Implemented in XmlRpc::XmlRpcClient, XmlRpc::XmlRpcServer, and XmlRpc::XmlRpcServerConnection.
Referenced by XmlRpc::XmlRpcDispatch::waitForAndProcessEvents().
void XmlRpc::XmlRpcSource::setfd | ( | int | fd | ) | [inline] |
Specify the file descriptor to monitor.
Definition at line 59 of file XmlRpcSource.h.
Referenced by XmlRpc::XmlRpcServer::bindAndListen(), and XmlRpc::XmlRpcClient::doConnect().
{ _fd = fd; }
void XmlRpc::XmlRpcSource::setKeepOpen | ( | bool | b = true |
) | [inline] |
Specify whether the file descriptor should be kept open if it is no longer monitored.
Definition at line 64 of file XmlRpcSource.h.
Referenced by XmlRpc::XmlRpcClient::XmlRpcClient().
{ _keepOpen = b; }
bool XmlRpc::XmlRpcSource::_deleteOnClose [private] |
Definition at line 85 of file XmlRpcSource.h.
Referenced by close().
int XmlRpc::XmlRpcSource::_fd [private] |
Definition at line 80 of file XmlRpcSource.h.
bool XmlRpc::XmlRpcSource::_keepOpen [private] |
Definition at line 88 of file XmlRpcSource.h.
Referenced by getKeepOpen(), and setKeepOpen().
Definition at line 73 of file XmlRpcSource.h.
Referenced by XmlRpc::XmlRpcClient::close(), XmlRpc::XmlRpcClient::doConnect(), and XmlRpc::XmlRpcClient::XmlRpcClient().
SSL_CTX* XmlRpc::XmlRpcSource::_ssl_ctx |
Definition at line 74 of file XmlRpcSource.h.
Referenced by close(), and XmlRpc::XmlRpcClient::doConnect().
SSL_METHOD* XmlRpc::XmlRpcSource::_ssl_meth |
Definition at line 76 of file XmlRpcSource.h.
Referenced by XmlRpc::XmlRpcClient::doConnect().
Definition at line 75 of file XmlRpcSource.h.
Referenced by close(), XmlRpc::XmlRpcClient::doConnect(), XmlRpc::XmlRpcServerConnection::readHeader(), XmlRpc::XmlRpcClient::readHeader(), XmlRpc::XmlRpcServerConnection::readRequest(), XmlRpc::XmlRpcClient::readResponse(), XmlRpc::XmlRpcClient::writeRequest(), XmlRpc::XmlRpcServerConnection::writeResponse(), and XmlRpc::XmlRpcClient::XmlRpcClient().