#include <global-router-interface.h>
Public Types | |
enum | LSType { Unknown = 0 } |
corresponds to LS type field of RFC 2328 OSPF LSA header More... | |
enum | SPFStatus { LSA_SPF_NOT_EXPLORED = 0, LSA_SPF_CANDIDATE, LSA_SPF_IN_SPFTREE } |
Enumeration of the possible values of the status flag in the Routing Link State Advertisements. More... | |
Public Member Functions | |
GlobalRoutingLSA () | |
Create a blank Global Routing Link State Advertisement. | |
GlobalRoutingLSA (SPFStatus status, Ipv4Address linkStateId, Ipv4Address advertisingRtr) | |
Create an initialized Global Routing Link State Advertisement. | |
GlobalRoutingLSA (GlobalRoutingLSA &lsa) | |
Copy constructor for a Global Routing Link State Advertisement. | |
~GlobalRoutingLSA () | |
Destroy an existing Global Routing Link State Advertisement. | |
GlobalRoutingLSA & | operator= (const GlobalRoutingLSA &lsa) |
Assignment operator for a Global Routing Link State Advertisement. | |
void | CopyLinkRecords (const GlobalRoutingLSA &lsa) |
Copy any Global Routing Link Records in a given Global Routing Link State Advertisement to the current LSA. | |
uint32_t | AddLinkRecord (GlobalRoutingLinkRecord *lr) |
Add a given Global Routing Link Record to the LSA. | |
uint32_t | GetNLinkRecords (void) const |
Return the number of Global Routing Link Records in the LSA. | |
GlobalRoutingLinkRecord * | GetLinkRecord (uint32_t n) const |
Return a pointer to the specified Global Routing Link Record. | |
void | ClearLinkRecords (void) |
Release all of the Global Routing Link Records present in the Global Routing Link State Advertisement and make the list of link records empty. | |
bool | IsEmpty (void) const |
Check to see if the list of Global Routing Link Records present in the Global Routing Link State Advertisement is empty. | |
void | Print (std::ostream &os) const |
Print the contents of the Global Routing Link State Advertisement and any Global Routing Link Records present in the list. Quite verbose. | |
LSType | GetLSType (void) const |
Return the LSType field of the LSA. | |
void | SetLSType (LSType typ) |
Set the LS type field of the LSA. | |
Ipv4Address | GetLinkStateId (void) const |
Get the Link State ID as defined by the OSPF spec. We always set it to the router ID of the router making the advertisement. | |
void | SetLinkStateId (Ipv4Address addr) |
Set the Link State ID is defined by the OSPF spec. We always set it to the router ID of the router making the advertisement. | |
Ipv4Address | GetAdvertisingRouter (void) const |
Get the Advertising Router as defined by the OSPF spec. We always set it to the router ID of the router making the advertisement. | |
void | SetAdvertisingRouter (Ipv4Address rtr) |
Set the Advertising Router as defined by the OSPF spec. We always set it to the router ID of the router making the advertisement. | |
void | SetNetworkLSANetworkMask (Ipv4Mask mask) |
For a Network LSA, set the Network Mask field that precedes the list of attached routers. | |
Ipv4Mask | GetNetworkLSANetworkMask (void) const |
For a Network LSA, get the Network Mask field that precedes the list of attached routers. | |
uint32_t | AddAttachedRouter (Ipv4Address addr) |
Add an attached router to the list in the NetworkLSA. | |
uint32_t | GetNAttachedRouters (void) const |
Return the number of attached routers listed in the NetworkLSA. | |
Ipv4Address | GetAttachedRouter (uint32_t n) const |
Return an Ipv4Address corresponding to the specified attached router. | |
SPFStatus | GetStatus (void) const |
Get the SPF status of the advertisement. | |
void | SetStatus (SPFStatus status) |
Set the SPF status of the advertisement. | |
Ptr< Node > | GetNode (void) const |
Get the Node pointer of the node that originated this LSA. | |
void | SetNode (Ptr< Node > node) |
Set the Node pointer of the node that originated this LSA. | |
Private Types | |
typedef std::list < GlobalRoutingLinkRecord * > | ListOfLinkRecords_t |
typedef std::list< Ipv4Address > | ListOfAttachedRouters_t |
Private Attributes | |
LSType | m_lsType |
Ipv4Address | m_linkStateId |
Ipv4Address | m_advertisingRtr |
ListOfLinkRecords_t | m_linkRecords |
Ipv4Mask | m_networkLSANetworkMask |
ListOfAttachedRouters_t | m_attachedRouters |
SPFStatus | m_status |
Roughly equivalent to a global incarnation of the OSPF link state header combined with a list of Link Records. Since it's global, there's no need for age or sequence number. See RFC 2328, Appendix A.
typedef std::list<Ipv4Address> ns3::GlobalRoutingLSA::ListOfAttachedRouters_t [private] |
A convenience typedef to avoid too much writers cramp.
typedef std::list<GlobalRoutingLinkRecord*> ns3::GlobalRoutingLSA::ListOfLinkRecords_t [private] |
A convenience typedef to avoid too much writers cramp.
ns3::GlobalRoutingLSA::GlobalRoutingLSA | ( | ) |
Create a blank Global Routing Link State Advertisement.
On completion Ipv4Address variables initialized to 0.0.0.0 and the list of Link State Records is empty.
ns3::GlobalRoutingLSA::GlobalRoutingLSA | ( | SPFStatus | status, | |
Ipv4Address | linkStateId, | |||
Ipv4Address | advertisingRtr | |||
) |
Create an initialized Global Routing Link State Advertisement.
On completion the list of Link State Records is empty.
status | The status to of the new LSA. | |
linkStateId | The Ipv4Address for the link state ID field. | |
advertisingRtr | The Ipv4Address for the advertising router field. |
ns3::GlobalRoutingLSA::GlobalRoutingLSA | ( | GlobalRoutingLSA & | lsa | ) |
Copy constructor for a Global Routing Link State Advertisement.
Takes a piece of memory and constructs a semantically identical copy of the given LSA.
lsa | The existing LSA to be used as the source. |
ns3::GlobalRoutingLSA::~GlobalRoutingLSA | ( | ) |
Destroy an existing Global Routing Link State Advertisement.
Any Global Routing Link Records present in the list are freed.
uint32_t ns3::GlobalRoutingLSA::AddAttachedRouter | ( | Ipv4Address | addr | ) |
Add an attached router to the list in the NetworkLSA.
addr | The Ipv4Address of the interface on the network link |
uint32_t ns3::GlobalRoutingLSA::AddLinkRecord | ( | GlobalRoutingLinkRecord * | lr | ) |
Add a given Global Routing Link Record to the LSA.
lr | The Global Routing Link Record to be added. |
void ns3::GlobalRoutingLSA::CopyLinkRecords | ( | const GlobalRoutingLSA & | lsa | ) |
Copy any Global Routing Link Records in a given Global Routing Link State Advertisement to the current LSA.
Existing Link Records are not deleted -- this is a concatenation of Link Records.
lsa | The LSA to copy the Link Records from. |
Ipv4Address ns3::GlobalRoutingLSA::GetAdvertisingRouter | ( | void | ) | const |
Get the Advertising Router as defined by the OSPF spec. We always set it to the router ID of the router making the advertisement.
GlobalRouting::GetRouterId ()
Ipv4Address ns3::GlobalRoutingLSA::GetAttachedRouter | ( | uint32_t | n | ) | const |
Return an Ipv4Address corresponding to the specified attached router.
n | The attached router number desired (number in the list). |
GlobalRoutingLinkRecord* ns3::GlobalRoutingLSA::GetLinkRecord | ( | uint32_t | n | ) | const |
Return a pointer to the specified Global Routing Link Record.
n | The LSA number desired. |
Ipv4Address ns3::GlobalRoutingLSA::GetLinkStateId | ( | void | ) | const |
Get the Link State ID as defined by the OSPF spec. We always set it to the router ID of the router making the advertisement.
GlobalRouting::GetRouterId ()
uint32_t ns3::GlobalRoutingLSA::GetNAttachedRouters | ( | void | ) | const |
Return the number of attached routers listed in the NetworkLSA.
Ipv4Mask ns3::GlobalRoutingLSA::GetNetworkLSANetworkMask | ( | void | ) | const |
For a Network LSA, get the Network Mask field that precedes the list of attached routers.
uint32_t ns3::GlobalRoutingLSA::GetNLinkRecords | ( | void | ) | const |
Return the number of Global Routing Link Records in the LSA.
SPFStatus ns3::GlobalRoutingLSA::GetStatus | ( | void | ) | const |
bool ns3::GlobalRoutingLSA::IsEmpty | ( | void | ) | const |
GlobalRoutingLSA& ns3::GlobalRoutingLSA::operator= | ( | const GlobalRoutingLSA & | lsa | ) |
Assignment operator for a Global Routing Link State Advertisement.
Takes an existing Global Routing Link State Advertisement and overwrites it to make a semantically identical copy of a given prototype LSA.
If there are any Global Routing Link Records present in the existing LSA, they are freed before the assignment happens.
lsa | The existing LSA to be used as the source. |
void ns3::GlobalRoutingLSA::SetAdvertisingRouter | ( | Ipv4Address | rtr | ) |
Set the Advertising Router as defined by the OSPF spec. We always set it to the router ID of the router making the advertisement.
GlobalRouting::GetRouterId ()
void ns3::GlobalRoutingLSA::SetLinkStateId | ( | Ipv4Address | addr | ) |
Set the Link State ID is defined by the OSPF spec. We always set it to the router ID of the router making the advertisement.
GlobalRouting::GetRouterId ()
void ns3::GlobalRoutingLSA::SetStatus | ( | SPFStatus | status | ) |
The Advertising Router is defined by the OSPF spec. We always set it to the router ID of the router making the advertisement.
GlobalRouting::GetRouterId ()
Each Network LSA contains a list of attached routers
m_attachedRouters is an STL list container to hold the addresses that have been discovered and prepared for the advertisement.
Each Link State Advertisement contains a number of Link Records that describe the kinds of links that are attached to a given node. We consider PointToPoint and StubNetwork links.
m_linkRecords is an STL list container to hold the Link Records that have been discovered and prepared for the advertisement.
The Link State ID is defined by the OSPF spec. We always set it to the router ID of the router making the advertisement.
GlobalRouting::GetRouterId ()
LSType ns3::GlobalRoutingLSA::m_lsType [private] |
The type of the LSA. Each LSA type has a separate advertisement format.
Each Network LSA contains the network mask of the attached network
SPFStatus ns3::GlobalRoutingLSA::m_status [private] |
This is a tristate flag used internally in the SPF computation to mark if an SPFVertex (a data structure representing a vertex in the SPF tree -- a router) is new, is a candidate for a shortest path, or is in its proper position in the tree.