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

ServiceEntry Class Reference

A ServiceEntry maintains the info required to ensure reliability during data transfer. More...

#include <ServiceEntry.h>

Inheritance diagram for ServiceEntry::

BasicObject List of all members.

Public Methods

 ServiceEntry (ServiceTable *)
 Construct the ServiceEntry. More...

virtual ~ServiceEntry ()
 Copy constructor. More...

void toConnectingState ()
 The object is only in this state during an active connect. More...

void toReconnectingState ()
 The state when the end-to-end connection has been lost and we are trying to reconnect. More...

void toDisconnectedState ()
 When there is no connection and no error. More...

void toBrokenState ()
 The state that occurs when the connection has broken, but we didnt want it to. More...

void toConnectedState ()
 This is the state while a end-to-end connection is open. More...

void toFailedState ()
 The failed state. More...

void connectionAccepted (int connectionDescriptor)
 When a connection is accepted from a remote peer, this function is called. More...

bool isReconnecting ()
 Returns true if this connection is in the "reconnecting" state. More...

bool isConnecting ()
 Returns true if this connection is in the "reconnecting" state. More...

bool isBroken ()
 Returns true if this connection is in the "broken" state. More...

bool isConnected ()
 Returns true if this connection is in the "connected" state. More...

bool isFailed ()
 Returns true if this connection is in the "failed" state. More...

bool isDisconnected ()
 Returns true if this connection is in the "disconnected" state. More...

void incrementRetries ()
 Increment the number of times we have tried to connect/reconnect. More...

int getRetries ()
 Return the number of times we have tried to connect/reconnect. More...

int getConnectionDescriptor ()
 Return the connection descriptor for this connection. More...

int getServiceNumber ()
 Return the service number for this connection. More...

SARgetSar ()
 Return the segmentation and reassembly object that was created for the end-to-end connection. More...

bool isOrigin ()
bool isDestination ()
bool waitForConnectComplete (int timeToWait)
 If the connection is already in the connected state, return true. More...

bool waitForDisconnect (int timeToWait)
 If the connection is already in the disconnected state, return true. More...

void signalDisconnect ()
 Signal that a FIN packet has been received. More...

void signalConnectComplete ()
 Signal that a EST packet has been received. More...

virtual void toStream (std::ostream &out)
 Print out the state of the ServiceEntry. More...


Private Methods

string stateToString ()
 Return the state as a string. More...

string transportLayerRoleToString ()
 Return the transport layer role as a string. More...


Private Attributes

State m_state
TransportLayerRole m_transportLayerRole
int m_retry
 number of retries made so far to repair this connection. More...

int m_connectionDescriptor
 the connection descriptor for this connection. More...

int m_serviceNumber
 a unique number for this service - logical transport layer connection identifier, unique across all reconnection attempts. More...

SARm_sar
 Segmentation and reassembly object for this connection. More...

ServiceTablem_serviceTable
 a pointer back to our container. More...

Condition m_estReceivedCondition
 Used to signal a that we have received an EST packet. More...

Condition m_finReceivedCondition
 fin received condition variable. More...

Mutex m_serviceEntryLock
 Used to lock this object. More...


Detailed Description

A ServiceEntry maintains the info required to ensure reliability during data transfer.

Definition at line 13 of file ServiceEntry.h.


Constructor & Destructor Documentation

ServiceEntry::ServiceEntry ServiceTable * serviceTable
 

Construct the ServiceEntry.

Parameters:
serviceTable   A pointer back to its container.

Definition at line 14 of file ServiceEntry.cpp.

ServiceEntry::~ServiceEntry [virtual]
 

Copy constructor.

Todo:
Add in a copy constructor for the SAR.

Definition at line 52 of file ServiceEntry.cpp.


Member Function Documentation

void ServiceEntry::connectionAccepted int connectionDescriptor
 

When a connection is accepted from a remote peer, this function is called.

Definition at line 175 of file ServiceEntry.cpp.

Referenced by ServiceTable::signalListenComplete().

int ServiceEntry::getConnectionDescriptor
 

Return the connection descriptor for this connection.

