INET Framework for OMNeT++/OMNEST
inet::Ipv4MulticastSourceList Struct Reference

#include <Ipv4InterfaceData.h>

Public Types

typedef std::vector< Ipv4AddressIpv4AddressVector
 

Public Member Functions

 Ipv4MulticastSourceList ()
 
 Ipv4MulticastSourceList (McastSourceFilterMode filterMode, const Ipv4AddressVector &sources)
 
bool operator== (const Ipv4MulticastSourceList &other)
 
bool operator!= (const Ipv4MulticastSourceList &other)
 
bool isEmpty () const
 
bool containsAll () const
 
bool contains (Ipv4Address source)
 
bool add (Ipv4Address source)
 
bool remove (Ipv4Address source)
 
std::string str () const
 
std::string detailedInfo () const
 

Public Attributes

McastSourceFilterMode filterMode
 
Ipv4AddressVector sources
 

Static Public Attributes

static const Ipv4MulticastSourceList ALL_SOURCES
 

Member Typedef Documentation

◆ Ipv4AddressVector

Constructor & Destructor Documentation

◆ Ipv4MulticastSourceList() [1/2]

inet::Ipv4MulticastSourceList::Ipv4MulticastSourceList ( )
inline

◆ Ipv4MulticastSourceList() [2/2]

inet::Ipv4MulticastSourceList::Ipv4MulticastSourceList ( McastSourceFilterMode  filterMode,
const Ipv4AddressVector sources 
)
inline

Member Function Documentation

◆ add()

bool inet::Ipv4MulticastSourceList::add ( Ipv4Address  source)
30 {
31  size_t oldSize = sources.size();
33  auto it = std::lower_bound(sources.begin(), sources.end(), source);
34  if (it == sources.end() || *it != source)
35  sources.insert(it, source);
36  }
37  else {
38  sources.erase(std::remove(sources.begin(), sources.end(), source), sources.end());
39  }
40  return sources.size() != oldSize;
41 }

Referenced by inet::Ipv4InterfaceData::addMulticastListener().

◆ contains()

bool inet::Ipv4MulticastSourceList::contains ( Ipv4Address  source)

◆ containsAll()

bool inet::Ipv4MulticastSourceList::containsAll ( ) const
inline

◆ detailedInfo()

std::string inet::Ipv4MulticastSourceList::detailedInfo ( ) const
67 {
68  std::stringstream out;
69  out << (filterMode == MCAST_INCLUDE_SOURCES ? "INCLUDE(" : "EXCLUDE(");
70  for (size_t i = 0; i < sources.size(); ++i)
71  out << (i > 0 ? ", " : "") << sources[i];
72  out << ")";
73  return out.str();
74 }

◆ isEmpty()

bool inet::Ipv4MulticastSourceList::isEmpty ( ) const
inline

◆ operator!=()

bool inet::Ipv4MulticastSourceList::operator!= ( const Ipv4MulticastSourceList other)
inline
31 { return filterMode != other.filterMode || sources != other.sources; }

◆ operator==()

bool inet::Ipv4MulticastSourceList::operator== ( const Ipv4MulticastSourceList other)
inline
30 { return filterMode == other.filterMode && sources == other.sources; }

◆ remove()

bool inet::Ipv4MulticastSourceList::remove ( Ipv4Address  source)
44 {
45  size_t oldSize = sources.size();
47  sources.erase(std::remove(sources.begin(), sources.end(), source), sources.end());
48  }
49  else {
50  auto it = lower_bound(sources.begin(), sources.end(), source);
51  if (it == sources.end() || *it != source)
52  sources.insert(it, source);
53  }
54  return sources.size() != oldSize;
55 }

◆ str()

std::string inet::Ipv4MulticastSourceList::str ( ) const
58 {
59  std::stringstream out;
60  out << (filterMode == MCAST_INCLUDE_SOURCES ? "I" : "E");
61  for (auto& elem : sources)
62  out << " " << elem;
63  return out.str();
64 }

Member Data Documentation

◆ ALL_SOURCES

const Ipv4MulticastSourceList inet::Ipv4MulticastSourceList::ALL_SOURCES
static

◆ filterMode

◆ sources


The documentation for this struct was generated from the following files:
inet::Ipv4MulticastSourceList::filterMode
McastSourceFilterMode filterMode
Definition: Ipv4InterfaceData.h:21
inet::remove
void remove(std::vector< T > &v, const Tk &a)
Definition: stlutils.h:107
inet::contains
bool contains(const std::vector< T > &v, const Tk &a)
Definition: stlutils.h:65
inet::MCAST_EXCLUDE_SOURCES
@ MCAST_EXCLUDE_SOURCES
Definition: NetworkInterface.h:33
inet::Ipv4MulticastSourceList::sources
Ipv4AddressVector sources
Definition: Ipv4InterfaceData.h:22
inet::MCAST_INCLUDE_SOURCES
@ MCAST_INCLUDE_SOURCES
Definition: NetworkInterface.h:33