QuISP
Loading...
Searching...
No Matches
quisp::modules::ospf::LinkStateDatabase Class Reference

Represents the database that holds link-state advertisements of nodes. Effectively, link_state_database is the topology information of a network. This class holds several public methods that enable easy execution of OSPF. More...

#include <Ospf.h>

Classes

struct  Vertex
 
struct  VertexMinPriority
 

Public Member Functions

void updateLinkStateDatabase (LinkStateAdvertisement &lsa)
 Adds new lsa or updated lsa to link_state_database As a sideffect, this function clears lsdb_summary.
 
LinkStateDatabaseSummary getLinkStateDatabaseSummary ()
 Get the Link State Database Summary object.
 
std::map< NodeAddr, int > generateRoutingTableFromGraph (NodeAddr source) const
 
RouterIds identifyMissingLinkStateAdvertisementId (const LinkStateDatabaseSummary &lsdb_summary_from_neighbor) const
 
virtual bool needsFullLinkStateAdvertisementOf (const SummaryLinkStateAdvertisement &summary_lsa) const
 
LinkStateUpdate getLinkStateUpdatesFor (const RouterIds &requests, int my_address) const
 
virtual LinkStateAdvertisement getLinkStateAdvertisementOf (NodeAddr router) const
 
bool hasLinkStateAdvertisementOf (NodeAddr router) const
 

Protected Types

using VertexSharedPtr = std::shared_ptr<Vertex>
 
using VertexMap = std::map<NodeAddr, VertexSharedPtr>
 
using PriorityQueue = std::priority_queue<VertexSharedPtr, std::vector<VertexSharedPtr>, VertexMinPriority>
 

Protected Member Functions

int getHopAddressToNeighbor (NodeAddr src, NodeAddr neighbor) const
 
NodeAddr getSecondNodeInPathToDestNode (NodeAddr source_id, NodeAddr dst_id, const VertexMap &vertices) const
 
virtual const VertexMap dijkstraAlgorithm (NodeAddr source_id) const
 Dijkstra's Algorithm Reference: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. 2009. Introduction to Algorithms, Third Edition (3rd. ed.). The MIT Press.
 
VertexMap generateVerticesFromLsdb () const
 
double weight (NodeAddr node1, NodeAddr node2) const
 
VertexSharedPtr popMinDistanceNode (PriorityQueue &q) const
 

Protected Attributes

std::map< NodeAddr, LinkStateAdvertisementlink_state_database
 
LinkStateDatabaseSummary lsdb_summary
 

Detailed Description

Represents the database that holds link-state advertisements of nodes. Effectively, link_state_database is the topology information of a network. This class holds several public methods that enable easy execution of OSPF.

Member Typedef Documentation

◆ PriorityQueue

◆ VertexMap

◆ VertexSharedPtr

Member Function Documentation

◆ dijkstraAlgorithm()

const LinkStateDatabase::VertexMap quisp::modules::ospf::LinkStateDatabase::dijkstraAlgorithm ( NodeAddr source_id) const
protectedvirtual

Dijkstra's Algorithm Reference: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. 2009. Introduction to Algorithms, Third Edition (3rd. ed.). The MIT Press.

Parameters
source_id
Returns
map<int (Node ID), LinkStateDatabase::VertexSharedPtr> Each node has a pointer to the previous node in its path from source The full path from source to destination can be retrieved by following the pointer from the destination to the source

◆ generateRoutingTableFromGraph()

std::map< NodeAddr, int > quisp::modules::ospf::LinkStateDatabase::generateRoutingTableFromGraph ( NodeAddr source) const

◆ generateVerticesFromLsdb()

LinkStateDatabase::VertexMap quisp::modules::ospf::LinkStateDatabase::generateVerticesFromLsdb ( ) const
protected

◆ getHopAddressToNeighbor()

int quisp::modules::ospf::LinkStateDatabase::getHopAddressToNeighbor ( NodeAddr src,
NodeAddr neighbor ) const
protected

◆ getLinkStateAdvertisementOf()

LinkStateAdvertisement quisp::modules::ospf::LinkStateDatabase::getLinkStateAdvertisementOf ( NodeAddr router) const
virtual

◆ getLinkStateDatabaseSummary()

LinkStateDatabaseSummary quisp::modules::ospf::LinkStateDatabase::getLinkStateDatabaseSummary ( )

Get the Link State Database Summary object.

This function also takes care of generating lsdb_summary when needed This is to prevent unnecessary lsdb_summary update, as lsdb_summary is not needed until a router receives LsrPacket

Returns
lsdb_summary

◆ getLinkStateUpdatesFor()

LinkStateUpdate quisp::modules::ospf::LinkStateDatabase::getLinkStateUpdatesFor ( const RouterIds & requests,
int my_address ) const

◆ getSecondNodeInPathToDestNode()

NodeAddr quisp::modules::ospf::LinkStateDatabase::getSecondNodeInPathToDestNode ( NodeAddr source_id,
NodeAddr dst_id,
const VertexMap & vertices ) const
protected

◆ hasLinkStateAdvertisementOf()

bool quisp::modules::ospf::LinkStateDatabase::hasLinkStateAdvertisementOf ( NodeAddr router) const

◆ identifyMissingLinkStateAdvertisementId()

RouterIds quisp::modules::ospf::LinkStateDatabase::identifyMissingLinkStateAdvertisementId ( const LinkStateDatabaseSummary & lsdb_summary_from_neighbor) const

◆ needsFullLinkStateAdvertisementOf()

bool quisp::modules::ospf::LinkStateDatabase::needsFullLinkStateAdvertisementOf ( const SummaryLinkStateAdvertisement & summary_lsa) const
virtual

◆ popMinDistanceNode()

LinkStateDatabase::VertexSharedPtr quisp::modules::ospf::LinkStateDatabase::popMinDistanceNode ( PriorityQueue & q) const
protected

◆ updateLinkStateDatabase()

void quisp::modules::ospf::LinkStateDatabase::updateLinkStateDatabase ( LinkStateAdvertisement & lsa)

Adds new lsa or updated lsa to link_state_database As a sideffect, this function clears lsdb_summary.

◆ weight()

double quisp::modules::ospf::LinkStateDatabase::weight ( NodeAddr node1,
NodeAddr node2 ) const
protected

Member Data Documentation

◆ link_state_database

std::map<NodeAddr, LinkStateAdvertisement> quisp::modules::ospf::LinkStateDatabase::link_state_database
protected

◆ lsdb_summary

LinkStateDatabaseSummary quisp::modules::ospf::LinkStateDatabase::lsdb_summary
protected

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