xorp

AreaRouter< A > Class Template Reference

Area Router. More...

#include <area_router.hh>

Inheritance diagram for AreaRouter< A >:
ServiceBase BugCatcher

List of all members.

Classes

struct  PeerState
 Internal state that is required about each peer. More...
struct  Range
 Range to be summarised or suppressed from other areas. More...

Public Types

enum  LsaSearch { NOMATCH, EQUIVALENT, NEWER, OLDER }
 

Returned by compare_lsa.


Public Member Functions

 AreaRouter (Ospf< A > &ospf, OspfTypes::AreaID area, OspfTypes::AreaType area_type)
int startup ()
 Required by the class Subsystem.
int shutdown ()
 Required by the class Subsystem.
void add_peer (OspfTypes::PeerID peer)
 Add peer.
void delete_peer (OspfTypes::PeerID peer)
 Delete peer.
bool peer_up (OspfTypes::PeerID peer)
 Peer came up.
bool peer_down (OspfTypes::PeerID peer)
 Peer went down.
void area_border_router_transition (bool up)
 Track border router transitions.
void change_area_router_type (OspfTypes::AreaType area_type)
 Change the type of this area.
bool find_global_address (uint32_t adv, uint16_t type, LsaTempStore &lsa_temp_store, A &global_address) const
 Given an advertising router and type find a global address if present in its associated Intra-Area-Prefix-LSA if present, OSPFv3 only.
bool configured_virtual_link () const
bool add_virtual_link (OspfTypes::RouterID rid)
 Add a virtual link endpoint.
bool remove_virtual_link (OspfTypes::RouterID rid)
 Remove a virtual link endpoint.
void start_virtual_link ()
 Start looking through the list of routers for a virtual link endpoint.
void check_for_virtual_linkV2 (const RouteCmd< Vertex > &rc, Lsa::LsaRef lsar)
 Check this node to see if its a virtual link endpoint.
void check_for_virtual_linkV3 (const RouteCmd< Vertex > &rc, Lsa::LsaRef lsar, LsaTempStore &lsa_temp_store)
 Check this node to see if its a virtual link endpoint.
void end_virtual_link ()
 End looking through the list of routers for a virtual link endpoint.
bool find_interface_address (Lsa::LsaRef src, Lsa::LsaRef dst, A &interface) const
 Given two LSAs find the interface address of the destination LSA.
bool find_interface_address (OspfTypes::RouterID rid, uint32_t interface_id, A &interface)
 OSPFv3 only.
bool area_range_add (IPNet< A > net, bool advertise)
 Add area range.
bool area_range_delete (IPNet< A > net)
 Delete area range.
bool area_range_change_state (IPNet< A > net, bool advertise)
 Change the advertised state of this area.
bool area_range_covered (IPNet< A > net, bool &advertise)
 Is network covered by an area range and if it is should it be advertised.
bool area_range_covering (IPNet< A > net, IPNet< A > &sumnet)
 This network falls in a covered area range, return the covering range.
bool area_range_configured ()
 Does this area have any area ranges configured.
bool originate_default_route (bool enable)
 If this is a "stub" or "nssa" area toggle the sending of a default route.
bool stub_default_cost (uint32_t cost)
 Set the StubDefaultCost, the default cost sent in a default route in a "stub" or "nssa" area.
bool summaries (bool enable)
 Toggle the sending of summaries into "stub" or "nssa" areas.
bool get_lsa (const uint32_t index, bool &valid, bool &toohigh, bool &self, vector< uint8_t > &lsa)
 get lsa at index if it exists.
bool new_router_links (OspfTypes::PeerID peer, const list< RouterLink > &router_link)
 A new set of router links.
void refresh_router_lsa (bool timer=false)
 Refresh Router-LSA.
void stub_networksV3 (bool timer)
 For OSPFv3 only there are no router links describing stub networks, Intra-Area-Prefix-LSAs that reference the Router-LSA have to be generated.
void summary_announce (OspfTypes::AreaID area, IPNet< A > net, RouteEntry< A > &rt, bool push)
 A new route has been added to the routing table it is being presented to this area for possible Summary-LSA generation.
void summary_withdraw (OspfTypes::AreaID area, IPNet< A > net, RouteEntry< A > &rt)
 A route has been deleted from the routing table.
void summary_replace (OspfTypes::AreaID area, IPNet< A > net, RouteEntry< A > &rt, RouteEntry< A > &previous_rt, OspfTypes::AreaID previous_area)
 A route has been replaced in the routing table.
bool external_area_type () const
void external_copy_net_nexthop (A, ASExternalLsa *dst, ASExternalLsa *src)
 Copy the net and nexthop information from one AS-External-LSA to another.
Lsa::LsaRef external_generate_type7 (Lsa::LsaRef lsar, bool &indb)
 Given an AS-External-LSA generate a Type-7 LSA.
Lsa::LsaRef external_generate_external (Lsa::LsaRef lsar)
 Given a Type-7 LSA generate an AS-External-LSA.
void external_announce (Lsa::LsaRef lsar, bool push, bool redist)
 An AS-External-LSA being announced either from another area or from the RIB as a redist.
void external_announce_complete ()
 Called to complete a series of calls to external_announce().
void external_refresh (Lsa::LsaRef lsar)
 Refresh this LSA either because a timer has expired or because a newer LSA has arrived from another area.
void external_withdraw (Lsa::LsaRef lsar)
 An AS-External-LSA being withdrawn either from another area or from the RIB as a redist.
bool add_link_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar)
 Add a Link-LSA for this peer.
bool update_link_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar)
 Update the Link-LSA for this peer.
bool withdraw_link_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar)
 Withdraw the Link-LSA for this peer.
void refresh_link_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar)
 Refresh the Link-LSA for this peer.
bool generate_network_lsa (OspfTypes::PeerID peer, OspfTypes::RouterID link_state_id, list< RouterInfo > &attached_routers, uint32_t network_mask)
 Generate a Network-LSA for this peer.
bool update_network_lsa (OspfTypes::PeerID peer, OspfTypes::RouterID link_state_id, list< RouterInfo > &attached_routers, uint32_t network_mask)
 Update the Network-LSA for this peer.
