|
|
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)
| create_area_router |
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. |
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.
PeerID create_peer (const string& interface, const string& vif,
const A source, uint16_t interface_prefix_length,
uint16_t interface_mtu,
OspfTypes::LinkType linktype, OspfTypes::AreaID area)
throw(BadPeer) | create_peer |
Create a peer.
Parameters:
source | address of transmitted packets. |
interface_mtu | , MTU of this interface. |
linktype | broadcast or point-2-point, etc... |
area | ID of area |
Returns: PeerID on success otherwise throw an exception.
bool delete_peer (const PeerID)
| delete_peer |
bool set_state_peer (const PeerID, bool state)
| set_state_peer |
bool set_link_status_peer (const PeerID, bool state)
| set_link_status_peer |
Set the link status of the 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 PeerID,
OspfTypes::AreaID area, A neighbour_address,
OspfTypes::RouterID)
| add_neighbour |
bool remove_neighbour (const 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 PeerID peerid, const 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 PeerID peerid)
| push_lsas |
bool known_interface_address (const A address)
| known_interface_address |
[const]
bool neighbours_exchange_or_loading (const 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 on_link_state_request_list (const 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 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 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 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 PeerID, A address)
| set_interface_address |
Set the interface address of this peer.
bool set_interface_id (const PeerID, OspfTypes::AreaID area,
uint32_t interface_id)
| set_interface_id |
Set the interface ID OSPFv3 only.
bool set_hello_interval (const PeerID, OspfTypes::AreaID area,
uint16_t hello_interval)
| set_hello_interval |
Set the hello interval in seconds.
bool set_router_priority (const PeerID, OspfTypes::AreaID area,
uint8_t priority)
| set_router_priority |
bool set_router_dead_interval (const 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 PeerID, OspfTypes::AreaID area,
uint16_t interface_cost)
| set_interface_cost |
bool set_retransmit_interval (const PeerID, OspfTypes::AreaID area,
uint16_t retransmit_interval)
| set_retransmit_interval |
bool set_inftransdelay (const PeerID, OspfTypes::AreaID area,
uint16_t inftransdelay)
| set_inftransdelay |
bool set_simple_authentication_key (const 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 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 PeerID peerid,
OspfTypes::AreaID area, uint8_t key_id,
const string& password,
uint32_t start_secs, uint32_t end_secs,
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_secs | start time in seconds since midnight 1 Jan 1970. |
end_secs | start time in seconds since midnight 1 Jan 1970. |
the | error message (if error). |
Returns: true on success, otherwise false.
bool delete_md5_authentication_key (const 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 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.