Sirikata
Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
Sirikata::SST::Connection< EndPointType > Class Template Reference

#include <SSTImpl.hpp>

Collaboration diagram for Sirikata::SST::Connection< EndPointType >:

List of all members.

Public Types

typedef std::tr1::shared_ptr
< Connection
Ptr
typedef Ptr ConnectionPtr

Public Member Functions

virtual ~Connection ()
virtual bool datagram (void *data, int length, uint32 local_port, uint32 remote_port, DatagramSendDoneCallback cb)
virtual bool registerReadDatagramCallback (uint32 port, ReadDatagramCallback cb)
virtual bool registerReadOrderedDatagramCallback (ReadDatagramCallback cb)
virtual void close (bool force)
virtual void iClose (bool force)
virtual EndPoint< EndPointType > localEndPoint ()
virtual EndPoint< EndPointType > remoteEndPoint ()

Private Types

enum  ConnectionStates {
  CONNECTION_DISCONNECTED = 1, CONNECTION_PENDING_CONNECT = 2, CONNECTION_PENDING_RECEIVE_CONNECT = 3, CONNECTION_CONNECTED = 4,
  CONNECTION_PENDING_DISCONNECT = 5
}
typedef BaseDatagramLayer
< EndPointType > 
BaseDatagramLayerType
typedef std::tr1::shared_ptr
< BaseDatagramLayerType
BaseDatagramLayerPtr
typedef CallbackTypes
< EndPointType > 
CBTypes
typedef
CBTypes::ConnectionReturnCallbackFunction 
ConnectionReturnCallbackFunction
typedef
CBTypes::StreamReturnCallbackFunction 
StreamReturnCallbackFunction
typedef
CBTypes::DatagramSendDoneCallback 
DatagramSendDoneCallback
typedef
CBTypes::ReadDatagramCallback 
ReadDatagramCallback
typedef
std::tr1::unordered_map
< EndPoint< EndPointType >
, std::tr1::shared_ptr
< Connection >, typename
EndPoint< EndPointType >
::Hasher
ConnectionMap
typedef
std::tr1::unordered_map
< EndPoint< EndPointType >
, ConnectionReturnCallbackFunction,
typename EndPoint
< EndPointType >::Hasher
ConnectionReturnCallbackMap
typedef
std::tr1::unordered_map
< EndPoint< EndPointType >
, StreamReturnCallbackFunction,
typename EndPoint
< EndPointType >::Hasher
StreamReturnCallbackMap
typedef std::map< LSID,
std::tr1::shared_ptr< Stream
< EndPointType > > > 
LSIDStreamMap
typedef std::vector< std::string > PartialPayloadList
typedef std::map< LSID,
PartialPayloadList
PartialPayloadMap

Private Member Functions

 Connection (ConnectionVariables< EndPointType > *sstConnVars, EndPoint< EndPointType > localEndPoint, EndPoint< EndPointType > remoteEndPoint)
void checkIfAlive (std::tr1::shared_ptr< Connection< EndPointType > > conn)
void sendSSTChannelPacket (Sirikata::Protocol::SST::SSTChannelHeader &sstMsg)
const ContextgetContext ()
void serviceConnectionNoReturn (std::tr1::shared_ptr< Connection< EndPointType > > conn)
bool serviceConnection (std::tr1::shared_ptr< Connection< EndPointType > > conn)
void listenStream (uint32 port, StreamReturnCallbackFunction scb)
void unlistenStream (uint32 port)
virtual int stream (StreamReturnCallbackFunction cb, void *initial_data, int length, uint32 local_port, uint32 remote_port)
virtual int stream (StreamReturnCallbackFunction cb, void *initial_data, int length, uint32 local_port, uint32 remote_port, LSID parentLSID)
uint64 sendData (const void *data, uint32 length, bool isAck)
void setState (int state)
uint8 getState ()
void setLocalChannelID (uint32 channelID)
void setRemoteChannelID (uint32 channelID)
void setWeakThis (std::tr1::shared_ptr< Connection > conn)
USID createNewUSID ()
void markAcknowledgedPacket (uint64 receivedAckNum)
void parsePacket (Sirikata::Protocol::SST::SSTChannelHeader *received_channel_msg)
void handleInitPacket (Sirikata::Protocol::SST::SSTStreamHeader *received_stream_msg)
void handleReplyPacket (Sirikata::Protocol::SST::SSTStreamHeader *received_stream_msg)
void handleDataPacket (Sirikata::Protocol::SST::SSTStreamHeader *received_stream_msg)
void handleAckPacket (Sirikata::Protocol::SST::SSTChannelHeader *received_channel_msg, Sirikata::Protocol::SST::SSTStreamHeader *received_stream_msg)
void handleDatagram (Sirikata::Protocol::SST::SSTStreamHeader *received_stream_msg)
void receiveMessage (void *recv_buff, int len)
uint64 getRTOMicroseconds ()
void eraseDisconnectedStream (Stream< EndPointType > *s)
void finalCleanup ()

