|
INET Framework for OMNeT++/OMNEST
|
Implements the OSPFv2 routing protocol.
More...
#include <Ospfv2.h>
Implements the OSPFv2 routing protocol.
See the NED file for more information.
◆ Ospfv2()
| inet::ospfv2::Ospfv2::Ospfv2 |
( |
| ) |
|
◆ ~Ospfv2()
| inet::ospfv2::Ospfv2::~Ospfv2 |
( |
| ) |
|
|
virtual |
◆ checkExternalRoute()
| int inet::ospfv2::Ospfv2::checkExternalRoute |
( |
const Ipv4Address & |
route | ) |
|
Checks if the route is in OSPF external LSA Table.
0: not external, 1: type 1 external, 2: type 2 external Used by the Bgp module.
182 if (externalAddr == route) {
183 if (externalLSA->getContents().getExternalTOSInfo(0).E_ExternalMetricType)
Referenced by inet::bgp::BgpRouter::checkExternalRoute().
◆ createOspfRouter()
| void inet::ospfv2::Ospfv2::createOspfRouter |
( |
| ) |
|
|
protectedvirtual |
69 cXMLElement *ospfConfig = par(
"ospfConfig");
70 Ospfv2ConfigReader configReader(
this,
ift);
71 if (!configReader.loadConfigFromXML(ospfConfig,
ospfRouter))
72 throw cRuntimeError(
"Error reading AS configuration from %s", ospfConfig->getSourceLocation());
Referenced by handleMessageWhenUp(), and handleStartOperation().
◆ handleCrashOperation()
◆ handleInterfaceDown()
194 EV_DEBUG <<
"interface " << ie->getInterfaceId() <<
" went down. \n";
201 if (ospfRoute && ospfRoute->getInterface() == ie && ospfRoute->getNextHopAsGeneric().isUnspecified()) {
202 EV_DEBUG <<
"removing route from OSPF routing table: " << ospfRoute <<
"\n";
208 for (int32_t i = 0; i <
rt->getNumRoutes(); i++) {
209 Ipv4Route *route =
rt->getRoute(i);
210 if (route && route->getInterface() == ie && route->getNextHopAsGeneric().isUnspecified()) {
211 EV_DEBUG <<
"removing route from Ipv4 routing table: " << route <<
"\n";
212 rt->deleteRoute(route);
218 Ospfv2Interface *foundIntf =
nullptr;
222 for (
auto& ifIndex : area->getInterfaceIndices()) {
224 if (intf && intf->getIfIndex() == ie->getInterfaceId()) {
Referenced by receiveSignal().
◆ handleMessageWhenUp()
| void inet::ospfv2::Ospfv2::handleMessageWhenUp |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
◆ handleStartOperation()
◆ handleStopOperation()
◆ initialize()
| void inet::ospfv2::Ospfv2::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
◆ insertExternalRoute()
| void inet::ospfv2::Ospfv2::insertExternalRoute |
( |
int |
ifIndex, |
|
|
const Ipv4AddressRange & |
netAddr |
|
) |
| |
Insert a route learn by BGP in OSPF routingTable as an external route.
Used by the Bgp module. @ifIndex: interface ID
162 Ospfv2AsExternalLsaContents newExternalContents;
163 newExternalContents.setExternalTOSInfoArraySize(1);
164 const Ipv4Address netmask = netAddr.mask;
165 newExternalContents.setNetworkMask(netmask);
166 auto& tosInfo = newExternalContents.getExternalTOSInfoForUpdate(0);
167 tosInfo.E_ExternalMetricType =
false;
Referenced by inet::bgp::BgpRouter::decisionProcess().
◆ numInitStages()
| virtual int inet::ospfv2::Ospfv2::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ receiveSignal()
| void inet::ospfv2::Ospfv2::receiveSignal |
( |
cComponent * |
source, |
|
|
simsignal_t |
signalID, |
|
|
cObject * |
obj, |
|
|
cObject * |
details |
|
) |
| |
|
overrideprotectedvirtual |
Listen on interface changes and update private data structures.
98 const NetworkInterface *ie;
99 const NetworkInterfaceChangeDetails *change;
103 ie = check_and_cast<const NetworkInterface *>(obj);
104 if (ie->isMulticast() && !ie->isLoopback()) {
109 ie = check_and_cast<const NetworkInterface *>(obj);
113 change = check_and_cast<const NetworkInterfaceChangeDetails *>(obj);
114 auto fieldId = change->getFieldId();
116 ie = change->getNetworkInterface();
126 throw cRuntimeError(
"Unexpected signal: %s", getSignalName(signalID));
◆ subscribe()
| void inet::ospfv2::Ospfv2::subscribe |
( |
| ) |
|
|
protectedvirtual |
◆ unsubscribe()
| void inet::ospfv2::Ospfv2::unsubscribe |
( |
| ) |
|
|
protectedvirtual |
◆ host
| cModule* inet::ospfv2::Ospfv2::host = nullptr |
|
private |
◆ ift
◆ ospfRouter
| Router* inet::ospfv2::Ospfv2::ospfRouter = nullptr |
|
private |
◆ rt
◆ startupTimer
| cMessage* inet::ospfv2::Ospfv2::startupTimer = nullptr |
|
private |
The documentation for this class was generated from the following files:
#define OSPFv2_BGP_DEFAULT_COST
Definition: Ospfv2Common.h:54
Ospfv2Interface * getInterface(unsigned char ifIndex)
Definition: Ospfv2Area.cc:197
@ F_STATE
Definition: NetworkInterface.h:146
ModuleRefByPar< IIpv4RoutingTable > rt
Definition: Ospfv2.h:30
AsExternalLsa * getASExternalLSA(unsigned long i)
Definition: Ospfv2Router.h:69
void addWatches()
Adds OMNeT++ watches for the routerID, the list of Areas and the list of AS External LSAs.
Definition: Ospfv2Router.cc:48
void processEvent(Ospfv2InterfaceEventType event)
Definition: Ospfv2Interface.cc:153
virtual void createOspfRouter()
Definition: Ospfv2.cc:64
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:40
virtual void initialize(int stage) override
Definition: OperationalMixinImpl.h:26
MessageHandler * getMessageHandler()
Definition: Ospfv2Router.h:66
unsigned long getASExternalLSACount() const
Definition: Ospfv2Router.h:68
#define OSPFv2_EXTERNAL_ROUTES_LEARNED_BY_BGP
Definition: Ospfv2Common.h:53
void messageReceived(cMessage *message)
Definition: MessageHandler.cc:33
virtual void unsubscribe()
Definition: Ospfv2.cc:84
ModuleRefByPar< IInterfaceTable > ift
Definition: Ospfv2.h:31
bool deleteRoute(Ospfv2RoutingTableEntry *entry)
Definition: Ospfv2Router.cc:776
Router * ospfRouter
Definition: Ospfv2.h:32
simsignal_t interfaceDeletedSignal
Definition: Simsignals.cc:31
@ F_CARRIER
Definition: NetworkInterface.h:146
Ospfv2Area * getAreaByID(AreaId areaID)
Returns the pointer to the Area identified by the input areaID, if it's on the Area list,...
Definition: Ospfv2Router.cc:63
void updateExternalRoute(Ipv4Address networkAddress, const Ospfv2AsExternalLsaContents &externalRouteContents, int ifIndex=-1)
Stores information on an AS External Route in externalRoutes and intalls(or updates) a new AsExternal...
Definition: Ospfv2Router.cc:1356
unsigned long getRoutingTableEntryCount() const
Definition: Ospfv2Router.h:73
@ INTERFACE_DOWN
Definition: Ospfv2Interface.h:48
simsignal_t interfaceStateChangedSignal
Definition: Simsignals.cc:32
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
std::vector< AreaId > getAreaIds()
Definition: Ospfv2Router.cc:81
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
cModule * host
Definition: Ospfv2.h:29
Ospfv2RoutingTableEntry * getRoutingTableEntry(unsigned long i)
Definition: Ospfv2Router.h:74
cMessage * startupTimer
Definition: Ospfv2.h:33
static const Protocol ospf
Definition: Protocol.h:102
#define Enter_Method(...)
Definition: SelfDoc.h:71
simsignal_t interfaceCreatedSignal
Definition: Simsignals.cc:30
void registerProtocol(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a protocol primitive (PDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:83
virtual const Ospfv2LsaHeader & getHeader() const
virtual void subscribe()
Definition: Ospfv2.cc:77
void handleInterfaceDown(const NetworkInterface *ie)
Definition: Ospfv2.cc:192
INET_API InitStage INITSTAGE_ROUTING_PROTOCOLS
Initialization of routing protocols.