bool withdraw_network_lsa (OspfTypes::PeerID peer, OspfTypes::RouterID link_state_id)
 Withdraw the Network-LSA for this peer by prematurely aging.
void refresh_network_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar, bool timer=false)
 Refresh the Network-LSAs.
bool check_link_lsa (LinkLsa *nllsa, LinkLsa *ollsa)
 OSPFv3 only.
void update_intra_area_prefix_lsa (OspfTypes::PeerID peerid)
 OSPFv3 only.
bool generate_intra_area_prefix_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar, uint32_t interface_id)
 Generate a Intra-Area-Prefix-LSA for this peer OSPFv3 only and add it to the database.
uint32_t populate_prefix (OspfTypes::PeerID peeridid, uint32_t interface_id, OspfTypes::RouterID router_id, list< IPv6Prefix > &prefixes)
 OSPFv3 only.
uint32_t update_intra_area_prefix_lsa (OspfTypes::PeerID peer, uint16_t referenced_ls_type, OspfTypes::RouterID interface_id, const list< RouterInfo > &attached_routers)
 Update the Intra-Area-Prefix-LSA for this peer OSPFv3 only.
bool withdraw_intra_area_prefix_lsa (OspfTypes::PeerID peer, uint16_t referenced_ls_type, uint32_t interface_id)
 Withdraw the Intra-Area-Prefix-LSA for this peer by prematurely aging OSPFv3 only.
void refresh_intra_area_prefix_lsa (OspfTypes::PeerID peerid, uint16_t referenced_ls_type, uint32_t interface_id)
 Refresh the Intra-Area-Prefix-LSA OSPFv3 only.
void generate_default_route ()
 Create an LSA that will be used to announce the default route into "stub" and "nssa" areas.
bool find_default_route (size_t &index)
 Find the default route LSA in the database if it exists.
void save_default_route ()
 If the default route LSA is in the database remove it.
void restore_default_route ()
 If the default route LSA should be in the database put it back.
void withdraw_default_route ()
 Withdraw the default route LSA if it exists.
void refresh_default_route ()
 Refresh the default route LSA.
OspfTypes::AreaType get_area_type () const
 Add a network to be announced.
uint32_t get_options ()
 Get the options that are sent in hello packets, data description packets, LSA headers (OSPFv2), Router-LSAs (OSPFv3) and Network-LSAs (OSPFv3).
void receive_lsas (OspfTypes::PeerID peerid, OspfTypes::NeighbourID nid, list< Lsa::LsaRef > &lsas, list< Lsa_header > &direct_ack, list< Lsa_header > &delayed_ack, bool is_router_dr, bool is_router_bdr, bool is_neighbour_dr)
 Receive LSAs.
LsaSearch compare_lsa (const Lsa_header &candidate, const Lsa_header &current) const
 Compare two LSAs.
LsaSearch compare_lsa (const Lsa_header &) const
 Compare this LSA to.
bool newer_lsa (const Lsa_header &) const
bool get_lsas (const list< Ls_request > &requests, list< Lsa::LsaRef > &lsas)
 Fetch a list of lsas given a list of requests.
DataBaseHandle open_database (OspfTypes::PeerID peerid, bool &empty)
 Open database.
bool valid_entry_database (OspfTypes::PeerID peerid, size_t index)
 Is this a valid entry to be returned by the database.
bool subsequent (DataBaseHandle &dbh)
 Is there another database entry following this one.
Lsa::LsaRef get_entry_database (DataBaseHandle &dbh, bool &last)
 Next database entry.
void close_database (DataBaseHandle &dbh)
 Close the database.
void clear_database (bool preserve_link_lsas=false)
 Clear the database.
void maxage_type_database (uint16_t type)
 All self originated LSAs of this type MaxAge them.
bool backbone () const
 Is this the backbone area?
bool backbone (OspfTypes::AreaID area) const
bool get_transit_capability () const
void routing_total_recompute ()
 Totally recompute the routing table from the LSA database.
void testing_routing_total_recompute ()
 Testing entry point to force a total routing computation.
void testing_print_link_state_database () const
 Print link state database.
bool testing_replace_router_lsa (Lsa::LsaRef lsar)
 Testing entry point to add this router Router-LSA to the database replacing the one that is already there.
bool testing_add_lsa (Lsa::LsaRef lsar)
 Testing entry point to add an LSA to the database.
bool testing_delete_lsa (Lsa::LsaRef lsar)
 Testing entry point to delete an LSA from the database.
string str ()
template<>
bool find_global_address (uint32_t, uint16_t, LsaTempStore &, IPv4 &) const
template<>
bool find_global_address (uint32_t adv, uint16_t type, LsaTempStore &lsa_temp_store, IPv6 &global_address) const
template<>
void check_for_virtual_linkV3 (const RouteCmd< Vertex > &, Lsa::LsaRef, LsaTempStore &)
template<>
void check_for_virtual_linkV3 (const RouteCmd< Vertex > &rc, Lsa::LsaRef r, LsaTempStore &lsa_temp_store)
template<>
bool find_interface_address (Lsa::LsaRef src, Lsa::LsaRef dst, IPv4 &interface) const
template<>
bool find_interface_address (Lsa::LsaRef, Lsa::LsaRef, IPv6 &) const
template<>
bool find_interface_address (OspfTypes::RouterID, uint32_t, IPv4 &)
template<>
bool find_interface_address (OspfTypes::RouterID rid, uint32_t interface_id, IPv6 &interface)

Public Attributes

Lsa::LsaRef _saved_default_route

Private Types

typedef ref_ptr< PeerStatePeerStateRef
typedef map< OspfTypes::PeerID,
PeerStateRef
PeerMap

Private Member Functions

void set_transit_capability (bool t)
void unique_link_state_id (Lsa::LsaRef lsar)
 Networks with same network number but different prefix lengths can generate the same link state ID.
bool unique_find_lsa (Lsa::LsaRef lsar, const IPNet< A > &net, size_t &index)
 Networks with same network number but different prefix lengths can generate the same link state ID.
void summary_network_lsa_set_net_lsid (SummaryNetworkLsa *snlsa, IPNet< A > net)
 Set network and link state ID in a Summary-LSA/Inter-Area-Prefix-LSA.
