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 info () const
 
std::string detailedInfo () const
 

Public Attributes

McastSourceFilterMode filterMode
 
IPv4AddressVector sources
 

Static Public Attributes

static const IPv4MulticastSourceList ALL_SOURCES
 

Member Typedef Documentation

Constructor & Destructor Documentation

inet::IPv4MulticastSourceList::IPv4MulticastSourceList ( )
inline
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
Definition: InterfaceEntry.h:44
inet::IPv4MulticastSourceList::IPv4MulticastSourceList ( McastSourceFilterMode  filterMode,
const IPv4AddressVector sources 
)
inline
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38

Member Function Documentation

bool inet::IPv4MulticastSourceList::add ( IPv4Address  source)

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

41 {
42  size_t oldSize = sources.size();
44  auto it = std::lower_bound(sources.begin(), sources.end(), source);
45  if (it == sources.end() || *it != source)
46  sources.insert(it, source);
47  }
48  else {
49  sources.erase(std::remove(sources.begin(), sources.end(), source), sources.end());
50  }
51  return sources.size() != oldSize;
52 }
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
void remove(std::vector< T > &v, const A &a)
Definition: stlutils.h:91
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
Definition: InterfaceEntry.h:44
bool inet::IPv4MulticastSourceList::contains ( IPv4Address  source)

Referenced by inet::IPv4InterfaceData::addMulticastListener(), and inet::IPv4InterfaceData::hasMulticastListener().

35 {
36  return (filterMode == MCAST_INCLUDE_SOURCES && find(sources.begin(), sources.end(), source) != sources.end()) ||
37  (filterMode == MCAST_EXCLUDE_SOURCES && find(sources.begin(), sources.end(), source) == sources.end());
38 }
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
Definition: InterfaceEntry.h:44
Definition: InterfaceEntry.h:44
std::vector< T >::iterator find(std::vector< T > &v, const T &a)
Definition: stlutils.h:48
bool inet::IPv4MulticastSourceList::containsAll ( ) const
inline

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

50 { return filterMode == MCAST_EXCLUDE_SOURCES && sources.empty(); }
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
Definition: InterfaceEntry.h:44
std::string inet::IPv4MulticastSourceList::detailedInfo ( ) const
78 {
79  std::stringstream out;
80  out << (filterMode == MCAST_INCLUDE_SOURCES ? "INCLUDE(" : "EXCLUDE(");
81  for (int i = 0; i < (int)sources.size(); ++i)
82  out << (i > 0 ? ", " : "") << sources[i];
83  out << ")";
84  return out.str();
85 }
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
Definition: InterfaceEntry.h:44
std::string inet::IPv4MulticastSourceList::info ( ) const

Referenced by inet::IPv4InterfaceData::addMulticastListener(), inet::IPv4InterfaceData::changeMulticastGroupMembership(), and inet::IPv4InterfaceData::removeMulticastListener().

69 {
70  std::stringstream out;
71  out << (filterMode == MCAST_INCLUDE_SOURCES ? "I" : "E");
72  for (auto & elem : sources)
73  out << " " << elem;
74  return out.str();
75 }
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
Definition: InterfaceEntry.h:44
bool inet::IPv4MulticastSourceList::isEmpty ( ) const
inline

Referenced by inet::IPv4InterfaceData::changeMulticastGroupMembership(), and inet::IPv4InterfaceData::hasMulticastListener().

49 { return filterMode == MCAST_INCLUDE_SOURCES && sources.empty(); }
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
Definition: InterfaceEntry.h:44
bool inet::IPv4MulticastSourceList::operator!= ( const IPv4MulticastSourceList other)
inline
48 { return filterMode != other.filterMode || sources != other.sources; }
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
bool inet::IPv4MulticastSourceList::operator== ( const IPv4MulticastSourceList other)
inline
47 { return filterMode == other.filterMode && sources == other.sources; }
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
bool inet::IPv4MulticastSourceList::remove ( IPv4Address  source)
55 {
56  size_t oldSize = sources.size();
58  sources.erase(std::remove(sources.begin(), sources.end(), source), sources.end());
59  }
60  else {
61  auto it = lower_bound(sources.begin(), sources.end(), source);
62  if (it == sources.end() || *it != source)
63  sources.insert(it, source);
64  }
65  return sources.size() != oldSize;
66 }
IPv4AddressVector sources
Definition: IPv4InterfaceData.h:39
void remove(std::vector< T > &v, const A &a)
Definition: stlutils.h:91
McastSourceFilterMode filterMode
Definition: IPv4InterfaceData.h:38
Definition: InterfaceEntry.h:44

Member Data Documentation

const IPv4MulticastSourceList inet::IPv4MulticastSourceList::ALL_SOURCES
static

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