xorp

Lsa Class Reference

Link State Advertisement (LSA) More...

#include <lsa.hh>

Inheritance diagram for Lsa:
ASExternalLsa IntraAreaPrefixLsa LinkLsa NetworkLsa RouterLsa SummaryNetworkLsa SummaryRouterLsa UnknownLsa

List of all members.

Public Types

typedef ref_ptr< LsaLsaRef
 A reference counted pointer to an LSA which will be automatically deleted.

Public Member Functions

 Lsa (OspfTypes::Version version)
 Lsa (OspfTypes::Version version, uint8_t *buf, size_t len)
 Note passing in the LSA buffer does not imply that it will be decoded.
OspfTypes::Version get_version () const
virtual uint16_t get_ls_type () const =0
 It is the responsibilty of the derived type to return this information.
virtual bool known () const
 OSPFv3 only is this a known LSA.
virtual bool external () const
virtual bool type7 () const
virtual size_t min_length () const =0
 It is the responsibilty of the derived type to return this information.
virtual LsaRef decode (uint8_t *buf, size_t &len) const =0 throw (InvalidPacket)
 Decode an LSA.
virtual bool encode ()=0
 Encode an LSA for transmission.
uint8_t * lsa (size_t &len)
 Get a reference to the raw LSA.
bool available () const
 Is a wire format version available?
Lsa_headerget_header ()
const Lsa_headerget_header () const
bool valid () const
 Is this LSA valid?
void invalidate (bool invalidate=true)
 Unconditionally clear the timer and invalidate the LSA if required, the default is to invalidate the LSA.
bool get_self_originating () const
void set_self_originating (bool orig)
 Set the state of this LSA with respect to self originating or not.
void record_creation_time (TimeVal now)
 Record the time of creation and initial age.
void get_creation_time (TimeVal &now)
 Get arrival time.
void revive (const TimeVal &now)
 Revive an LSA that is at MaxAge and MaxSequenceNumber.
void update_age_and_seqno (const TimeVal &now)
 Update the age and sequence number of a self originated LSAs.
void update_age (TimeVal now)
 Update the age field based on the current time.
void set_maxage ()
 Set the age to MaxAge.
bool maxage () const
 Is the age of this LSA MaxAge.
bool max_sequence_number () const
 Is the LS Sequence Number MaxSequenceNumber?
int32_t get_ls_sequence_number () const
 Get the LS Sequence Number.
void set_ls_sequence_number (int32_t seqno)
 Set the LS Sequence Number.
void increment_sequence_number ()
 Increment sequence number.
void add_nack (OspfTypes::NeighbourID nid)
 Add a neighbour ID to the NACK list.
void remove_nack (OspfTypes::NeighbourID nid)
 Remove a neighbour ID from the NACK list.
bool exists_nack (OspfTypes::NeighbourID nid)
 Does this neighbour exist on the NACK list.
bool empty_nack () const
 If the NACK list is empty return true.
bool get_transmitted ()
void set_transmitted (bool t)
 Set the transmitted state of this LSA.
XorpTimerget_timer ()
 Get a reference to the internal timer.
void set_tracing (bool trace)
bool tracing () const
void set_peerid (OspfTypes::PeerID peerid)
 For OSPFv3 only LSAs with Link-local flooding scope save the ingress PeerID.
OspfTypes::PeerID get_peerid () const
 For OSPFv3 only LSAs with Link-local flooding scope get the ingress PeerID.
bool link_local_scope () const
 OSPFv3 only Link-local scope.
bool area_scope () const
 OSPFv3 only area scope.
bool as_scope () const
 OSPFv3 only AS scope.
virtual const char * name () const =0
 Printable name of this LSA.
virtual string str () const =0
 Generate a printable representation of the LSA.

Static Public Member Functions

static void update_age_inftransdelay (uint8_t *ptr, uint16_t inftransdelay)
 Increment the age field of an LSA by inftransdelay.

Protected Attributes

Lsa_header _header
 Add the LSA type bindings.
vector< uint8_t > _pkt

Private Member Functions

void set_ls_age (uint16_t ls_age)
 Set the age and update the stored packet if it exists.
bool understood () const
 OSPFv3 only is the U-bit set, i.e.

Private Attributes

const OspfTypes::Version _version
bool _valid
bool _self_originating
uint16_t _initial_age
TimeVal _creation
XorpTimer _timer
bool _transmitted
bool _trace
set< OspfTypes::NeighbourID_nack_list
OspfTypes::PeerID _peerid
 If this is an OSPFv3 LSA and the flooding scope is Link-local then the PeerID should be set to the peer that the LSA is associated with.

