Area Router
AreaRouter (Ospf<A>& ospf, OspfTypes::AreaID area,
OspfTypes::AreaType area_type)
| AreaRouter |
bool startup ()
| startup |
Required by the class Subsystem. Called on startup.
Reimplemented from ServiceBase.
bool shutdown ()
| shutdown |
Required by the class Subsystem. Called on shutdown.
Reimplemented from ServiceBase.
void add_peer (PeerID peer)
| add_peer |
void delete_peer (PeerID peer)
| delete_peer |
bool peer_up (PeerID peer)
| peer_up |
bool peer_down (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 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_link (const RouteCmd<Vertex>& rc, Lsa::LsaRef lsar)
| check_for_virtual_link |
Check this node to see if its a virtual link endpoint.
Parameters:
rc | node under consideration. |
router | this router's Router-LSA. |
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 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 (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 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.
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_shove() is seen. In many cases a number of LSAs may arrive in a single packet, waiting for the external_shove() 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_shove ()
| external_shove |
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 generate_network_lsa (PeerID peer,
OspfTypes::RouterID link_state_id,
list<OspfTypes::RouterID>& attached_routers,
uint32_t network_mask)
| generate_network_lsa |
Generate a Network-LSA for this peer.
bool update_network_lsa (PeerID peer,
OspfTypes::RouterID link_state_id,
list<OspfTypes::RouterID>& attached_routers,
uint32_t network_mask)
| update_network_lsa |
Update the Network-LSA for this peer.
bool withdraw_network_lsa (PeerID peer, OspfTypes::RouterID link_state_id)
| withdraw_network_lsa |
Withdraw the Network-LSA for this peer by prematurely aging.
void refresh_network_lsa (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? |
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 (PeerID peerid, OspfTypes::NeighbourID nid,
list<Lsa::LsaRef>& lsas,
list<Lsa_header>& direct_ack,
list<Lsa_header>& delayed_ack,
bool backup, bool 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 |
backup | true if the receiving interface was in state backup. |
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 (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 (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 ()
| clear_database |
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]
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.
void testing_routing_total_recompute ()
| testing_routing_total_recompute |
Testing enty point to force a toal routing computation.
string str ()
| str |