|
|
In OSPF terms this class represents an interface/link; interface is too overloaded a term. The Peer class is also associated with an area. In OSPFv2 there is a one-to-one correspondence. In OSPFv3 an interface/link can belong to multiple areas.
Responsibilities: 1) Packet transmission; the outgoing queue lives here. 2) Exchange Hello packets. 3) Bring up adjacency, synchronize databases. 4) Elect designated and backup router.
PeerOut (Ospf<A>& ospf, const string interface, const string vif,
OspfTypes::PeerID peerid, const A source,
OspfTypes::LinkType linktype, OspfTypes::AreaID area,
OspfTypes::AreaType area_type)
| PeerOut |
~PeerOut ()
| ~PeerOut |
string get_if_name ()
| get_if_name |
[const]
For debugging only printable rendition of this interface/vif.
bool match (A source, string& interface, string& vif)
| match |
If the source address matches the interface address return the interface and vif.
OspfTypes::PeerID get_peerid ()
| get_peerid |
[const]
bool set_interface_address (A interface_address)
| set_interface_address |
Set the address of this interface/vif
A get_interface_address ()
| get_interface_address |
[const]
Address of this interface/vif.
Returns: interface/vif address.
uint16_t get_interface_prefix_length ()
| get_interface_prefix_length |
[const]
Returns: prefix length of this interface.
uint16_t get_interface_mtu ()
| get_interface_mtu |
[const]
Returns: mtu of this interface.
uint16_t get_frame_size ()
| get_frame_size |
[const]
The maximum size of an OSPF frame, the MTU minus the IP header.
Returns: maximum frame size.
void join_multicast_group (A address)
| join_multicast_group |
Join multicast group on this interface/vif.
void leave_multicast_group (A address)
| leave_multicast_group |
Leave multicast group on this interface/vif.
uint16_t get_interface_cost ()
| get_interface_cost |
[const]
Returns: cost of this interface.
uint16_t get_inftransdelay ()
| get_inftransdelay |
[const]
Returns: InfTransDelay
bool get_areas (list<OspfTypes::AreaID>& areas)
| get_areas |
[const]
Get the list of areas associated with this peer.
bool add_area (OspfTypes::AreaID area, OspfTypes::AreaType area_type)
| add_area |
Add another Area for this peer to be in, should only be allowed for OSPFv3.
bool change_area_router_type (OspfTypes::AreaID area,
OspfTypes::AreaType area_type)
| change_area_router_type |
bool remove_area (OspfTypes::AreaID area)
| remove_area |
This area is being removed.
Returns: true if this peer is no longer associated with any areas. Allowing the caller to delete this peer.
bool add_neighbour (OspfTypes::AreaID area, A neighbour_address,
OspfTypes::RouterID)
| add_neighbour |
bool remove_neighbour (OspfTypes::AreaID area, A neighbour_address,
OspfTypes::RouterID rid)
| remove_neighbour |
Remove a neighbour from the peer.
void set_state (bool state)
| set_state |
bool get_state ()
| get_state |
[const]
void set_link_status (bool status)
| set_link_status |
Set the link status. This is not only the link status but is the interface/vif/address configured up.
void peer_change ()
| peer_change |
Dependent on the configured peer status and the link status decide if the peer should be brought up or taken down.
bool transmit (typename Transmit<A>::TransmitRef tr)
| transmit |
Used by external and internal entities to transmit packets.
bool receive (A dst, A src, Packet *packet)
throw(BadPeer) | receive |
Packets for this peer are received here.
bool send_lsa (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
bool queue_lsa (OspfTypes::PeerID peerid, OspfTypes::NeighbourID nid,
Lsa::LsaRef lsar, bool &multicast_on_peer)
| queue_lsa |
[const]
Queue an LSA for transmission.
Parameters:
peer | the LSA arrived on. |
nid | the LSA arrived on. |
lsar | the lsa |
multicast_on_peer | Did this LSA get multicast on this peer. |
Returns: true on success.
bool push_lsas ()
| push_lsas |
bool neighbours_exchange_or_loading (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 (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 (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 (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 (OspfTypes::AreaID area,
const OspfTypes::NeighbourID nid)
| event_bad_link_state_request |
Generate a BadLSReq event.
bool virtual_link_endpoint (OspfTypes::AreaID area)
| virtual_link_endpoint |
Are any of neighbours of this peer a virtual link endpoint.
Returns: true if any are.
OspfTypes::LinkType get_linktype ()
| get_linktype |
[const]
Returns: the link type.
void router_id_changing ()
| router_id_changing |
The router ID is about to change.
bool set_interface_id (uint32_t interface_id)
| set_interface_id |
Set the interface ID OSPFv3 only.
uint32_t get_interface_id ()
| get_interface_id |
[const]
Get the interface ID OSPFv3 only.
bool get_attached_routers (OspfTypes::AreaID area,
list<RouterInfo>& routes)
| get_attached_routers |
Return a list of the fully adjacent routers.
bool add_advertise_net (OspfTypes::AreaID area, A addr, uint32_t prefix)
| add_advertise_net |
Set a network to advertise OSPFv3 only.
bool remove_all_nets (OspfTypes::AreaID area)
| remove_all_nets |
Remove all the networks that are being advertised OSPFv3 only.
bool update_nets (OspfTypes::AreaID area)
| update_nets |
Calls to add_advertise_net() and remove_all_nets() must be followed by a call to update nets to force a new Link-LSA to be sent out OSPFv3 only.
bool set_hello_interval (OspfTypes::AreaID area, uint16_t hello_interval)
| set_hello_interval |
Set the hello interval in seconds.
bool set_options (OspfTypes::AreaID area, uint32_t options)
| set_options |
bool set_router_priority (OspfTypes::AreaID area, uint8_t priority)
| set_router_priority |
bool set_router_dead_interval (OspfTypes::AreaID area,
uint32_t router_dead_interval)
| set_router_dead_interval |
Set the router dead interval in seconds.
bool set_simple_authentication_key (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:
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 (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:
area | the area ID. |
the | error message (if error). |
Returns: true on success, otherwise false.
bool set_md5_authentication_key (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:
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 (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:
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 (OspfTypes::AreaID area, bool passive, bool host)
| set_passive |
Toggle the passive status of an interface.
bool set_interface_cost (uint16_t interface_cost)
| set_interface_cost |
bool set_retransmit_interval (OspfTypes::AreaID area,
uint16_t retransmit_interval)
| set_retransmit_interval |
bool set_inftransdelay (uint16_t inftransdelay)
| set_inftransdelay |
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. |
set<AddressInfo<A> >& get_address_info (OspfTypes::AreaID area)
| get_address_info |
Get the set of addresses that should be advertised OSPFv3 only.
void start_receiving_packets ()
| start_receiving_packets |
Enable receiving packets on this interface.
void stop_receiving_packets ()
| stop_receiving_packets |
Disable receiving packets on this interface.