Session Class Reference

<class description="" goes="" here=""> <short description=""> More...

#include <Session.hpp>

Inheritance diagram for Session:

VThread ProxySession SemiProxySession ServerSession List of all members.

Public Types

enum  SessionState {
  SESSION_ERR, SESSION_NEW, SESSION_INITIALIZED, SESSION_ACTIVE,
  SESSION_PAUSED, SESSION_CLOSED
}

Public Member Functions

virtual bool options (const Url *fileName, const char *remaining)=0
virtual bool connect (const Url *fileName, const char *remaining)=0
virtual bool setup (const Url *fileName, const char *remaining)=0
virtual bool play (const Url *fileName, const char *remaining)=0
virtual bool pause (const Url *fileName, const char *remaining)=0
virtual bool getOptions (const Url *fileName, const char *remaining)=0
virtual bool setOptions (const Url *fileName, const char *remaining)=0
virtual bool tearDown (int sessionKey, bool immediate=false, const Url *fileName=NULL, const char *remaining=NULL)=0
 teardowns the session specified with sessionKey (if no fileName and no reminaing is specified.
virtual void setUrl (const Url *uri, bool makeExactMatch=true)=0
 deep-copies uri, sets mp4Stream by asking the cacheManager
const UrlgetUrl () const
bool setRtxInfoForES (u32 esId, rtx_info *rtx)
 creates a rtx_group for the given input params
rtx_group * getRtxGroup (u32 esId)
 returns an rtx_group for the esId, or NULL
std::list< rtx_group * > * getAllRtxGroups ()
const struct sockaddr_in * getDataSinkInfo () const
void setDataChannel (DataChannel *dc)
 simply appends
AdaptorgetSuggestedAdaptor ()
const std::list< DataChannel * > & getDataChannels () const
DataChannelgetDataChannel (int esId)
 searches an existing DataChannel within this session for the given
ContainerInfogetContainerInfo () const
void setTerminalCapabilities (TerminalCapabilities *tc)
const TerminalCapabilitiesgetTerminalCapabilities () const
int getControlSocket () const
bool sendResponse (const char *str, int bytes)
 writes the string to the session control channel
int readRequest (char *str, const int MAX_BYTES)
 reads at most
RTSPgetProtocol ()
KnownProtocols determineProtocol (const char *request)
 returns the known protocol or PROTO_UNKNOWN

Protected Member Functions

DataChannelfind (int esId)
 searches for an ES its DataChannel.

Protected Attributes

GlobalTimerglobalTimer
ReferenceCountergtRefCount
SharedAdaptorgtSharedAdapt
ResourceUsage resUsage
int sessionControlChannel
SessionState state
TerminalCapabilitiestermCap
UserPreferences * userPref
ContainerInfomp4Stream
list< rtx_group * > rtxInfo
 stores for each ES an optional retransmission wish
list< DataChannel * > channels
 the List of all DataChannels that this Session manages.
AdaptorsuggestedAdaptor
sockaddr_in * client
u32 clientId
RTSPprot
Urlurl
 the url of the source/destination file
char * serverID
bool canAdmitRequest

Detailed Description

<class description="" goes="" here=""> <short description="">

Author:
Michael Kropfberger and Peter Schojer
Version:
Id
Session.hpp,v 1.16 2006/01/20 15:37:54 mkropfbe Exp

Definition at line 79 of file Session.hpp.


Member Function Documentation

DataChannel* Session::find int  esId  )  [protected]
 

searches for an ES its DataChannel.

returns NULL on failure

DataChannel * Session::getDataChannel int  esId  ) 
 

searches an existing DataChannel within this session for the given

Parameters:
esId. NULL is returned if no DC exists
Definition at line 214 of file Session.cpp.

References channels.

00215 { 00216 list < DataChannel * >::const_iterator dcI; 00217 if (!channels.empty()) { 00218 dcI = channels.begin(); 00219 while (dcI != channels.end()) { 00220 if ((*dcI)->getESInfo()->getStreamId() == (u32) esId) { 00221 return (*dcI); 00222 } 00223 dcI++; 00224 } 00225 } 00226 return NULL; 00227 };

int Session::readRequest char *  str,
const int  MAX_BYTES
 

reads at most

Parameters:
MAX_BYTES-1 bytes from a socket and sets '' at the end of the string. This method is blocking, it stores the read data in
str,@param return contains the bytes read. returns a negative value in case of error, returns 0 if the client closed the socket
Definition at line 113 of file Session.cpp.
00114 { 00115 assert(str && MAX_BYTES>0); 00116 00117 if(!str || MAX_BYTES<=0) 00118 return -1; 00119 00120 int n=0; 00121 int total=0; 00122 memset(str,0,MAX_BYTES); 00123 00124 do { 00125 // n == 0 if connection closed 00126 // n < 0 if error 00127 n=recv(sessionControlChannel, str+total, MAX_BYTES-1-total,0); 00128 dprintf_full("Session::readRequest: partial %i total %i\r\n",n,total); 00129 dprintf_full("Session::readRequest:X%sX\r\n",str+total); 00130 if(n<=0) 00131 break; 00132 total+=n; 00133 } 00134 while(n>0 && !(total>3 && str[total-4]=='\r' && str[total-3]=='\n' && 00135 str[total-2]=='\r' && str[total-1]=='\n')); 00136 00137 dprintf_full("Session::readRequest: %i\r\n",total);fflush(stdout); 00138 return total; 00139 };

void Session::setDataChannel DataChannel dc  ) 
 

simply appends

Parameters:
dc to the list of DataChannels. No checking is done, if an entry already exists for the ElementaryStream
Definition at line 208 of file Session.cpp.

References channels.

00209 { 00210 channels.push_back(dc); 00211 };

virtual void Session::setUrl const Url uri,
bool  makeExactMatch = true
[pure virtual]
 

deep-copies uri, sets mp4Stream by asking the cacheManager

Parameters:
makeExactMatch decides on possible server-side transcoding

Implemented in ProxySession, ServerSession, and SemiProxySession.

virtual bool Session::tearDown int  sessionKey,
bool  immediate = false,
const Url fileName = NULL,
const char *  remaining = NULL
[pure virtual]
 

teardowns the session specified with sessionKey (if no fileName and no reminaing is specified.

Otherwise remaining will be parsed for the sessionkey, and the first param is ignored

Implemented in ProxySession, ServerSession, and SemiProxySession.


Member Data Documentation

list< DataChannel * > Session::channels [protected]
 

the List of all DataChannels that this Session manages.

1 DataChannel = 1 ESDefinition at line 162 of file Session.hpp.

Referenced by getDataChannel(), and setDataChannel().


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