This is the number the network layer uses to identify a virtual circuit.

Definition at line 212 of file ServiceEntry.cpp.

Referenced by ServiceTable::connectService(), ServiceTable::disconnectService(), ServiceTable::getServiceEntryByDescriptor(), ServiceTable::listenService(), ServiceTable::repairConnectionImpl(), ServiceTable::sendData(), ServiceTable::sendDataPacket(), and ServiceTable::signalConnectComplete().

int ServiceEntry::getRetries
 

Return the number of times we have tried to connect/reconnect.

Definition at line 193 of file ServiceEntry.cpp.

Referenced by ServiceTable::connectService(), and ServiceTable::repairConnectionImpl().

SAR * ServiceEntry::getSar
 

Return the segmentation and reassembly object that was created for the end-to-end connection.

Todo:
Get rid of this function, replace with read/write functions.

Definition at line 233 of file ServiceEntry.cpp.

Referenced by ServiceTable::handleDataPacket(), ServiceTable::receiveData(), and ServiceTable::sendData().

int ServiceEntry::getServiceNumber
 

Return the service number for this connection.

This is the number for the end-to-end connection, used by the application layer to ID the connection.

Definition at line 222 of file ServiceEntry.cpp.

Referenced by ServiceTable::connectService(), ServiceTable::getServiceEntry(), ServiceTable::listenService(), ServiceTable::removeServiceEntry(), ServiceTable::repairConnectionImpl(), and ServiceTable::signalDisconnect().

void ServiceEntry::incrementRetries
 

Increment the number of times we have tried to connect/reconnect.

Definition at line 202 of file ServiceEntry.cpp.

Referenced by ServiceTable::connectService(), and ServiceTable::repairConnectionImpl().

bool ServiceEntry::isBroken
 

Returns true if this connection is in the "broken" state.

Definition at line 260 of file ServiceEntry.cpp.

Referenced by ServiceTable::repairConnectionImpl().

bool ServiceEntry::isConnected
 

Returns true if this connection is in the "connected" state.

Definition at line 269 of file ServiceEntry.cpp.

Referenced by ServiceTable::listenService(), and ServiceTable::sendDataPacket().

bool ServiceEntry::isConnecting
 

Returns true if this connection is in the "reconnecting" state.

Definition at line 251 of file ServiceEntry.cpp.

Referenced by ServiceTable::signalConnectComplete().

bool ServiceEntry::isDestination
 

Definition at line 299 of file ServiceEntry.cpp.

bool ServiceEntry::isDisconnected
 

Returns true if this connection is in the "disconnected" state.

Definition at line 278 of file ServiceEntry.cpp.

bool ServiceEntry::isFailed
 

Returns true if this connection is in the "failed" state.

Definition at line 287 of file ServiceEntry.cpp.

Referenced by ServiceTable::receiveData().

bool ServiceEntry::isOrigin
 

Definition at line 293 of file ServiceEntry.cpp.

Referenced by ServiceTable::listenService(), and ServiceTable::repairConnectionImpl().

bool ServiceEntry::isReconnecting
 

Returns true if this connection is in the "reconnecting" state.

Definition at line 242 of file ServiceEntry.cpp.

Referenced by ServiceTable::signalConnectComplete().

void ServiceEntry::signalConnectComplete
 

Signal that a EST packet has been received.

Definition at line 363 of file ServiceEntry.cpp.

Referenced by ServiceTable::signalConnectComplete().

void ServiceEntry::signalDisconnect
 

Signal that a FIN packet has been received.

Definition at line 354 of file ServiceEntry.cpp.

Referenced by toDisconnectedState().

string ServiceEntry::stateToString [private]
 

Return the state as a string.

Definition at line 372 of file ServiceEntry.cpp.

Referenced by toBrokenState(), toConnectedState(), toConnectingState(), toFailedState(), toReconnectingState(), and toStream().

void ServiceEntry::toBrokenState
 

The state that occurs when the connection has broken, but we didnt want it to.

Definition at line 144 of file ServiceEntry.cpp.

Referenced by ServiceTable::signalBreak().

void ServiceEntry::toConnectedState
 

