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

#include <SSTImpl.hpp>

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

List of all members.

Public Types

enum  StreamStates {
  DISCONNECTED = 1, CONNECTED = 2, PENDING_DISCONNECT = 3, PENDING_CONNECT = 4,
  NOT_FINISHED_CONSTRUCTING__CALL_INIT
}
typedef std::tr1::shared_ptr
< Stream
Ptr
typedef Ptr StreamPtr
typedef Connection< EndPointType > ConnectionType
typedef EndPoint< EndPointType > EndpointType
typedef CallbackTypes
< EndPointType > 
CBTypes
typedef
CBTypes::StreamReturnCallbackFunction 
StreamReturnCallbackFunction
typedef CBTypes::ReadCallback ReadCallback
typedef
std::tr1::unordered_map
< EndPoint< EndPointType >
, StreamReturnCallbackFunction,
typename EndPoint
< EndPointType >::Hasher
StreamReturnCallbackMap

Public Member Functions

virtual ~Stream ()
bool connected ()
void listenSubstream (uint32 port, StreamReturnCallbackFunction scb)
void unlistenSubstream (uint32 port)
virtual int write (const uint8 *data, int len)
virtual bool registerReadCallback (ReadCallback callback)
virtual bool close (bool force)
virtual void setPriority (int pri)
virtual int priority ()
virtual std::tr1::weak_ptr
< Connection< EndPointType > > 
connection ()
virtual int createChildStream (StreamReturnCallbackFunction cb, void *data, int length, uint32 local_port, uint32 remote_port)
virtual EndPoint< EndPointType > localEndPoint ()
virtual EndPoint< EndPointType > remoteEndPoint ()
virtual uint8 getState ()
const ContextgetContext ()

Static Public Member Functions

static bool connectStream (ConnectionVariables< EndPointType > *sstConnVars, EndPoint< EndPointType > localEndPoint, EndPoint< EndPointType > remoteEndPoint, StreamReturnCallbackFunction cb)
static bool listen (ConnectionVariables< EndPointType > *sstConnVars, StreamReturnCallbackFunction cb, EndPoint< EndPointType > listeningEndPoint)
static bool unlisten (ConnectionVariables< EndPointType > *sstConnVars, EndPoint< EndPointType > listeningEndPoint)

Private Member Functions

 Stream (LSID parentLSID, std::tr1::weak_ptr< Connection< EndPointType > > conn, uint32 local_port, uint32 remote_port, USID usid, LSID lsid, StreamReturnCallbackFunction cb, ConnectionVariables< EndPointType > *sstConnVars)
int init (void *initial_data, uint32 length, bool remotelyInitiated, LSID remoteLSID)
uint8 * receiveBuffer ()
uint8 * receiveBitmap ()
void initRemoteLSID (LSID remoteLSID)
void sendKeepAlive (std::tr1::weak_ptr< Stream< EndPointType > > wstrm, std::tr1::shared_ptr< Connection< EndPointType > > conn)
void serviceStreamNoReturn (std::tr1::shared_ptr< Stream< EndPointType > > strm, std::tr1::shared_ptr< Connection< EndPointType > > conn)
bool serviceStream (std::tr1::shared_ptr< Stream< EndPointType > > strm, std::tr1::shared_ptr< Connection< EndPointType > > conn)
void resendUnackedPackets ()
void sendToApp (uint32 skipLength)
void receiveData (Sirikata::Protocol::SST::SSTStreamHeader *streamMsg, const void *buffer, uint64 offset, uint32 len)
LSID getLSID ()
LSID getRemoteLSID ()
void updateRTO (Time sampleStartTime, Time sampleEndTime)
void sendInitPacket (void *data, uint32 len)
void sendAckPacket ()
uint64 sendDataPacket (const void *data, uint32 len, uint64 offset)
void sendReplyPacket (void *data, uint32 len, LSID remoteLSID)

Static Private Member Functions

static void connectionCreated (int errCode, std::tr1::shared_ptr< Connection< EndPointType > > c)

Private Attributes

