ns-3
ns3::GlobalRoutingLSA Class Reference

a Link State Advertisement (LSA) for a router, used in global routing. More...

#include <global-router-interface.h>

List of all members.

Public Types

enum  LSType {
  Unknown = 0, RouterLSA, NetworkLSA, SummaryLSA,
  SummaryLSA_ASBR, ASExternalLSAs
}
 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.
GlobalRoutingLSAoperator= (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.
GlobalRoutingLinkRecordGetLinkRecord (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< NodeGetNode (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.

Detailed Description

a Link State Advertisement (LSA) for a router, used in global routing.

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.


Member Enumeration Documentation

corresponds to LS type field of RFC 2328 OSPF LSA header

Enumerator:
Unknown 

Uninitialized Type

Enumeration of the possible values of the status flag in the Routing Link State Advertisements.

Enumerator:
LSA_SPF_NOT_EXPLORED 

New vertex not yet considered

LSA_SPF_CANDIDATE 

Vertex is in the SPF candidate queue

LSA_SPF_IN_SPFTREE 

Vertex is in the SPF tree


Constructor & Destructor Documentation

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.

References NS_LOG_FUNCTION_NOARGS.

Create an initialized Global Routing Link State Advertisement.

On completion the list of Link State Records is empty.

Parameters:
statusThe status to of the new LSA.
linkStateIdThe Ipv4Address for the link state ID field.
advertisingRtrThe Ipv4Address for the advertising router field.

References NS_LOG_FUNCTION.

Copy constructor for a Global Routing Link State Advertisement.

Takes a piece of memory and constructs a semantically identical copy of the given LSA.

Parameters:
lsaThe existing LSA to be used as the source.

References CopyLinkRecords(), IsEmpty(), NS_ASSERT_MSG, and NS_LOG_FUNCTION_NOARGS.

Destroy an existing Global Routing Link State Advertisement.

Any Global Routing Link Records present in the list are freed.

References ClearLinkRecords(), and NS_LOG_FUNCTION_NOARGS.


Member Function Documentation

Add an attached router to the list in the NetworkLSA.

Parameters:
addrThe Ipv4Address of the interface on the network link
Returns:
The number of addresses in the list.

References NS_LOG_FUNCTION_NOARGS.

Add a given Global Routing Link Record to the LSA.

Parameters:
lrThe Global Routing Link Record to be added.
Returns:
The number of link records in the list.

References NS_LOG_FUNCTION_NOARGS.

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.

See also:
ClearLinkRecords ()
Parameters:
lsaThe LSA to copy the Link Records from.

References ns3::GlobalRoutingLinkRecord::GetLinkData(), ns3::GlobalRoutingLinkRecord::GetLinkId(), ns3::GlobalRoutingLinkRecord::GetLinkType(), ns3::GlobalRoutingLinkRecord::GetMetric(), NS_LOG_FUNCTION_NOARGS, ns3::GlobalRoutingLinkRecord::SetLinkData(), ns3::GlobalRoutingLinkRecord::SetLinkId(), ns3::GlobalRoutingLinkRecord::SetLinkType(), and ns3::GlobalRoutingLinkRecord::SetMetric().

Referenced by GlobalRoutingLSA(), and operator=().

Get the Advertising Router as defined by the OSPF spec. We always set it to the router ID of the router making the advertisement.

See also:
RoutingEnvironment::AllocateRouterId ()
GlobalRouting::GetRouterId ()
Returns:
The Ipv4Address stored as the advertising router.

References NS_LOG_FUNCTION_NOARGS.

Return an Ipv4Address corresponding to the specified attached router.

Parameters:
nThe attached router number desired (number in the list).
Returns:
The Ipv4Address of the requested router

References NS_ASSERT_MSG, and NS_LOG_FUNCTION_NOARGS.

Return a pointer to the specified Global Routing Link Record.

Parameters:
nThe LSA number desired.
Returns:
The number of link records in the list.

References NS_ASSERT_MSG, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::GlobalRouteManagerLSDB::GetLSAByLinkData().

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.

See also:
RoutingEnvironment::AllocateRouterId ()
GlobalRouting::GetRouterId ()
Returns:
The Ipv4Address stored as the link state ID.

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::GlobalRouteManagerImpl::BuildGlobalRoutingDatabase().

uint32_t ns3::GlobalRoutingLSA::GetNAttachedRouters ( void  ) const

Return the number of attached routers listed in the NetworkLSA.

Returns:
The number of attached routers.

References NS_LOG_FUNCTION_NOARGS.

For a Network LSA, get the Network Mask field that precedes the list of attached routers.

Returns:
the NetworkLSANetworkMask

References NS_LOG_FUNCTION_NOARGS.

uint32_t ns3::GlobalRoutingLSA::GetNLinkRecords ( void  ) const

Return the number of Global Routing Link Records in the LSA.

Returns:
The number of link records in the list.

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::GlobalRouteManagerLSDB::GetLSAByLinkData().

Get the Node pointer of the node that originated this LSA.

Returns:
Node pointer

References NS_LOG_FUNCTION_NOARGS.

Get the SPF status of the advertisement.

See also:
SPFStatus
Returns:
The SPFStatus of the LSA.

References NS_LOG_FUNCTION_NOARGS.

bool ns3::GlobalRoutingLSA::IsEmpty ( void  ) const

Check to see if the list of Global Routing Link Records present in the Global Routing Link State Advertisement is empty.

Returns:
True if the list is empty, false otherwise.

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::GlobalRouter::GetLSA(), and GlobalRoutingLSA().

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.

Parameters:
lsaThe existing LSA to be used as the source.
Returns:
Reference to the overwritten LSA.

References ClearLinkRecords(), CopyLinkRecords(), and NS_LOG_FUNCTION_NOARGS.

Set the Advertising Router as defined by the OSPF spec. We always set it to the router ID of the router making the advertisement.

Parameters:
rtrID of the router making advertisement
See also:
RoutingEnvironment::AllocateRouterId ()
GlobalRouting::GetRouterId ()

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::GlobalRouter::DiscoverLSAs().

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.

Parameters:
addrIPv4 address which will act as ID
See also:
RoutingEnvironment::AllocateRouterId ()
GlobalRouting::GetRouterId ()

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::GlobalRouter::DiscoverLSAs().

Set the Node pointer of the node that originated this LSA.

Parameters:
nodeNode pointer

References ns3::Node::GetId(), and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouter::DiscoverLSAs().

Set the SPF status of the advertisement.

Parameters:
statusSPF status to set
See also:
SPFStatus

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::GlobalRouter::DiscoverLSAs(), and ns3::GlobalRouteManagerLSDB::Initialize().


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