WSF
wsf::comm::router::ProtocolOSPF Class Reference

#include <WsfCommProtocolOSPF.hpp>

Inheritance diagram for wsf::comm::router::ProtocolOSPF:
Collaboration diagram for wsf::comm::router::ProtocolOSPF:

Classes

struct  LinkStateData

Public Types

using ProtocolVector = std::vector<ProtocolOSPF*>
 ProtocolVector provides a vector of OSPF protocols.
using AreaVector = std::vector<std::shared_ptr<OSPF_Area>>
using AreaGraphMap = std::map<Address, std::unique_ptr<graph::Graph>>
 A mapping of an area with the corresponding graph/routing table.
Public Types inherited from WsfComponentT< Router >
typedef Router ParentType
 This is needed to support the WsfComponentList template.
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.

Common OSPF message identifiers.

enum class  RouterAreaType : size_t { cNONE , cNORMAL , cABR , cASBR }
static constexpr const char * cOSPF_ALL_HELLO = "OSPF_ALL_HELLO"
static constexpr const char * cOSPF_ALL_DROP = "OSPF_ALL_DROP"
static constexpr const char * cOSPF_ALL_DR_DROP = "OSPF_ALL_DR_DROP"
static constexpr const char * cOSPF_ALL_DR_ADD = "OSPF_ALL_DR_ADD"
static ProtocolOSPFFind (const Router &aParent)
static ProtocolOSPFFindOrCreate (Router &aParent)
 ProtocolOSPF ()=default
 ~ProtocolOSPF () override=default
 ProtocolOSPF (const ProtocolOSPF &aSrc)

Graph/Table Methods

using LinkStateMap = std::map<Address, std::vector<LinkStateData>>
using LinkStateIt = LinkStateMap::iterator
graph::GraphGetGraph () const override
graph::GraphGetGraph (const Address &aArea)
bool ShouldPropagateTruth () const override
void SetGraph (const Address &aArea, std::unique_ptr< graph::Graph > aGraph)
AreaVectorGetAreas ()
OSPF_AreaGetArea (const Address &aAreaAddress)
const std::vector< Address > & GetInputAreas () const
const AddressGetInputBackbone () const
bool IsSetup () const
void SetSetup (bool aSetup)
RouterAreaType GetAreaType () const
void SetAreaType (RouterAreaType aType)
size_t GetPriorityDR () const
CommGetPriorityInterface (const std::string aNetwork) const
void PlatformInitialized (double aSimTime, WsfPlatform *aPlatformPtr)
 Callback methods to handle addition of routers during runtime.
ProtocolVector GetAllOSPF ()
std::set< std::shared_ptr< OSPF_Area > > GetAllAreas ()
 Convenience method for runtime acquisition of all existing areas.
void SetRouterRoleType (ProtocolOSPF &aProtocol)
 A method that determines and sets the OSPF router type.
void VerifyBackboneConnections (const AreaVector &aAreas)
void InitializeLinkState (const AreaVector &aAreas, graph::Graph &aGraph)
Address InterfaceInContiguousOSPF (const Address &aDestinationInterface, ProtocolOSPF &aProtocol, std::set< Address > &aCheckedAreas)
std::set< ProtocolOSPF * > GetAllASBR (ProtocolOSPF &aProtocol, std::set< Address > &aCheckedAreas)
 Provides all of the ASBRs in contiguous OSPF areas.

Routing Methods

Routing in OSPF is based on the location of the sender in respect to the backbone, and whether the destination is in the same area, a different area, or even external to a connected OSPF area. These methods standardize the routing procedures based on discovery of these conditions during normal routing operation.