uint8 mState
uint32 mLocalPort
uint32 mRemotePort
uint64 mNumBytesSent
LSID mParentLSID
std::tr1::weak_ptr< Connection
< EndPointType > > 
mConnection
const ContextmContext
std::map< uint64,
std::tr1::shared_ptr
< StreamBuffer > > 
mChannelToBufferMap
std::map< uint64, uint32 > mChannelToStreamOffsetMap
std::deque
< std::tr1::shared_ptr
< StreamBuffer > > 
mQueuedBuffers
uint32 mCurrentQueueLength
USID mUSID
LSID mLSID
LSID mRemoteLSID
uint16 MAX_PAYLOAD_SIZE
uint32 MAX_QUEUE_LENGTH
uint32 MAX_RECEIVE_WINDOW
boost::mutex mQueueMutex
bool mFirstRTO
int64 mStreamRTOMicroseconds
float FL_ALPHA
uint32 mTransmitWindowSize
uint32 mReceiveWindowSize
uint32 mNumOutstandingBytes
int64 mNextByteExpected
int64 mLastContiguousByteReceived
Time mLastSendTime
Time mLastReceiveTime
uint8 * mReceiveBuffer
uint8 * mReceiveBitmap
boost::recursive_mutex mReceiveBufferMutex
ReadCallback mReadCallback
StreamReturnCallbackFunction mStreamReturnCallback
bool mConnected
uint8 * mInitialData
uint16 mInitialDataLength
uint8 mNumInitRetransmissions
uint8 MAX_INIT_RETRANSMISSIONS
ConnectionVariables
< EndPointType > * 
mSSTConnVars
std::tr1::weak_ptr< Stream
< EndPointType > > 
mWeakThis
EndPoint< EndPointType > mLocalEndPoint
 Store the endpoints here to avoid talking to mConnection.
EndPoint< EndPointType > mRemoteEndPoint

Friends

class Connection< EndPointType >

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


Member Typedef Documentation

template<class EndPointType>
typedef CallbackTypes<EndPointType> Sirikata::SST::Stream< EndPointType >::CBTypes
template<class EndPointType>
typedef Connection<EndPointType> Sirikata::SST::Stream< EndPointType >::ConnectionType
template<class EndPointType>
typedef EndPoint<EndPointType> Sirikata::SST::Stream< EndPointType >::EndpointType
template<class EndPointType>
typedef std::tr1::shared_ptr<Stream> Sirikata::SST::Stream< EndPointType >::Ptr
template<class EndPointType>
typedef CBTypes::ReadCallback Sirikata::SST::Stream< EndPointType >::ReadCallback
template<class EndPointType>
typedef Ptr Sirikata::SST::Stream< EndPointType >::StreamPtr
template<class EndPointType>
typedef CBTypes::StreamReturnCallbackFunction Sirikata::SST::Stream< EndPointType >::StreamReturnCallbackFunction
template<class EndPointType>
typedef std::tr1::unordered_map<EndPoint<EndPointType>, StreamReturnCallbackFunction, typename EndPoint<EndPointType>::Hasher> Sirikata::SST::Stream< EndPointType >::StreamReturnCallbackMap

Member Enumeration Documentation

template<class EndPointType>
enum Sirikata::SST::Stream::StreamStates
Enumerator:
DISCONNECTED 
CONNECTED 
PENDING_DISCONNECT 
PENDING_CONNECT 
NOT_FINISHED_CONSTRUCTING__CALL_INIT 

Constructor & Destructor Documentation

template<class EndPointType>
virtual Sirikata::SST::Stream< EndPointType >::~Stream ( ) [inline, virtual]
template<class EndPointType>
Sirikata::SST::Stream< EndPointType >::Stream ( LSID  parentLSID,
std::tr1::weak_ptr< Connection< EndPointType > >  conn,
uint32  local_port,
uint32  remote_port,
USID  usid,
LSID  lsid,
StreamReturnCallbackFunction  cb,
ConnectionVariables< EndPointType > *  sstConnVars 
) [inline, private]

Member Function Documentation

template<class EndPointType>
virtual bool Sirikata::SST::Stream< EndPointType >::close ( bool  force) [inline, virtual]
template<class EndPointType>
bool Sirikata::SST::Stream< EndPointType >::connected ( ) [inline]
template<class EndPointType>
virtual std::tr1::weak_ptr<Connection<EndPointType> > Sirikata::SST::Stream< EndPointType >::connection ( ) [inline, virtual]
template<class EndPointType>
static void Sirikata::SST::Stream< EndPointType >::connectionCreated ( int  errCode,
std::tr1::shared_ptr< Connection< EndPointType > >  c 
) [inline, static, private]
template<class EndPointType>
static bool Sirikata::SST::Stream< EndPointType >::connectStream ( ConnectionVariables< EndPointType > *  sstConnVars,
EndPoint< EndPointType >  localEndPoint,
EndPoint< EndPointType >  remoteEndPoint,
StreamReturnCallbackFunction  cb 
) [inline, static]
template<class EndPointType>
virtual int Sirikata::SST::Stream< EndPointType >::createChildStream ( StreamReturnCallbackFunction  cb,
void *  data,
int  length,
uint32  local_port,
uint32  remote_port 
) [inline, virtual]
template<class EndPointType>
const Context* Sirikata::SST::Stream< EndPointType >::getContext ( ) [inline]
template<class EndPointType>
LSID Sirikata::SST::Stream< EndPointType >::getLSID ( ) [inline, private]
template<class EndPointType>
LSID Sirikata::SST::Stream< EndPointType >::getRemoteLSID ( ) [inline, private]
template<class EndPointType>
virtual uint8 Sirikata::SST::Stream< EndPointType >::getState ( ) [inline, virtual]
template<class EndPointType>
int Sirikata::SST::Stream< EndPointType >::init ( void *  initial_data,
uint32  length,
bool  remotelyInitiated,
LSID  remoteLSID 
) [inline, private]

