Area Router
AreaRouter (Ospf<A>& ospf, OspfTypes::AreaID area,
OspfTypes::AreaType area_type)
| AreaRouter |
int startup ()
| startup |
Required by the class Subsystem. Called on startup.
Returns: XORP_OK on success, otherwise XORP_ERROR.
Reimplemented from ServiceBase.
int shutdown ()
| shutdown |
Required by the class Subsystem. Called on shutdown.
Returns: XORP_OK on success, otherwise XORP_ERROR.
Reimplemented from ServiceBase.
void add_peer (OspfTypes::PeerID peer)
| add_peer |
void delete_peer (OspfTypes::PeerID peer)
| delete_peer |
bool peer_up (OspfTypes::PeerID peer)
| peer_up |
bool peer_down (OspfTypes::PeerID peer)
| peer_down |
void area_border_router_transition (bool up)
| area_border_router_transition |
Track border router transitions.
Parameters:
up | true of the router just became an area border router, false if the router was an area border router and is no longer. |
void change_area_router_type (OspfTypes::AreaType area_type)
| change_area_router_type |
bool find_global_address (uint32_t adv, uint16_t type,
LsaTempStore& lsa_temp_store,
A& global_address)
| find_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:
adv | advertising router. |
type | of Intra-Area-Prefix-LSA (Router-LSA or Network-LSA), Router-LSA expected. |
lsa_temp_store | store of all possible Router-LSAs. |
global_address | (out) argument. |
Returns: true if global address found.
bool configured_virtual_link ()
| configured_virtual_link |
[const]
Returns: true if any virtual links are configured through this area.
bool add_virtual_link (OspfTypes::RouterID rid)
| add_virtual_link |
bool remove_virtual_link (OspfTypes::RouterID rid)
| remove_virtual_link |
Remove a virtual link endpoint.
void start_virtual_link ()
| 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_for_virtual_linkV2 |
Check this node to see if its a virtual link endpoint.
Parameters:
rc | node under consideration. |
router | this router's Router-LSA. |
void check_for_virtual_linkV3 (const RouteCmd<Vertex>& rc,
Lsa::LsaRef lsar,
LsaTempStore& lsa_temp_store)
| check_for_virtual_linkV3 |
Check this node to see if its a virtual link endpoint.
Parameters:
rc | node under consideration. |
lsar | RouterLSA belonging to the router under consideration. |
lsa_temp_store | store of all possible Router-LSAs. |
void end_virtual_link ()
| 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)
| find_interface_address |
[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.
bool find_interface_address (OspfTypes::RouterID rid, uint32_t interface_id,
A& interface)
| find_interface_address |
OSPFv3 only. Given a Router ID and interface ID find the associated Link-LSA if present and return the Link-local Interface Address.
bool area_range_add (IPNet<A> net, bool advertise)
| area_range_add |
bool area_range_delete (IPNet<A> net)
| area_range_delete |
bool area_range_change_state (IPNet<A> net, bool advertise)
| area_range_change_state |
Change the advertised state of this area.
bool area_range_covered (IPNet<A> net, bool& advertise)
| area_range_covered |
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)
| area_range_covering |
This network falls in a covered area range, return the covering range.
bool area_range_configured ()
| area_range_configured |
Does this area have any area ranges configured.
bool originate_default_route (bool enable)
| originate_default_route |
If this is a "stub" or "nssa" area toggle the sending of a default route.
bool stub_default_cost (uint32_t cost)
| stub_default_cost |
Set the StubDefaultCost, the default cost sent in a default route in a "stub" or "nssa" area.
bool summaries (bool enable)
| summaries |
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 |
get lsa at index if it exists.
bool new_router_links (OspfTypes::PeerID peer,
const list<RouterLink>& router_link)
| new_router_links |
void refresh_router_lsa (bool timer = false)
| refresh_router_lsa |
Refresh Router-LSA.
Cause the generation of a new Router-LSA if necessary.
Parameters:
timer | true if called by the timer. |
void stub_networksV3 (bool timer)
| stub_networksV3 |
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)
| summary_announce |
A new route has been added to the routing table it is being presented to this area for possible Summary-LSA generation.
Parameters:
area | the route came from |
rt | routing entry. |
push | true if the routes are arriving as a consquence of calling summary_push() |
void summary_withdraw (OspfTypes::AreaID area, IPNet<A> net,
RouteEntry<A>& rt)
| summary_withdraw |
A route has been deleted from the routing table. It may previously have caused a Summary-LSA which now needs to be withdrawn.
void summary_replace (OspfTypes::AreaID area, IPNet<A> net,
RouteEntry<A>& rt, RouteEntry<A>& previous_rt,
OspfTypes::AreaID previous_area)
| summary_replace |
A route has been replaced in the routing table. A previously generated Summary-LSA may need to be withdrawn or replaced.
bool external_area_type ()
| external_area_type |
[const]
Returns: true if this area should accept an AS-External-LSA or a Type-7-LSA.
void external_copy_net_nexthop (A,
ASExternalLsa *dst,
ASExternalLsa *src)
| external_copy_net_nexthop |
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.
Lsa::LsaRef external_generate_type7 (Lsa::LsaRef lsar, bool& indb)
| external_generate_type7 |
Given an AS-External-LSA generate a Type-7 LSA.
Parameters:
indb | if true the Type-7-LSA is already in the database. |
Lsa::LsaRef external_generate_external (Lsa::LsaRef lsar)
| external_generate_external |
Given a Type-7 LSA generate an AS-External-LSA.
void external_announce (Lsa::LsaRef lsar, bool push, bool redist)
| external_announce |
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:
lsar | the AS-External-LSA |
push | set to true if the push is a result of an external_push(). |
redist | true if this LSA was locally generated due to a redistribution. |
void external_announce_complete ()
| external_announce_complete |
Called to complete a series of calls to external_announce().
void external_refresh (Lsa::LsaRef lsar)
| external_refresh |
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.
void external_withdraw (Lsa::LsaRef lsar)
| external_withdraw |
An AS-External-LSA being withdrawn either from another area or from the RIB as a redist.
Parameters:
lsar | the AS-External-LSA |
bool add_link_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar)
| add_link_lsa |
bool update_link_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar)
| update_link_lsa |
Update the Link-LSA for this peer.
bool withdraw_link_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar)
| withdraw_link_lsa |
Withdraw the Link-LSA for this peer.
void refresh_link_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar)
| refresh_link_lsa |
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_network_lsa |
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_network_lsa |
Update the Network-LSA for this peer.
bool withdraw_network_lsa (OspfTypes::PeerID peer,
OspfTypes::RouterID link_state_id)
| withdraw_network_lsa |
Withdraw the Network-LSA for this peer by prematurely aging.
void refresh_network_lsa (OspfTypes::PeerID peerid, Lsa::LsaRef lsar,
bool timer = false)
| refresh_network_lsa |
Refresh the Network-LSAs.
Parameters:
peerid | the peer that needs its Network-LSA refreshed. |
lsar | the Network-LSA itself. |
timer | is the Network-LSA being refreshed due to the timer firing? |
bool check_link_lsa (LinkLsa *nllsa, LinkLsa *ollsa)
| check_link_lsa |
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.
void update_intra_area_prefix_lsa (OspfTypes::PeerID peerid)
| update_intra_area_prefix_lsa |
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.
bool generate_intra_area_prefix_lsa (OspfTypes::PeerID peerid,
Lsa::LsaRef lsar,
uint32_t interface_id)
| generate_intra_area_prefix_lsa |
Generate a Intra-Area-Prefix-LSA for this peer OSPFv3 only and add it to the database.
Parameters:
peerid | the peer that the generated Intra-Area-Prefix-LSA belongs to. |
lsar | the LSA that is referenced by the Intra-Area-Prefix-LSA. |
interface_id | that the generated Intra-Area-Prefix-LSA belongs to. |
uint32_t populate_prefix (OspfTypes::PeerID peeridid,
uint32_t interface_id,
OspfTypes::RouterID router_id,
list<IPv6Prefix>& prefixes)
| populate_prefix |
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.
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_intra_area_prefix_lsa |
Update the Intra-Area-Prefix-LSA for this peer OSPFv3 only.
Parameters:
peerid | the peer that needs its Intra-Area-Prefix-LSA refreshed. |
interface_id | that the generated Intra-Area-Prefix-LSA belongs to. |
attached_routers | list of fully attached routers. |
Returns: the options fields from all the Link-LSAs or'd together.
bool withdraw_intra_area_prefix_lsa (OspfTypes::PeerID peer,
uint16_t referenced_ls_type,
uint32_t interface_id)
| withdraw_intra_area_prefix_lsa |
Withdraw the Intra-Area-Prefix-LSA for this peer by prematurely aging OSPFv3 only.
Parameters:
peerid | the peer that needs its Intra-Area-Prefix-LSA refreshed. |
interface_id | that the generated Intra-Area-Prefix-LSA belongs to. |
void refresh_intra_area_prefix_lsa (OspfTypes::PeerID peerid,
uint16_t referenced_ls_type,
uint32_t interface_id)
| refresh_intra_area_prefix_lsa |
Refresh the Intra-Area-Prefix-LSA OSPFv3 only.
NOT IMPLEMENTED.
Parameters:
peerid | the peer that needs its Intra-Area-Prefix-LSA refreshed. |
interface_id | that the generated Intra-Area-Prefix-LSA belongs to. |
void generate_default_route ()
| 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_default_route |
Find the default route LSA in the database if it exists.
Lsa::LsaRef _saved_default_route | _saved_default_route |
void save_default_route ()
| 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.
void restore_default_route ()
| 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().
void withdraw_default_route ()
| withdraw_default_route |
Withdraw the default route LSA if it exists. Set the LSA to MaxAge and floods.
void refresh_default_route ()
| refresh_default_route |
Refresh the default route LSA. Increments the sequence and floods updates the cost if it has changed.
OspfTypes::AreaType get_area_type ()
| get_area_type |
[const]
Returns: the type of this area.
uint32_t get_options ()
| 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 |
Receive LSAs
Parameters:
peerid | that the LSAs arrived on. |
nid | neighbourID that the LSAs arrived on. |
lsas | list of recived lsas. |
direct_ack | list of direct acks to send in response to the LSA |
delayed_ack | list of delayed acks to send in response to the LSA |
is_router_dr | true if the router is the designated router. |
is_router_bdr | true if the receiving interface was in state backup. |
is_neighbour_dr | true if the LSA was received from the designated router. |
enum LsaSearch { NOMATCH, EQUIVALENT, NEWER, OLDER, } | LsaSearch |
LsaSearch compare_lsa (const Lsa_header& candidate,
const Lsa_header& current)
| compare_lsa |
[const]
Compare two LSAs.
Parameters:
candidate | offered LSA |
current | equivalent to the database copy. |
Returns: LsaSearch that describes the type of match.
LsaSearch compare_lsa (const Lsa_header&)
| compare_lsa |
[const]
Compare this LSA to
Parameters:
Lsa_header | that is being sought. |
Returns: LsaSearch that describes the type of match.
bool newer_lsa (const Lsa_header&)
| newer_lsa |
[const]
Returns: true if this is a newer LSA than we already have.
bool get_lsas (const list<Ls_request>& requests,
list<Lsa::LsaRef>& lsas)
| get_lsas |
Fetch a list of lsas given a list of requests.
The age fields of the returned LSAs will be correctly set.
Parameters:
requests | list of requests |
lsas | list 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.
DataBaseHandle open_database (OspfTypes::PeerID peerid, bool& empty)
| open_database |
Open database
Used only by the peer to generate the database description packets.
Parameters:
empty | true if the database is empty. |
Returns: Database Handle
bool valid_entry_database (OspfTypes::PeerID peerid, size_t index)
| valid_entry_database |
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.
bool subsequent (DataBaseHandle& dbh)
| subsequent |
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.
Lsa::LsaRef get_entry_database (DataBaseHandle& dbh, bool& last)
| get_entry_database |
Next database entry
Parameters:
last | true if this is the last entry. |
Returns: The next LSA in the database.
void close_database (DataBaseHandle& dbh)
| close_database |
Close the database
Parameters:
dbd | Database descriptor |
void clear_database (bool preserve_link_lsas = false)
| clear_database |
Clear the database.
Parameters:
preserve_link_lsas | if true when clearing the database don't remove Link-LSAs that were generated by this router. Relevant to OSPFv3 only. |
void maxage_type_database (uint16_t type)
| maxage_type_database |
All self originated LSAs of this type MaxAge them.
bool backbone ()
| backbone |
[const]
bool backbone (OspfTypes::AreaID area)
| backbone |
[const]
bool get_transit_capability ()
| get_transit_capability |
[const]
void routing_total_recompute ()
| routing_total_recompute |
Totally recompute the routing table from the LSA database.
void testing_routing_total_recompute ()
| testing_routing_total_recompute |
Testing entry point to force a total routing computation.
void testing_print_link_state_database ()
| testing_print_link_state_database |
[const]
bool testing_replace_router_lsa (Lsa::LsaRef lsar)
| testing_replace_router_lsa |
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_add_lsa |
Testing entry point to add an LSA to the database.
bool testing_delete_lsa (Lsa::LsaRef lsar)
| testing_delete_lsa |
Testing entry point to delete an LSA from the database.
string str ()
| str |