Lsa::LsaRef summary_network_lsa (IPNet< A > net, RouteEntry< A > &rt)
Lsa::LsaRef summary_network_lsa_intra_area (OspfTypes::AreaID area, IPNet< A > net, RouteEntry< A > &rt, bool &announce)
 Generate a Summary-LSA for an intra area path taking into account area ranges.
Lsa::LsaRef summary_build (OspfTypes::AreaID area, IPNet< A > net, RouteEntry< A > &rt, bool &announce)
 Construct a summary LSA if appropriate.
void refresh_summary_lsa (Lsa::LsaRef lsar)
 Announce this Summary-LSA to all neighbours and refresh it as appropriate.
bool age_lsa (Lsa::LsaRef lsar)
 Start aging LSA.
void maxage_reached (Lsa::LsaRef lsar, size_t index)
 This LSA has reached MAXAGE so flood it to all the peers of this area.
void premature_aging (Lsa::LsaRef lsar, size_t index)
 Prematurely age self originated LSAs, remove them from the database flood with age set to MAXAGE.
void increment_sequence_number (Lsa::LsaRef lsar)
 Increment the sequence number of of this LSA, most importantly handle the sequence number reaching MaxSequenceNumber.
void update_age_and_seqno (Lsa::LsaRef lsar, const TimeVal &now)
 Update the age and increment the sequence number of of this LSA, most importantly handle the sequence number reaching MaxSequenceNumber.
void max_sequence_number_reached (Lsa::LsaRef lsar)
 Process an LSA where the sequence number has reached MaxSequenceNumber.
bool reincarnate ()
 Reincarnate LSAs that have gone through the MaxSequenceNumber transition.
bool add_lsa (Lsa::LsaRef lsar)
 Add this LSA to the database.
bool delete_lsa (Lsa::LsaRef lsar, size_t index, bool invalidate)
 Delete this LSA from the database.
bool update_lsa (Lsa::LsaRef lsar, size_t index)
 Update this LSA in the database.
bool find_lsa (const Ls_request &lsr, size_t &index) const
 Find LSA matching this request.
bool find_lsa (Lsa::LsaRef lsar, size_t &index) const
 Find LSA matching this request.
bool find_network_lsa (uint32_t link_state_id, size_t &index) const
 Find Network-LSA.
bool find_router_lsa (uint32_t advertising_router, size_t &index) const
 Find Router-LSA.
LsaSearch compare_lsa (const Lsa_header &, size_t &index) const
 Compare this LSA to.
bool update_router_links ()
 Update router links.
void publish (const OspfTypes::PeerID peerid, const OspfTypes::NeighbourID nid, Lsa::LsaRef lsar, bool &multicast_on_peer) const
void publish_all (Lsa::LsaRef lsar)
void push_lsas (const char *msg)
 Send (push) any queued LSAs.
bool external_propagate_bit (Lsa::LsaRef lsar) const
 Return the setting of the propagate bit in a Type-7-LSA.
void external_type7_translate (Lsa::LsaRef lsar)
 Take a Type-7-LSA that has arrived on the wire and translate if required.
void external_flood_all_areas (Lsa::LsaRef lsar)
 Send this LSA to all area's.
void external_push_all_areas ()
 Notify all areas this is the last of the AS-External-LSAs.
bool neighbours_exchange_or_loading () const
bool neighbour_at_least_two_way (OspfTypes::RouterID rid) const
bool get_neighbour_address (OspfTypes::RouterID rid, uint32_t interface_id, A &neighbour_address) const
 OSPFv3 Only Neighbour's source address.
bool on_link_state_request_list (const OspfTypes::PeerID peerid, const OspfTypes::NeighbourID nid, Lsa::LsaRef lsar) const
 Is this LSA on this neighbours link state request list.
bool event_bad_link_state_request (const OspfTypes::PeerID peerid, const OspfTypes::NeighbourID nid) const
 Generate a BadLSReq event.
bool send_lsa (const OspfTypes::PeerID peerid, const OspfTypes::NeighbourID nid, Lsa::LsaRef lsar) const
 Send this LSA directly to the neighbour.
bool self_originated_by_interface (Lsa::LsaRef lsar, A=A::ZERO()) const
 Check this LSA to see if its link state id matched any of the routers interfaces.
bool self_originated (Lsa::LsaRef lsar, bool match, size_t index)
 If this is a self-originated LSA do the appropriate processing.
void RouterVertex (Vertex &v)
 Create a vertex for this router.
void routing_begin ()
 Prepare for routing changes.
void routing_add (Lsa::LsaRef lsar, bool known)
 Add this LSA to the routing computation.
void routing_delete (Lsa::LsaRef lsar)
 Remove this LSA from the routing computation.
void routing_end ()
 Routing changes are completed.
void routing_schedule_total_recompute ()
 Schedule recomputing the whole table.
void routing_timer ()
 Callback routine that causes route recomputation.
void routing_total_recomputeV2 ()
 Totally recompute the routing table from the LSA database.
void routing_total_recomputeV3 ()
void routing_table_add_entry (RoutingTable< A > &routing_table, IPNet< A > net, RouteEntry< A > &route_entry, const char *msg)
 Add an entry to the routing table making sure that an entry doesn't already exist.
void routing_area_ranges (list< RouteCmd< Vertex > > &r)
 Compute the discard routes related to area ranges.
void routing_area_rangesV2 (const list< RouteCmd< Vertex > > &r)
void routing_area_rangesV3 (const list< RouteCmd< Vertex > > &r, LsaTempStore &lsa_temp_store)
void routing_inter_area ()
 Compute the inter-area routes.
void routing_inter_areaV2 ()
void routing_inter_areaV3 ()
void routing_transit_area ()
 Compute the transit area routes.
void routing_transit_areaV2 ()
void routing_transit_areaV3 ()
void routing_as_external ()
 Compute the AS external routes.
void routing_as_externalV2 ()
void routing_as_externalV3 ()
bool associated_prefixesV3 (uint16_t ls_type, uint32_t referenced_link_state_id, const list< IntraAreaPrefixLsa * > &lsai, list< IPv6Prefix > &prefixes) const
 Given a LS type and a referenced link state ID and the list of Intra-Area-Prefix-LSAs generated by the same router, return the list of prefixes that are associated with the LSA.