std::vector< AddressRouteToBackbone (ProtocolOSPF &aProtocol, const Address &aSendingAddress, double &aCost, size_t &aHops)
std::vector< AddressRouteFromBackbone (ProtocolOSPF &aProtocol, const Address &aSendingAddress, const Address &aDestinationAddress, double &aCost, size_t &aHops)
std::pair< std::vector< Address >, Comm * > RouteExternallyASBR (const Message &aMessage)
std::vector< AddressMyMessage (Message &aMessage) const
void ScheduleEvent (std::unique_ptr< WsfEvent > aEvent) const
void SendHello (double aSimTime)
void ReceiveHello (double aSimTime, const Address &aReceiverAddress, const std::vector< Address > &aValidAreas, Message &aMessage)
void SendDR_GraphAdd (double aSimTime, const Address &aReceivingInterface, const std::vector< Address > &aTraceRoute)
void ReceiveDR_GraphAdd (double aSimTime, const Address &aReceivingInterface, const std::vector< Address > &aValidAreas, Message &aMessage)
void SendDR_GraphDrop (double aSimTime, const Address &aReceivingInterface, const Address &aDroppedInterface, const std::string &aDroppedInterfaceNetwork)
void ReceiveDR_GraphDrop (double aSimTime, const Address &aReceivingInterface, const std::vector< Address > &aValidAreas, Message &aMessage)
void DR_GraphAdd (graph::Graph &aGraph, const Address &aReceivingInterface, const std::vector< Address > &aTraceRoute)
void DR_GraphDrop (graph::Graph &aGraph, const Address &aArea, const Address &aDroppedInterface, const std::string &aDroppedNetwork)
void TimeoutUpdate (double aSimTime, bool aCalledFromEvent)
 Handles the update of the link state list for checks on dropped interfaces via timeout.
void AddLinkState (const Address &aAreaAddress, const LinkStateData &aData)
LinkStateDataFindLinkState (const Address &aAreaAddress, const Address &aLocalAddress, const Address &aRemoteAddress)
std::vector< LinkStateDataFindLinkState (const Address &aAreaAddress, const Address &aRemoteAddress)
bool RemoveLinkState (const Address &aAreaAddress, const Address &aLocalAddress, const Address &aRemoteAddress)
const LinkStateMapGetLinkStates () const
LinkStateMapGetLinkStates ()

Required interface from WsfComponent.

WsfComponentCloneComponent () const override
const int * GetComponentRoles () const override
void * QueryInterface (int aRole) override
int GetPriority () const override
ProtocolOSPFClone () const override
const char * GetScriptClassName () const override

Optional interface usage

void Setup () override
bool ProcessInput (UtInput &aInput) override
bool Initialize (double aSimTime) override

ProtocolProcess methods

This method implements the OSPF logic for reception of OSPF messages in the network layer. It "grabs" the message and checks if it is an OSPF type message (via Aux data) and acts accordingly to that data.

bool Send (double aSimTime, Router::SendData &aData) override
bool Receive (double aSimTime, const Address &aReceivingInterface, Message &aMessage, bool &aOverrideForward) override
std::vector< AddressRouting (double aSimTime, const Address &aSendingInterface, size_t &aHopNumber, double &aCost, const Message &aMessage) override

Additional Inherited Members

Public Member Functions inherited from wsf::comm::router::ProtocolInterface
 ProtocolInterface ()=default
 ~ProtocolInterface () override=default
const char * GetScriptClassName () const override
WsfStringId GetComponentName () const override final
bool operator< (const ProtocolInterface &aRhs) const
virtual void PerfectCommAdded (double aSimTime, Comm *aCommPtr)
virtual void PerfectCommRemoved (double aSimTime, Comm *aCommPtr)
virtual void PerfectNetworkAdded (double aSimTime, Network *aNetworkPtr)
virtual void PerfectNetworkRemoved (double aSimTime, Network *aNetworkPtr)
virtual void PerfectCommEnabled (double aSimTime, Comm *aCommPtr)
virtual void PerfectCommDisabled (double aSimTime, Comm *aCommPtr)
virtual void PerfectConnectionAdded (double aSimTime, const Address &aSourceAddress, const Address &aDestinationAddress)
virtual void PerfectConnectionRemoved (double aSimTime, const Address &aSourceAddress, const Address &aDestinationAddress)
virtual void PerfectConnectionEnabled (double aSimTime, const Address &aSourceAddress, const Address &aDestinationAddress)
virtual void PerfectConnectionDisabled (double aSimTime, const Address &aSourceAddress, const Address &aDestinationAddress)
Public Member Functions inherited from wsf::comm::router::RouterComponent
 RouterComponent ()=default
 ~RouterComponent () override=default
RouterGetRouter () const
WsfSimulationGetSimulation () const
NetworkManagerGetNetworkManager () const
virtual void PendingStart ()
virtual bool Initialize (double aSimTime)
virtual bool Initialize2 (double aSimTime)
virtual bool PreInitialize (double aSimTime)
virtual bool ProcessInput (UtInput &aInput)
Public Member Functions inherited from WsfComponentT< Router >
 WsfComponentT ()
WsfComponentToperator= (const WsfComponentT &) noexcept
 ~WsfComponentT () override=default
virtual void ComponentParentChanged (ParentType *aParentPtr)
ParentTypeGetComponentParent () const
void SetComponentParent (ParentType *aParentPtr)
Public Member Functions inherited from WsfComponent
virtual ~WsfComponent ()=default
virtual int GetComponentInitializationOrder () const
template<typename T>
bool QueryInterfaceT (T *&aRolePtr)
bool ComponentHasRole (int aRole)
 Returns true if the component has the specified role.
virtual void PreInput ()
Public Member Functions inherited from WsfObject
 WsfObject ()
 This is the constructor for the WsfObject class.
 ~WsfObject () override
 This is the destructor for the WsfObject class.
const char * GetScriptClassName () const override
const std::string & GetType () const
WsfStringId GetTypeId () const
 Get the string ID of the 'type' of the object.
void SetType (WsfStringId aType)
const std::string & GetBaseType () const
WsfStringId GetBaseTypeId () const
const TypeListGetTypeList () const
bool IsA_TypeOf (WsfStringId aType) const
WsfObjectoperator= (const WsfObject &aRhs)
 Assignment operator.
template<typename T>
void Serialize (T &aBuff)
 For XIO (de)serialization.
const std::string & GetName () const
WsfStringId GetNameId () const
void SetName (WsfStringId aName)
 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Detailed Description

This is a generic implementation of some of the features commonly associated with the OSPF routing protocol. Usage assumes several operating conditions that may be otherwise configurable in a full implementation to avoid issues with complexity and performance in a mission level simulation. Note that this protocol requires multicasting capabilities, currently provided by the basic IGMP multicast protocol, pre-defined and included in AFSIM, in order to function correctly. Removing the IGMP protocol when using this protocol will result in a lack of state sharing between routers with OSPF.

In general, this protocol provides some general capabilities commonly associated with OSPF in a generalized and highly abstract nature. These include:

  1. Using "routing areas" to define AS (autonomous systems).
  2. Limited sharing and updating states between routers to avoid excessive communications. (Still is performance heavy)
  3. Immediate distribution of network updates on update.
  4. Polling intervals for nodes (heartbeat for down nodes).
  5. Discovery and inclusion of new nodes (comms), assuming they are correctly configured.
  6. Re-election of BDR in the case of DR/BDR loss (we always promote the BDR to DR upon DR loss)

What this implementation does NOT do:

  1. Attempt a full implementation of OSPF.
  2. Implement full OSPF data containers, link state messages, etc.
  3. Actually distribute routing data to every router. This implementation uses a generalization of routing data that is only contained on DR/BDRs, and other routers use this data for routing (instead of being shared via type 2 LSAs)
  4. Allow non DR/BDR networking types, such as point to point or most non-broadcasting network types.
  5. Neighbor relationships are not fully modeled. General assumptions are used to simplify the process based on connected interfaces.
  6. This model does not enforce timers to be the same between members. However, be aware that an excessive hello timer time beyond any DR/BDRs hold interval will cause that router to be dropped from OSPF.

Member Typedef Documentation

◆ AreaGraphMap

A mapping of an area with the corresponding graph/routing table.

◆ AreaVector

using wsf::comm::router::ProtocolOSPF::AreaVector = std::vector<std::shared_ptr<OSPF_Area>>

A list of areas associated with this router/protocol. These are shared pointers, as the OSPF_Area lifetime is shared between any routers sharing the OSPF area, and the area objects are common across routers who are members.

◆ LinkStateIt

using wsf::comm::router::ProtocolOSPF::LinkStateIt = LinkStateMap::iterator

◆ LinkStateMap

A LinkStateMap provides a mapping between an area and the link state data in that area. Only ABRs and ASBRs will have more than one map entry (one for each area).

◆ ProtocolVector

ProtocolVector provides a vector of OSPF protocols.

Member Enumeration Documentation

◆ RouterAreaType

Enumerator
cNONE 
cNORMAL 

Router non-functional - host specification.

cABR 

No special area type - internal area router.

cASBR 

Autonomous Border Router - connected to 2 or more OSPF areas.

Autonomous System Boundary Router - connected to 2 or more areas, of which one or more do not use OSPF

Constructor & Destructor Documentation

◆ ProtocolOSPF() [1/2]

◆ ~ProtocolOSPF()

wsf::comm::router::ProtocolOSPF::~ProtocolOSPF ( )
overridedefault

◆ ProtocolOSPF() [2/2]

wsf::comm::router::ProtocolOSPF::ProtocolOSPF ( const ProtocolOSPF & aSrc)

Member Function Documentation

◆ AddLinkState()

void wsf::comm::router::ProtocolOSPF::AddLinkState ( const Address & aAreaAddress,
const LinkStateData & aData )
protected

◆ Clone()

ProtocolOSPF * wsf::comm::router::ProtocolOSPF::Clone ( ) const
overridevirtual

Return a copy of this object. Must be implemented by all derived types. If cloning is impossible, a WsfUncloneableException should be thrown.

Implements wsf::comm::router::ProtocolInterface.

References ProtocolOSPF().

Referenced by ~ProtocolOSPF().

◆ CloneComponent()

WsfComponent * wsf::comm::router::ProtocolOSPF::CloneComponent ( ) const
overridevirtual

Clones a component. May return null if component does not support clone.

Implements wsf::comm::router::ProtocolInterface.

References ProtocolOSPF().

Referenced by ~ProtocolOSPF().

◆ DR_GraphAdd()

void wsf::comm::router::ProtocolOSPF::DR_GraphAdd ( graph::Graph & aGraph,
const Address & aReceivingInterface,
const std::vector< Address > & aTraceRoute )
protected

Updates the local graph to reflect the data contained in a received OSPF HELLO message, Only valid for routers acting as the DR/BDR.

References wsf::comm::graph::Graph::CreateNode(), wsf::comm::graph::Graph::FindEdge(), wsf::comm::graph::Graph::FindNode(), wsf::comm::graph::Graph::InsertEdge(), and wsf::comm::Address::IsNull().

Referenced by ReceiveDR_GraphAdd(), and ReceiveHello().

◆ DR_GraphDrop()

void wsf::comm::router::ProtocolOSPF::DR_GraphDrop ( graph::Graph & aGraph,
const Address & aArea,
const Address & aDroppedInterface,
const std::string & aDroppedNetwork )
protected

Updates the local graph to reflect a dropped interface due to timeout of non-reception of OSPF HELLO. Only valid for routers acting as the DR/BDR.

References GetArea(), GetGraph(), wsf::comm::router::RouterComponent::GetSimulation(), and wsf::comm::graph::Graph::RemoveNode().

Referenced by ReceiveDR_GraphDrop().

◆ Find()

ProtocolOSPF * wsf::comm::router::ProtocolOSPF::Find ( const Router & aParent)
static

◆ FindLinkState() [1/2]

ProtocolOSPF::LinkStateData * wsf::comm::router::ProtocolOSPF::FindLinkState ( const Address & aAreaAddress,
const Address & aLocalAddress,
const Address & aRemoteAddress )
protected

◆ FindLinkState() [2/2]

std::vector< ProtocolOSPF::LinkStateData > wsf::comm::router::ProtocolOSPF::FindLinkState ( const Address & aAreaAddress,
const Address & aRemoteAddress )
protected

Finds a link state regardless of local interface. Returns all link states that match the destination in the provided area.

◆ FindOrCreate()

ProtocolOSPF * wsf::comm::router::ProtocolOSPF::FindOrCreate ( Router & aParent)
static

◆ GetAllAreas()

std::set< std::shared_ptr< OSPF_Area > > wsf::comm::router::ProtocolOSPF::GetAllAreas ( )
protected

Convenience method for runtime acquisition of all existing areas.

References GetAllOSPF().

Referenced by PlatformInitialized().

◆ GetAllASBR()

std::set< ProtocolOSPF * > wsf::comm::router::ProtocolOSPF::GetAllASBR ( ProtocolOSPF & aProtocol,
std::set< Address > & aCheckedAreas )
protected

Provides all of the ASBRs in contiguous OSPF areas.

References cASBR, GetAllASBR(), GetAreas(), and ProtocolOSPF().

Referenced by GetAllASBR(), and RouteExternallyASBR().

◆ GetAllOSPF()

ProtocolOSPF::ProtocolVector wsf::comm::router::ProtocolOSPF::GetAllOSPF ( )
protected

Convenience method for querying the Network Manager and getting all of the OSPF enabled comm objects at the time of the call.

References WsfComponentList::RoleIterator< T >::AtEnd(), WsfSimulation::GetPlatformCount(), wsf::comm::router::RouterComponent::GetRouter(), WsfPlatformPart::GetSimulation(), and platformPtr.

Referenced by GetAllAreas(), and Setup().

◆ GetArea()

OSPF_Area * wsf::comm::router::ProtocolOSPF::GetArea ( const Address & aAreaAddress)

◆ GetAreas()

AreaVector & wsf::comm::router::ProtocolOSPF::GetAreas ( )
inline

◆ GetAreaType()

RouterAreaType wsf::comm::router::ProtocolOSPF::GetAreaType ( ) const
inline

Referenced by SetRouterRoleType().

◆ GetComponentRoles()

const int * wsf::comm::router::ProtocolOSPF::GetComponentRoles ( ) const
overridevirtual

Returns a zero-terminated array of component roles. Note that the array should be in decreasing order of specificity and should generally the inheritance hierarchy. The first entry should be the components 'primary' role. For example a sensor would do the following:

return roles;
@ cWSF_COMPONENT_SENSOR
A 'sensor' component (WsfSensor).
Definition WsfComponentRoles.hpp:105
@ cWSF_COMPONENT_PLATFORM_PART
The component derives from WsfPlatformPart.
Definition WsfComponentRoles.hpp:98
@ cWSF_COMPONENT_ARTICULATED_PART
The component derives from WsfArticulatedPart.
Definition WsfComponentRoles.hpp:99

Implements wsf::comm::router::ProtocolInterface.

References cWSF_COMPONENT_COMM_ROUTER_PROTOCOL, cWSF_COMPONENT_COMM_ROUTER_PROTOCOL_OSPF, and cWSF_COMPONENT_NULL.

Referenced by ~ProtocolOSPF().

◆ GetGraph() [1/2]

graph::Graph * wsf::comm::router::ProtocolOSPF::GetGraph ( ) const
overridevirtual

This graph is truth via the network manager. It shouldn't be used internally. It is provided for multicast functionality.

Implements wsf::comm::router::ProtocolInterface.

References WsfSimulation::GetCommNetworkManager(), wsf::comm::NetworkManager::GetGraph(), and wsf::comm::router::RouterComponent::GetSimulation().

Referenced by DR_GraphDrop(), ReceiveDR_GraphAdd(), ReceiveDR_GraphDrop(), ReceiveHello(), and Setup().

◆ GetGraph() [2/2]

graph::Graph * wsf::comm::router::ProtocolOSPF::GetGraph ( const Address & aArea)

◆ GetInputAreas()

const std::vector< Address > & wsf::comm::router::ProtocolOSPF::GetInputAreas ( ) const
inline

◆ GetInputBackbone()

const Address & wsf::comm::router::ProtocolOSPF::GetInputBackbone ( ) const
inline

◆ GetLinkStates() [1/2]

LinkStateMap & wsf::comm::router::ProtocolOSPF::GetLinkStates ( )
inlineprotected

◆ GetLinkStates() [2/2]

const LinkStateMap & wsf::comm::router::ProtocolOSPF::GetLinkStates ( ) const
inlineprotected

◆ GetPriority()

int wsf::comm::router::ProtocolOSPF::GetPriority ( ) const
overridevirtual

Required query for protocol priority. Protocols are evaluated in order based on their assigned priorities. A lower value indicates a higher priority.

Implements wsf::comm::router::ProtocolInterface.

References wsf::comm::cOSPF.

Referenced by ~ProtocolOSPF().

◆ GetPriorityDR()

size_t wsf::comm::router::ProtocolOSPF::GetPriorityDR ( ) const
inline

◆ GetPriorityInterface()

Comm * wsf::comm::router::ProtocolOSPF::GetPriorityInterface ( const std::string aNetwork) const

Given a network name, returns the interface available to this router/protocol with the highest priority (the highest binary value address) belonging to that network. Returns a nullptr if such an interface could not be found.

References wsf::comm::router::RouterComponent::GetRouter().

Referenced by wsf::comm::router::OSPF_Area::ElectionDR().

◆ GetScriptClassName()

const char * wsf::comm::router::ProtocolOSPF::GetScriptClassName ( ) const
inlineoverride

◆ Initialize()

bool wsf::comm::router::ProtocolOSPF::Initialize ( double aSimTime)
overridevirtual

Perform phase 1 initialization. This is called by WsfPlatform::Initialize() during phase 1 initialization of the platform. The component should complete validation of input data that could not be done by ProcessInput, as well as any other functions to prepare for simulation use (subject to the next paragraph).

