xorp

PeerOut< A > Class Template Reference

In OSPF terms this class represents an interface/link; interface is too overloaded a term. More...

#include <peer.hh>

List of all members.

Public Member Functions

 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)
string get_if_name () const
 For debugging only printable rendition of this interface/vif.
bool match (A source, string &interface, string &vif)
 If the source address matches the interface address return the interface and vif.
OspfTypes::PeerID get_peerid () const
 Get Peer ID.
bool set_interface_address (A interface_address)
 Set the address of this interface/vif.
get_interface_address () const
 Address of this interface/vif.
uint16_t get_interface_prefix_length () const
uint16_t get_interface_mtu () const
uint16_t get_frame_size () const
 The maximum size of an OSPF frame, the MTU minus the IP header.
void join_multicast_group (A address)
 Join multicast group on this interface/vif.
void leave_multicast_group (A address)
 Leave multicast group on this interface/vif.
uint16_t get_interface_cost () const
uint16_t get_inftransdelay () const
bool get_areas (list< OspfTypes::AreaID > &areas) const
 Get the list of areas associated with this peer.
bool add_area (OspfTypes::AreaID area, OspfTypes::AreaType area_type)
 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 the type of this area.
bool remove_area (OspfTypes::AreaID area)
 This area is being removed.
bool add_neighbour (OspfTypes::AreaID area, A neighbour_address, OspfTypes::RouterID)
 Add a neighbour to the peer.
bool remove_neighbour (OspfTypes::AreaID area, A neighbour_address, OspfTypes::RouterID rid)
 Remove a neighbour from the peer.
void set_state (bool state)
 Set the state of this peer.
bool get_state () const
 Get the state of this peer.
void set_link_status (bool status, const char *dbg)
 Set the link status.
void 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)
 Used by external and internal entities to transmit packets.
bool receive (A dst, A src, Packet *packet) throw (BadPeer)
 Packets for this peer are received here.
bool send_lsa (OspfTypes::AreaID area, const OspfTypes::NeighbourID nid, Lsa::LsaRef lsar)
 Send this LSA directly to the neighbour.
bool queue_lsa (OspfTypes::PeerID peerid, OspfTypes::NeighbourID nid, Lsa::LsaRef lsar, bool &multicast_on_peer) const
 Queue an LSA for transmission.
bool push_lsas (const char *message)
 Send (push) any queued LSAs.
bool neighbours_exchange_or_loading (OspfTypes::AreaID area)
 Are any of the neighbours of this peer in the state exchange or loading.
bool neighbour_at_least_two_way (OspfTypes::AreaID area, OspfTypes::RouterID rid, bool &twoway)
 Is the state of the neighbour with the specified Router ID at least 2-Way.
bool get_neighbour_address (OspfTypes::AreaID area, OspfTypes::RouterID rid, uint32_t interface_id, A &neighbour_address)
 Neighbour's source address.
bool on_link_state_request_list (OspfTypes::AreaID area, const OspfTypes::NeighbourID nid, Lsa::LsaRef lsar)
 Is this LSA on this neighbours link state request list.
bool event_bad_link_state_request (OspfTypes::AreaID area, const OspfTypes::NeighbourID nid)
 Generate a BadLSReq event.
bool virtual_link_endpoint (OspfTypes::AreaID area)
 Are any of neighbours of this peer a virtual link endpoint.
OspfTypes::LinkType get_linktype () const
void router_id_changing ()
 The router ID is about to change.
bool set_interface_id (uint32_t interface_id)
 Set the interface ID OSPFv3 only.
uint32_t get_interface_id () const
 Get the interface ID OSPFv3 only.
bool get_attached_routers (OspfTypes::AreaID area, list< RouterInfo > &routes)
 Return a list of the fully adjacent routers.
bool add_advertise_net (OspfTypes::AreaID area, A addr, uint32_t prefix)
 Set a network to advertise OSPFv3 only.
bool remove_all_nets (OspfTypes::AreaID area)
 Remove all the networks that are being advertised OSPFv3 only.
