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.
00015 : _fd(fd), _deleteOnClose(deleteOnClose), _keepOpen(false) 00016 { 00017 }
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().
00026 { 00027 if (_fd != -1) { 00028 XmlRpcUtil::log(2,"XmlRpcSource::close: closing socket %d.", _fd); 00029 XmlRpcSocket::close(_fd); 00030 XmlRpcUtil::log(2,"XmlRpcSource::close: done closing socket %d.", _fd); 00031 _fd = -1; 00032 } 00033 if (_deleteOnClose) { 00034 XmlRpcUtil::log(2,"XmlRpcSource::close: deleting this"); 00035 _deleteOnClose = false; 00036 delete this; 00037 } 00038 #ifdef USE_SSL 00039 if (_ssl_ssl != (SSL *) NULL) { 00040 SSL_shutdown (_ssl_ssl); 00041 SSL_free (_ssl_ssl); 00042 SSL_CTX_free (_ssl_ctx); 00043 } 00044 #endif 00045 }
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().
00057 { 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().
00062 { 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().
00059 { _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().
00064 { _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().