|
|
A peer represents a single area and is bound to a PeerOut.
enum InterfaceState { Down, Loopback, Waiting, Point2Point, DR_other, Backup, DR, } | InterfaceState |
Interface as defined by OSPF not XORP.
Peer (Ospf<A>& ospf, PeerOut<A>& peerout, OspfTypes::AreaID area_id,
OspfTypes::AreaType area_type)
| Peer |
~Peer ()
| ~Peer |
string get_if_name ()
| get_if_name |
[const]
For debugging only printable rendition of this interface/vif.
PeerID get_peerid ()
| get_peerid |
[const]
Get Peer ID.
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.
A get_p2p_neighbour_address ()
| get_p2p_neighbour_address |
[const]
Address of the p2p neighbour.
Returns: p2p neighbour address.
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. Also include any bytes that the authentication scheme may use.
Returns: maximum frame size.
uint16_t get_inftransdelay ()
| get_inftransdelay |
[const]
Returns: InfTransDelay
bool transmit (typename Transmit<A>::TransmitRef tr)
| transmit |
Used by external and internal entities to transmit packets.
bool add_neighbour (A neighbour_address, OspfTypes::RouterID rid)
| add_neighbour |
bool remove_neighbour (A neighbour_address, OspfTypes::RouterID rid)
| remove_neighbour |
bool receive (A dst, A src, Packet *packet)
| receive |
Packets for this peer are received here.
bool accept_lsa (Lsa::LsaRef lsar)
| accept_lsa |
[const]
Used to test if an lsa should be accepted for this peer/neighbour. Specifically to deal with the case that AS-External-LSAs should not be sent on virtual links.
bool send_lsa (const OspfTypes::NeighbourID nid, Lsa::LsaRef lsar)
| send_lsa |
[const]
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 do_dr_or_bdr ()
| do_dr_or_bdr |
[const]
bool is_DR ()
| is_DR |
[const]
Returns: true if this router is the DR.
bool is_BDR ()
| is_BDR |
[const]
Returns: true if this router is the BDR.
bool is_DR_or_BDR ()
| is_DR_or_BDR |
[const]
Returns: true if this router is the DR or BDR.
bool neighbours_exchange_or_loading ()
| neighbours_exchange_or_loading |
[const]
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 OspfTypes::NeighbourID nid,
Lsa::LsaRef lsar)
| on_link_state_request_list |
[const]
Is this LSA on this neighbours link state request list.
Returns: true if it is.
bool event_bad_link_state_request (const OspfTypes::NeighbourID nid)
| event_bad_link_state_request |
[const]
Generate a BadLSReq event.
bool virtual_link_endpoint ()
| virtual_link_endpoint |
[const]
Are any of neighbours of this peer a virtual link endpoint.
Returns: true if any are.
void send_direct_acks (OspfTypes::NeighbourID nid,
list<Lsa_header>& ack)
| send_direct_acks |
Send direct ACKs
Parameters:
nid | the neighbour that the LSAs that are being acked arrived on. |
ack | list of acks to send. |
void send_delayed_acks (OspfTypes::NeighbourID nid,
list<Lsa_header>& ack)
| send_delayed_acks |
Send delayed ACKs
Parameters:
nid | the neighbour that the LSAs that are being acked arrived on. |
ack | list of acks to send. |
Neighbour<A> * find_neighbour (A src, OspfTypes::RouterID rid)
| find_neighbour |
bool is_neighbour_DR_or_BDR (OspfTypes::NeighbourID nid)
| is_neighbour_DR_or_BDR |
[const]
Returns: true if this routers neighbour is the DR or BDR.
bool process_hello_packet (A dst, A src, HelloPacket *hello)
| process_hello_packet |
bool process_data_description_packet (A dst, A src,
DataDescriptionPacket *dd)
| process_data_description_packet |
Process a data description packet.
bool process_link_state_request_packet (A dst, A src,
LinkStateRequestPacket *lsrp)
| process_link_state_request_packet |
Process a link state request packet.
bool process_link_state_update_packet (A dst, A src,
LinkStateUpdatePacket *lsup)
| process_link_state_update_packet |
Process a link state update packet.
bool
process_link_state_acknowledgement_packet (A dst, A src,
LinkStateAcknowledgementPacket
*lsap)
| process_link_state_acknowledgement_packet |
Process a link state acknowledgement packet.
void start ()
| start |
Start the protocol machinery running
void stop ()
| stop |
Stop the protocol machinery running
void change_area_router_type (OspfTypes::AreaType area_type)
| change_area_router_type |
void event_interface_up ()
| event_interface_up |
void event_wait_timer ()
| event_wait_timer |
void event_backup_seen ()
| event_backup_seen |
void event_neighbour_change ()
| event_neighbour_change |
void event_loop_ind ()
| event_loop_ind |
void event_unloop_ind ()
| event_unloop_ind |
void event_interface_down ()
| event_interface_down |
void schedule_event (const char *)
| schedule_event |
Schedule an event, used by the neighbours to schedule an interface event.
void process_scheduled_events ()
| process_scheduled_events |
Run all the deferred events, callback method.
AreaRouter<A> * get_area_router ()
| get_area_router |
OspfTypes::RouterID get_candidate_id (A, OspfTypes::RouterID)
| get_candidate_id |
[static]
Returns: the value that should be used for DR or BDR. In OSPFv2 its the source address of the interface. In OSPFv3 its the router ID.
OspfTypes::RouterID get_candidate_id (A = A::ZERO())
| get_candidate_id |
[const]
Returns: the value that should be used for DR or BDR for this router In OSPFv2 its the source address of the interface. In OSPFv3 its the router ID. A dummy argument is used to force an IPv4 and an IPv6 instance of this method to be generated. Isn't C++ cool?
InterfaceState get_state ()
| get_state |
[const]
OspfTypes::LinkType get_linktype ()
| get_linktype |
[const]
Returns: the link type.
Auth& get_auth_handler ()
| get_auth_handler |
Return the authentication handler.
uint32_t send_options ()
| send_options |
Returns: the options field that is placed in some of outgoing packets.
void populate_common_header (Packet& packet)
| populate_common_header |
Fill in the common header parts of the packet.
string pp_interface_state (InterfaceState is)
| pp_interface_state |
[static]
Pretty print the interface state.
OspfTypes::AreaID get_area_id ()
| get_area_id |
[const]
Returns: the Area ID.
OspfTypes::AreaType get_area_type ()
| get_area_type |
[const]
Returns: the Area Type.
void set_area_type (OspfTypes::AreaType area_type)
| set_area_type |
Returns: the Area Type.
void router_id_changing ()
| router_id_changing |
The router ID is about to change.
bool set_network_mask (uint32_t network_mask)
| set_network_mask |
Set the network mask OSPFv2 only.
uint32_t get_network_mask ()
| get_network_mask |
[const]
Set the network mask OSPFv2 only.
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 set_hello_interval (uint16_t hello_interval)
| set_hello_interval |
Set the hello interval in seconds.
bool set_options (uint32_t options)
| set_options |
uint32_t get_options ()
| get_options |
[const]
bool set_router_priority (uint8_t priority)
| set_router_priority |
bool set_router_dead_interval (uint32_t router_dead_interval)
| set_router_dead_interval |
Set the router dead interval in seconds.
uint32_t get_router_dead_interval ()
| get_router_dead_interval |
[const]
Get the router dead interval in seconds.
bool set_simple_authentication_key (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:
password | the password to set. |
the | error message (if error). |
Returns: true on success, otherwise false.
bool delete_simple_authentication_key (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:
the | error message (if error). |
Returns: true on success, otherwise false.
bool set_md5_authentication_key (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:
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 (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:
key_id | the ID of the key to delete. |
the | error message (if error). |
Returns: true on success, otherwise false.
bool set_passive (bool passive)
| set_passive |
Toggle the passive status of an interface.
bool set_rxmt_interval (uint32_t rxmt_interval)
| set_rxmt_interval |
uint32_t get_rxmt_interval ()
| get_rxmt_interval |
OspfTypes::RouterID get_designated_router ()
| get_designated_router |
[const]
OspfTypes::RouterID get_backup_designated_router ()
| get_backup_designated_router |
[const]
Get the backup designated router.
uint32_t get_designated_router_interface_id (A = A::ZERO())
| get_designated_router_interface_id |
[const]
Get the interface ID of the designated router. OSPFv3 only.
void update_router_links ()
| update_router_links |
Compute the current router link.
Typically called after a state transition.
void adjacency_change (bool up)
| adjacency_change |
Used to notify the peer that a neighbour has become fully adjacent or a neighbour is no longer fully adjacent. Used to trigger the generation or withdrawal of a network-LSA. Should only be called if the interface is in state DR.
Parameters:
up | true if the adjacency became full, false otherwise. |
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. |