Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

VOS::LocalSocketSite Class Reference

A local site implemented using TCP sockets. More...

#include <vos/corelibs/vos/localsocketsite.hh>

Inheritance diagram for VOS::LocalSocketSite:

VOS::LocalSite VOS::Site VOS::LocalMetaObject VOS::MetaObject VOS::MetaObject VOS::LocalVobject VOS::Vobject VOS::Vobject VOS::VobjectImplementation VOS::RefCounted VOS::RefCounted VOS::Vobject VOS::ObjectExciseListener VOS::RefCounted List of all members.

Public Member Functions

Static Public Attributes

Friends


Detailed Description

A local site implemented using TCP sockets.

It binds a TCP socket and accepts connection requests.

Definition at line 43 of file localsocketsite.hh.


Constructor & Destructor Documentation

LocalSocketSite::LocalSocketSite SiteAccessControl ac  )  throw (PortBindingError)
 

The usual constructor to use.

Gets hostname from the system (gethostname), unless "VOS_HOSTNAME" environment variable is present. Uses the first free port number <= 4231 (VOS_DEFAULT_PORT)

Definition at line 162 of file localsocketsite.cc.

LocalSocketSite::LocalSocketSite const string &  defaultHostname,
unsigned short int  port,
SiteAccessControl ac
throw (PortBindingError)
 

Definition at line 192 of file localsocketsite.cc.

LocalSocketSite::LocalSocketSite const string &  defaultHostname,
SiteAccessControl ac
throw (PortBindingError)
 

Definition at line 200 of file localsocketsite.cc.

LocalSocketSite::LocalSocketSite unsigned short int  port,
SiteAccessControl ac
throw (PortBindingError)
 

Definition at line 218 of file localsocketsite.cc.

LocalSocketSite::~LocalSocketSite  )  [virtual]
 

destructor

Definition at line 228 of file localsocketsite.cc.


Member Function Documentation

void LocalSocketSite::addFDtoSelect int  fd,
int  which
 

Add an extra file descriptor to our select() call.

Parameters:
fd the file description
which The OR'd together flags of LocalSocketSite::SELECTREAD, LocalSocketSite::SELECTWRITE and LocalSocketSite::SELECTERROR specifying which select set to add the file descriptor to.

Definition at line 495 of file localsocketsite.cc.

Referenced by VOS::RemoteSocketSite::flushOutgoingBuffers().

struct timeval * LocalSocketSite::calculateTimeout  ) 
 

Calculate the timeout value of the next call to select() and return an appropriate timeval structure.

If the time returned is less than the time set with setTimeoutOnSelect(), then it is amount of time to the next event (message delivery or timer callback). If a null pointer is returned, the select is expected to block indefinitely.

Returns:
a pointer timeval structure allocated with 'new', which the user is expected to 'delete' when done; or may be null signifying an indefinitely wait.

Definition at line 335 of file localsocketsite.cc.

Referenced by flushIncomingBuffers().

void LocalSocketSite::flushIncomingBuffers  )  [virtual]
 

Flush any incoming buffers (eg read any data waiting in sockets).

Implements VOS::LocalSite.

Definition at line 395 of file localsocketsite.cc.

int LocalSocketSite::getFDset fd_set *  readset,
fd_set *  writeset,
fd_set *  errorset
 

On the supplied file descriptor sets, set all the file descriptors that a call to flushIncomingBuffers() would wait upon.

Parameters:
readset the FDs to wait for reading
writeset the FDs to wait for writing
errorset the FDs to wait for errors
Returns:
the largest value file descriptor that was set

Definition at line 313 of file localsocketsite.cc.

Referenced by flushIncomingBuffers().

int VOS::LocalSocketSite::getSocket  )  [inline]
 

Return the underlying system socket file descriptor on which this site is listening.

You are strongly advised NOT to read or write to this file descriptor, but you may find it rather useful to know for doing your own select() calls...

Definition at line 165 of file localsocketsite.hh.

SSL_CTX * LocalSocketSite::getSSLContext const string &  protocol  ) 
 

Get the OpenSSL context.

Will return NULL if there was an error or VOS was not compiled with SSL support.

Definition at line 511 of file localsocketsite.cc.

Referenced by sendMessage().

int LocalSocketSite::lastSelectResultForFD int  fd  ) 
 

Get most recent result for this file descriptor.

Parameters:
fd the file description
Returns:
The result stored in the first three bits. Do a boolean AND to get the result for each select set. For example:
        x = lastSelectResultForFD(fd);
        if(x & LocalSocketSite::SELECTREAD) ...

Definition at line 506 of file localsocketsite.cc.

void LocalSocketSite::removeFDfromSelect int  fd,
int  which
 

Remove an extra file descriptor to our select() call.

Parameters:
fd the file description
which The OR'd together flags of LocalSocketSite::SELECTREAD, LocalSocketSite::SELECTWRITE and LocalSocketSite::SELECTERROR specifying which select set to remove the file descriptor from.

Definition at line 500 of file localsocketsite.cc.

Referenced by VOS::RemoteSocketSite::flushOutgoingBuffers().

void LocalSocketSite::sendMessage Message m  )  [virtual]
 

Sends a message to the object.

This may trigger immediate processing of the message if the object is local.

Parameters:
m A pointer to the message which is being sent. Its reference count will be increased as necssary.

Reimplemented from VOS::LocalSite.

Definition at line 520 of file localsocketsite.cc.

void LocalSocketSite::setupSSL const string &  certificateFile,
const string &  privateKeyFile,
const string &  password
 

Set up our SSL identity.

Parameters:
certificateFile The filename the X509 certificate (public key)
privateKeyFile The filename the private key
password The password needed to decrypt the private key file

Definition at line 575 of file localsocketsite.cc.


Friends And Related Function Documentation

void Site::doSitePeering LocalSite localsite,
RemoteSite remotesite,
bool  isspooftest,
bool  waitforhello
[friend]
 

Reimplemented from VOS::LocalSite.


Member Data Documentation

const int LocalSocketSite::SELECTERROR = 0x4 [static]
 

Definition at line 493 of file localsocketsite.cc.

Referenced by flushIncomingBuffers(), and getFDset().

const int LocalSocketSite::SELECTREAD = 0x1 [static]
 

Definition at line 491 of file localsocketsite.cc.

Referenced by flushIncomingBuffers(), and getFDset().

const int LocalSocketSite::SELECTWRITE = 0x2 [static]
 

Definition at line 492 of file localsocketsite.cc.

Referenced by flushIncomingBuffers(), and getFDset().


The documentation for this class was generated from the following files:
Generated on Tue Aug 12 03:56:03 2003 for Interreality Project - VOS by doxygen 1.3.2