bool routing_compare_externals (Lsa::LsaRef current, Lsa::LsaRef candidate) const
 RFC 3101 Section 2.5.
bool bidirectionalV2 (RouterLink::Type rl_type, const uint32_t link_state_id, const RouterLink &rl, RouterLsa *rlsa, uint16_t &metric, uint32_t &interface_address)
 Does this Router-LSA point back to the router link that points at it.
bool bidirectional (const uint32_t link_state_id_or_adv, const RouterLink &rl, NetworkLsa *nlsa) const
 Does this Network-LSA point back to the router link that points at it.
bool bidirectionalV2 (RouterLsa *rlsa, NetworkLsa *nlsa, uint32_t &interface_address)
 Does the Router-LSA point at the Network-LSA that points at it.
bool bidirectionalV3 (RouterLsa *rlsa, NetworkLsa *nlsa, uint32_t &interface_id)
 Does the Router-LSA point at the Network-LSA that points at it, OSPFv3.
bool bidirectionalV3 (RouterLink::Type rl_type, uint32_t advertising_router, RouterLsa *rlsa, uint16_t &metric)
 Does this Router-LSA point back to the router link that points at it, OSPFv3.
void routing_router_lsaV2 (Spt< Vertex > &spt, const Vertex &src, RouterLsa *rlsa)
 Add this newly arrived or changed Router-LSA to the SPT.
void routing_router_link_p2p_vlinkV2 (Spt< Vertex > &spt, const Vertex &src, RouterLsa *rlsa, RouterLink rl)
void routing_router_link_transitV2 (Spt< Vertex > &spt, const Vertex &src, RouterLsa *rlsa, RouterLink rl)
void routing_router_link_stubV2 (Spt< Vertex > &spt, const Vertex &src, RouterLsa *rlsa, RouterLink rl)
void routing_router_lsaV3 (Spt< Vertex > &spt, const Vertex &src, RouterLsa *rlsa)
 Add this newly arrived or changed Router-LSA to the SPT.
void routing_router_link_p2p_vlinkV3 (Spt< Vertex > &spt, const Vertex &src, RouterLsa *rlsa, RouterLink rl)
void routing_router_link_transitV3 (Spt< Vertex > &spt, const Vertex &src, RouterLsa *rlsa, RouterLink rl)
template<>
void unique_link_state_id (Lsa::LsaRef lsar)
template<>
void unique_link_state_id (Lsa::LsaRef)
template<>
bool unique_find_lsa (Lsa::LsaRef lsar, const IPNet< IPv4 > &net, size_t &index)
template<>
bool unique_find_lsa (Lsa::LsaRef lsar, const IPNet< IPv6 > &, size_t &index)
template<>
void summary_network_lsa_set_net_lsid (SummaryNetworkLsa *snlsa, IPNet< IPv4 > net)
template<>
void summary_network_lsa_set_net_lsid (SummaryNetworkLsa *snlsa, IPNet< IPv6 > net)
template<>
bool self_originated_by_interface (Lsa::LsaRef lsar, IPv4) const
template<>
bool self_originated_by_interface (Lsa::LsaRef, IPv6) const
template<>
void routing_area_rangesV2 (const list< RouteCmd< Vertex > > &r)
template<>
void routing_inter_areaV2 ()
template<>
void routing_transit_areaV2 ()
template<>
void routing_as_externalV2 ()
template<>
void routing_area_rangesV3 (const list< RouteCmd< Vertex > > &r, LsaTempStore &lsa_temp_store)
template<>
void routing_inter_areaV3 ()
template<>
void routing_transit_areaV3 ()
template<>
void routing_as_externalV3 ()
template<>
void routing_total_recomputeV2 ()
template<>
void routing_total_recomputeV2 ()
template<>
void routing_total_recomputeV3 ()
template<>
void routing_total_recomputeV3 ()
template<>
void routing_area_rangesV2 (const list< RouteCmd< Vertex > > &r)
template<>
void routing_area_rangesV3 (const list< RouteCmd< Vertex > > &r, LsaTempStore &lsa_temp_store)
template<>
void routing_inter_areaV2 ()
template<>
void routing_inter_areaV3 ()
template<>
void routing_transit_areaV2 ()
template<>
void routing_transit_areaV3 ()
template<>
void routing_as_externalV2 ()
template<>
void routing_as_externalV3 ()

Private Attributes

Ospf< A > & _ospf
OspfTypes::AreaID _area
OspfTypes::AreaType _area_type
map< OspfTypes::RouterID, bool > _vlinks
set< OspfTypes::RouterID_tmp
bool _summaries
bool _stub_default_announce
uint32_t _stub_default_cost
bool _external_flooding
Lsa::LsaRef _invalid_lsa
Lsa::LsaRef _router_lsa
vector< Lsa::LsaRef_db
deque< size_t > _empty_slots
uint32_t _last_entry
uint32_t _allocated_entries
uint32_t _readers
DelayQueue< Lsa::LsaRef_queue
XorpTimer _reincarnate_timer
list< Lsa::LsaRef_reincarnate
uint32_t _lsid
map< IPNet< IPv6 >, uint32_t > _lsmap
bool _TransitCapability
PeerMap _peers
uint32_t _routing_recompute_delay
XorpTimer _routing_recompute_timer
OspfTypes::NSSATranslatorRole _translator_role
OspfTypes::NSSATranslatorState _translator_state
bool _type7_propagate
Trie< A, Range_area_range

Detailed Description

template<typename A>
class AreaRouter< A >

Area Router.


Member Function Documentation

template<typename A >
bool AreaRouter< A >::add_lsa ( Lsa::LsaRef  lsar) [private]

Add this LSA to the database.

The LSA must have an updated age field.

Parameters:
lsarLSA to add.
Returns:
true on success
template<typename A >
bool AreaRouter< A >::age_lsa ( Lsa::LsaRef  lsar) [private]

Start aging LSA.

All non self originated LSAs must be aged and when they reach MAXAGE flooded and flushed.

template<typename A >
void AreaRouter< A >::area_border_router_transition ( bool  up)