This is the state while a end-to-end connection is open.

Definition at line 90 of file ServiceEntry.cpp.

Referenced by connectionAccepted(), ServiceTable::repairConnectionImpl(), and ServiceTable::signalConnectComplete().

void ServiceEntry::toConnectingState
 

The object is only in this state during an active connect.

Definition at line 64 of file ServiceEntry.cpp.

Referenced by ServiceTable::connectService().

void ServiceEntry::toDisconnectedState
 

When there is no connection and no error.

Definition at line 131 of file ServiceEntry.cpp.

Referenced by ServiceTable::disconnectService().

void ServiceEntry::toFailedState
 

The failed state.

We cannot create an end-to-end connection no matter how hard we try.

Definition at line 158 of file ServiceEntry.cpp.

Referenced by ServiceTable::repairConnectionImpl().

void ServiceEntry::toReconnectingState
 

The state when the end-to-end connection has been lost and we are trying to reconnect.

Only the originator of a connection can get to this state.

Definition at line 109 of file ServiceEntry.cpp.

Referenced by ServiceTable::repairConnectionImpl().

void ServiceEntry::toStream std::ostream & out [virtual]
 

Print out the state of the ServiceEntry.

Reimplemented from BasicObject.

Definition at line 412 of file ServiceEntry.cpp.

string ServiceEntry::transportLayerRoleToString [private]
 

Return the transport layer role as a string.

Definition at line 395 of file ServiceEntry.cpp.

Referenced by toStream().

bool ServiceEntry::waitForConnectComplete int timeToWait
 

If the connection is already in the connected state, return true.

Otherwise, block and wait for a EST packet, or until the specified period of time has elapsed, whichever comes first. The function "signalConnectComplete" must be called before the timeout occurs in order for this to return true.

Parameters:
timeToWait   Time to wait in millisecs.
Returns:
true if we have received a EST packet before the time has run out.

Definition at line 316 of file ServiceEntry.cpp.

Referenced by ServiceTable::connectService(), and ServiceTable::repairConnectionImpl().

bool ServiceEntry::waitForDisconnect int timeToWait
 

If the connection is already in the disconnected state, return true.

Otherwise, block and wait for a FIN packet, or until the specified period of time has elapsed, whichever comes first. The function "signalDisonnect" must be called before the timeout occurs in order for this to return true.

Parameters:
timeToWait   Time to wait in millisecs.
Returns:
true if we have received a FIN packet before the time has run out.

Definition at line 339 of file ServiceEntry.cpp.


Member Data Documentation

int ServiceEntry::m_connectionDescriptor [private]
 

the connection descriptor for this connection.

Definition at line 147 of file ServiceEntry.h.

Condition ServiceEntry::m_estReceivedCondition [private]
 

Used to signal a that we have received an EST packet.

Definition at line 160 of file ServiceEntry.h.

Condition ServiceEntry::m_finReceivedCondition [private]
 

fin received condition variable.

Definition at line 163 of file ServiceEntry.h.

int ServiceEntry::m_retry [private]
 

number of retries made so far to repair this connection.

Definition at line 144 of file ServiceEntry.h.

SAR* ServiceEntry::m_sar [private]
 

Segmentation and reassembly object for this connection.

Definition at line 154 of file ServiceEntry.h.

Mutex ServiceEntry::m_serviceEntryLock [private]
 

Used to lock this object.

Definition at line 166 of file ServiceEntry.h.

int ServiceEntry::m_serviceNumber [private]
 

a unique number for this service - logical transport layer connection identifier, unique across all reconnection attempts.

Definition at line 151 of file ServiceEntry.h.

ServiceTable* ServiceEntry::m_serviceTable [private]
 

a pointer back to our container.

Definition at line 157 of file ServiceEntry.h.

State ServiceEntry::m_state [private]
 

Definition at line 113 of file ServiceEntry.h.

TransportLayerRole ServiceEntry::m_transportLayerRole [private]
 

Definition at line 134 of file ServiceEntry.h.


The documentation for this class was generated from the following files:
Generated at Thu Jul 11 13:31:58 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001