The order in which components are initialized is defined by GetComponentInitializationOrder. In general a component implementation of this method should not be dependent on the state of another component, i.e.: it should not assume that the other components Initialize() method has been called. If such a dependency exists one should use Initialize2() if possible, or specify a value GetComponentInitializationOrder to force things to initialize in a particular order.

Parameters
aSimTimeThe current simulation time.
Returns
true if successful or false if unsuccessful (bad input data, etc.)
Note
This method should NOT add any other components to the platform. This MUST be done in PreInitialize().

Reimplemented from wsf::comm::router::ProtocolInterface.

References WsfComponentList::GetComponent(), wsf::comm::router::Router::GetComponents(), WsfObject::GetName(), WsfPlatformPart::GetPlatform(), wsf::comm::router::RouterComponent::GetRouter(), wsf::comm::router::RouterComponent::GetSimulation(), wsf::comm::router::ProtocolMulticast::Initialize(), PlatformInitialized(), ScheduleEvent(), SendHello(), and TimeoutUpdate().

◆ InitializeLinkState()

void wsf::comm::router::ProtocolOSPF::InitializeLinkState ( const AreaVector & aAreas,
graph::Graph & aGraph )
protected

A method for initializing link state data for OSPF routers. Used only for sim initialization for network convergence. The data is maintained organically during runtime, or with the entry of new routers/interfaces. Uses the provided graph to initialize the data.

References wsf::comm::graph::Graph::FindAnyPath(), wsf::comm::Address::GetAddress(), wsf::comm::router::ProtocolOSPF::LinkStateData::mLastUpdateTime, wsf::comm::router::ProtocolOSPF::LinkStateData::mLocalInterface, wsf::comm::router::ProtocolOSPF::LinkStateData::mLocalNetwork, wsf::comm::router::ProtocolOSPF::LinkStateData::mRemoteInterface, and wsf::comm::router::ProtocolOSPF::LinkStateData::mRemoteNetwork.

Referenced by Setup().

◆ InterfaceInContiguousOSPF()

Address wsf::comm::router::ProtocolOSPF::InterfaceInContiguousOSPF ( const Address & aDestinationInterface,
ProtocolOSPF & aProtocol,
std::set< Address > & aCheckedAreas )
protected

Instead of using summary tables, we cheat by peeking at other area link state data to find the membership of a router with an interface in our connected OSPF areas. Returns the address of the area, which is null if not found.

References GetAreas(), InterfaceInContiguousOSPF(), and ProtocolOSPF().

Referenced by InterfaceInContiguousOSPF(), and Routing().

◆ IsSetup()

bool wsf::comm::router::ProtocolOSPF::IsSetup ( ) const
inline

Referenced by SetRouterRoleType(), and Setup().

◆ MyMessage()

std::vector< Address > wsf::comm::router::ProtocolOSPF::MyMessage ( Message & aMessage) const
protected

Determines if a message is for us. OSPF multicast messages provide the area, so we ensure this matches the area we belong to. Returns the matching addresses of the areas shared.

References wsf::comm::Message::SourceMessage().

Referenced by Receive().

◆ PlatformInitialized()

void wsf::comm::router::ProtocolOSPF::PlatformInitialized ( double aSimTime,
WsfPlatform * aPlatformPtr )

◆ ProcessInput()

bool wsf::comm::router::ProtocolOSPF::ProcessInput ( UtInput & aInput)
overridevirtual

Evaluate the current input command and determine if it is one processed by the component. The component should get the current command from the input stream and determine if it is one that it recognizes. If it does not recognize the command then it should leave the command in the input stream and return false. If it does recognize the command then it should process the command and return true. If invalid arguments are encountered then it should throw an exception.

Parameters
aInputThe input stream.
Returns
true if the current command was recognized (and processed), or false if the command was not recognized.
Exceptions
UtInput::ExceptionBaseif an invalid input was encountered.

Reimplemented from wsf::comm::router::ProtocolInterface.

References wsf::comm::Address::ProcessInput(), and WsfRandomVariable::ProcessInput().

◆ QueryInterface()

void * wsf::comm::router::ProtocolOSPF::QueryInterface ( int aRole)
overridevirtual

Requests a component's role interface. A component can support one or more roles.