Track border router transitions.

Parameters:
uptrue of the router just became an area border router, false if the router was an area border router and is no longer.
template<typename A >
bool AreaRouter< A >::associated_prefixesV3 ( uint16_t  ls_type,
uint32_t  referenced_link_state_id,
const list< IntraAreaPrefixLsa * > &  lsai,
list< IPv6Prefix > &  prefixes 
) const [private]

Given a LS type and a referenced link state ID and the list of Intra-Area-Prefix-LSAs generated by the same router, return the list of prefixes that are associated with the LSA.

Parameters:
ls_typeFrom Router-LSA or Network-LSA
referenced_link_state_idzero for a Router-LSA and the link state ID from a Network-LSA (in fact its interface ID).
iaplList of Intra-Area-Prefix-LSAs same router as the Router-LSA
prefixes(out argument) List if prefixes associated with LSA
template<typename A >
bool AreaRouter< A >::bidirectional ( const uint32_t  link_state_id_or_adv,
const RouterLink rl,
NetworkLsa nlsa 
) const [private]

Does this Network-LSA point back to the router link that points at it.

Parameters:
link_state_id_or_advOSPFv2 Link State ID, OSPFv3 Advertising Router.
template<typename A >
bool AreaRouter< A >::bidirectionalV2 ( RouterLink::Type  rl_type,
const uint32_t  link_state_id,
const RouterLink rl,
RouterLsa rlsa,
uint16_t &  metric,
uint32_t &  interface_address 
) [private]

Does this Router-LSA point back to the router link that points at it.

Parameters:
rl_typetype of link p2p or vlink
link_state_idfrom RouterLSA that points at rlsa.
rllink from RouterLSA that points at rlsa.
rlsathat is pointed at by previous two arguments.
metric(out argument) from rlsa back to link_state_id if the back pointer exists.
interface_address(out argument) if the back pointer exists.
Returns:
true if the back pointer exists also fill in the metric and interface address. value.
template<typename A >
bool AreaRouter< A >::bidirectionalV2 ( RouterLsa rlsa,
NetworkLsa nlsa,
uint32_t &  interface_address 
) [private]

Does the Router-LSA point at the Network-LSA that points at it.

Parameters:
interface_address(out argument) if the back pointer exists.
Returns:
true if Router-LSA points at the Network-LSA.
template<typename A >
bool AreaRouter< A >::bidirectionalV3 ( RouterLsa rlsa,
NetworkLsa nlsa,
uint32_t &  interface_id 
) [private]

Does the Router-LSA point at the Network-LSA that points at it, OSPFv3.

Parameters:
interface_id(out argument) interface ID if the Router-LSA points at the Network-LSA.
Returns:
true if Router-LSA points at the Network-LSA.
template<typename A >
bool AreaRouter< A >::bidirectionalV3 ( RouterLink::Type  rl_type,
uint32_t  advertising_router,
RouterLsa rlsa,
uint16_t &  metric 
) [private]

Does this Router-LSA point back to the router link that points at it, OSPFv3.

Parameters:
rl_typetype of link p2p or vlink
advertising_router
rlsathat is searched for a router link pointing at the advertising router.
metric(out argument) from rlsa back to advertising router if the back pointer exists.
Returns:
true if the Router-LSA points to the advertising router.
template<typename A >
void AreaRouter< A >::check_for_virtual_linkV2 ( const RouteCmd< Vertex > &  rc,
Lsa::LsaRef  lsar 
)

Check this node to see if its a virtual link endpoint.

Parameters:
rcnode under consideration.
routerthis router's Router-LSA.
template<typename A>
void AreaRouter< A >::check_for_virtual_linkV3 ( const RouteCmd< Vertex > &  rc,
Lsa::LsaRef  lsar,
LsaTempStore lsa_temp_store 
)

Check this node to see if its a virtual link endpoint.

Parameters:
rcnode under consideration.
lsarRouterLSA belonging to the router under consideration.
lsa_temp_storestore of all possible Router-LSAs.
template<typename A >
bool AreaRouter< A >::check_link_lsa ( LinkLsa nllsa,
LinkLsa ollsa 
)

OSPFv3 only.

A new Link-LSA has arrived if this router is the designated router then it may be necessary to generate a new Intra-Area-Prefix-LSA.

Returns:
true if a new Intra-Area-Prefix-LSA needs to be generated.
template<typename A >
void AreaRouter< A >::clear_database ( bool  preserve_link_lsas = false)

Clear the database.

Parameters:
preserve_link_lsasif true when clearing the database don't remove Link-LSAs that were generated by this router. Relevant to OSPFv3 only.
template<typename A >
void AreaRouter< A >::close_database ( DataBaseHandle dbh)

Close the database.

Parameters:
dbdDatabase descriptor
template<typename A >
AreaRouter< A >::LsaSearch AreaRouter< A >::compare_lsa ( const Lsa_header candidate,
const Lsa_header current 
) const

Compare two LSAs.

RFC 2328 Section 13.1 Determining which LSA is newer.

Parameters:
candidateoffered LSA
currentequivalent to the database copy.
Returns:
LsaSearch that describes the type of match.
template<typename A >
AreaRouter< A >::LsaSearch AreaRouter< A >::compare_lsa ( const Lsa_header lsah) const

Compare this LSA to.

Parameters:
Lsa_headerthat is being sought.
Returns:
LsaSearch that describes the type of match.
template<typename A >
AreaRouter< A >::LsaSearch AreaRouter< A >::compare_lsa ( const Lsa_header lsah,
size_t &  index 
) const [private]

Compare this LSA to.

Parameters:
Lsa_headerthat is being sought.
indexinto LSA database if search succeeded.
Returns:
LsaSearch that describes the type of match.
template<typename A >
bool AreaRouter< A >::configured_virtual_link ( ) const
Returns:
true if any virtual links are configured through this area.
template<typename A >
bool AreaRouter< A >::delete_lsa ( Lsa::LsaRef  lsar,
size_t  index,
bool  invalidate 
) [private]

Delete this LSA from the database.

Parameters:
lsarLSA to delete.
indexinto database.
invalidateif true as well as removing from the database mark the LSA as invalid.
Returns:
true on success
template<typename A >
bool AreaRouter< A >::event_bad_link_state_request ( const OspfTypes::PeerID  peerid,
const OspfTypes::NeighbourID  nid 
) const [private]

Generate a BadLSReq event.

Parameters:
peerid
nid
template<typename A >
void AreaRouter< A >::external_announce ( Lsa::LsaRef  lsar,
bool  push,
bool  redist 
)

An AS-External-LSA being announced either from another area or from the RIB as a redist.

The LSAs should not be scheduled for transmission until the external_announce_complete() is seen. In many cases a number of LSAs may arrive in a single packet, waiting for the external_announce_complete() offers an opportunity for aggregation.

Parameters:
lsarthe AS-External-LSA
pushset to true if the push is a result of an external_push().
redisttrue if this LSA was locally generated due to a redistribution.
template<typename A >
bool AreaRouter< A >::external_area_type ( ) const
Returns:
true if this area should accept an AS-External-LSA or a Type-7-LSA.
template<typename A >
void AreaRouter< A >::external_copy_net_nexthop ( ,
ASExternalLsa dst,
ASExternalLsa src 
)

Copy the net and nexthop information from one AS-External-LSA to another.

The first dummy argument A is to allow template specialisation by address family.

template<typename A >
void AreaRouter< A >::external_flood_all_areas ( Lsa::LsaRef  lsar) [private]

Send this LSA to all area's.

This is an AS-External-LSA being sent to other areas.

Parameters:
lsarThe LSA to publish
template<typename A >
Lsa::LsaRef AreaRouter< A >::external_generate_type7 ( Lsa::LsaRef  lsar,
bool &  indb 
)

Given an AS-External-LSA generate a Type-7 LSA.

Parameters:
indbif true the Type-7-LSA is already in the database.
template<typename A >
void AreaRouter< A >::external_refresh ( Lsa::LsaRef  lsar)

Refresh this LSA either because a timer has expired or because a newer LSA has arrived from another area.

In either cause the LSA should already be in this area's database.

template<typename A >
void AreaRouter< A >::external_withdraw ( Lsa::LsaRef  lsar)

An AS-External-LSA being withdrawn either from another area or from the RIB as a redist.

Parameters:
lsarthe AS-External-LSA
template<typename A>
bool AreaRouter< A >::find_global_address ( uint32_t  adv,
uint16_t  type,
LsaTempStore lsa_temp_store,
A &  global_address 
) const

Given an advertising router and type find a global address if present in its associated Intra-Area-Prefix-LSA if present, OSPFv3 only.

Parameters:
advadvertising router.
typeof Intra-Area-Prefix-LSA (Router-LSA or Network-LSA), Router-LSA expected.
lsa_temp_storestore of all possible Router-LSAs.
global_address(out) argument.
Returns:
true if global address found.
template<typename A>
bool AreaRouter< A >::find_interface_address ( Lsa::LsaRef  src,
Lsa::LsaRef  dst,
A &  interface 
) const

Given two LSAs find the interface address of the destination LSA.

The source LSA can be a Router-LSA or a Network-LSA the destination LSA must be a Router-LSA.

template<typename A>
bool AreaRouter< A >::find_interface_address ( OspfTypes::RouterID  rid,
uint32_t  interface_id,
A &  interface 
)

OSPFv3 only.

Given a Router ID and interface ID find the associated Link-LSA if present and return the Link-local Interface Address.

template<typename A >
bool AreaRouter< A >::find_lsa ( const Ls_request lsr,
size_t &  index 
) const [private]

Find LSA matching this request.

Parameters:
lsrthat is being sought.
indexinto LSA database if search succeeded.
Returns:
true if an LSA was found.
template<typename A >
bool AreaRouter< A >::find_lsa ( Lsa::LsaRef  lsar,
size_t &  index 
) const [private]

Find LSA matching this request.

Parameters:
lsarthat is being sought.
indexinto LSA database if search succeeded.
Returns:
true if an LSA was found.
template<typename A >
bool AreaRouter< A >::find_network_lsa ( uint32_t  link_state_id,
size_t &  index 
) const [private]

Find Network-LSA.

Parameters:
link_state_id
indexinto LSA database if search succeeded.
Returns:
true if an LSA was found.
template<typename A >
bool AreaRouter< A >::find_router_lsa ( uint32_t  advertising_router,
size_t &  index 
) const [private]

Find Router-LSA.

OSPFv3 only

In OSPFv3 a router may generate more that one Router-LSA. In order to find all the Router-LSAs that a router may have generated the index must be seeded.

Parameters:
advertising_router
indexinto LSA database if search succeeded. On input the index should be set to one past the last search result.
Returns:
true if an LSA was found.
template<typename A >
bool AreaRouter< A >::generate_intra_area_prefix_lsa ( OspfTypes::PeerID  peerid,
Lsa::LsaRef  lsar,
uint32_t  interface_id 
)

Generate a Intra-Area-Prefix-LSA for this peer OSPFv3 only and add it to the database.

Parameters:
peeridthe peer that the generated Intra-Area-Prefix-LSA belongs to.
lsarthe LSA that is referenced by the Intra-Area-Prefix-LSA.
interface_idthat the generated Intra-Area-Prefix-LSA belongs to.
template<typename A>
OspfTypes::AreaType AreaRouter< A >::get_area_type ( ) const [inline]

Add a network to be announced.

Remove a network to be announced.

Returns:
the type of this area.
template<typename A >
Lsa::LsaRef AreaRouter< A >::get_entry_database ( DataBaseHandle dbh,
bool &  last 
)

Next database entry.

Parameters:
lasttrue if this is the last entry.
Returns:
The next LSA in the database.
template<typename A >
bool AreaRouter< A >::get_lsas ( const list< Ls_request > &  requests,
list< Lsa::LsaRef > &  lsas 
)

Fetch a list of lsas given a list of requests.

The age fields of the returned LSAs will be correctly set.

Parameters:
requestslist of requests
lsaslist of LSAs
Returns:
True if *all* the requests have been satisfied. If an LSA can not be found False is returned and the state of the lsas list is undefined; hence should not be used.
template<typename A >
bool AreaRouter< A >::get_neighbour_address ( OspfTypes::RouterID  rid,
uint32_t  interface_id,
A &  neighbour_address 
) const [private]

