#include <RTPParticipantInfo.h>
Inheritance diagram for RTPParticipantInfo:
RTPSenderInformation
Public Member Functions | |
RTPParticipantInfo (u_int32 ssrc=0) | |
RTPParticipantInfo (const RTPParticipantInfo &participantInfo) | |
virtual | ~RTPParticipantInfo () |
RTPParticipantInfo & | operator= (const RTPParticipantInfo &participantInfo) |
virtual cObject * | dup () const |
virtual const char * | className () const |
virtual void | processRTPPacket (RTPPacket *packet, simtime_t arrivalTime) |
virtual void | processSenderReport (SenderReport *report, simtime_t arrivalTime) |
virtual void | processReceptionReport (ReceptionReport *report, simtime_t arrivalTime) |
virtual void | processSDESChunk (SDESChunk *sdesChunk, simtime_t arrivalTime) |
virtual SDESChunk * | sdesChunk () |
virtual void | addSDESItem (SDESItem *sdesItem) |
virtual ReceptionReport * | receptionReport (simtime_t now) |
virtual SenderReport * | senderReport (simtime_t now) |
virtual void | nextInterval (simtime_t now) |
virtual bool | toBeDeleted (simtime_t now) |
virtual bool | isSender () |
virtual u_int32 | ssrc () |
virtual void | setSSRC (u_int32 ssrc) |
virtual IN_Addr | address () |
virtual void | setAddress (IN_Addr address) |
virtual IN_Port | rtpPort () |
virtual void | setRTPPort (IN_Port rtpPort) |
virtual IN_Port | rtcpPort () |
virtual void | setRTCPPort (IN_Port rtpPort) |
Static Public Member Functions | |
static char * | ssrcToName (u_int32 ssrc) |
Protected Member Functions | |
virtual void | addSDESItem (SDESItem::SDES_ITEM_TYPE type, const char *content) |
Protected Attributes | |
SDESChunk * | _sdesChunk |
IN_Addr | _address |
IN_Port | _rtpPort |
IN_Port | _rtcpPort |
int | _silentIntervals |
RTPParticipantInfo::RTPParticipantInfo | ( | u_int32 | ssrc = 0 |
) |
Default constructor.
00033 : cObject() { 00034 setName(ssrcToName(ssrc)); 00035 _sdesChunk = new SDESChunk("SDESChunk", ssrc); 00036 // because there haven't been sent any rtp packets 00037 // by this endsystem at all, the number of silent 00038 // intervals would be undefined; to calculate with 00039 // it but not to regard this endsystem as a sender 00040 // it is set to 3; see isSender() for details 00041 _silentIntervals = 3; 00042 _address = IPADDRESS_UNDEF; 00043 _rtpPort = IPSuite_PORT_UNDEF; 00044 _rtcpPort = IPSuite_PORT_UNDEF; 00045 };
RTPParticipantInfo::RTPParticipantInfo | ( | const RTPParticipantInfo & | participantInfo | ) |
Copy constructor.
00048 : cObject() { 00049 setName(participantInfo.name()); 00050 operator=(participantInfo); 00051 };
RTPParticipantInfo::~RTPParticipantInfo | ( | ) | [virtual] |
IN_Addr RTPParticipantInfo::address | ( | ) | [virtual] |
void RTPParticipantInfo::addSDESItem | ( | SDESItem::SDES_ITEM_TYPE | type, | |
const char * | content | |||
) | [protected, virtual] |
Creates a new SDESItem and adds it to the SDESChunk stored in this RTPParticipantInfo.
00155 { 00156 _sdesChunk->addSDESItem(new SDESItem(type, content)); 00157 };
void RTPParticipantInfo::addSDESItem | ( | SDESItem * | sdesItem | ) | [virtual] |
Adds this sdes item to the sdes chunk of this participant.
00113 { 00114 _sdesChunk->addSDESItem(sdesItem); 00115 };
const char * RTPParticipantInfo::className | ( | ) | const [virtual] |
cObject * RTPParticipantInfo::dup | ( | ) | const [virtual] |
Duplicates this RTPParticipantInfo by calling the copy constructor.
Reimplemented in RTPReceiverInfo, and RTPSenderInfo.
00069 { 00070 return new RTPParticipantInfo(*this); 00071 };
bool RTPParticipantInfo::isSender | ( | ) | [virtual] |
Returns true if this endsystem has sent at least one rtp data packet during the last two rtcp intervals (including the current one).
00118 { 00119 return (_silentIntervals <= 1); 00120 };
void RTPParticipantInfo::nextInterval | ( | simtime_t | now | ) | [virtual] |
This method should be called by the rtcp module which uses this class for storing information every time an rtcp packet is sent. Some behaviour of rtp and rtcp (and this class) depend on how many rtcp intervals have passed, for example an rtp end system is marked as inactive if there haven't been received packets from it for a certain number of rtpc intervals. Call senderReport() and receptionReport() before calling this method.
Reimplemented in RTPReceiverInfo.
00134 { 00135 _silentIntervals++; 00136 };
RTPParticipantInfo & RTPParticipantInfo::operator= | ( | const RTPParticipantInfo & | participantInfo | ) |
Assignment operator.
00059 { 00060 cObject::operator=(participantInfo); 00061 _sdesChunk = new SDESChunk(*(participantInfo._sdesChunk)); 00062 _address = participantInfo._address; 00063 _rtpPort = participantInfo._rtpPort; 00064 _rtcpPort = participantInfo._rtcpPort; 00065 return *this; 00066 };
void RTPParticipantInfo::processReceptionReport | ( | ReceptionReport * | report, | |
simtime_t | arrivalTime | |||
) | [virtual] |
void RTPParticipantInfo::processRTPPacket | ( | RTPPacket * | packet, | |
simtime_t | arrivalTime | |||
) | [virtual] |
This method should be extended by a subclass for extracting information about the originating endsystem of an rtp packet. This method sets _silentInterval to 0 so that the sender of this rtp packet is regarded as an active sender.
Reimplemented in RTPReceiverInfo, and RTPSenderInfo.
00079 { 00080 _silentIntervals = 0; 00081 delete packet; 00082 };
void RTPParticipantInfo::processSDESChunk | ( | SDESChunk * | sdesChunk, | |
simtime_t | arrivalTime | |||
) | [virtual] |
This method extracts sdes information of the given sdes chunk.and stores it.
Reimplemented in RTPReceiverInfo.
00097 { 00098 for (int i = 0; i < sdesChunk->items(); i++) { 00099 if (sdesChunk->exist(i)) { 00100 SDESItem *sdesItem = (SDESItem *)(sdesChunk->remove(i)); 00101 addSDESItem(sdesItem); 00102 } 00103 } 00104 delete sdesChunk; 00105 };
void RTPParticipantInfo::processSenderReport | ( | SenderReport * | report, | |
simtime_t | arrivalTime | |||
) | [virtual] |
This method extracts information about an rtp endsystem as provided by the given SenderReport.
Reimplemented in RTPReceiverInfo.
ReceptionReport * RTPParticipantInfo::receptionReport | ( | simtime_t | now | ) | [virtual] |
This method is intended to be overwritten by subclasses. It should return a receiver report if there have been received rtp packets from that endsystem and NULL otherwise.
Reimplemented in RTPReceiverInfo.
00123 { 00124 opp_error("Returning NULL pointer results in segmentation fault"); 00125 return NULL; 00126 };
IN_Port RTPParticipantInfo::rtcpPort | ( | ) | [virtual] |
Returns the port used by this endsystem for transmitting rtcp packets.
00180 { 00181 return _rtcpPort; 00182 };
IN_Port RTPParticipantInfo::rtpPort | ( | ) | [virtual] |
Returns the port used by this endsystem for transmitting rtp packets.
00170 { 00171 return _rtpPort; 00172 };
SDESChunk * RTPParticipantInfo::sdesChunk | ( | ) | [virtual] |
Returns a copy of the sdes chunk used for storing source description items about this system.
00108 { 00109 return new SDESChunk(*_sdesChunk); 00110 };
SenderReport * RTPParticipantInfo::senderReport | ( | simtime_t | now | ) | [virtual] |
This method is intended to be overwritten by subclasses which are used for storing information about itself. It should return a sender report if there have been sent rtp packets recently or NULL otherwise. The implementation for this class always returns NULL.
Reimplemented in RTPSenderInfo.
void RTPParticipantInfo::setAddress | ( | IN_Addr | address | ) | [virtual] |
void RTPParticipantInfo::setRTCPPort | ( | IN_Port | rtpPort | ) | [virtual] |
void RTPParticipantInfo::setRTPPort | ( | IN_Port | rtpPort | ) | [virtual] |
void RTPParticipantInfo::setSSRC | ( | u_int32 | ssrc | ) | [virtual] |
Sets the ssrc identifier.
00149 { 00150 setName(ssrcToName(ssrc)); 00151 _sdesChunk->setSSRC(ssrc); 00152 };
u_int32 RTPParticipantInfo::ssrc | ( | ) | [virtual] |
char * RTPParticipantInfo::ssrcToName | ( | u_int32 | ssrc | ) | [static] |
This method returns the given 32 bit ssrc identifier as an 8 character hexadecimal number which is used as name of an RTPParticipantInfo object.
00190 { 00191 char name[9]; 00192 sprintf(name, "%08x", ssrc); 00193 return opp_strdup(name); 00194 };
bool RTPParticipantInfo::toBeDeleted | ( | simtime_t | now | ) | [virtual] |
Returns true if the end system does no longer participate in the rtp session. The implementation in this class always returns false.
Reimplemented in RTPReceiverInfo, and RTPSenderInfo.
IN_Addr RTPParticipantInfo::_address [protected] |
Used for storing the ip address of this endsystem.
IN_Port RTPParticipantInfo::_rtcpPort [protected] |
Used for storing the port for rtcp by this endsystem.
IN_Port RTPParticipantInfo::_rtpPort [protected] |
Used for storing the port for rtp by this endsystem.
SDESChunk* RTPParticipantInfo::_sdesChunk [protected] |
Used for storing sdes information about this rtp endsystem. The ssrc identifier is also stored here.
int RTPParticipantInfo::_silentIntervals [protected] |
Stores the number of rtcp intervals (including the current one) during which this rtp endsystem hasn't sent any rtp data packets. When an rtp data packet is received it is reset to 0.