Parameters
aRoleThe role whose interface is to be returned.
Returns
A pointer to the object if it supports the indicated role, or 'null' if it does not. Usage: WsfProcessor* procPtrOrNull = (WsfProcessor*)componentPtr->QueryComponentInterface(cWSF_COMPONENT_PROCESSOR);

Implements wsf::comm::router::ProtocolInterface.

References cWSF_COMPONENT_COMM_ROUTER_PROTOCOL, cWSF_COMPONENT_COMM_ROUTER_PROTOCOL_OSPF, and wsf::comm::router::ProtocolInterface::ProtocolInterface().

Referenced by ~ProtocolOSPF().

◆ Receive()

bool wsf::comm::router::ProtocolOSPF::Receive ( double aSimTime,
const Address & aReceivingInterface,
Message & aMessage,
bool & aOverrideForward )
overridevirtual

Received a hello message.

Received a drop message for DR/BDR graph usage.

Receive an add message for DR/BDR graph usage.

Reimplemented from wsf::comm::router::ProtocolInterface.

References wsf::comm::router::cID_OSPF_ALL_DR_ADD, wsf::comm::router::cID_OSPF_ALL_DR_DROP, wsf::comm::router::cID_OSPF_ALL_HELLO, MyMessage(), ReceiveDR_GraphAdd(), ReceiveDR_GraphDrop(), ReceiveHello(), and wsf::comm::Message::SourceMessage().

◆ ReceiveDR_GraphAdd()

void wsf::comm::router::ProtocolOSPF::ReceiveDR_GraphAdd ( double aSimTime,
const Address & aReceivingInterface,
const std::vector< Address > & aValidAreas,
Message & aMessage )
protected

◆ ReceiveDR_GraphDrop()

void wsf::comm::router::ProtocolOSPF::ReceiveDR_GraphDrop ( double aSimTime,
const Address & aReceivingInterface,
const std::vector< Address > & aValidAreas,
Message & aMessage )
protected

◆ ReceiveHello()

◆ RemoveLinkState()

bool wsf::comm::router::ProtocolOSPF::RemoveLinkState ( const Address & aAreaAddress,
const Address & aLocalAddress,
const Address & aRemoteAddress )
protected

◆ RouteExternallyASBR()

std::pair< std::vector< Address >, Comm * > wsf::comm::router::ProtocolOSPF::RouteExternallyASBR ( const Message & aMessage)
protected

Using all of the connected ASBRs, find the optimal external route to the destination using a non-OSPF routing protocol. This is not guaranteed to succeed. Removes the need for ASBR's to send summary data across OSPF by directly polling. Does not provide a path from the current sender to the ASBR itself, just the best external path available and identification of the router that provides it.

References cWSF_COMPONENT_COMM_ROUTER_PROTOCOL, cWSF_COMPONENT_COMM_ROUTER_PROTOCOL_MULTICAST, cWSF_COMPONENT_COMM_ROUTER_PROTOCOL_OSPF, GetAllASBR(), wsf::comm::router::RouterComponent::GetSimulation(), wsf::comm::router::ProtocolInterface::ProtocolInterface(), and wsf::comm::router::ProtocolInterface::Routing().

Referenced by Routing().

◆ RouteFromBackbone()

std::vector< Address > wsf::comm::router::ProtocolOSPF::RouteFromBackbone ( ProtocolOSPF & aProtocol,
const Address & aSendingAddress,
const Address & aDestinationAddress,
double & aCost,
size_t & aHops )
protected

Find a route to the correct area from the backbone. Assumes knowledge that the destination is in a connected OSPF area that isn't the backbone, and the current handling router is in the backbone.

References cABR, cASBR, wsf::comm::NetworkManager::GetComm(), WsfSimulation::GetCommNetworkManager(), wsf::comm::router::RouterComponent::GetSimulation(), and ProtocolOSPF().

Referenced by Routing().

◆ RouteToBackbone()

std::vector< Address > wsf::comm::router::ProtocolOSPF::RouteToBackbone ( ProtocolOSPF & aProtocol,
const Address & aSendingAddress,
double & aCost,
size_t & aHops )
protected

Finds a route to the backbone. Assumes knowledge that the destination is in a connected OSPF area, and the current handling router is not in the backbone.

We only want the ABR/ASBRs. Check that they are in the backbone.

References cABR, cASBR, FindLinkState(), wsf::comm::Address::GetAddress(), wsf::comm::NetworkManager::GetComm(), WsfSimulation::GetCommNetworkManager(), wsf::comm::router::RouterComponent::GetSimulation(), and ProtocolOSPF().

