Link State Advertisement (LSA)
A generic LSA. All actual LSAs should be derived from this LSA.
typedef ref_ptr<Lsa> LsaRef | LsaRef |
A reference counted pointer to an LSA which will be automatically deleted.
Lsa (OspfTypes::Version version)
| Lsa |
Lsa (OspfTypes::Version version, uint8_t *buf, size_t len)
| Lsa |
Note passing in the LSA buffer does not imply that it will be decoded. The buffer is just being stored.
~Lsa ()
| ~Lsa |
[virtual]
OspfTypes::Version get_version ()
| get_version |
[const]
uint16_t get_ls_type ()
| get_ls_type |
[const pure virtual]
It is the responsibilty of the derived type to return this information.
Returns: The type this lsa represents.
bool known ()
| known |
[const virtual]
OSPFv3 only is this a known LSA.
Returns: true if this is a known LSA.
bool external ()
| external |
[const virtual]
Returns: True if this is an AS-external-LSA.
bool type7 ()
| type7 |
[const virtual]
Returns: True if this LSA is a Type-7-LSA.
size_t min_length ()
| 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.
LsaRef decode (uint8_t *buf, size_t& len)
throw(InvalidPacket) | decode |
[const pure virtual]
Decode an LSA.
Parameters:
buf | pointer to buffer. |
len | length 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.
bool encode ()
| encode |
[pure virtual]
Encode an LSA for transmission.
Returns: True on success.
uint8_t * lsa (size_t &len)
| lsa |
Get a reference to the raw LSA
Parameters:
len | The length of the LSA. |
Returns: pointer to start of the LSA.
bool available ()
| available |
[const]
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.
Lsa_header& get_header ()
| get_header |
const Lsa_header& get_header ()
| get_header |
[const]
bool valid ()
| valid |
[const]
void invalidate (bool invalidate = true)
| invalidate |
Unconditionally clear the timer and invalidate the LSA if required, the default is to invalidate the LSA.
bool get_self_originating ()
| get_self_originating |
[const]
Returns: true of this is a self originating LSA.
void set_self_originating (bool orig)
| set_self_originating |
Set the state of this LSA with respect to self originating or not.
void record_creation_time (TimeVal now)
| record_creation_time |
Record the time of creation and initial age.
Parameters:
now | the current time. |
void get_creation_time (TimeVal& now)
| get_creation_time |
Get arrival time.
Parameters:
now | out parameter which will be contain the time the LSA arrived. |
void revive (const TimeVal& now)
| revive |
Revive an LSA that is at MaxAge and MaxSequenceNumber. The age is taken back to zero and sequence number InitialSequenceNumber.
void update_age_and_seqno (const TimeVal& now)
| update_age_and_seqno |
Update the age and sequence number of a self originated LSAs. Plus encode.
void update_age (TimeVal now)
| update_age |
Update the age field based on the current time.
Parameters:
now | the current time. |
void update_age_inftransdelay (uint8_t *ptr, uint16_t inftransdelay)
| update_age_inftransdelay |
[static]
Increment the age field of an LSA by inftransdelay.
Parameters:
ptr | to the age field, first field in a LSA. |
inftransdelay | delay to add in seconds. |
void set_maxage ()
| set_maxage |
bool maxage ()
| maxage |
[const]
Is the age of this LSA MaxAge.
bool max_sequence_number ()
| max_sequence_number |
[const]
Is the LS Sequence Number MaxSequenceNumber?
int32_t get_ls_sequence_number ()
| get_ls_sequence_number |
[const]
void set_ls_sequence_number (int32_t seqno)
| set_ls_sequence_number |
void increment_sequence_number ()
| increment_sequence_number |
void add_nack (OspfTypes::NeighbourID nid)
| add_nack |
Add a neighbour ID to the NACK list.
void remove_nack (OspfTypes::NeighbourID nid)
| remove_nack |
Remove a neighbour ID from the NACK list.
bool exists_nack (OspfTypes::NeighbourID nid)
| exists_nack |
Does this neighbour exist on the NACK list.
bool empty_nack ()
| empty_nack |
[const]
If the NACK list is empty return true. All of the neighbours have now nacked this LSA.
bool get_transmitted ()
| get_transmitted |
Returns: true if this LSA has been transmitted.
void set_transmitted (bool t)
| set_transmitted |
Set the transmitted state of this LSA.
XorpTimer& get_timer ()
| get_timer |
Get a reference to the internal timer.
void set_tracing (bool trace)
| set_tracing |
bool tracing ()
| tracing |
[const]
void set_peerid (OspfTypes::PeerID peerid)
| set_peerid |
For OSPFv3 only LSAs with Link-local flooding scope save the ingress PeerID.
OspfTypes::PeerID get_peerid ()
| get_peerid |
[const]
For OSPFv3 only LSAs with Link-local flooding scope get the ingress PeerID.
bool link_local_scope ()
| link_local_scope |
[const]
bool area_scope ()
| area_scope |
[const]
bool as_scope ()
| as_scope |
[const]
const char * name ()
| name |
[const pure virtual]
string str ()
| str |
[const pure virtual]
Generate a printable representation of the LSA.
Lsa_header _header | _header |
[protected]
vector<uint8_t> _pkt | _pkt |
[protected]