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

VOS::LocalSite Class Reference

A site which is local to your application. More...

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

Inheritance diagram for 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 VOS::LocalSocketSite List of all members.

Public Types

Public Member Functions

Static Public Member Functions

Protected Member Functions

Protected Attributes

Friends


Detailed Description

A site which is local to your application.

This acts as the communication point between your application and other VOS applications, managing the delivery of incoming messages as well as servicing certain types of requests about your local Vobjects. All Vobjects are associated with some site.

Definition at line 49 of file localsite.hh.


Member Typedef Documentation

typedef void(* VOS::LocalSite::callback_t)(void* userdata)
 

Timer callback type for a global C function.

Register the callback using addCallback.

Definition at line 102 of file localsite.hh.


Constructor & Destructor Documentation

VOS::LocalSite::LocalSite  )  [protected]
 

constructor

virtual VOS::LocalSite::~LocalSite  )  [virtual]
 

destructor


Member Function Documentation

void VOS::LocalSite::addCallback callback_t  callback,
void *  userdata,
double  timeout,
bool  repeat = true
 

Register a simple global function as a timer callback.

void VOS::LocalSite::addCallback CallbackListener listener,
double  timeout,
bool  repeat = true
 

Register a periodic or timed callback listener.

Callbacks are checked each time flushIncomingBuffers is called.

void VOS::LocalSite::addLocalObjectExtension const char *  type,
metaobject_extender_t  newmethod
[static]
 

virtual void VOS::LocalSite::addNotification NotifyEvent ev  )  [virtual]
 

Add a notification event to be called during flushIncomingBuffers().

A notification event is called once and then destroyed.

Implements VOS::Site.

Referenced by VOS::RemoteSite::addNotification().

virtual void VOS::LocalSite::addPrioritizedNonce const string &  nonce,
RemoteSite source
[virtual]
 

virtual bool VOS::LocalSite::checkScheduleHoldsSite Site site  )  [virtual]
 

Check if any messages in the schedule have "site" as a source site.

Mainly used when a site disconnects and its pending messages need to be flushed...

Referenced by VOS::RemoteSite::excise(), and VOS::RemoteStreamSite::runScript().

template<class T>
T* VOS::LocalSite::createMetaObject const char *  name = 0,
VobjectAccessControl ac = 0
[inline]
 

Create a new metaobject with one type, and cast it to that type.

Parameters:
T Desired MetaObject subclass
name If given, site-name of the new object
ac Primary access control on the new object

Definition at line 256 of file localsite.hh.

virtual MetaObject* VOS::LocalSite::createMetaObject const char *  name,
VobjectAccessControl ac,
const deque< string > &  typelist
[virtual]
 

Create a new local metaobject, with the supplied access control (ar defoult site AC if 0).

See also:
createMetaObject(const char*, const char*, ...)

virtual MetaObject* VOS::LocalSite::createMetaObject const char *  name,
VobjectAccessControl ac,
const char *  type0,
... 
[virtual]
 

Create a new local metaobject, with the supplied access control (ar defoult site AC if 0).

See also:
createMetaObject(const char*, const char*, ...)

virtual MetaObject* VOS::LocalSite::createMetaObject const char *  name,
const deque< string > &  typelist
[virtual]
 

Same as the other createMetaObject method, but takes a deque of type strings rather than a variable list of strings.

See also:
createMetaObject(const char*, const char*, ...)

Implements VOS::Site.

virtual MetaObject* VOS::LocalSite::createMetaObject const char *  name,
const char *  type0,
... 
[virtual]
 

Use 0 to terminate the list of type strings.

Implements VOS::Site.

void VOS::LocalSite::doCallbacks  ) 
 

Run pending callbacks.

void VOS::LocalSite::extendMetaObject LocalMetaObject root,
const char *  type
[static]
 

Use this site to extend a LocalMetaObject with for a new type.

virtual void VOS::LocalSite::flushIncomingBuffers  )  [pure virtual]
 

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

Implements VOS::Site.

Implemented in VOS::LocalSocketSite.

Referenced by VOS::AsyncConnect::connect(), VOS::RemoteSite::flushIncomingBuffers(), and VOS::RemoteStreamSite::runScript().

virtual void VOS::LocalSite::flushNotifications  )  [virtual]
 

Execute any pending notification events.

Implements VOS::Site.

Referenced by VOS::RemoteSite::flushNotifications().

const string& VOS::LocalSite::getAntiSpoofIDMapping const string &  recv  )  [inline]
 

Maps a received anti-spoof ID to the one sent to that site.

Definition at line 297 of file localsite.hh.

Referenced by VOS::LocalSocketSite::flushIncomingBuffers().

virtual Site& VOS::LocalSite::getSite  )  [inline, virtual]
 

Get the site this object resides on.

Returns:
the site object. NOTE YOU MUST CALL release() WHEN DONE OR USE A rREF() BLOCK

Reimplemented from VOS::LocalMetaObject.

Definition at line 204 of file localsite.hh.

double VOS::LocalSite::getTimeoutOnSelect  ) 
 

Get the select wait time.

Returns:
the maximum time (in seconds) that select will wait, or -1 if select will block indefinately.

Referenced by VOS::AsyncConnect::connect(), and VOS::RemoteStreamSite::runScript().

virtual void VOS::LocalSite::insertChild int  position,
const string &  contextual_name,
Vobject child
throw (AccessControlError, RemoteError) [virtual]
 

Insert a child at some position with a new object.

If the position is positive, the object is inserted such that it now occupies that position, and all objects starting from the previous occupant of that position onward are moved up one. If the position in negative, the object is similarly inserted so that it now occupies that position. For example, position -1 will append the object to the end of the list, position -2 will insert the object in the second-to-last position, etc. See setChild() for more information on positions.

Parameters:
position the position
contextual_name This is the name, specific to this parent-child relation, used for refering to this object by path.
child the child object, in question
Exceptions:
AccessControl if this object (when it is remote) doesn't approve of this action.

Reimplemented from VOS::LocalMetaObject.

virtual bool VOS::LocalSite::isConnected  )  [inline, virtual]
 

Always true.

Implements VOS::Site.

Definition at line 200 of file localsite.hh.

virtual void VOS::LocalSite::lockNotificationFlush  )  [virtual]
 

Calling this will cause flushNotifications() to do nothing (and hence no notifications will be processed) until unlockNotificationFlush is called.

Implements VOS::Site.

Referenced by VOS::RemoteSite::lockNotificationFlush().

void VOS::LocalSite::printExtensionTable ostream &  stream = std::cerr  )  [static]
 

void VOS::LocalSite::removeCallback CallbackListener listener  ) 
 

Remove a callback.

(see addCallback)

void VOS::LocalSite::removeCallback callback_t  callback  ) 
 

Remove a callback.

(see addCallback)

virtual void VOS::LocalSite::removeChild int  position  )  throw (AccessControlError, RemoteError) [virtual]
 

Remove the child at some position.

See setChild() for more information on positions.

Parameters:
position the position
Exceptions:
AccessControl if this object (when it is remote) doesn't approve of this action.

Reimplemented from VOS::LocalMetaObject.

void VOS::LocalSite::removeLocalObjectExtension const char *  type,
metaobject_extender_t  oldmethod
[static]
 

virtual void VOS::LocalSite::removePrioritizedNonce const string &  nonce,
RemoteSite source
[virtual]
 

virtual void VOS::LocalSite::removeRemotePeer RemoteSite rs  )  [virtual]
 

Remove the peering relationship with a remote site.

Referenced by VOS::RemoteSite::excise(), and VOS::LocalSocketSite::flushIncomingBuffers().

virtual void VOS::LocalSite::runSchedule  )  [virtual]
 

Execute the current schedule.

Referenced by VOS::LocalSocketSite::flushIncomingBuffers().