Referenced by Routing().

◆ Routing()

std::vector< Address > wsf::comm::router::ProtocolOSPF::Routing ( double aSimTime,
const Address & aSendingInterface,
size_t & aHopNumber,
double & aCost,
const Message & aMessage )
overridevirtual

◆ ScheduleEvent()

void wsf::comm::router::ProtocolOSPF::ScheduleEvent ( std::unique_ptr< WsfEvent > aEvent) const
protected

Schedules an event. Doesn't fire if the scheduler is removed from the sim.

References WsfComponentT< Router >::GetComponentParent(), and wsf::comm::router::RouterComponent::GetSimulation().

Referenced by Initialize(), SendHello(), and TimeoutUpdate().

◆ Send()

◆ SendDR_GraphAdd()

void wsf::comm::router::ProtocolOSPF::SendDR_GraphAdd ( double aSimTime,
const Address & aReceivingInterface,
const std::vector< Address > & aTraceRoute )
protected

Send a message to DR/BDR over multicast about a discovered interface and connections.

References wsf::comm::router::cID_OSPF_ALL_DR_ADD, wsf::comm::NetworkManager::GetComm(), WsfSimulation::GetCommNetworkManager(), and wsf::comm::router::RouterComponent::GetSimulation().

Referenced by ReceiveHello().

◆ SendDR_GraphDrop()

void wsf::comm::router::ProtocolOSPF::SendDR_GraphDrop ( double aSimTime,
const Address & aReceivingInterface,
const Address & aDroppedInterface,
const std::string & aDroppedInterfaceNetwork )
protected

◆ SendHello()

void wsf::comm::router::ProtocolOSPF::SendHello ( double aSimTime)
protected

OSPF messages These messages are generic link state messages to implement general OSPF behavior.

Reschedule hello packet sending.

References wsf::comm::router::cID_OSPF_ALL_HELLO, wsf::comm::router::RouterComponent::GetRouter(), wsf::comm::router::RouterComponent::GetSimulation(), ScheduleEvent(), and SendHello().

Referenced by Initialize(), and SendHello().

◆ SetAreaType()

void wsf::comm::router::ProtocolOSPF::SetAreaType ( RouterAreaType aType)
inline

Referenced by SetRouterRoleType().

◆ SetGraph()

void wsf::comm::router::ProtocolOSPF::SetGraph ( const Address & aArea,
std::unique_ptr< graph::Graph > aGraph )

◆ SetRouterRoleType()

◆ SetSetup()

void wsf::comm::router::ProtocolOSPF::SetSetup ( bool aSetup)
inline

◆ Setup()

◆ ShouldPropagateTruth()

bool wsf::comm::router::ProtocolOSPF::ShouldPropagateTruth ( ) const
inlineoverridevirtual

◆ TimeoutUpdate()

void wsf::comm::router::ProtocolOSPF::TimeoutUpdate ( double aSimTime,
bool aCalledFromEvent )
protected

Handles the update of the link state list for checks on dropped interfaces via timeout.

References ScheduleEvent(), SendDR_GraphDrop(), and TimeoutUpdate().

Referenced by Initialize(), ReceiveHello(), and TimeoutUpdate().

◆ VerifyBackboneConnections()

void wsf::comm::router::ProtocolOSPF::VerifyBackboneConnections ( const AreaVector & aAreas)
protected

A method that provides verification that each area is directly connected to the backbone, and throw an exception if this condition does not exist due to improper user configuration.

Referenced by PlatformInitialized(), and Setup().

Member Data Documentation

◆ cOSPF_ALL_DR_ADD

const char * wsf::comm::router::ProtocolOSPF::cOSPF_ALL_DR_ADD = "OSPF_ALL_DR_ADD"
staticconstexpr

◆ cOSPF_ALL_DR_DROP

const char * wsf::comm::router::ProtocolOSPF::cOSPF_ALL_DR_DROP = "OSPF_ALL_DR_DROP"
staticconstexpr

◆ cOSPF_ALL_DROP

const char * wsf::comm::router::ProtocolOSPF::cOSPF_ALL_DROP = "OSPF_ALL_DROP"
staticconstexpr

◆ cOSPF_ALL_HELLO

const char * wsf::comm::router::ProtocolOSPF::cOSPF_ALL_HELLO = "OSPF_ALL_HELLO"
staticconstexpr

The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved