XmlRpc::XmlRpcSource Class Reference

An RPC source represents a file descriptor to monitor. More...

#include <XmlRpcSource.h>

Inheritance diagram for XmlRpc::XmlRpcSource:
XmlRpc::XmlRpcClient XmlRpc::XmlRpcServer XmlRpc::XmlRpcServerConnection XmlRpc::XmlRpcThreadedServer XmlRpcInterface

List of all members.

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

Detailed Description

An RPC source represents a file descriptor to monitor.

Definition at line 46 of file XmlRpcSource.h.


Constructor & Destructor Documentation

XmlRpc::XmlRpcSource::XmlRpcSource ( int  fd = -1,
bool  deleteOnClose = false 
)

Constructor.

Parameters:
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]

Destructor.

Definition at line 19 of file XmlRpcSource.cc.

00020   {
00021   }


Member Function Documentation

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]
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; }


Member Data Documentation

Definition at line 85 of file XmlRpcSource.h.

Referenced by close().

Definition at line 80 of file XmlRpcSource.h.

Referenced by close(), getfd(), and setfd().

Definition at line 88 of file XmlRpcSource.h.

Referenced by getKeepOpen(), and setKeepOpen().

Definition at line 74 of file XmlRpcSource.h.

Referenced by close(), and XmlRpc::XmlRpcClient::doConnect().

Definition at line 76 of file XmlRpcSource.h.

Referenced by XmlRpc::XmlRpcClient::doConnect().


The documentation for this class was generated from the following files:
Generated on Wed May 26 16:21:20 2010 for OverSim by  doxygen 1.6.3