void VOS::LocalSite::scheduleCallback callback_t  callback,
CallbackListener listener,
void *  userdata,
double  timeout,
bool  repeat
[protected]
 

virtual void VOS::LocalSite::scheduleMessageBlock MessageBlock mb,
MessageContext mc,
Site ss,
double  plustime = 0.0,
const char *  extradependency = 0
[virtual]
 

Schedule a message block for delivery.

Special message types like include will be processed.

Parameters:
mb The message block
mc The enclosing message context
ss The source site
plustime This value will be added to the delivery time
extradependency This dependency string will added to each message

Referenced by VOS::RemoteStreamSite::flushIncomingBuffers(), and VOS::RemoteSocketSite::flushIncomingBuffers().

virtual void VOS::LocalSite::sendMessage MessageBlock m  )  [virtual]
 

Sends a block of messages 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::LocalMetaObject.

virtual void VOS::LocalSite::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::LocalMetaObject.

Reimplemented in VOS::LocalSocketSite.

Referenced by VOS::RemoteStreamSite::runScript().

void VOS::LocalSite::setAntiSpoofIDMapping const string &  recv,
const string &  sent
[inline]
 

Maps a received anti-spoof ID to the one sent to that site.

Definition at line 294 of file localsite.hh.

virtual void VOS::LocalSite::setChild int  position,
const string &  contextual_name,
Vobject child
throw (AccessControlError, RemoteError) [virtual]
 

Replace a child at some position with a new object.

Note:
On positions: if a position is zero or positive, its meaning is as you would expect, expressing the offset into an array of children. However, if the position is negative, it expresses the offset from the end of the list. This means for a list of length n, -1 is the last item in the list (equal to position position n - 1) and -n is the first item (equal to positive position 0). This position notation is used in setChild() findObject(), findObjectFromRoot(), insertChild(), and removeChild(); it should also be available with any methods who make use of the previously-mentioned methods.
Parameters:
position the position
contextual_name This is the name, specific to this parent-child relation, used for refering to this object by path.
child the child object, in question
Exceptions:
AccessControl if this object (when it is remote) doesn't approve of this action.

Reimplemented from VOS::LocalMetaObject.

virtual void VOS::LocalSite::setPrimaryHostname string  s  )  [virtual]
 

Set the hostname we will prefer to use.

Parameters:
s the DNS hostname or dotted quad IP address

Referenced by VOS::AsyncConnect::operator()().

void VOS::LocalSite::setTimeoutOnSelect double  sec  ) 
 

When select() is called to test file descriptors, this sets maximum amount of time to wait before returning if there is no data available.

This primarily applies to LocalSite::flushIncomingBuffers().

Parameters:
sec the time to wait, in seconds. This may be zero, in which case a flushIncomingBuffers() call will return immediately if there is no pending data. If "sec" is negative, select will sleep indefinitely until data is received on any of the sockets or the process catches a signal.

Referenced by VOS::AsyncConnect::connect(), and VOS::RemoteStreamSite::runScript().

virtual void VOS::LocalSite::setURL const URL u  )  [virtual]
 

Set the base URL ("vop://host:port") that this site will use.

Parameters:
u some URL.

Implements VOS::Site.

void VOS::LocalSite::takeOverMessages Site was,
Site now
 

Any messages belonging to site "was" will be reassigned to site "now".

This only affects the source site field of the message object.

virtual void VOS::LocalSite::unlockNotificationFlush  )  [virtual]
 

Allow notifcations to be processed again.

Implements VOS::Site.

Referenced by VOS::RemoteSite::unlockNotificationFlush().

void VOS::LocalSite::verifyCheckIDPair RemoteSocketSite rss,
const string &  spoofID
[protected]
 


Friends And Related Function Documentation

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

Reimplemented in VOS::LocalSocketSite.


Member Data Documentation

map<string, string> VOS::LocalSite::antiSpoofMap [protected]
 

Definition at line 131 of file localsite.hh.

