|
|
Peer Manager: 1) Monitor the state of the interfaces. An interface going up/down will be monitored and trigger either adjacency attempts or new (withdraw) LSAs. 2) Manage interface configuration state. Control peers and area state. 3) Accept incoming hello's and demultiplex to the correct peer. 4) Manage the set of peers (peers are bound to interface and area). The peers themselves are hidden and are only exposed by reference (PeerID).
PeerManager (Ospf<A>& ospf)
| PeerManager |
~PeerManager ()
| ~PeerManager |
bool check_area_type (OspfTypes::AreaID area,
OspfTypes::AreaType area_type)
| check_area_type |
Check area type.
Verify that this area can be set to this area type.
bool create_area_router (OspfTypes::AreaID area,
OspfTypes::AreaType area_type,
bool permissive = true)
| create_area_router |
Create an area router.
Parameters:
permissive | if true won't fail if the area already exists. |
AreaRouter<A> * get_area_router (OspfTypes::AreaID area)
| get_area_router |
bool change_area_router_type (OspfTypes::AreaID area,
OspfTypes::AreaType area_type)
| change_area_router_type |
bool destroy_area_router (OspfTypes::AreaID area)
| destroy_area_router |
bool area_range_add (OspfTypes::AreaID area, IPNet<A> net, bool advertise)
| area_range_add |
bool area_range_delete (OspfTypes::AreaID area, IPNet<A> net)
| area_range_delete |
bool area_range_change_state (OspfTypes::AreaID area, IPNet<A> net,
bool advertise)
| area_range_change_state |
Change the advertised state of this area.
bool get_lsa (const OspfTypes::AreaID area, const uint32_t index,
bool& valid, bool& toohigh, bool& self, vector<uint8_t>& lsa)
| get_lsa |
Get a single lsa from an area. A stateless mechanism to get LSAs. The client of this interface should start from zero and continue to request LSAs (incrementing index) until toohigh becomes true.
Parameters:
area | database that is being searched. |
index | into database starting from 0. |
valid | true if a LSA has been returned. Some index values do not contain LSAs. This should not be considered an error. |
toohigh | true if no more LSA exist after this index. |
self | if true this LSA was originated by this router. |
lsa | if valid is true the LSA at index. |
bool get_area_list (list<OspfTypes::AreaID>& areas)
| get_area_list |
[const]
Get a list of all the configured areas.
bool get_neighbour_list (list<OspfTypes::NeighbourID>& neighbours)
| get_neighbour_list |
[const]
Get a list of all the neighbours.
bool get_neighbour_info (OspfTypes::NeighbourID nid,
NeighbourInfo& ninfo)
| get_neighbour_info |
[const]
Get state information about this neighbour.
Parameters:
nid | neighbour information is being request about. |
ninfo | if neighbour is found its information. |
OspfTypes::PeerID get_peerid (const string& interface, const string& vif)
throw(BadPeer) | get_peerid |
Convert an interface/vif to a PeerID. Throw an exception if no mapping is found.
bool get_interface_vif_by_peerid (OspfTypes::PeerID peerid,
string& interface, string& vif)
| get_interface_vif_by_peerid |
[const]
Given a PeerID convert it back to an interface and vif.
OspfTypes::PeerID create_peer (const string& interface, const string& vif,
A source,
OspfTypes::LinkType linktype,
OspfTypes::AreaID area)
throw(BadPeer) | create_peer |
Create a peer.
Parameters:
source | address of transmitted packets. |
linktype | broadcast or point-2-point, etc... |
area | ID of area |
Returns: PeerID on success otherwise throw an exception.
bool delete_peer (const OspfTypes::PeerID)
| delete_peer |
bool set_state_peer (const OspfTypes::PeerID, bool state)
| set_state_peer |
bool set_link_status_peer (const OspfTypes::PeerID, bool state)
| set_link_status_peer |
Set the link status of the peer.
bool add_address_peer (const string& interface, const string& vif,
OspfTypes::AreaID area, A addr)
| add_address_peer |
Add an address to this peer OSPFv3 only.
bool remove_address_peer (const OspfTypes::PeerID, OspfTypes::AreaID area,
A addr)
| remove_address_peer |
Remove an address from this peer OSPFv3 only.
bool set_address_state_peer (const OspfTypes::PeerID,
OspfTypes::AreaID area, A addr, bool enable)
| set_address_state_peer |
Set the state of the address on this peer OSPFv3 only.
bool activate_peer (const string& interface, const string& vif,
OspfTypes::AreaID area)
| activate_peer |
Activate this peer OSPFv3 only. Called once after the peer is created and every time a new address is added, but not when an address is deleted.
bool update_peer (const string& interface, const string& vif,
OspfTypes::AreaID area)
| update_peer |
Update this peer OSPFv3 only. Called every time a variable related to this peer is changed.
bool recompute_addresses_peer (const OspfTypes::PeerID,
OspfTypes::AreaID area)
| recompute_addresses_peer |
Update this peer OSPFv3 only. Reset the addresses that should be advertised by this peer.
void address_status_change (const string& interface, const string& vif,
A source, bool state)
| address_status_change |
Track the state of an address. Callback when the status of the address changes.
bool add_neighbour (const OspfTypes::PeerID,
OspfTypes::AreaID area, A neighbour_address,
OspfTypes::RouterID)
| add_neighbour |
bool remove_neighbour (const OspfTypes::PeerID,
OspfTypes::AreaID area, A neighbour_address,
OspfTypes::RouterID rid)
| remove_neighbour |
Remove a neighbour from the peer.
bool transmit (const string& interface, const string& vif,
A dst, A src,
uint8_t* data, uint32_t len)
| transmit |
bool receive (const string& interface, const string& vif, A dst, A src,
Packet *packet)
throw(BadPeer) | receive |
Demultiplex incoming packets to the associated peer. If the packet contains LSAs send it to the LSA database manager if appropriate.
Parameters:
interface | that packet arrived on |
vif | that packet arrived on |
Returns: true if the packet is now owned by the peer manager.
bool queue_lsa (const OspfTypes::PeerID peerid,
const OspfTypes::PeerID peer,
OspfTypes::NeighbourID nid, Lsa::LsaRef lsar,
bool &multicast_on_peer)
| queue_lsa |
Queue an LSA for transmission.
Parameters:
peerid | to queue to LSA on. |
peer | the LSA arrived on. |
nid | the LSA arrived on. |
lsar | the lsa |
multicast_on_peer | will this LSA get multicast on this peer. |
Returns: true on success.
bool push_lsas (const OspfTypes::PeerID peerid)
| push_lsas |
uint32_t get_interface_id (const OspfTypes::PeerID peerid)
| get_interface_id |
Get the interface ID of this peer OSPFv3 only.
bool configured_network (const A address)
| configured_network |
[const]
bool known_interface_address (const A address)
| known_interface_address |
[const]
bool neighbours_exchange_or_loading (const OspfTypes::PeerID peerid,
OspfTypes::AreaID area)
| neighbours_exchange_or_loading |
Are any of the neighbours of this peer in the state exchange or loading.
Returns: true if any of the neighbours are in state exchange or loading.
bool neighbour_at_least_two_way (const OspfTypes::PeerID peerid,
OspfTypes::AreaID area,
OspfTypes::RouterID rid, bool& twoway)
| neighbour_at_least_two_way |
Is the state of the neighbour with the specified Router ID at least 2-Way.
Parameters:
rid | Router ID |
twoway | if the neighbour is found true means the neighbour is at least twoway. |
Returns: true if the neighbour is found.
bool get_neighbour_address (const OspfTypes::PeerID peerid,
OspfTypes::AreaID area,
OspfTypes::RouterID rid,
uint32_t interface_id, A& neighbour_address)
| get_neighbour_address |
Neighbour's source address.
Parameters:
rid | Router ID |
interface_id | Interface ID. |
neighbour_address | set if neighbour is found. |
Returns: true if the neighbour is found.
bool on_link_state_request_list (const OspfTypes::PeerID peerid,
OspfTypes::AreaID area,
const OspfTypes::NeighbourID nid,
Lsa::LsaRef lsar)
| on_link_state_request_list |
Is this LSA on this neighbours link state request list.
Returns: true if it is.
bool event_bad_link_state_request (const OspfTypes::PeerID peerid,
OspfTypes::AreaID area,
const OspfTypes::NeighbourID nid)
| event_bad_link_state_request |
Generate a BadLSReq event.
Returns: true if it is.
bool send_lsa (const OspfTypes::PeerID peerid, OspfTypes::AreaID area,
const OspfTypes::NeighbourID nid,
Lsa::LsaRef lsar)
| send_lsa |
Send this LSA directly to the neighbour. Do not place on retransmission list.
Returns: true on success
void adjacency_changed (const OspfTypes::PeerID peerid,
OspfTypes::RouterID rid,
bool up)
| adjacency_changed |
Upcall from a peer to notify the peer manager that a full adjacency has been achieved or lost.
Parameters:
rid | neighbours router ID. |
up | true if the adjacency has become full, false if a full adjacency has been lost. |
void area_border_router_transition (bool up)
| area_border_router_transition |
[const]
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 refresh_router_lsas ()
| refresh_router_lsas |
[const]
Send a new Router-LSA in all areas.
Typically called when one of the Router-LSA flags changes state.
bool create_virtual_peer (OspfTypes::RouterID rid)
| create_virtual_peer |
bool delete_virtual_peer (OspfTypes::RouterID rid)
| delete_virtual_peer |
bool virtual_link_endpoint (OspfTypes::AreaID area)
| virtual_link_endpoint |
[const]
Are any of neighbours of this area a virtual link endpoint.
Returns: true if any are.
bool create_virtual_link (OspfTypes::RouterID rid)
| create_virtual_link |
Create a virtual link (Configuration).
Parameters:
rid | neighbours router ID. |
bool transit_area_virtual_link (OspfTypes::RouterID rid,
OspfTypes::AreaID transit_area)
| transit_area_virtual_link |
Attach this transit area to the neighbours router ID (Configuration).
bool delete_virtual_link (OspfTypes::RouterID rid)
| delete_virtual_link |
Delete a virtual link (Configuration).
Parameters:
rid | neighbours router ID. |
void up_virtual_link (OspfTypes::RouterID rid, A source,
uint16_t interface_cost, A destination)
| up_virtual_link |
Bring virtual link up (Upcall from area router).
Parameters:
rid | neighbours router ID. |
source | address of packets sent to this neighbour. |
destination | address of the neighbour router. |
void down_virtual_link (OspfTypes::RouterID rid)
| down_virtual_link |
Take this virtual link down (Upcall from area router).
bool receive_virtual_link (A dst, A src, Packet *packet)
| receive_virtual_link |
A packet was sent to a peer that rejected it so this may be a virtual link candidate.
uint32_t area_count (OspfTypes::AreaType area_type)
| area_count |
[const]
Return the number of areas of the specified type.
bool internal_router_p ()
| internal_router_p |
[const]
bool area_border_router_p ()
| area_border_router_p |
[const]
Is this an area border router?
bool backbone_router_p ()
| backbone_router_p |
[const]
bool as_boundary_router_p ()
| as_boundary_router_p |
[const]
Is this an AS boundary router?
uint32_t compute_options (OspfTypes::AreaType area_type)
| compute_options |
Compute the options that are sent in hello packets, data description packets, LSA headers (OSPFv2), Router-LSAs (OSPFv3) and Network-LSAs (OSPFv3).
void router_id_changing ()
| router_id_changing |
The router ID is about to change.
bool set_options (const PeerID, OspfTypes::AreaID area,
uint32_t options)
| set_options |
bool set_interface_address (const OspfTypes::PeerID, A address)
| set_interface_address |
Set the interface address of this peer.
bool set_hello_interval (const OspfTypes::PeerID, OspfTypes::AreaID area,
uint16_t hello_interval)
| set_hello_interval |
Set the hello interval in seconds.
bool set_router_priority (const OspfTypes::PeerID, OspfTypes::AreaID area,
uint8_t priority)
| set_router_priority |
bool set_router_dead_interval (const OspfTypes::PeerID,
OspfTypes::AreaID area,
uint32_t router_dead_interval)
| set_router_dead_interval |
Set the router dead interval in seconds.
bool set_interface_cost (const OspfTypes::PeerID, OspfTypes::AreaID area,
uint16_t interface_cost)
| set_interface_cost |
bool set_retransmit_interval (const OspfTypes::PeerID,
OspfTypes::AreaID area,
uint16_t retransmit_interval)
| set_retransmit_interval |
bool set_inftransdelay (const OspfTypes::PeerID, OspfTypes::AreaID area,
uint16_t inftransdelay)
| set_inftransdelay |
bool set_simple_authentication_key (const OspfTypes::PeerID peerid,
OspfTypes::AreaID area,
const string& password,
string& error_msg)
| set_simple_authentication_key |
Set a simple password authentication key.
Note that the current authentication handler is replaced with a simple password authentication handler.
Parameters:
peerid | the peer ID. |
area | the area ID. |
password | the password to set. |
the | error message (if error). |
Returns: true on success, otherwise false.
bool delete_simple_authentication_key (const OspfTypes::PeerID peerid,
OspfTypes::AreaID area,
string& error_msg)
| delete_simple_authentication_key |
Delete a simple password authentication key.
Note that after the deletion the simple password authentication handler is replaced with a Null authentication handler.
Parameters:
peerid | the peer ID. |
area | the area ID. |
the | error message (if error). |
Returns: true on success, otherwise false.
bool set_md5_authentication_key (const OspfTypes::PeerID peerid,
OspfTypes::AreaID area, uint8_t key_id,
const string& password,
const TimeVal& start_timeval,
const TimeVal& end_timeval,
const TimeVal& max_time_drift,
string& error_msg)
| set_md5_authentication_key |
Set an MD5 authentication key.
Note that the current authentication handler is replaced with an MD5 authentication handler.
Parameters:
peerid | the peer ID. |
area | the area ID. |
key_id | unique ID associated with key. |
password | phrase used for MD5 digest computation. |
start_timeval | start time when key becomes valid. |
end_timeval | end time when key becomes invalid. |
max_time_drift | the maximum time drift among all routers. |
the | error message (if error). |
Returns: true on success, otherwise false.
bool delete_md5_authentication_key (const OspfTypes::PeerID peerid,
OspfTypes::AreaID area, uint8_t key_id,
string& error_msg)
| delete_md5_authentication_key |
Delete an MD5 authentication key.
Note that after the deletion if there are no more valid MD5 keys, the MD5 authentication handler is replaced with a Null authentication handler.
Parameters:
peerid | the peer ID. |
area | the area ID. |
key_id | the ID of the key to delete. |
the | error message (if error). |
Returns: true on success, otherwise false.
bool set_passive (const OspfTypes::PeerID, OspfTypes::AreaID area,
bool passive)
| set_passive |
Toggle the passive status of an interface.
bool originate_default_route (OspfTypes::AreaID area, bool enable)
| originate_default_route |
If this is a "stub" or "nssa" area toggle the sending of a default route.
bool stub_default_cost (OspfTypes::AreaID area, 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 (OspfTypes::AreaID area, bool enable)
| summaries |
Toggle the sending of summaries into "stub" or "nssa" areas.
size_t number_of_areas ()
| number_of_areas |
[const]
Number of areas this router serves.
void summary_announce (OspfTypes::AreaID area, IPNet<A> net,
RouteEntry<A>& rt)
| summary_announce |
A new route has been added to the routing table announce it to all areas as it is a candidate for Summary-LSA generation.
Parameters:
area | that the route was introduced by. |
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.
Parameters:
area | that the route was introduced by. |
void summary_push (OspfTypes::AreaID area)
| summary_push |
Send all the summary information to specified area. New areas or stub areas that change from do not advertise can use this hook to force all routes to be sent to the specified area.
Parameters:
area | that all routes should be sent to. |
bool area_range_covered (OspfTypes::AreaID area, IPNet<A> net,
bool& advertise)
| area_range_covered |
In the specified area is the net covered by an area range.
Parameters:
area | being checked. |
net | that may be covered. |
advertise | if the area is covered set to advertise or do not advertise. |
Returns: true if the area is covered.
bool area_range_configured (OspfTypes::AreaID area)
| area_range_configured |
Does the specified area have any area ranges configured.
The primary purpose is to discover if the backbone area has any area ranges configured, this is required when an area becomes a transit area.
bool external_announce (OspfTypes::AreaID area, Lsa::LsaRef lsar)
| external_announce |
An AS-External-LSA has arrived from this area announce it to all others.
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.
bool external_announce (const IPNet<A>& net, const A& nexthop,
const uint32_t& metric,
const PolicyTags& policytags)
| external_announce |
Create an AS-External-LSA and announce it to all appropriate areas.
bool external_withdraw (OspfTypes::AreaID area, Lsa::LsaRef lsar)
| external_withdraw |
An AS-External-LSA is being withdrawn from this area withdraw from all others.
bool external_withdraw (const IPNet<A>& net)
| external_withdraw |
Withdraw a previously createed and announced AS-External-LSA from all areas.
bool external_shove (OspfTypes::AreaID area)
| external_shove |
Called to complete a series of calls to external_announce(area).
void external_push (OspfTypes::AreaID area)
| external_push |
When a new area is configured it can use this method to
Parameters:
area | that all AS-External-LSAs should be sent to. |
void external_push_routes ()
| external_push_routes |
Re-run the policy filters on all routes.
void routing_recompute_all_areas ()
| routing_recompute_all_areas |
Recompute routing calculation all areas BACKBONE first.
void routing_recompute_all_transit_areas ()
| routing_recompute_all_transit_areas |
Recompute routing calculation for all transit areas.