OSPFv3 Only Neighbour's source address.

Parameters:
ridRouter ID
interface_idInterface ID.
neighbour_addressset if neighbour is found.
Returns:
true if the neighbour is found.
template<typename A >
void AreaRouter< A >::maxage_reached ( Lsa::LsaRef  lsar,
size_t  index 
) [private]

This LSA has reached MAXAGE so flood it to all the peers of this area.

If its an external LSA flood it to all areas.

template<typename A >
bool AreaRouter< A >::neighbour_at_least_two_way ( OspfTypes::RouterID  rid) const [private]
Parameters:
ridRouter ID of neighbouring router.
Returns:
true if this router is at least twoway with the specified router.
template<typename A >
bool AreaRouter< A >::neighbours_exchange_or_loading ( ) const [private]
Returns:
true if any of the neigbours are in state Exchange or Loading.
template<typename A >
bool AreaRouter< A >::newer_lsa ( const Lsa_header lsah) const
Returns:
true if this is a newer LSA than we already have.
template<typename A >
bool AreaRouter< A >::on_link_state_request_list ( const OspfTypes::PeerID  peerid,
const OspfTypes::NeighbourID  nid,
Lsa::LsaRef  lsar 
) const [private]

Is this LSA on this neighbours link state request list.

Parameters:
peerid
nid
Returns:
true if it is.
template<typename A >
DataBaseHandle AreaRouter< A >::open_database ( OspfTypes::PeerID  peerid,
bool &  empty 
)

Open database.

Used only by the peer to generate the database description packets.

Parameters:
peerid
emptytrue if the database is empty.
Returns:
Database Handle
template<typename A >
uint32_t AreaRouter< A >::populate_prefix ( OspfTypes::PeerID  peeridid,
uint32_t  interface_id,
OspfTypes::RouterID  router_id,
list< IPv6Prefix > &  prefixes 
)

OSPFv3 only.

Find the Link-LSA (if it exists) specified by the the tuple LS type, Link State ID and Router ID, and add to the prefix list. If the prefix is already on the list just or in the options field.

Returns:
the options associated with this Link-LSA if present otherwise zero.
template<typename A >
void AreaRouter< A >::receive_lsas ( OspfTypes::PeerID  peerid,
OspfTypes::NeighbourID  nid,
list< Lsa::LsaRef > &  lsas,
list< Lsa_header > &  direct_ack,
list< Lsa_header > &  delayed_ack,
bool  is_router_dr,
bool  is_router_bdr,
bool  is_neighbour_dr 
)

Receive LSAs.

Parameters:
peeridthat the LSAs arrived on.
nidneighbourID that the LSAs arrived on.
lsaslist of recived lsas.
direct_acklist of direct acks to send in response to the LSA
delayed_acklist of delayed acks to send in response to the LSA
is_router_drtrue if the router is the designated router.
is_router_bdrtrue if the receiving interface was in state backup.
is_neighbour_drtrue if the LSA was received from the designated router.
template<typename A >
void AreaRouter< A >::refresh_default_route ( )

Refresh the default route LSA.

Increments the sequence and floods updates the cost if it has changed.

template<typename A >
void AreaRouter< A >::refresh_intra_area_prefix_lsa ( OspfTypes::PeerID  peerid,
uint16_t  referenced_ls_type,
uint32_t  interface_id 
)

Refresh the Intra-Area-Prefix-LSA OSPFv3 only.

NOT IMPLEMENTED.

Parameters:
peeridthe peer that needs its Intra-Area-Prefix-LSA refreshed.
referenced_ls_type
interface_idthat the generated Intra-Area-Prefix-LSA belongs to.
template<typename A >
void AreaRouter< A >::refresh_network_lsa ( OspfTypes::PeerID  peerid,
Lsa::LsaRef  lsar,
bool  timer = false 
)

Refresh the Network-LSAs.

Parameters:
peeridthe peer that needs its Network-LSA refreshed.
lsarthe Network-LSA itself.
timeris the Network-LSA being refreshed due to the timer firing?
template<typename A >
void AreaRouter< A >::refresh_router_lsa ( bool  timer = false)

Refresh Router-LSA.

Cause the generation of a new Router-LSA if necessary.

Parameters:
timertrue if called by the timer.
template<typename A >
bool AreaRouter< A >::reincarnate ( ) [private]

Reincarnate LSAs that have gone through the MaxSequenceNumber transition.

Called on a periodic timer.

template<typename A >
void AreaRouter< A >::restore_default_route ( )

If the default route LSA should be in the database put it back.

Either from the previously saved or generate a new one if necessary. Typically paired with save_default_route().

template<typename A >
void AreaRouter< A >::routing_add ( Lsa::LsaRef  lsar,
bool  known 
) [private]

Add this LSA to the routing computation.

The calls to this method are bracketed between a call to routing begin and routing end.

Parameters:
lsarLSA to be added to the database.
knowntrue if this LSA is already in the database.
template<typename A >
bool AreaRouter< A >::routing_compare_externals ( Lsa::LsaRef  current,
Lsa::LsaRef  candidate 
) const [private]

RFC 3101 Section 2.5.

(6) (e) Calculating Type-7 AS external routes.

Return true if the current LSA should be replaced by the candidate LSA.

template<typename A >
void AreaRouter< A >::routing_delete ( Lsa::LsaRef  lsar) [private]

Remove this LSA from the routing computation.

The calls to this method are *NOT* bracketed between a call to routing begin and routing end.

template<typename A >
void AreaRouter< A >::routing_end ( ) [private]

Routing changes are completed.

1) Update the routing table if necessary. 2) Possibly generate new summary LSAs.

template<typename A >
void AreaRouter< A >::save_default_route ( )

If the default route LSA is in the database remove it.

Typically to stop it being purged when the area type changes or summarisation is disable.

template<typename A >
bool AreaRouter< A >::self_originated ( Lsa::LsaRef  lsar,
bool  match,
size_t  index 
) [private]

If this is a self-originated LSA do the appropriate processing.

RFC 2328 Section 13.4. Receiving self-originated LSAs