Static Private Member Functions

static bool createConnection (ConnectionVariables< EndPointType > *sstConnVars, EndPoint< EndPointType > localEndPoint, EndPoint< EndPointType > remoteEndPoint, ConnectionReturnCallbackFunction cb, StreamReturnCallbackFunction scb)
static bool listen (ConnectionVariables< EndPointType > *sstConnVars, StreamReturnCallbackFunction cb, EndPoint< EndPointType > listeningEndPoint)
static bool unlisten (ConnectionVariables< EndPointType > *sstConnVars, EndPoint< EndPointType > listeningEndPoint)
static void cleanup (std::tr1::shared_ptr< Connection< EndPointType > > conn)
static void closeConnections (ConnectionVariables< EndPointType > *sstConnVars)
static void handleReceive (ConnectionVariables< EndPointType > *sstConnVars, EndPoint< EndPointType > remoteEndPoint, EndPoint< EndPointType > localEndPoint, void *recv_buffer, int len)

Private Attributes

EndPoint< EndPointType > mLocalEndPoint
EndPoint< EndPointType > mRemoteEndPoint
ConnectionVariables
< EndPointType > * 
mSSTConnVars
BaseDatagramLayerPtr mDatagramLayer
int mState
uint32 mRemoteChannelID
uint32 mLocalChannelID
uint64 mTransmitSequenceNumber
uint64 mLastReceivedSequenceNumber
std::map< LSID,
std::tr1::shared_ptr< Stream
< EndPointType > > > 
mOutgoingSubstreamMap
std::map< LSID,
std::tr1::shared_ptr< Stream
< EndPointType > > > 
mIncomingSubstreamMap
std::map< uint32,
StreamReturnCallbackFunction
mListeningStreamsCallbackMap
std::map< uint32, std::vector
< ReadDatagramCallback > > 
mReadDatagramCallbacks
PartialPayloadMap mPartialReadDatagrams
uint32 mNumStreams
std::deque
< std::tr1::shared_ptr
< ChannelSegment > > 
mQueuedSegments
std::deque
< std::tr1::shared_ptr
< ChannelSegment > > 
mOutstandingSegments
boost::mutex mOutstandingSegmentsMutex
uint16 mCwnd
int64 mRTOMicroseconds
bool mFirstRTO
boost::mutex mQueueMutex
uint16 MAX_DATAGRAM_SIZE
uint16 MAX_PAYLOAD_SIZE
uint32 MAX_QUEUED_SEGMENTS
float CC_ALPHA
Time mLastTransmitTime
std::tr1::weak_ptr< Connection
< EndPointType > > 
mWeakThis
uint16 mNumInitialRetransmissionAttempts
google::protobuf::LogSilencer logSilencer
bool mInSendingMode

Friends

class Stream< EndPointType >
class ConnectionManager< EndPointType >
class BaseDatagramLayer< EndPointType >

template<class EndPointType>
class Sirikata::SST::Connection< EndPointType >


Member Typedef Documentation

