INET Framework for OMNeT++/OMNEST
inet::Igmpv3::RouterGroupData Struct Reference

#include <Igmpv3.h>

Public Member Functions

 RouterGroupData (RouterInterfaceData *parent, Ipv4Address group)
 
virtual ~RouterGroupData ()
 
bool hasSourceRecord (Ipv4Address source)
 
SourceRecordcreateSourceRecord (Ipv4Address source)
 
SourceRecordgetOrCreateSourceRecord (Ipv4Address source)
 
void deleteSourceRecord (Ipv4Address source)
 
std::string getStateInfo () const
 
void collectForwardedSources (Ipv4MulticastSourceList &result) const
 

Public Attributes

RouterInterfaceDataparent
 
Ipv4Address groupAddr
 
FilterMode filter
 
RouterGroupState state
 
cMessage * timer
 
SourceToSourceRecordMap sources
 

Private Member Functions

void printSourceList (std::ostream &out, bool withRunningTimer) const
 

Constructor & Destructor Documentation

◆ RouterGroupData()

inet::Igmpv3::RouterGroupData::RouterGroupData ( RouterInterfaceData parent,
Ipv4Address  group 
)
1130 {
1131  ASSERT(parent);
1132  ASSERT(groupAddr.isMulticast());
1133 
1134  timer = new cMessage("Igmpv3 router group timer", IGMPV3_R_GROUP_TIMER);
1135  timer->setContextPointer(this);
1136 }

◆ ~RouterGroupData()

inet::Igmpv3::RouterGroupData::~RouterGroupData ( )
virtual
1139 {
1140  parent->owner->cancelAndDelete(timer);
1141 }

Member Function Documentation

◆ collectForwardedSources()

void inet::Igmpv3::RouterGroupData::collectForwardedSources ( Ipv4MulticastSourceList result) const
1206 {
1207  switch (filter) {
1208  case IGMPV3_FM_INCLUDE:
1209  result.filterMode = MCAST_INCLUDE_SOURCES;
1210  result.sources.clear();
1211  for (const auto& elem : sources) {
1212  if (elem.second->sourceTimer && elem.second->sourceTimer->isScheduled())
1213  result.sources.push_back(elem.first);
1214  }
1215  break;
1216 
1217  case IGMPV3_FM_EXCLUDE:
1218  result.filterMode = MCAST_EXCLUDE_SOURCES;
1219  result.sources.clear();
1220  for (const auto& elem : sources) {
1221  if (!elem.second->sourceTimer || !elem.second->sourceTimer->isScheduled())
1222  result.sources.push_back(elem.first);
1223  }
1224  break;
1225  }
1226 }

Referenced by inet::Igmpv3::processReport().

◆ createSourceRecord()

Igmpv3::SourceRecord * inet::Igmpv3::RouterGroupData::createSourceRecord ( Ipv4Address  source)
1144 {
1145  ASSERT(!containsKey(sources, source));
1146  SourceRecord *record = new SourceRecord(this, source);
1147  sources[source] = record;
1148  return record;
1149 }

Referenced by inet::Igmpv3::processReport().

◆ deleteSourceRecord()

void inet::Igmpv3::RouterGroupData::deleteSourceRecord ( Ipv4Address  source)
1160 {
1161  auto it = sources.find(source);
1162  if (it != sources.end()) {
1163  SourceRecord *record = it->second;
1164  sources.erase(it);
1165  delete record;
1166  }
1167 }

Referenced by inet::Igmpv3::processReport(), inet::Igmpv3::processRouterGroupTimer(), and inet::Igmpv3::processRouterSourceTimer().

◆ getOrCreateSourceRecord()

Igmpv3::SourceRecord * inet::Igmpv3::RouterGroupData::getOrCreateSourceRecord ( Ipv4Address  source)
1152 {
1153  auto it = sources.find(source);
1154  if (it != sources.end())
1155  return it->second;
1156  return createSourceRecord(source);
1157 }

Referenced by inet::Igmpv3::processReport().

◆ getStateInfo()

string inet::Igmpv3::RouterGroupData::getStateInfo ( ) const
1170 {
1171  ostringstream out;
1172  switch (filter) {
1173  case IGMPV3_FM_INCLUDE:
1174  out << "INCLUDE(";
1175  printSourceList(out, true);
1176  out << ")";
1177  break;
1178 
1179  case IGMPV3_FM_EXCLUDE:
1180  out << "EXCLUDE(";
1181  printSourceList(out, true);
1182  out << ";";
1183  printSourceList(out, false);
1184  out << ")";
1185  break;
1186  }
1187  return out.str();
1188 }

Referenced by inet::Igmpv3::processReport(), and inet::Igmpv3::processRouterGroupTimer().

◆ hasSourceRecord()

bool inet::Igmpv3::RouterGroupData::hasSourceRecord ( Ipv4Address  source)
inline
148 { return containsKey(sources, source); }

Referenced by inet::Igmpv3::processReport().

◆ printSourceList()

void inet::Igmpv3::RouterGroupData::printSourceList ( std::ostream &  out,
bool  withRunningTimer 
) const
private
1191 {
1192  bool first = true;
1193  for (const auto& elem : sources) {
1194  bool timerIsRunning = elem.second->sourceTimer && elem.second->sourceTimer->isScheduled();
1195  if (withRunningTimer == timerIsRunning) {
1196  if (!first)
1197  out << ",";
1198  first = false;
1199  out << elem.first;
1200  }
1201  }
1202 }

Member Data Documentation

◆ filter

◆ groupAddr

◆ parent

◆ sources

◆ state

RouterGroupState inet::Igmpv3::RouterGroupData::state

◆ timer


The documentation for this struct was generated from the following files:
inet::Igmpv3::RouterGroupData::sources
SourceToSourceRecordMap sources
Definition: Igmpv3.h:143
inet::Igmpv3::RouterGroupData::groupAddr
Ipv4Address groupAddr
Definition: Igmpv3.h:139
inet::Ipv4Address::isMulticast
bool isMulticast() const
Returns true if this address is in the multicast address range, 224.0.0.0 thru 239....
Definition: Ipv4Address.h:215
inet::Igmpv3::IGMPV3_RGS_NO_MEMBERS_PRESENT
@ IGMPV3_RGS_NO_MEMBERS_PRESENT
Definition: Igmpv3.h:42
inet::Igmpv3::RouterGroupData::timer
cMessage * timer
Definition: Igmpv3.h:142
inet::Igmpv3::RouterGroupData::filter
FilterMode filter
Definition: Igmpv3.h:140
inet::Igmpv3::RouterGroupData::createSourceRecord
SourceRecord * createSourceRecord(Ipv4Address source)
Definition: Igmpv3.cc:1143
inet::Igmpv3::IGMPV3_FM_INCLUDE
@ IGMPV3_FM_INCLUDE
Definition: Igmpv3.h:54
inet::Igmpv3::RouterInterfaceData::owner
Igmpv3 * owner
Definition: Igmpv3.h:162
inet::Igmpv3::IGMPV3_R_GROUP_TIMER
@ IGMPV3_R_GROUP_TIMER
Definition: Igmpv3.h:69
inet::Igmpv3::RouterGroupData::state
RouterGroupState state
Definition: Igmpv3.h:141
inet::Igmpv3::RouterGroupData::parent
RouterInterfaceData * parent
Definition: Igmpv3.h:138
inet::Igmpv3::RouterGroupData::printSourceList
void printSourceList(std::ostream &out, bool withRunningTimer) const
Definition: Igmpv3.cc:1190
inet::MCAST_EXCLUDE_SOURCES
@ MCAST_EXCLUDE_SOURCES
Definition: NetworkInterface.h:33
inet::Igmpv3::IGMPV3_FM_EXCLUDE
@ IGMPV3_FM_EXCLUDE
Definition: Igmpv3.h:55
inet::MCAST_INCLUDE_SOURCES
@ MCAST_INCLUDE_SOURCES
Definition: NetworkInterface.h:33
inet::containsKey
bool containsKey(const std::map< K, V, _C > &m, const Tk &a)
Definition: stlutils.h:80