bool update_nets (OspfTypes::AreaID area)
 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 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 the router dead interval in seconds.
bool set_simple_authentication_key (OspfTypes::AreaID area, const string &password, string &error_msg)
 Set a simple password authentication key.
bool delete_simple_authentication_key (OspfTypes::AreaID area, string &error_msg)
 Delete a simple password authentication key.
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 an MD5 authentication key.
bool delete_md5_authentication_key (OspfTypes::AreaID area, uint8_t key_id, string &error_msg)
 Delete an MD5 authentication key.
bool set_passive (OspfTypes::AreaID area, bool passive, bool host)
 Toggle the passive status of an interface.
bool set_interface_cost (uint16_t interface_cost)
 Set the interface cost.
bool set_retransmit_interval (OspfTypes::AreaID area, uint16_t retransmit_interval)
 Set RxmtInterval.
bool set_inftransdelay (uint16_t inftransdelay)
 Set InfTransDelay.
bool get_neighbour_list (list< OspfTypes::NeighbourID > &neighbours) const
 Get a list of all the neighbours.
bool get_neighbour_info (OspfTypes::NeighbourID nid, NeighbourInfo &ninfo) const
 Get state information about this neighbour.
set< AddressInfo< A > > & get_address_info (OspfTypes::AreaID area)
 Get the set of addresses that should be advertised OSPFv3 only.
void start_receiving_packets ()
 Enable receiving packets on this interface.
void stop_receiving_packets ()
 Disable receiving packets on this interface.
template<>
bool match (IPv6 source, string &interface, string &vif)

Private Member Functions

void set_mask (Peer< A > *peer)
 If this IPv4 then set the mask in the hello packet.
bool bring_up_peering ()
void take_down_peering ()
bool get_passive ()
 Are all the peers in a passive state.

Private Attributes

Ospf< A > & _ospf
const string _interface
const string _vif
const OspfTypes::PeerID _peerid
uint32_t _interface_id
_interface_address
uint16_t _interface_prefix_length
uint16_t _interface_mtu
uint16_t _interface_cost
uint16_t _inftransdelay
const OspfTypes::LinkType _linktype
map< OspfTypes::AreaID, Peer
< A > * > 
_areas
bool _running
bool _link_status
bool _status
set< AddressInfo< A > > _dummy
bool _receiving
queue< typename Transmit< A >
::TransmitRef > 
_transmit_queue

Detailed Description

template<typename A>
class PeerOut< A >

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.


Member Function Documentation

template<typename A >
bool PeerOut< A >::delete_md5_authentication_key ( OspfTypes::AreaID  area,
uint8_t  key_id,
string &  error_msg 
)

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:
areathe area ID.
key_idthe ID of the key to delete.
theerror message (if error).
Returns:
true on success, otherwise false.
template<typename A >
bool PeerOut< A >::delete_simple_authentication_key ( OspfTypes::AreaID  area,
string &  error_msg 
)

Delete a simple password authentication key.

Note that after the deletion the simple password authentication handler is replaced with a Null authentication handler.

Parameters:
areathe area ID.
theerror message (if error).
Returns:
true on success, otherwise false.
template<typename A >
bool PeerOut< A >::event_bad_link_state_request ( OspfTypes::AreaID  area,
const OspfTypes::NeighbourID  nid 
)

Generate a BadLSReq event.

Parameters:
area
nid
template<typename A >
uint16_t PeerOut< A >::get_frame_size ( ) const

The maximum size of an OSPF frame, the MTU minus the IP header.

Returns:
maximum frame size.
template<typename A>
uint16_t PeerOut< A >::get_inftransdelay ( ) const [inline]
Returns:
InfTransDelay
template<typename A>
A PeerOut< A >::get_interface_address ( ) const [inline]

Address of this interface/vif.

Returns:
interface/vif address.
template<typename A>
uint16_t PeerOut< A >::get_interface_cost ( ) const [inline]
Returns:
cost of this interface.
template<typename A>
uint16_t PeerOut< A >::get_interface_mtu ( ) const [inline]
Returns:
mtu of this interface.
template<typename A >
uint16_t PeerOut< A >::get_interface_prefix_length ( ) const
Returns:
prefix length of this interface.
template<typename A>
OspfTypes::LinkType PeerOut< A >::get_linktype ( ) const [inline]
Returns:
the link type.
template<typename A>
bool PeerOut< A >::get_neighbour_address ( OspfTypes::AreaID  area,
OspfTypes::RouterID  rid,
uint32_t  interface_id,
A &  neighbour_address 
)

Neighbour's source address.

Parameters:
area
ridRouter ID
interface_idInterface ID.
neighbour_addressset if neighbour is found.
Returns:
true if the neighbour is found.
template<typename A >
bool PeerOut< A >::get_neighbour_info ( OspfTypes::NeighbourID  nid,
NeighbourInfo ninfo 
) const

Get state information about this neighbour.

Parameters:
nidneighbour information is being request about.
ninfoif neighbour is found its information.
template<typename A >
bool PeerOut< A >::neighbour_at_least_two_way ( OspfTypes::AreaID  area,
OspfTypes::RouterID  rid,
bool &  twoway 
)

Is the state of the neighbour with the specified Router ID at least 2-Way.

Parameters:
area
ridRouter ID
twowayif the neighbour is found true means the neighbour is at least twoway.
Returns:
true if the neighbour is found.
template<typename A >
bool PeerOut< A >::neighbours_exchange_or_loading ( OspfTypes::AreaID  area)

Are any of the neighbours of this peer in the state exchange or loading.

Parameters:
area
Returns:
true if any of the neighbours are in state exchange or loading.
template<typename A >
bool PeerOut< A >::on_link_state_request_list ( OspfTypes::AreaID  area,
const OspfTypes::NeighbourID  nid,
Lsa::LsaRef  lsar 
)

Is this LSA on this neighbours link state request list.

Parameters:
nid
Returns:
true if it is.
template<typename A >
bool PeerOut< A >::queue_lsa ( OspfTypes::PeerID  peerid,
OspfTypes::NeighbourID  nid,
Lsa::LsaRef  lsar,
bool &  multicast_on_peer 
) const

Queue an LSA for transmission.

Parameters:
peerthe LSA arrived on.
nidthe LSA arrived on.
lsarthe lsa
multicast_on_peerDid this LSA get multicast on this peer.
Returns:
true on success.
template<typename A >
bool PeerOut< A >::remove_area ( OspfTypes::AreaID  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.
template<typename A >
bool PeerOut< A >::send_lsa ( OspfTypes::AreaID  area,
const OspfTypes::NeighbourID  nid,
Lsa::LsaRef  lsar 
)

Send this LSA directly to the neighbour.

Do not place on retransmission list.

Parameters:
area
nid
lsar
Returns:
true on success
template<typename A >
void PeerOut< A >::set_link_status ( bool  status,
const char *  dbg 
)

Set the link status.

This is not only the link status but is the interface/vif/address configured up.

template<typename A >
bool PeerOut< A >::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 an MD5 authentication key.

Note that the current authentication handler is replaced with an MD5 authentication handler.

Parameters:
areathe area ID.
key_idunique ID associated with key.
passwordphrase used for MD5 digest computation.
start_timevalstart time when key becomes valid.
end_timevalend time when key becomes invalid.
max_time_driftthe maximum time drift among all routers.
theerror message (if error).
Returns:
true on success, otherwise false.
template<typename A >
bool PeerOut< A >::set_simple_authentication_key ( OspfTypes::AreaID  area,
const string &  password,
string &  error_msg 
)

Set a simple password authentication key.

Note that the current authentication handler is replaced with a simple password authentication handler.

Parameters:
areathe area ID.
passwordthe password to set.
theerror message (if error).
Returns:
true on success, otherwise false.
template<typename A >
bool PeerOut< A >::virtual_link_endpoint ( OspfTypes::AreaID  area)

Are any of neighbours of this peer a virtual link endpoint.

Returns:
true if any are.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations