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

Holds the RIP configuration of the interfaces. More...

#include <RIPRouting.h>

Public Member Functions

 RIPInterfaceEntry (const InterfaceEntry *ie)
 
void configure (cXMLElement *config)
 Fills in the parameters of the interface from the matching <interface> element of the configuration. More...
 

Public Attributes

const InterfaceEntryie = nullptr
 
int metric = 0
 
RIPMode mode = NO_RIP
 

Detailed Description

Holds the RIP configuration of the interfaces.

We could store this data in the InterfaceEntry* itself, but it contains only 5 holes for protocol data, and they are used by network layer protocols only. Therefore RIPRouting manages its own table of these entries.

Constructor & Destructor Documentation

inet::RIPInterfaceEntry::RIPInterfaceEntry ( const InterfaceEntry ie)
103  : ie(ie), metric(1), mode(NO_RIP)
104 {
105  ASSERT(!ie->isLoopback());
106  ASSERT(ie->isMulticast());
107 }
bool isLoopback() const
Definition: InterfaceEntry.h:195
Definition: RIPRouting.h:89
RIPMode mode
Definition: RIPRouting.h:106
int metric
Definition: RIPRouting.h:105
bool isMulticast() const
Definition: InterfaceEntry.h:193
const InterfaceEntry * ie
Definition: RIPRouting.h:104

Member Function Documentation

void inet::RIPInterfaceEntry::configure ( cXMLElement *  config)

Fills in the parameters of the interface from the matching <interface> element of the configuration.

Referenced by inet::RIPRouting::addInterface().

114 {
115  const char *metricAttr = config->getAttribute("metric");
116 
117  if (metricAttr) {
118  int metric = atoi(metricAttr);
119  if (metric < 1 || metric >= RIP_INFINITE_METRIC)
120  throw cRuntimeError("RIP: invalid metric in <interface> element at %s: %s", config->getSourceLocation(), metricAttr);
121  this->metric = metric;
122  }
123 
124  const char *ripModeAttr = config->getAttribute("mode");
125  RIPMode mode = !ripModeAttr ? SPLIT_HORIZON_POISONED_REVERSE :
126  strcmp(ripModeAttr, "NoRIP") == 0 ? NO_RIP :
127  strcmp(ripModeAttr, "NoSplitHorizon") == 0 ? NO_SPLIT_HORIZON :
128  strcmp(ripModeAttr, "SplitHorizon") == 0 ? SPLIT_HORIZON :
129  strcmp(ripModeAttr, "SplitHorizonPoisonedReverse") == 0 ? SPLIT_HORIZON_POISONED_REVERSE :
130  static_cast<RIPMode>(-1);
131  if (mode == static_cast<RIPMode>(-1))
132  throw cRuntimeError("RIP: invalid split-horizon-mode attribute in <interface> element at %s: %s",
133  config->getSourceLocation(), ripModeAttr);
134  this->mode = mode;
135 }
#define RIP_INFINITE_METRIC
Definition: RIPRouting.h:31
Definition: RIPRouting.h:92
Definition: RIPRouting.h:89
RIPMode mode
Definition: RIPRouting.h:106
int metric
Definition: RIPRouting.h:105
Definition: RIPRouting.h:91
RIPMode
Enumerated parameter to control how the RIPRouting module advertises the routes to its neighbors...
Definition: RIPRouting.h:88
Definition: RIPRouting.h:90

Member Data Documentation


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