Parameters:
lsarreceived LSA.
matchif true this LSA has matched a self-originated LSA already in the database.
indexif match is true the index into the database for the matching LSA.
Returns:
true if this is a self-orignated LSA.
template<typename A>
bool AreaRouter< A >::self_originated_by_interface ( Lsa::LsaRef  lsar,
= A::ZERO() 
) const [private]

Check this LSA to see if its link state id matched any of the routers interfaces.

Parameters:
lsarLSA to check. A dummy argument is used to force an IPv4 and an IPv6 instance of this method to be generated. Isn't C++ cool?
template<typename A >
bool AreaRouter< A >::send_lsa ( const OspfTypes::PeerID  peerid,
const OspfTypes::NeighbourID  nid,
Lsa::LsaRef  lsar 
) const [private]

Send this LSA directly to the neighbour.

Do not place on retransmission list.

Parameters:
peerid
nid
lsar
Returns:
true on success
template<typename A >
int AreaRouter< A >::shutdown ( ) [virtual]

Required by the class Subsystem.

Called on shutdown.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

template<typename A >
int AreaRouter< A >::startup ( ) [virtual]

Required by the class Subsystem.

Called on startup.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

template<typename A >
bool AreaRouter< A >::subsequent ( DataBaseHandle dbh)

Is there another database entry following this one.

This method is for internal use and its use is not recommended.

Returns:
true if there is a subsequent entry.
template<typename A >
void AreaRouter< A >::summary_announce ( OspfTypes::AreaID  area,
IPNet< A >  net,
RouteEntry< A > &  rt,
bool  push 
)

A new route has been added to the routing table it is being presented to this area for possible Summary-LSA generation.

Parameters:
areathe route came from
net
rtrouting entry.
pushtrue if the routes are arriving as a consquence of calling summary_push()
template<typename A >
Lsa::LsaRef AreaRouter< A >::summary_build ( OspfTypes::AreaID  area,
IPNet< A >  net,
RouteEntry< A > &  rt,
bool &  announce 
) [private]

Construct a summary LSA if appropriate.

Parameters:
announcetrue if this in an announce false if its a withdraw.
Returns:
the LSA can be empty.
template<typename A >
Lsa::LsaRef AreaRouter< A >::summary_network_lsa_intra_area ( OspfTypes::AreaID  area,
IPNet< A >  net,
RouteEntry< A > &  rt,
bool &  announce 
) [private]

Generate a Summary-LSA for an intra area path taking into account area ranges.

An announcement may not generate an LSA and a withdraw may not cause an LSA to be removed.

template<typename A >
void AreaRouter< A >::summary_replace ( OspfTypes::AreaID  area,
IPNet< A >  net,
RouteEntry< A > &  rt,
RouteEntry< A > &  previous_rt,
OspfTypes::AreaID  previous_area 
)

A route has been replaced in the routing table.

A previously generated Summary-LSA may need to be withdrawn or replaced.

template<typename A >
void AreaRouter< A >::summary_withdraw ( OspfTypes::AreaID  area,
IPNet< A >  net,
RouteEntry< A > &  rt 
)

A route has been deleted from the routing table.

It may previously have caused a Summary-LSA which now needs to be withdrawn.

template<typename A>
bool AreaRouter< A >::unique_find_lsa ( Lsa::LsaRef  lsar,
const IPNet< A > &  net,
size_t &  index 
) [private]

Networks with same network number but different prefix lengths can generate the same link state ID.

When looking for an LSA make sure that there the lsar that matches the net is found. Summary-LSAs only.

template<typename A>
void AreaRouter< A >::unique_link_state_id ( Lsa::LsaRef  lsar) [private]

Networks with same network number but different prefix lengths can generate the same link state ID.

When generating a new LSA if a collision occurs use: RFC 2328 Appendix E. An algorithm for assigning Link State IDs to resolve the clash. Summary-LSAs only.

template<typename A >
void AreaRouter< A >::update_intra_area_prefix_lsa ( OspfTypes::PeerID  peerid)

OSPFv3 only.

This method is paired with check_link_lsa() if a new Link-LSA has arrived that requires a new Intra-Area-Prefix-LSA then this method should be called.

template<typename A >
uint32_t AreaRouter< A >::update_intra_area_prefix_lsa ( OspfTypes::PeerID  peer,
uint16_t  referenced_ls_type,
OspfTypes::RouterID  interface_id,
const list< RouterInfo > &  attached_routers 
)

Update the Intra-Area-Prefix-LSA for this peer OSPFv3 only.

Parameters:
peeridthe peer that needs its Intra-Area-Prefix-LSA refreshed.
referenced_ls_type
interface_idthat the generated Intra-Area-Prefix-LSA belongs to.
attached_routerslist of fully attached routers.
Returns:
the options fields from all the Link-LSAs or'd together.
template<typename A >
bool AreaRouter< A >::update_lsa ( Lsa::LsaRef  lsar,
size_t  index 
) [private]

Update this LSA in the database.

Parameters:
lsarLSA to update.
indexinto database.
Returns:
true on success
template<typename A >
bool AreaRouter< A >::update_router_links ( ) [private]

Update router links.

A peer has just changed state, or the refresh timer has fired, so update the router lsa and publish.

Returns:
true if something changed.
template<typename A >
bool AreaRouter< A >::valid_entry_database ( OspfTypes::PeerID  peerid,
size_t  index 
)

Is this a valid entry to be returned by the database.

This method is for internal use and its use is not recommended.

Returns:
true if this entry is valid.
template<typename A >
void AreaRouter< A >::withdraw_default_route ( )

Withdraw the default route LSA if it exists.

Set the LSA to MaxAge and floods.

template<typename A >
bool AreaRouter< A >::withdraw_intra_area_prefix_lsa ( OspfTypes::PeerID  peer,
uint16_t  referenced_ls_type,
uint32_t  interface_id 
)

Withdraw the Intra-Area-Prefix-LSA for this peer by prematurely aging OSPFv3 only.

Parameters:
peeridthe peer that needs its Intra-Area-Prefix-LSA refreshed.
referenced_ls_type
interface_idthat the generated Intra-Area-Prefix-LSA belongs to.

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