template<class EndPointType>
typedef std::tr1::shared_ptr<BaseDatagramLayerType> Sirikata::SST::Connection< EndPointType >::BaseDatagramLayerPtr [private]
template<class EndPointType>
typedef BaseDatagramLayer<EndPointType> Sirikata::SST::Connection< EndPointType >::BaseDatagramLayerType [private]
template<class EndPointType>
typedef CallbackTypes<EndPointType> Sirikata::SST::Connection< EndPointType >::CBTypes [private]
template<class EndPointType>
typedef std::tr1::unordered_map<EndPoint<EndPointType>, std::tr1::shared_ptr<Connection>, typename EndPoint<EndPointType>::Hasher > Sirikata::SST::Connection< EndPointType >::ConnectionMap [private]
template<class EndPointType>
typedef Ptr Sirikata::SST::Connection< EndPointType >::ConnectionPtr
template<class EndPointType>
typedef CBTypes::ConnectionReturnCallbackFunction Sirikata::SST::Connection< EndPointType >::ConnectionReturnCallbackFunction [private]
template<class EndPointType>
typedef std::tr1::unordered_map<EndPoint<EndPointType>, ConnectionReturnCallbackFunction, typename EndPoint<EndPointType>::Hasher> Sirikata::SST::Connection< EndPointType >::ConnectionReturnCallbackMap [private]
template<class EndPointType>
typedef CBTypes::DatagramSendDoneCallback Sirikata::SST::Connection< EndPointType >::DatagramSendDoneCallback [private]
template<class EndPointType>
typedef std::map<LSID, std::tr1::shared_ptr< Stream<EndPointType> > > Sirikata::SST::Connection< EndPointType >::LSIDStreamMap [private]
template<class EndPointType>
typedef std::vector<std::string> Sirikata::SST::Connection< EndPointType >::PartialPayloadList [private]
template<class EndPointType>
typedef std::map<LSID, PartialPayloadList> Sirikata::SST::Connection< EndPointType >::PartialPayloadMap [private]
template<class EndPointType>
typedef std::tr1::shared_ptr<Connection> Sirikata::SST::Connection< EndPointType >::Ptr
template<class EndPointType>
typedef CBTypes::ReadDatagramCallback Sirikata::SST::Connection< EndPointType >::ReadDatagramCallback [private]
template<class EndPointType>
typedef CBTypes::StreamReturnCallbackFunction Sirikata::SST::Connection< EndPointType >::StreamReturnCallbackFunction [private]
template<class EndPointType>
typedef std::tr1::unordered_map<EndPoint<EndPointType>, StreamReturnCallbackFunction, typename EndPoint<EndPointType>::Hasher> Sirikata::SST::Connection< EndPointType >::StreamReturnCallbackMap [private]

Member Enumeration Documentation

template<class EndPointType>
enum Sirikata::SST::Connection::ConnectionStates [private]
Enumerator:
CONNECTION_DISCONNECTED 
CONNECTION_PENDING_CONNECT 
CONNECTION_PENDING_RECEIVE_CONNECT 
CONNECTION_CONNECTED 
CONNECTION_PENDING_DISCONNECT 

Constructor & Destructor Documentation

template<class EndPointType>
Sirikata::SST::Connection< EndPointType >::Connection ( ConnectionVariables< EndPointType > *  sstConnVars,
EndPoint< EndPointType >  localEndPoint,
EndPoint< EndPointType >  remoteEndPoint 
) [inline, private]
template<class EndPointType>
virtual Sirikata::SST::Connection< EndPointType >::~Connection ( ) [inline, virtual]

Member Function Documentation

template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::checkIfAlive ( std::tr1::shared_ptr< Connection< EndPointType > >  conn) [inline, private]
template<class EndPointType>
static void Sirikata::SST::Connection< EndPointType >::cleanup ( std::tr1::shared_ptr< Connection< EndPointType > >  conn) [inline, static, private]

References SST_IMPL_FAILURE.

template<class EndPointType>
virtual void Sirikata::SST::Connection< EndPointType >::close ( bool  force) [inline, virtual]
template<class EndPointType>
static void Sirikata::SST::Connection< EndPointType >::closeConnections ( ConnectionVariables< EndPointType > *  sstConnVars) [inline, static, private]
template<class EndPointType>
static bool Sirikata::SST::Connection< EndPointType >::createConnection ( ConnectionVariables< EndPointType > *  sstConnVars,
EndPoint< EndPointType >  localEndPoint,
EndPoint< EndPointType >  remoteEndPoint,
ConnectionReturnCallbackFunction  cb,
StreamReturnCallbackFunction  scb 
) [inline, static, private]
template<class EndPointType>
USID Sirikata::SST::Connection< EndPointType >::createNewUSID ( ) [inline, private]
template<class EndPointType>
virtual bool Sirikata::SST::Connection< EndPointType >::datagram ( void *  data,
int  length,
uint32  local_port,
uint32  remote_port,
DatagramSendDoneCallback  cb 
) [inline, virtual]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::eraseDisconnectedStream ( Stream< EndPointType > *  s) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::finalCleanup ( ) [inline, private]
template<class EndPointType>
const Context* Sirikata::SST::Connection< EndPointType >::getContext ( ) [inline, private]
template<class EndPointType>
uint64 Sirikata::SST::Connection< EndPointType >::getRTOMicroseconds ( ) [inline, private]
template<class EndPointType>
uint8 Sirikata::SST::Connection< EndPointType >::getState ( ) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::handleAckPacket ( Sirikata::Protocol::SST::SSTChannelHeader *  received_channel_msg,
Sirikata::Protocol::SST::SSTStreamHeader *  received_stream_msg 
) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::handleDatagram ( Sirikata::Protocol::SST::SSTStreamHeader *  received_stream_msg) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::handleDataPacket ( Sirikata::Protocol::SST::SSTStreamHeader *  received_stream_msg) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::handleInitPacket ( Sirikata::Protocol::SST::SSTStreamHeader *  received_stream_msg) [inline, private]

References SST_LOG, and Sirikata::Logging::warn.

template<class EndPointType>
static void Sirikata::SST::Connection< EndPointType >::handleReceive ( ConnectionVariables< EndPointType > *  sstConnVars,
EndPoint< EndPointType >  remoteEndPoint,
EndPoint< EndPointType >  localEndPoint,
void *  recv_buffer,
int  len 
) [inline, static, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::handleReplyPacket ( Sirikata::Protocol::SST::SSTStreamHeader *  received_stream_msg) [inline, private]
template<class EndPointType>
virtual void Sirikata::SST::Connection< EndPointType >::iClose ( bool  force) [inline, virtual]
template<class EndPointType>
static bool Sirikata::SST::Connection< EndPointType >::listen ( ConnectionVariables< EndPointType > *  sstConnVars,
StreamReturnCallbackFunction  cb,
EndPoint< EndPointType >  listeningEndPoint 
) [inline, static, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::listenStream ( uint32  port,
StreamReturnCallbackFunction  scb 
) [inline, private]
template<class EndPointType>
virtual EndPoint<EndPointType> Sirikata::SST::Connection< EndPointType >::localEndPoint ( ) [inline, virtual]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::markAcknowledgedPacket ( uint64  receivedAckNum) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::parsePacket ( Sirikata::Protocol::SST::SSTChannelHeader *  received_channel_msg) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::receiveMessage ( void *  recv_buff,
int  len 
) [inline, private]
template<class EndPointType>
virtual bool Sirikata::SST::Connection< EndPointType >::registerReadDatagramCallback ( uint32  port,
ReadDatagramCallback  cb 
) [inline, virtual]
template<class EndPointType>
virtual bool Sirikata::SST::Connection< EndPointType >::registerReadOrderedDatagramCallback ( ReadDatagramCallback  cb) [inline, virtual]
template<class EndPointType>
virtual EndPoint<EndPointType> Sirikata::SST::Connection< EndPointType >::remoteEndPoint ( ) [inline, virtual]
template<class EndPointType>
uint64 Sirikata::SST::Connection< EndPointType >::sendData ( const void *  data,
uint32  length,
bool  isAck 
) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::sendSSTChannelPacket ( Sirikata::Protocol::SST::SSTChannelHeader &  sstMsg) [inline, private]
template<class EndPointType>
bool Sirikata::SST::Connection< EndPointType >::serviceConnection ( std::tr1::shared_ptr< Connection< EndPointType > >  conn) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::serviceConnectionNoReturn ( std::tr1::shared_ptr< Connection< EndPointType > >  conn) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::setLocalChannelID ( uint32  channelID) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::setRemoteChannelID ( uint32  channelID) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::setState ( int  state) [inline, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::setWeakThis ( std::tr1::shared_ptr< Connection< EndPointType > >  conn) [inline, private]
template<class EndPointType>
virtual int Sirikata::SST::Connection< EndPointType >::stream ( StreamReturnCallbackFunction  cb,
void *  initial_data,
int  length,
uint32  local_port,
uint32  remote_port 
) [inline, private, virtual]
template<class EndPointType>
virtual int Sirikata::SST::Connection< EndPointType >::stream ( StreamReturnCallbackFunction  cb,
void *  initial_data,
int  length,
uint32  local_port,
uint32  remote_port,
LSID  parentLSID 
) [inline, private, virtual]
template<class EndPointType>
static bool Sirikata::SST::Connection< EndPointType >::unlisten ( ConnectionVariables< EndPointType > *  sstConnVars,
EndPoint< EndPointType >  listeningEndPoint 
) [inline, static, private]
template<class EndPointType>
void Sirikata::SST::Connection< EndPointType >::unlistenStream ( uint32  port) [inline, private]

Friends And Related Function Documentation

template<class EndPointType>
friend class BaseDatagramLayer< EndPointType > [friend]
template<class EndPointType>
friend class ConnectionManager< EndPointType > [friend]
template<class EndPointType>
friend class Stream< EndPointType > [friend]

Member Data Documentation

template<class EndPointType>
float Sirikata::SST::Connection< EndPointType >::CC_ALPHA [private]
template<class EndPointType>
google::protobuf::LogSilencer Sirikata::SST::Connection< EndPointType >::logSilencer [private]
template<class EndPointType>
uint16 Sirikata::SST::Connection< EndPointType >::MAX_DATAGRAM_SIZE [private]
template<class EndPointType>
uint16 Sirikata::SST::Connection< EndPointType >::MAX_PAYLOAD_SIZE [private]
template<class EndPointType>
uint32 Sirikata::SST::Connection< EndPointType >::MAX_QUEUED_SEGMENTS [private]
template<class EndPointType>
uint16 Sirikata::SST::Connection< EndPointType >::mCwnd [private]
template<class EndPointType>
BaseDatagramLayerPtr Sirikata::SST::Connection< EndPointType >::mDatagramLayer [private]
template<class EndPointType>
bool Sirikata::SST::Connection< EndPointType >::mFirstRTO [private]
template<class EndPointType>
std::map<LSID, std::tr1::shared_ptr< Stream<EndPointType> > > Sirikata::SST::Connection< EndPointType >::mIncomingSubstreamMap [private]
template<class EndPointType>
bool Sirikata::SST::Connection< EndPointType >::mInSendingMode [private]
template<class EndPointType>
uint64 Sirikata::SST::Connection< EndPointType >::mLastReceivedSequenceNumber [private]
template<class EndPointType>
Time Sirikata::SST::Connection< EndPointType >::mLastTransmitTime [private]
template<class EndPointType>
std::map<uint32, StreamReturnCallbackFunction> Sirikata::SST::Connection< EndPointType >::mListeningStreamsCallbackMap [private]
template<class EndPointType>
uint32 Sirikata::SST::Connection< EndPointType >::mLocalChannelID [private]
template<class EndPointType>
EndPoint<EndPointType> Sirikata::SST::Connection< EndPointType >::mLocalEndPoint [private]
template<class EndPointType>
uint16 Sirikata::SST::Connection< EndPointType >::mNumInitialRetransmissionAttempts [private]
template<class EndPointType>
uint32 Sirikata::SST::Connection< EndPointType >::mNumStreams [private]
template<class EndPointType>
std::map<LSID, std::tr1::shared_ptr< Stream<EndPointType> > > Sirikata::SST::Connection< EndPointType >::mOutgoingSubstreamMap [private]
template<class EndPointType>
std::deque< std::tr1::shared_ptr<ChannelSegment> > Sirikata::SST::Connection< EndPointType >::mOutstandingSegments [private]
template<class EndPointType>
boost::mutex Sirikata::SST::Connection< EndPointType >::mOutstandingSegmentsMutex [private]
template<class EndPointType>
PartialPayloadMap Sirikata::SST::Connection< EndPointType >::mPartialReadDatagrams [private]
template<class EndPointType>
std::deque< std::tr1::shared_ptr<ChannelSegment> > Sirikata::SST::Connection< EndPointType >::mQueuedSegments [private]
template<class EndPointType>
boost::mutex Sirikata::SST::Connection< EndPointType >::mQueueMutex [private]
template<class EndPointType>
std::map<uint32, std::vector<ReadDatagramCallback> > Sirikata::SST::Connection< EndPointType >::mReadDatagramCallbacks [private]
template<class EndPointType>
uint32 Sirikata::SST::Connection< EndPointType >::mRemoteChannelID [private]
template<class EndPointType>
EndPoint<EndPointType> Sirikata::SST::Connection< EndPointType >::mRemoteEndPoint [private]
template<class EndPointType>
int64 Sirikata::SST::Connection< EndPointType >::mRTOMicroseconds [private]
template<class EndPointType>
ConnectionVariables<EndPointType>* Sirikata::SST::Connection< EndPointType >::mSSTConnVars [private]
template<class EndPointType>
int Sirikata::SST::Connection< EndPointType >::mState [private]
template<class EndPointType>
uint64 Sirikata::SST::Connection< EndPointType >::mTransmitSequenceNumber [private]
template<class EndPointType>
std::tr1::weak_ptr<Connection<EndPointType> > Sirikata::SST::Connection< EndPointType >::mWeakThis [private]

The documentation for this class was generated from the following file: