|
|
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,
PeerID peerid,
const A source, const uint16_t prefix_length,
const uint16_t interface_mtu,
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.
PeerID get_peerid ()
| get_peerid |
[const]
Get Peer ID.
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 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 (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 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 (OspfTypes::AreaID area, uint32_t interface_id)
| set_interface_id |
Set the interface ID 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,
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:
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 (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)
| 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. |