Post a keep-alive task...

template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::initRemoteLSID ( LSID  remoteLSID) [inline, private]
template<class EndPointType>
static bool Sirikata::SST::Stream< EndPointType >::listen ( ConnectionVariables< EndPointType > *  sstConnVars,
StreamReturnCallbackFunction  cb,
EndPoint< EndPointType >  listeningEndPoint 
) [inline, static]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::listenSubstream ( uint32  port,
StreamReturnCallbackFunction  scb 
) [inline]
template<class EndPointType>
virtual EndPoint<EndPointType> Sirikata::SST::Stream< EndPointType >::localEndPoint ( ) [inline, virtual]
template<class EndPointType>
virtual int Sirikata::SST::Stream< EndPointType >::priority ( ) [inline, virtual]
template<class EndPointType>
uint8* Sirikata::SST::Stream< EndPointType >::receiveBitmap ( ) [inline, private]
template<class EndPointType>
uint8* Sirikata::SST::Stream< EndPointType >::receiveBuffer ( ) [inline, private]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::receiveData ( Sirikata::Protocol::SST::SSTStreamHeader *  streamMsg,
const void *  buffer,
uint64  offset,
uint32  len 
) [inline, private]
template<class EndPointType>
virtual bool Sirikata::SST::Stream< EndPointType >::registerReadCallback ( ReadCallback  callback) [inline, virtual]
template<class EndPointType>
virtual EndPoint<EndPointType> Sirikata::SST::Stream< EndPointType >::remoteEndPoint ( ) [inline, virtual]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::resendUnackedPackets ( ) [inline, private]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::sendAckPacket ( ) [inline, private]
template<class EndPointType>
uint64 Sirikata::SST::Stream< EndPointType >::sendDataPacket ( const void *  data,
uint32  len,
uint64  offset 
) [inline, private]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::sendInitPacket ( void *  data,
uint32  len 
) [inline, private]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::sendKeepAlive ( std::tr1::weak_ptr< Stream< EndPointType > >  wstrm,
std::tr1::shared_ptr< Connection< EndPointType > >  conn 
) [inline, private]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::sendReplyPacket ( void *  data,
uint32  len,
LSID  remoteLSID 
) [inline, private]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::sendToApp ( uint32  skipLength) [inline, private]
template<class EndPointType>
bool Sirikata::SST::Stream< EndPointType >::serviceStream ( std::tr1::shared_ptr< Stream< EndPointType > >  strm,
std::tr1::shared_ptr< Connection< EndPointType > >  conn 
) [inline, private]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::serviceStreamNoReturn ( std::tr1::shared_ptr< Stream< EndPointType > >  strm,
std::tr1::shared_ptr< Connection< EndPointType > >  conn 
) [inline, private]
template<class EndPointType>
virtual void Sirikata::SST::Stream< EndPointType >::setPriority ( int  pri) [inline, virtual]
template<class EndPointType>
static bool Sirikata::SST::Stream< EndPointType >::unlisten ( ConnectionVariables< EndPointType > *  sstConnVars,
EndPoint< EndPointType >  listeningEndPoint 
) [inline, static]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::unlistenSubstream ( uint32  port) [inline]
template<class EndPointType>
void Sirikata::SST::Stream< EndPointType >::updateRTO ( Time  sampleStartTime,
Time  sampleEndTime 
) [inline, private]
template<class EndPointType>
virtual int Sirikata::SST::Stream< EndPointType >::write ( const uint8 *  data,
int  len 
) [inline, virtual]

Friends And Related Function Documentation

template<class EndPointType>
friend class Connection< EndPointType > [friend]

Member Data Documentation

template<class EndPointType>
float Sirikata::SST::Stream< EndPointType >::FL_ALPHA [private]
template<class EndPointType>
uint8 Sirikata::SST::Stream< EndPointType >::MAX_INIT_RETRANSMISSIONS [private]
template<class EndPointType>
uint16 Sirikata::SST::Stream< EndPointType >::MAX_PAYLOAD_SIZE [private]
template<class EndPointType>
uint32 Sirikata::SST::Stream< EndPointType >::MAX_QUEUE_LENGTH [private]
template<class EndPointType>
uint32 Sirikata::SST::Stream< EndPointType >::MAX_RECEIVE_WINDOW [private]
template<class EndPointType>
std::map<uint64, std::tr1::shared_ptr<StreamBuffer> > Sirikata::SST::Stream< EndPointType >::mChannelToBufferMap [private]
template<class EndPointType>
std::map<uint64, uint32> Sirikata::SST::Stream< EndPointType >::mChannelToStreamOffsetMap [private]
template<class EndPointType>
bool Sirikata::SST::Stream< EndPointType >::mConnected [private]
template<class EndPointType>
std::tr1::weak_ptr<Connection<EndPointType> > Sirikata::SST::Stream< EndPointType >::mConnection [private]
template<class EndPointType>
const Context* Sirikata::SST::Stream< EndPointType >::mContext [private]
template<class EndPointType>
uint32 Sirikata::SST::Stream< EndPointType >::mCurrentQueueLength [private]
template<class EndPointType>
bool Sirikata::SST::Stream< EndPointType >::mFirstRTO [private]
template<class EndPointType>
uint8* Sirikata::SST::Stream< EndPointType >::mInitialData [private]
template<class EndPointType>
uint16 Sirikata::SST::Stream< EndPointType >::mInitialDataLength [private]
template<class EndPointType>
int64 Sirikata::SST::Stream< EndPointType >::mLastContiguousByteReceived [private]
template<class EndPointType>
Time Sirikata::SST::Stream< EndPointType >::mLastReceiveTime [private]
template<class EndPointType>
Time Sirikata::SST::Stream< EndPointType >::mLastSendTime [private]
template<class EndPointType>
EndPoint<EndPointType> Sirikata::SST::Stream< EndPointType >::mLocalEndPoint [private]

Store the endpoints here to avoid talking to mConnection.

It's ok to do this because the endpoints never change for an SST Stream.

template<class EndPointType>
uint32 Sirikata::SST::Stream< EndPointType >::mLocalPort [private]
template<class EndPointType>
LSID Sirikata::SST::Stream< EndPointType >::mLSID [private]
template<class EndPointType>
int64 Sirikata::SST::Stream< EndPointType >::mNextByteExpected [private]
template<class EndPointType>
uint64 Sirikata::SST::Stream< EndPointType >::mNumBytesSent [private]
template<class EndPointType>
uint8 Sirikata::SST::Stream< EndPointType >::mNumInitRetransmissions [private]
template<class EndPointType>
uint32 Sirikata::SST::Stream< EndPointType >::mNumOutstandingBytes [private]
template<class EndPointType>
LSID Sirikata::SST::Stream< EndPointType >::mParentLSID [private]
template<class EndPointType>
std::deque< std::tr1::shared_ptr<StreamBuffer> > Sirikata::SST::Stream< EndPointType >::mQueuedBuffers [private]
template<class EndPointType>
boost::mutex Sirikata::SST::Stream< EndPointType >::mQueueMutex [private]
template<class EndPointType>
ReadCallback Sirikata::SST::Stream< EndPointType >::mReadCallback [private]
template<class EndPointType>
uint8* Sirikata::SST::Stream< EndPointType >::mReceiveBitmap [private]
template<class EndPointType>
uint8* Sirikata::SST::Stream< EndPointType >::mReceiveBuffer [private]
template<class EndPointType>
boost::recursive_mutex Sirikata::SST::Stream< EndPointType >::mReceiveBufferMutex [private]
template<class EndPointType>
uint32 Sirikata::SST::Stream< EndPointType >::mReceiveWindowSize [private]
template<class EndPointType>
EndPoint<EndPointType> Sirikata::SST::Stream< EndPointType >::mRemoteEndPoint [private]
template<class EndPointType>
LSID Sirikata::SST::Stream< EndPointType >::mRemoteLSID [private]
template<class EndPointType>
uint32 Sirikata::SST::Stream< EndPointType >::mRemotePort [private]
template<class EndPointType>
ConnectionVariables<EndPointType>* Sirikata::SST::Stream< EndPointType >::mSSTConnVars [private]
template<class EndPointType>
uint8 Sirikata::SST::Stream< EndPointType >::mState [private]
template<class EndPointType>
StreamReturnCallbackFunction Sirikata::SST::Stream< EndPointType >::mStreamReturnCallback [private]
template<class EndPointType>
int64 Sirikata::SST::Stream< EndPointType >::mStreamRTOMicroseconds [private]
template<class EndPointType>
uint32 Sirikata::SST::Stream< EndPointType >::mTransmitWindowSize [private]
template<class EndPointType>
USID Sirikata::SST::Stream< EndPointType >::mUSID [private]
template<class EndPointType>
std::tr1::weak_ptr<Stream<EndPointType> > Sirikata::SST::Stream< EndPointType >::mWeakThis [private]

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