queue<CallbackListener*> VOS::LocalSite::callback_listener_remove_queue [protected]
 

Definition at line 125 of file localsite.hh.

queue<pair<double, CallbackInfo> > VOS::LocalSite::callbackaddqueue [protected]
 

Definition at line 123 of file localsite.hh.

bool VOS::LocalSite::callbacklock [protected]
 

Definition at line 121 of file localsite.hh.

queue<callback_t> VOS::LocalSite::callbackremovequeue [protected]
 

Definition at line 124 of file localsite.hh.

map<double, CallbackInfo> VOS::LocalSite::callbacks [protected]
 

Definition at line 122 of file localsite.hh.

int VOS::LocalSite::iteratorsUsingPeerSites [protected]
 

Definition at line 64 of file localsite.hh.

Referenced by VOS::LocalSocketSite::flushIncomingBuffers().

list<Message*> VOS::LocalSite::msgsReady [protected]
 

Definition at line 90 of file localsite.hh.

list< pair<string, RemoteSite*> > VOS::LocalSite::needSpoofIDreply [protected]
 

Definition at line 145 of file localsite.hh.

Referenced by VOS::LocalSocketSite::flushIncomingBuffers().

queue<NotifyEvent*> VOS::LocalSite::notifyEvents [protected]
 

Definition at line 128 of file localsite.hh.

bool VOS::LocalSite::notifyflushlock [protected]
 

Definition at line 129 of file localsite.hh.

map<RemoteSite*, struct SiteTableEntry*> VOS::LocalSite::peerSites [protected]
 

List of remote sites we are peers with.

Definition at line 86 of file localsite.hh.

Referenced by VOS::LocalSocketSite::flushIncomingBuffers().

boost::mutex VOS::LocalSite::peerSitesBuffer_mutex [protected]
 

Definition at line 83 of file localsite.hh.

Referenced by VOS::LocalSocketSite::flushIncomingBuffers().

deque<RemoteSite*> VOS::LocalSite::peerSitesBuffer_remove [protected]
 

Definition at line 81 of file localsite.hh.

Referenced by VOS::LocalSocketSite::flushIncomingBuffers().

deque<RemoteSite*> VOS::LocalSite::peerSitesBuffer_rs [protected]
 

The following three data structures are used to buffer changes to peerSites when we have an active iterator using peerSites.

This is to avoid invalidating the iterator (ye gods that was an obnoxious bug to track down.) The alternative would have to be to make a complete copy of the peerSites deque every time we want to copy it (ewww...)

Note:
although peerSitesBuffer_rs and peerSitesBuffer_st could be combined into a single structure like deque< pair<RemoteSite*, struct SiteTableEntry*> > BUT that causes an internal compiler error when compiling site.cc! So instead we do it this way. Bleh.

Definition at line 79 of file localsite.hh.

Referenced by VOS::LocalSocketSite::flushIncomingBuffers().

deque<struct SiteTableEntry*> VOS::LocalSite::peerSitesBuffer_st [protected]
 

Definition at line 80 of file localsite.hh.

Referenced by VOS::LocalSocketSite::flushIncomingBuffers().

set<string> VOS::LocalSite::pendingValidationHosts [protected]
 

Definition at line 143 of file localsite.hh.

map<RemoteSocketSite*, ValidationEntry> VOS::LocalSite::pendingValidations [protected]
 

Definition at line 142 of file localsite.hh.

map<string, RemoteSite*> VOS::LocalSite::prioritized [protected]
 

Definition at line 95 of file localsite.hh.

list<Message*> VOS::LocalSite::prioritizedQueue [protected]
 

Definition at line 91 of file localsite.hh.

struct ::timeval* VOS::LocalSite::selectwait [protected]
 

Definition at line 93 of file localsite.hh.

map<double, list<Message*> > VOS::LocalSite::siteMessageQueue [protected]
 

The current message schedule.

Definition at line 89 of file localsite.hh.


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