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_t 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 (Packet *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 (const SenderReport &report, simtime_t arrivalTime)
 This method extracts information about an RTP endsystem as provided by the given SenderReport. More...
 
virtual void processReceptionReport (const ReceptionReport &report, simtime_t arrivalTime)
 This method extracts information of the given ReceptionReport. More...
 
virtual void processSDESChunk (const 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_t getSsrc () const override
 Returns the ssrc identifier of the RTP endsystem. More...
 
virtual void setSsrc (uint32_t ssrc) override
 Sets the ssrc identifier. More...
 
virtual void addSDESItem (SdesItem::SdesItemType 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 const ::inet::Ipv4AddressgetAddress () const
 
virtual ::inet::Ipv4AddressgetAddressForUpdate ()
 
virtual void setAddress (const ::inet::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_t 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
::inet::Ipv4Address address = Ipv4Address::UNSPECIFIED_ADDRESS
 
int RTPPort = PORT_UNDEF
 
int RTCPPort = PORT_UNDEF
 

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 &)=delete
 
 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

◆ RtpParticipantInfo() [1/2]

inet::rtp::RtpParticipantInfo::RtpParticipantInfo ( uint32_t  ssrc = 0)

Default constructor.

18  :
20  _sdesChunk("SdesChunk", ssrc)
21 {
22  setName(ssrcToName(ssrc).c_str());
23  // because there haven't been sent any RTP packets
24  // by this endsystem at all, the number of silent
25  // intervals would be undefined; to calculate with
26  // it but not to regard this endsystem as a sender
27  // it is set to 3; see isSender() for details
28  _silentIntervals = 3;
29 }

Referenced by dup().

◆ RtpParticipantInfo() [2/2]

inet::rtp::RtpParticipantInfo::RtpParticipantInfo ( const RtpParticipantInfo participantInfo)

Copy constructor.

32 {
33  copy(other);
34 }

◆ ~RtpParticipantInfo()

inet::rtp::RtpParticipantInfo::~RtpParticipantInfo ( )
virtual

Destructor.

37 {
38 }

Member Function Documentation

◆ addSDESItem() [1/2]

void inet::rtp::RtpParticipantInfo::addSDESItem ( SdesItem sdesItem)
virtual

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

93 {
94  _sdesChunk.addSDESItem(sdesItem);
95 }

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

◆ addSDESItem() [2/2]

void inet::rtp::RtpParticipantInfo::addSDESItem ( SdesItem::SdesItemType  type,
const char *  content 
)
virtual

Creates a new SdesItem and adds it to the SdesChunk stored in this RtpParticipantInfo.

133 {
134  _sdesChunk.addSDESItem(new SdesItem(type, content));
135 }

◆ copy()

void inet::rtp::RtpParticipantInfo::copy ( const RtpParticipantInfo other)
inlineprivate
50 {
51  _sdesChunk = other._sdesChunk;
52  _silentIntervals = other._silentIntervals;
53 }

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

◆ dup()

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.

56 {
57  return new RtpParticipantInfo(*this);
58 }

◆ getSDESChunk()

SdesChunk * inet::rtp::RtpParticipantInfo::getSDESChunk ( ) const
virtual

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

88 {
89  return new SdesChunk(_sdesChunk);
90 }

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

◆ getSsrc()

uint32_t inet::rtp::RtpParticipantInfo::getSsrc ( ) const
overridevirtual

◆ isSender()

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).

98 {
99  return _silentIntervals <= 1;
100 }

Referenced by inet::rtp::Rtcp::createPacket(), inet::rtp::RtpReceiverInfo::receptionReport(), inet::rtp::Rtcp::scheduleInterval(), and inet::rtp::RtpSenderInfo::senderReport().

◆ nextInterval()

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.

113 {
115 }

Referenced by inet::rtp::Rtcp::createPacket(), and inet::rtp::RtpReceiverInfo::nextInterval().

◆ operator=()

RtpParticipantInfo & inet::rtp::RtpParticipantInfo::operator= ( const RtpParticipantInfo participantInfo)

Assignment operator.

41 {
42  if (this == &other)
43  return *this;
45  copy(other);
46  return *this;
47 }

Referenced by inet::rtp::RtpSenderInfo::copy(), inet::rtp::RtpSenderInfo::operator=(), and inet::rtp::RtpReceiverInfo::operator=().

◆ parsimPack()

virtual void inet::rtp::RtpParticipantInfo::parsimPack ( cCommBuffer *  b) const
inlineoverridevirtual
157 { throw cRuntimeError(this, "parsimPack() not implemented"); }

◆ parsimUnpack()

virtual void inet::rtp::RtpParticipantInfo::parsimUnpack ( cCommBuffer *  b)
inlineoverridevirtual
158 { throw cRuntimeError("The parsimUnpack() not implemented."); }

◆ processReceptionReport()

void inet::rtp::RtpParticipantInfo::processReceptionReport ( const ReceptionReport report,
simtime_t  arrivalTime 
)
virtual

This method extracts information of the given ReceptionReport.

73 {
74  // useful code can be found in subclasses
75 }

◆ processRTPPacket()

void inet::rtp::RtpParticipantInfo::processRTPPacket ( Packet 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.

61 {
62  packet->peekAtFront<RtpHeader>();
63  _silentIntervals = 0;
64  delete packet;
65 }

Referenced by inet::rtp::Rtcp::processIncomingRTPPacket(), inet::rtp::RtpSenderInfo::processRTPPacket(), and inet::rtp::RtpReceiverInfo::processRTPPacket().

◆ processSDESChunk()

void inet::rtp::RtpParticipantInfo::processSDESChunk ( const SdesChunk sdesChunk,
simtime_t  arrivalTime 
)
virtual

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

Reimplemented in inet::rtp::RtpReceiverInfo.

78 {
79  for (int i = 0; i < sdesChunk->size(); i++) {
80  if (sdesChunk->exist(i)) {
81  const SdesItem *sdesItem = check_and_cast<const SdesItem *>(sdesChunk->get(i));
82  addSDESItem(sdesItem->dup());
83  }
84  }
85 }

Referenced by inet::rtp::Rtcp::processIncomingRTCPSDESPacket(), and inet::rtp::RtpReceiverInfo::processSDESChunk().

◆ processSenderReport()

void inet::rtp::RtpParticipantInfo::processSenderReport ( const SenderReport report,
simtime_t  arrivalTime 
)
virtual

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

68 {
69  // useful code can be found in subclasses
70 }

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

◆ receptionReport()

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.

103 {
104  return nullptr;
105 }

◆ senderReport()

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.

108 {
109  return nullptr;
110 }

◆ setSsrc()

void inet::rtp::RtpParticipantInfo::setSsrc ( uint32_t  ssrc)
overridevirtual

Sets the ssrc identifier.

Implements inet::rtp::RtpParticipantInfo_Base.

128 {
129  _sdesChunk.setSsrc(ssrc);
130 }

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

◆ ssrcToName()

std::string inet::rtp::RtpParticipantInfo::ssrcToName ( uint32_t  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.

138 {
139  char name[9];
140  sprintf(name, "%08x", ssrc);
141  return name;
142 }

Referenced by inet::rtp::Rtcp::findParticipantInfo(), and RtpParticipantInfo().

◆ toBeDeleted()

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.

118 {
119  return false;
120 }

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

Member Data Documentation

◆ _sdesChunk

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().

◆ _silentIntervals

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:
inet::rtp::RtpParticipantInfo::_sdesChunk
SdesChunk _sdesChunk
Used for storing sdes information about this RTP endsystem.
Definition: RtpParticipantInfo.h:175
inet::rtp::SdesChunk::setSsrc
virtual void setSsrc(uint32_t ssrc)
Sets the ssrc identifier this SdesChunk is for.
Definition: Sdes.cc:189
inet::rtp::RtpParticipantInfo::_silentIntervals
int _silentIntervals
Stores the number of rtcp intervals (including the current one) during which this RTP endsystem hasn'...
Definition: RtpParticipantInfo.h:182
inet::rtp::SdesChunk::addSDESItem
virtual void addSDESItem(SdesItem *item)
Adds an SdesItem to this SdesChunk.
Definition: Sdes.cc:166
inet::rtp::SdesChunk::getSsrc
virtual uint32_t getSsrc() const
Returns the ssrc identifier this SdesChunk is for.
Definition: Sdes.cc:184
inet::rtp::RtpParticipantInfo::addSDESItem
virtual void addSDESItem(SdesItem *sdesItem)
Adds this sdes item to the sdes chunk of this participant.
Definition: RtpParticipantInfo.cc:92
type
removed type
Definition: IUdp-gates.txt:7
inet::rtp::RtpParticipantInfo::RtpParticipantInfo
RtpParticipantInfo(uint32_t ssrc=0)
Default constructor.
Definition: RtpParticipantInfo.cc:18
inet::rtp::RtpParticipantInfo_Base::RtpParticipantInfo_Base
RtpParticipantInfo_Base(const char *name=nullptr)
inet::rtp::RtpParticipantInfo::ssrcToName
static std::string ssrcToName(uint32_t ssrc)
This method returns the given 32 bit ssrc identifier as an 8 character hexadecimal number which is us...
Definition: RtpParticipantInfo.cc:137
inet::rtp::RtpParticipantInfo_Base::operator=
RtpParticipantInfo_Base & operator=(const RtpParticipantInfo_Base &other)
inet::rtp::RtpParticipantInfo::copy
void copy(const RtpParticipantInfo &other)
Definition: RtpParticipantInfo.cc:49