INET Framework for OMNeT++/OMNEST
inet::rtp::RTPParticipantInfo Class Reference

This class is a super class for classes intended for storing information about RTP end systems. More...

#include <RTPParticipantInfo.h>

Inheritance diagram for inet::rtp::RTPParticipantInfo:
inet::rtp::RTPParticipantInfo_Base inet::rtp::RTPReceiverInfo inet::rtp::RTPSenderInfo

Public Member Functions

 RTPParticipantInfo (uint32 ssrc=0)
 Default constructor. More...
 
 RTPParticipantInfo (const RTPParticipantInfo &participantInfo)
 Copy constructor. More...
 
virtual ~RTPParticipantInfo ()
 Destructor. More...
 
RTPParticipantInfooperator= (const RTPParticipantInfo &participantInfo)
 Assignment operator. More...
 
virtual RTPParticipantInfodup () const override
 Duplicates this RTPParticipantInfo by calling the copy constructor. More...
 
virtual void processRTPPacket (RTPPacket *packet, int id, simtime_t arrivalTime)
 This method should be extended by a subclass for extracting information about the originating endsystem of an RTP packet. More...
 
virtual void processSenderReport (SenderReport &report, simtime_t arrivalTime)
 This method extracts information about an RTP endsystem as provided by the given SenderReport. More...
 
virtual void processReceptionReport (ReceptionReport &report, simtime_t arrivalTime)
 This method extracts information of the given ReceptionReport. More...
 
virtual void processSDESChunk (SDESChunk *sdesChunk, simtime_t arrivalTime)
 This method extracts sdes information of the given sdes chunk.and stores it. More...
 
virtual SDESChunkgetSDESChunk () const
 Returns a copy of the sdes chunk used for storing source description items about this system. More...
 
virtual void addSDESItem (SDESItem *sdesItem)
 Adds this sdes item to the sdes chunk of this participant. More...
 
virtual ReceptionReportreceptionReport (simtime_t now)
 This method is intended to be overwritten by subclasses. More...
 
virtual SenderReportsenderReport (simtime_t now)
 This method is intended to be overwritten by subclasses which are used for storing information about itself. More...
 
virtual void nextInterval (simtime_t now)
 This method should be called by the rtcp module which uses this class for storing information every time an rtcp packet is sent. More...
 
virtual bool toBeDeleted (simtime_t now)
 Returns true if the end system does no longer participate in the RTP session. More...
 
virtual bool isSender () const
 Returns true if this endsystem has sent at least one RTP data packet during the last two rtcp intervals (including the current one). More...
 
virtual uint32 getSsrc () const override
 Returns the ssrc identifier of the RTP endsystem. More...
 
virtual void setSsrc (uint32 ssrc) override
 Sets the ssrc identifier. More...
 
virtual void addSDESItem (SDESItem::SDES_ITEM_TYPE type, const char *content)
 Creates a new SDESItem and adds it to the SDESChunk stored in this RTPParticipantInfo. More...
 
virtual void parsimPack (cCommBuffer *b) const override
 
virtual void parsimUnpack (cCommBuffer *b) override
 
- Public Member Functions inherited from inet::rtp::RTPParticipantInfo_Base
virtual ~RTPParticipantInfo_Base ()
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual IPv4AddressgetAddress ()
 
virtual const IPv4AddressgetAddress () const
 
virtual void setAddress (const IPv4Address &address)
 
virtual int getRTPPort () const
 
virtual void setRTPPort (int RTPPort)
 
virtual int getRTCPPort () const
 
virtual void setRTCPPort (int RTCPPort)
 

Static Public Member Functions

static std::string ssrcToName (uint32 ssrc)
 This method returns the given 32 bit ssrc identifier as an 8 character hexadecimal number which is used as name of an RTPParticipantInfo object. More...
 

Protected Attributes

SDESChunk _sdesChunk
 Used for storing sdes information about this RTP endsystem. More...
 
int _silentIntervals
 Stores the number of rtcp intervals (including the current one) during which this RTP endsystem hasn't sent any RTP data packets. More...
 
- Protected Attributes inherited from inet::rtp::RTPParticipantInfo_Base
IPv4Address address
 
int RTPPort
 
int RTCPPort
 

Private Member Functions

void copy (const RTPParticipantInfo &other)
 

Additional Inherited Members

- Protected Member Functions inherited from inet::rtp::RTPParticipantInfo_Base
bool operator== (const RTPParticipantInfo_Base &)
 
 RTPParticipantInfo_Base (const char *name=nullptr)
 
 RTPParticipantInfo_Base (const RTPParticipantInfo_Base &other)
 
RTPParticipantInfo_Baseoperator= (const RTPParticipantInfo_Base &other)
 

Detailed Description

This class is a super class for classes intended for storing information about RTP end systems.

It has two subclasses: RTPReceiverInformation which is used for storing information about other system participating in an RTP session. RTPSenderInformation is used by an RTP endsystem for storing information about itself.

See also
RTPReceiverInformation
RTPSenderInformation

Constructor & Destructor Documentation

inet::rtp::RTPParticipantInfo::RTPParticipantInfo ( uint32  ssrc = 0)

Default constructor.

Referenced by dup().

29  :
31  _sdesChunk("SDESChunk", ssrc)
32 {
33  setName(ssrcToName(ssrc).c_str());
34  // because there haven't been sent any RTP packets
35  // by this endsystem at all, the number of silent
36  // intervals would be undefined; to calculate with
37  // it but not to regard this endsystem as a sender
38  // it is set to 3; see isSender() for details
39  _silentIntervals = 3;
40 }
SDESChunk _sdesChunk
Used for storing sdes information about this RTP endsystem.
Definition: RTPParticipantInfo.h:188
static std::string ssrcToName(uint32 ssrc)
This method returns the given 32 bit ssrc identifier as an 8 character hexadecimal number which is us...
Definition: RTPParticipantInfo.cc:148
int _silentIntervals
Stores the number of rtcp intervals (including the current one) during which this RTP endsystem hasn&#39;...
Definition: RTPParticipantInfo.h:195
RTPParticipantInfo_Base(const char *name=nullptr)
inet::rtp::RTPParticipantInfo::RTPParticipantInfo ( const RTPParticipantInfo participantInfo)

Copy constructor.

43 {
44  copy(other);
45 }
void copy(const RTPParticipantInfo &other)
Definition: RTPParticipantInfo.cc:60
RTPParticipantInfo_Base(const char *name=nullptr)
inet::rtp::RTPParticipantInfo::~RTPParticipantInfo ( )
virtual

Destructor.

48 {
49 }

Member Function Documentation

void inet::rtp::RTPParticipantInfo::addSDESItem ( SDESItem sdesItem)
virtual

Adds this sdes item to the sdes chunk of this participant.

Referenced by inet::rtp::RTCP::handleInitializeRTCP(), and processSDESChunk().

104 {
105  _sdesChunk.addSDESItem(sdesItem);
106 }
SDESChunk _sdesChunk
Used for storing sdes information about this RTP endsystem.
Definition: RTPParticipantInfo.h:188
virtual void addSDESItem(SDESItem *item)
Adds an SDESItem to this SDESChunk.
Definition: sdes.cc:170
void inet::rtp::RTPParticipantInfo::addSDESItem ( SDESItem::SDES_ITEM_TYPE  type,
const char *  content 
)
virtual

Creates a new SDESItem and adds it to the SDESChunk stored in this RTPParticipantInfo.

144 {
145  _sdesChunk.addSDESItem(new SDESItem(type, content));
146 }
SDESChunk _sdesChunk
Used for storing sdes information about this RTP endsystem.
Definition: RTPParticipantInfo.h:188
virtual void addSDESItem(SDESItem *item)
Adds an SDESItem to this SDESChunk.
Definition: sdes.cc:170
void inet::rtp::RTPParticipantInfo::copy ( const RTPParticipantInfo other)
inlineprivate

Referenced by operator=(), and RTPParticipantInfo().

61 {
62  _sdesChunk = other._sdesChunk;
63  _silentIntervals = other._silentIntervals;
64 }
SDESChunk _sdesChunk
Used for storing sdes information about this RTP endsystem.
Definition: RTPParticipantInfo.h:188
int _silentIntervals
Stores the number of rtcp intervals (including the current one) during which this RTP endsystem hasn&#39;...
Definition: RTPParticipantInfo.h:195
RTPParticipantInfo * inet::rtp::RTPParticipantInfo::dup ( ) const
overridevirtual

Duplicates this RTPParticipantInfo by calling the copy constructor.

Reimplemented from inet::rtp::RTPParticipantInfo_Base.

Reimplemented in inet::rtp::RTPReceiverInfo, and inet::rtp::RTPSenderInfo.

67 {
68  return new RTPParticipantInfo(*this);
69 }
RTPParticipantInfo(uint32 ssrc=0)
Default constructor.
Definition: RTPParticipantInfo.cc:29
SDESChunk * inet::rtp::RTPParticipantInfo::getSDESChunk ( ) const
virtual

Returns a copy of the sdes chunk used for storing source description items about this system.

Referenced by inet::rtp::RTCP::createPacket().

99 {
100  return new SDESChunk(_sdesChunk);
101 }
SDESChunk _sdesChunk
Used for storing sdes information about this RTP endsystem.
Definition: RTPParticipantInfo.h:188
uint32 inet::rtp::RTPParticipantInfo::getSsrc ( ) const
overridevirtual

Returns the ssrc identifier of the RTP endsystem.

Implements inet::rtp::RTPParticipantInfo_Base.

Referenced by inet::rtp::RTCP::createPacket(), inet::rtp::RTCP::handleSelfMessage(), inet::rtp::RTCP::processIncomingRTCPReceiverReportPacket(), inet::rtp::RTCP::processIncomingRTCPSenderReportPacket(), and inet::rtp::RTPReceiverInfo::receptionReport().

134 {
135  return _sdesChunk.getSsrc();
136 }
SDESChunk _sdesChunk
Used for storing sdes information about this RTP endsystem.
Definition: RTPParticipantInfo.h:188
virtual uint32 getSsrc() const
Returns the ssrc identifier this SDESChunk is for.
Definition: sdes.cc:188
bool inet::rtp::RTPParticipantInfo::isSender ( ) const
virtual

Returns true if this endsystem has sent at least one RTP data packet during the last two rtcp intervals (including the current one).

Referenced by inet::rtp::RTCP::createPacket(), inet::rtp::RTPReceiverInfo::receptionReport(), inet::rtp::RTCP::scheduleInterval(), and inet::rtp::RTPSenderInfo::senderReport().

109 {
110  return _silentIntervals <= 1;
111 }
int _silentIntervals
Stores the number of rtcp intervals (including the current one) during which this RTP endsystem hasn&#39;...
Definition: RTPParticipantInfo.h:195
void inet::rtp::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 getSenderReport() and createReceptionReport() before calling this method.

See also
getSenderReport()
createReceptionReport()

Reimplemented in inet::rtp::RTPReceiverInfo.

Referenced by inet::rtp::RTCP::createPacket(), and inet::rtp::RTPReceiverInfo::nextInterval().

124 {
126 }
int _silentIntervals
Stores the number of rtcp intervals (including the current one) during which this RTP endsystem hasn&#39;...
Definition: RTPParticipantInfo.h:195
RTPParticipantInfo & inet::rtp::RTPParticipantInfo::operator= ( const RTPParticipantInfo participantInfo)

Assignment operator.

Referenced by inet::rtp::RTPSenderInfo::copy(), inet::rtp::RTPSenderInfo::operator=(), and inet::rtp::RTPReceiverInfo::operator=().

52 {
53  if (this == &other)
54  return *this;
56  copy(other);
57  return *this;
58 }
void copy(const RTPParticipantInfo &other)
Definition: RTPParticipantInfo.cc:60
RTPParticipantInfo_Base & operator=(const RTPParticipantInfo_Base &other)
virtual void inet::rtp::RTPParticipantInfo::parsimPack ( cCommBuffer *  b) const
inlineoverridevirtual
170 { throw cRuntimeError(this, "parsimPack() not implemented"); }
virtual void inet::rtp::RTPParticipantInfo::parsimUnpack ( cCommBuffer *  b)
inlineoverridevirtual
171 { throw cRuntimeError("The parsimUnpack() not implemented."); }
void inet::rtp::RTPParticipantInfo::processReceptionReport ( ReceptionReport report,
simtime_t  arrivalTime 
)
virtual

This method extracts information of the given ReceptionReport.

83 {
84  // useful code can be found in subclasses
85 }
void inet::rtp::RTPParticipantInfo::processRTPPacket ( RTPPacket packet,
int  id,
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 inet::rtp::RTPReceiverInfo, and inet::rtp::RTPSenderInfo.

Referenced by inet::rtp::RTCP::processIncomingRTPPacket(), inet::rtp::RTPSenderInfo::processRTPPacket(), and inet::rtp::RTPReceiverInfo::processRTPPacket().

72 {
73  _silentIntervals = 0;
74  delete packet;
75 }
int _silentIntervals
Stores the number of rtcp intervals (including the current one) during which this RTP endsystem hasn&#39;...
Definition: RTPParticipantInfo.h:195
void inet::rtp::RTPParticipantInfo::processSDESChunk ( SDESChunk sdesChunk,
simtime_t  arrivalTime 
)
virtual

This method extracts sdes information of the given sdes chunk.and stores it.

Reimplemented in inet::rtp::RTPReceiverInfo.

Referenced by inet::rtp::RTCP::processIncomingRTCPSDESPacket(), and inet::rtp::RTPReceiverInfo::processSDESChunk().

88 {
89  for (int i = 0; i < sdesChunk->size(); i++) {
90  if (sdesChunk->exist(i)) {
91  SDESItem *sdesItem = (SDESItem *)(sdesChunk->remove(i));
92  addSDESItem(sdesItem);
93  }
94  }
95  delete sdesChunk;
96 }
virtual void addSDESItem(SDESItem *sdesItem)
Adds this sdes item to the sdes chunk of this participant.
Definition: RTPParticipantInfo.cc:103
void inet::rtp::RTPParticipantInfo::processSenderReport ( SenderReport report,
simtime_t  arrivalTime 
)
virtual

This method extracts information about an RTP endsystem as provided by the given SenderReport.

Referenced by inet::rtp::RTCP::processIncomingRTCPSenderReportPacket().

78 {
79  // useful code can be found in subclasses
80 }
ReceptionReport * inet::rtp::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 nullptr otherwise.

Reimplemented in inet::rtp::RTPReceiverInfo.

114 {
115  return nullptr;
116 }
SenderReport * inet::rtp::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 nullptr otherwise. The implementation for this class always returns nullptr.

Reimplemented in inet::rtp::RTPSenderInfo.

119 {
120  return nullptr;
121 }
void inet::rtp::RTPParticipantInfo::setSsrc ( uint32  ssrc)
overridevirtual

Sets the ssrc identifier.

Implements inet::rtp::RTPParticipantInfo_Base.

Referenced by inet::rtp::RTCP::chooseSSRC().

139 {
140  _sdesChunk.setSsrc(ssrc);
141 }
SDESChunk _sdesChunk
Used for storing sdes information about this RTP endsystem.
Definition: RTPParticipantInfo.h:188
virtual void setSsrc(uint32 ssrc)
Sets the ssrc identifier this SDESChunk is for.
Definition: sdes.cc:193
std::string inet::rtp::RTPParticipantInfo::ssrcToName ( uint32  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.

Referenced by inet::rtp::RTCP::findParticipantInfo(), and RTPParticipantInfo().

149 {
150  char name[9];
151  sprintf(name, "%08x", ssrc);
152  return name;
153 }
bool inet::rtp::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 inet::rtp::RTPReceiverInfo.

Referenced by inet::rtp::RTCP::createPacket().

129 {
130  return false;
131 }

Member Data Documentation

SDESChunk inet::rtp::RTPParticipantInfo::_sdesChunk
protected

Used for storing sdes information about this RTP endsystem.

The ssrc identifier is also stored here.

Referenced by addSDESItem(), copy(), getSDESChunk(), getSsrc(), and setSsrc().

int inet::rtp::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.

Referenced by copy(), isSender(), nextInterval(), processRTPPacket(), and RTPParticipantInfo().


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