Detailed Description

Link State Advertisement (LSA)

A generic LSA. All actual LSAs should be derived from this LSA.


Constructor & Destructor Documentation

Lsa::Lsa ( OspfTypes::Version  version,
uint8_t *  buf,
size_t  len 
) [inline]

Note passing in the LSA buffer does not imply that it will be decoded.

The buffer is just being stored.


Member Function Documentation

bool Lsa::available ( ) const [inline]

Is a wire format version available?

For all non self orignating LSAs there should be a wire version available.

Self originating LSAs such as Router LSAs can exist that do not yet have any valid fields (no interfaces to describe). Use this field to check if this LSA is available.

Returns:
true is a wire format version is available.
virtual LsaRef Lsa::decode ( uint8_t *  buf,
size_t &  len 
) const throw (InvalidPacket) [pure virtual]

Decode an LSA.

Parameters:
bufpointer to buffer.
lenlength of the buffer on input set to the number of bytes consumed on output.
Returns:
A reference to an LSA that manages its own memory.

Implemented in UnknownLsa, RouterLsa, NetworkLsa, SummaryNetworkLsa, SummaryRouterLsa, ASExternalLsa, LinkLsa, and IntraAreaPrefixLsa.

bool Lsa::empty_nack ( ) const [inline]

If the NACK list is empty return true.

All of the neighbours have now nacked this LSA.

virtual bool Lsa::encode ( ) [pure virtual]

Encode an LSA for transmission.

Returns:
True on success.

Implemented in UnknownLsa, RouterLsa, NetworkLsa, SummaryNetworkLsa, SummaryRouterLsa, ASExternalLsa, LinkLsa, and IntraAreaPrefixLsa.

virtual bool Lsa::external ( ) const [inline, virtual]
Returns:
True if this is an AS-external-LSA.

Reimplemented in ASExternalLsa, and Type7Lsa.

void Lsa::get_creation_time ( TimeVal now) [inline]

Get arrival time.

Parameters:
nowout parameter which will be contain the time the LSA arrived.
virtual uint16_t Lsa::get_ls_type ( ) const [pure virtual]

It is the responsibilty of the derived type to return this information.

Returns:
The type this lsa represents.

Implemented in UnknownLsa, RouterLsa, NetworkLsa, SummaryNetworkLsa, SummaryRouterLsa, ASExternalLsa, Type7Lsa, LinkLsa, and IntraAreaPrefixLsa.

bool Lsa::get_self_originating ( ) const [inline]
Returns:
true of this is a self originating LSA.
bool Lsa::get_transmitted ( ) [inline]
Returns:
true if this LSA has been transmitted.
virtual bool Lsa::known ( ) const [inline, virtual]

OSPFv3 only is this a known LSA.

Returns:
true if this is a known LSA.

Reimplemented in UnknownLsa.

uint8_t* Lsa::lsa ( size_t &  len) [inline]

Get a reference to the raw LSA.

Parameters:
lenThe length of the LSA.
Returns:
pointer to start of the LSA.
virtual size_t Lsa::min_length ( ) const [pure virtual]

It is the responsibilty of the derived type to return this information.

Returns:
The minmum possible length of this LSA.

Implemented in UnknownLsa, RouterLsa, NetworkLsa, SummaryNetworkLsa, SummaryRouterLsa, ASExternalLsa, LinkLsa, and IntraAreaPrefixLsa.

void Lsa::record_creation_time ( TimeVal  now) [inline]

Record the time of creation and initial age.

Parameters:
nowthe current time.
void Lsa::revive ( const TimeVal now)

Revive an LSA that is at MaxAge and MaxSequenceNumber.

The age is taken back to zero and sequence number InitialSequenceNumber.

virtual bool Lsa::type7 ( ) const [inline, virtual]
Returns:
True if this LSA is a Type-7-LSA.

Reimplemented in Type7Lsa.

bool Lsa::understood ( ) const [inline, private]

OSPFv3 only is the U-bit set, i.e.

should this LSA be processed as if it is understood; obviously if we already know about it it is understood.

void Lsa::update_age ( TimeVal  now)

Update the age field based on the current time.

Parameters:
nowthe current time.
void Lsa::update_age_and_seqno ( const TimeVal now)

Update the age and sequence number of a self originated LSAs.

Plus encode.

void Lsa::update_age_inftransdelay ( uint8_t *  ptr,
uint16_t  inftransdelay 
) [static]

Increment the age field of an LSA by inftransdelay.

Parameters:
ptrto the age field, first field in a LSA.
inftransdelaydelay to add in seconds.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations