SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Classes | Public Member Functions | Private Attributes | List of all members
qrtplib::RTPCollisionList Class Reference

#include <rtpcollisionlist.h>

Classes

class  AddressAndTime
 

Public Member Functions

 RTPCollisionList ()
 
 ~RTPCollisionList ()
 
void Clear ()
 
int UpdateAddress (const RTPAddress *addr, const RTPTime &receivetime, bool *created)
 
bool HasAddress (const RTPAddress *addr) const
 
void Timeout (const RTPTime &currenttime, const RTPTime &timeoutdelay)
 

Private Attributes

std::list< AddressAndTimeaddresslist
 

Detailed Description

This class represents a list of addresses from which SSRC collisions were detected.

Definition at line 54 of file rtpcollisionlist.h.

Constructor & Destructor Documentation

◆ RTPCollisionList()

qrtplib::RTPCollisionList::RTPCollisionList ( )

Constructs an instance, optionally installing a memory manager.

Definition at line 39 of file rtpcollisionlist.cpp.

References qrtplib::RTPTimeInitializerObject::Dummy(), and qrtplib::timeinit.

40 {
41  timeinit.Dummy();
42 }
RTPTimeInitializerObject timeinit
+ Here is the call graph for this function:

◆ ~RTPCollisionList()

qrtplib::RTPCollisionList::~RTPCollisionList ( )
inline

Definition at line 59 of file rtpcollisionlist.h.

60  {
61  Clear();
62  }

Member Function Documentation

◆ Clear()

void qrtplib::RTPCollisionList::Clear ( )

Clears the list of addresses.

Definition at line 44 of file rtpcollisionlist.cpp.

References addresslist.

Referenced by qrtplib::RTPSession::BYEDestroy(), and qrtplib::RTPSession::Destroy().

45 {
46  std::list<AddressAndTime>::iterator it;
47 
48  for (it = addresslist.begin(); it != addresslist.end(); it++)
49  delete (*it).addr;
50  addresslist.clear();
51 }
std::list< AddressAndTime > addresslist
+ Here is the caller graph for this function:

◆ HasAddress()

bool qrtplib::RTPCollisionList::HasAddress ( const RTPAddress addr) const

Returns true} if the address addr appears in the list.

Definition at line 79 of file rtpcollisionlist.cpp.

References addresslist.

80 {
81  std::list<AddressAndTime>::const_iterator it;
82 
83  for (it = addresslist.begin(); it != addresslist.end(); it++)
84  {
85  if (((*it).addr)->IsSameAddress(addr))
86  return true;
87  }
88 
89  return false;
90 }
std::list< AddressAndTime > addresslist

◆ Timeout()

void qrtplib::RTPCollisionList::Timeout ( const RTPTime currenttime,
const RTPTime timeoutdelay 
)

Assuming that the current time is given by currenttime, this function times out entries which haven't been updated in the previous time interval specified by timeoutdelay.

Definition at line 92 of file rtpcollisionlist.cpp.

References addresslist.

Referenced by qrtplib::RTPSession::ProcessPolledData().

93 {
94  std::list<AddressAndTime>::iterator it;
95  RTPTime checktime = currenttime;
96  checktime -= timeoutdelay;
97 
98  it = addresslist.begin();
99  while (it != addresslist.end())
100  {
101  if ((*it).recvtime < checktime) // timeout
102  {
103  delete (*it).addr;
104  it = addresslist.erase(it);
105  }
106  else
107  it++;
108  }
109 }
std::list< AddressAndTime > addresslist
+ Here is the caller graph for this function:

◆ UpdateAddress()

int qrtplib::RTPCollisionList::UpdateAddress ( const RTPAddress addr,
const RTPTime receivetime,
bool *  created 
)

Updates the entry for address addr to indicate that a collision was detected at time receivetime. Updates the entry for address addr to indicate that a collision was detected at time receivetime. If the entry did not exist yet, the flag created is set to true, otherwise it is set to false.

Definition at line 53 of file rtpcollisionlist.cpp.

References addresslist, qrtplib::RTPAddress::CreateCopy(), ERR_RTP_COLLISIONLIST_BADADDRESS, and ERR_RTP_OUTOFMEM.

Referenced by qrtplib::RTPSession::ProcessPolledData().

54 {
55  if (addr == 0)
57 
58  std::list<AddressAndTime>::iterator it;
59 
60  for (it = addresslist.begin(); it != addresslist.end(); it++)
61  {
62  if (((*it).addr)->IsSameAddress(addr))
63  {
64  (*it).recvtime = receivetime;
65  *created = false;
66  return 0;
67  }
68  }
69 
70  RTPAddress *newaddr = addr->CreateCopy();
71  if (newaddr == 0)
72  return ERR_RTP_OUTOFMEM;
73 
74  addresslist.push_back(AddressAndTime(newaddr, receivetime));
75  *created = true;
76  return 0;
77 }
std::list< AddressAndTime > addresslist
#define ERR_RTP_COLLISIONLIST_BADADDRESS
Definition: rtperrors.h:55
#define ERR_RTP_OUTOFMEM
Definition: rtperrors.h:53
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ addresslist

std::list<AddressAndTime> qrtplib::RTPCollisionList::addresslist
private

Definition at line 94 of file rtpcollisionlist.h.

Referenced by Clear(), HasAddress(), Timeout(), and UpdateAddress().


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