xorp

Neighbour< A > Class Template Reference

Neighbour specific information. More...

#include <peer.hh>

List of all members.

Public Types

enum  State {
  Down = 1, Attempt = 2, Init = 3, TwoWay = 4,
  ExStart = 5, Exchange = 6, Loading = 7, Full = 8
}
 

The ordering is important (used in the DR and BDR election).


enum  Timers { INITIAL = 0, FULL = 1 }
 

Index for timers.


typedef XorpCallback0< bool >
::RefPtr 
RxmtCallback

Public Member Functions

 Neighbour (Ospf< A > &ospf, Peer< A > &peer, OspfTypes::RouterID router_id, A neighbour_address, OspfTypes::NeighbourID neighbourid, OspfTypes::LinkType linktype, State state=Init)
 We start in Init not Down state as typically this class is created on demand when a hello packet arrives.
OspfTypes::NeighbourID get_neighbour_id () const
 Get neighbour ID our internal ID for each neighbour.
OspfTypes::RouterID get_router_id () const
 Neighbours router ID.
get_neighbour_address () const
 Neighbour's source address.
OspfTypes::RouterID get_candidate_id () const
State get_state () const
 Get the state of this neighbour.
Authget_auth_handler ()
 Return the authentication handler.
bool is_neighbour_DR () const
bool is_neighbour_DR_or_BDR () const
bool announce_in_hello_packet () const
 Should this neighbour be announced in hello packet.
HelloPacketget_hello_packet ()
 Get a copy of the last hello packet that was received.
HelloPacketget_hello_packet () const
 Get a copy of the last hello packet that was received.
void event_hello_received (HelloPacket *hello)
 RFC 2328 Section 10.5 Receiving Hello Packets, neighbour component.
void data_description_received (DataDescriptionPacket *dd)
 RFC 2328 Section 10.6 Receiving Database Description Packets, neighbour component.
void link_state_request_received (LinkStateRequestPacket *lsrp)
 RFC 2328 Section 10.7.
void link_state_update_received (LinkStateUpdatePacket *lsup)
void link_state_acknowledgement_received (LinkStateAcknowledgementPacket *lsap)
bool send_lsa (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)
 Queue an LSA for transmission.
bool push_lsas (const char *message)
 Send (push) any queued LSAs.
bool on_link_state_request_list (Lsa::LsaRef lsar) const
 Is this LSA on this neighbours link state request list.
OspfTypes::LinkType get_linktype () const
bool send_ack (list< Lsa_header > &ack, bool direct, bool &multicast_on_peer)
 Send acknowledgement.
void event_kill_neighbour ()
void event_adj_ok ()
void event_bad_link_state_request ()
bool get_neighbour_info (NeighbourInfo &ninfo) const
 Get state information about this neighbour.
string str ()
template<>
OspfTypes::NeighbourID _ticket

Static Public Member Functions

static const char * pp_state (State is)
 Pretty print the neighbour state.

Static Public Attributes

static const uint32_t TIMERS = 2
static OspfTypes::NeighbourID _ticket

Private Member Functions

AreaRouter< A > * get_area_router ()
 Get the area router.
void change_state (State state)
 Change state, use this not set_state when changing states.
void set_state (State state)
 Set the state of this neighbour.
bool establish_adjacency_p () const
 RFC 2328 Section 10.4.
bool is_DR () const
bool is_BDR () const
bool is_DR_or_BDR () const
void start_inactivity_timer ()
 Start the inactivity timer.
void stop_inactivity_timer ()
 Stop the inactivity timer.
void start_rxmt_timer (uint32_t index, RxmtCallback, bool immediate, const char *comment)
 Start the retransmit timer.
void stop_rxmt_timer (uint32_t index, const char *comment)
 Stop the retransmit timer.
void ensure_retransmitter_running (const char *comment)
 Ensure that the LSA retransmitter is running.
bool retransmitter ()
 Retransmit link state request and link state update packets.
void build_data_description_packet ()
 Build database description packet.
bool send_data_description_packet ()
 Send database description packet.
void start_sending_data_description_packets (const char *event_name, bool immediate=true)
 Start sending data description packets.
bool extract_lsa_headers (DataDescriptionPacket *dd)
 Extract the list of LSA headers for future requests from the neighbour.
bool send_link_state_request_packet (LinkStateRequestPacket &lsrp)
 Send link state request packet.
bool send_link_state_update_packet (LinkStateUpdatePacket &lsup, bool direct=false)
 Send link state update packet.
bool send_link_state_ack_packet (LinkStateAcknowledgementPacket &lsap, bool direct, bool &multicast_on_peer)
 Send link state ack packet.
void tear_down_state (State previous_state)
 The state has just dropped so pull out any state associated with a higher state.
void event_1_way_received ()
void event_2_way_received ()
void event_negotiation_done ()
void event_sequence_number_mismatch ()
void event_exchange_done ()
void event_loading_done ()
void event_inactivity_timer ()
void event_SequenceNumberMismatch_or_BadLSReq (const char *event_name)
 Common code for: Sequence Number Mismatch and Bad Link State Request.

Private Attributes

Ospf< A > & _ospf
Peer< A > & _peer
const OspfTypes::RouterID _router_id
const A _neighbour_address
const OspfTypes::NeighbourID _neighbourid
const OspfTypes::LinkType _linktype
State _state
HelloPacket_hello_packet
DataDescriptionPacket _last_dd
DataDescriptionPacket _data_description_packet
bool _all_headers_sent
XorpTimer _rxmt_timer [TIMERS]
RxmtWrapper_rxmt_wrapper [TIMERS]
DataBaseHandle _database_handle
list< Lsa_header_ls_request_list
list< Lsa::LsaRef_lsa_queue
list< Lsa::LsaRef_lsa_rxmt
XorpTimer _inactivity_timer
TimeVal _creation_time
TimeVal _adjacency_time

Detailed Description

template<typename A>
class Neighbour< A >

Neighbour specific information.


Member Function Documentation

template<typename A>
bool Neighbour< A >::announce_in_hello_packet ( ) const [inline]

Should this neighbour be announced in hello packet.

Returns:
true if it should.
template<typename A >
void Neighbour< A >::ensure_retransmitter_running ( const char *  comment) [private]

Ensure that the LSA retransmitter is running.

If there is an existing timer, make no changes, otherwise start a new timer running.

template<typename A >
bool Neighbour< A >::establish_adjacency_p ( ) const [private]

RFC 2328 Section 10.4.

Returns:
true if an adjacency should be established with this neighbour

Whether to become adjacent

template<typename A >
bool Neighbour< A >::extract_lsa_headers ( DataDescriptionPacket dd) [private]

Extract the list of LSA headers for future requests from the neighbour.

Returns:
false if an unknown LS type is encountered or if an AS-External-LSA appears in a non-normal area, otherwise true.
template<typename A>
OspfTypes::RouterID Neighbour< A >::get_candidate_id ( ) const [inline]
Returns:
the value that should be used for DR or BDR for this neighbour In OSPFv2 its the source address of the interface. In OSPFv3 its the router ID.
template<typename A>
OspfTypes::LinkType Neighbour< A >::get_linktype ( ) const [inline]
Returns:
the link type.
template<typename A >
bool Neighbour< A >::get_neighbour_info ( NeighbourInfo ninfo) const

Get state information about this neighbour.

Parameters:
ninfoif neighbour is found its information.
template<typename A >
bool Neighbour< A >::is_BDR ( ) const [private]
Returns:
true if this router is the BDR.
template<typename A >
bool Neighbour< A >::is_DR ( ) const [private]
Returns:
true if this router is the DR.
template<typename A >
bool Neighbour< A >::is_DR_or_BDR ( ) const [private]
Returns:
true if this router is the DR or BDR.
template<typename A >
bool Neighbour< A >::is_neighbour_DR ( ) const
Returns:
true if this routers neighbour is the DR.
template<typename A >
bool Neighbour< A >::is_neighbour_DR_or_BDR ( ) const
Returns:
true if this routers neighbour is the DR or BDR.
template<typename A >
void Neighbour< A >::link_state_request_received ( LinkStateRequestPacket lsrp)

RFC 2328 Section 10.7.

Receiving Link State Request Packets

template<typename A >
bool Neighbour< A >::on_link_state_request_list ( Lsa::LsaRef  lsar) const

Is this LSA on this neighbours link state request list.

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

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 Neighbour< A >::retransmitter ( ) [private]

Retransmit link state request and link state update packets.

Returns:
true if there are more retransmissions to perform.
template<typename A >
bool Neighbour< A >::send_ack ( list< Lsa_header > &  ack,
bool  direct,
bool &  multicast_on_peer 
)

Send acknowledgement.

Parameters:
acklist of acknowledgements.
directif true send directly to the neighbour.
multicast_on_peerset to true if the ack was multicast. Only if direct is false is it possible for the packet to be multicast.
Returns:
true if an acknowledgement is sent.
template<typename A >
bool Neighbour< A >::send_link_state_ack_packet ( LinkStateAcknowledgementPacket lsap,
bool  direct,
bool &  multicast_on_peer 
) [private]

Send link state ack packet.

Parameters:
directif true send directly to the neighbour.
multicast_on_peerset to true if the packet is multicast false otherwise.
template<typename A >
bool Neighbour< A >::send_link_state_update_packet ( LinkStateUpdatePacket lsup,
bool  direct = false 
) [private]

Send link state update packet.

Parameters:
directif true send directly to the neighbour.
template<typename A >
bool Neighbour< A >::send_lsa ( Lsa::LsaRef  lsar)

Send this LSA directly to the neighbour.

Do not place on retransmission list.

Parameters:
lsar
Returns:
true on success
template<typename A >
void Neighbour< A >::start_inactivity_timer ( ) [private]

Start the inactivity timer.

Used to track Hello packets from the neighbour.

template<typename A >
void Neighbour< A >::start_rxmt_timer ( uint32_t  index,
RxmtCallback  rcb,
bool  immediate,
const char *  comment 
) [private]

Start the retransmit timer.

Parameters:
indexdefining which timer to use.
RxmtCallbackmethod to be called ever retransmit interval.
immediatedon't wait for the retransmit interval send one now.
commentto track the callbacks
template<typename A >
void Neighbour< A >::start_sending_data_description_packets ( const char *  event_name,
bool  immediate = true 
) [private]

Start sending data description packets.

RFC 2328 Section 10.8.

Should only be called in state ExStart.

Parameters:
event_namefor debugging.
immediateif true send the packet immediately, if false wait the retransmit interval.

Sending Database Description Packets. (ExStart)

template<typename A >
void Neighbour< A >::stop_inactivity_timer ( ) [private]

Stop the inactivity timer.

Used to track Hello packets from the neighbour.

template<typename A >
void Neighbour< A >::stop_rxmt_timer ( uint32_t  index,
const char *  comment 
) [private]

Stop the retransmit timer.

Parameters:
indexdefining which timer to use.
template<typename A >
void Neighbour< A >::tear_down_state ( State  previous_state) [private]

The state has just dropped so pull out any state associated with a higher state.

Parameters:
previous_state

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