xorp

Neighbor Class Reference

A one-hop neighbor. More...

#include <neighbor.hh>

List of all members.

Public Member Functions

 Neighbor (EventLoop &ev, Neighborhood *parent, const OlsrTypes::NeighborID nid, const IPv4 &main_addr, const OlsrTypes::LogicalLinkID linkid)
OlsrTypes::NeighborID id () const
const IPv4 main_addr () const
string toStringBrief ()
OlsrTypes::NeighborType neighbor_type () const
uint8_t willingness () const
 Get the willingness-to-forward for this neighbor.
void set_willingness (OlsrTypes::WillType value)
 Set the willingness-to-forward for this neighbor.
bool is_mpr_selector () const
 Return the MPR selector state of this neighbor.
void set_is_mpr_selector (bool value, const TimeVal &expiry_time)
 Set the MPR selector state of this neighbor.
bool is_mpr () const
 Return the previously stored result of MPR selection.
void set_is_mpr (bool value)
bool is_persistent_cand_mpr () const
bool is_cand_mpr ()
 Return the MPR candidacy of this neighbor.
bool is_sym () const
void set_is_sym (bool value)
const set
< OlsrTypes::LogicalLinkID > & 
links () const
const set
< OlsrTypes::TwoHopLinkID > & 
twohop_links () const
void update_link (const OlsrTypes::LogicalLinkID linkid)
 Associate a link tuple with a Neighbor or update an existing one.
bool delete_link (const OlsrTypes::LogicalLinkID linkid)
 Disassociate a link tuple from a Neighbor.
void add_twohop_link (const OlsrTypes::TwoHopLinkID tlid)
 Associate a two-hop link with a Neighbor.
bool delete_twohop_link (const OlsrTypes::TwoHopLinkID tlid)
 Disassociate a two-hop link from a Neighbor.
size_t delete_all_twohop_links ()
 Disassociate all two-hop links from a Neighbor.
void event_mpr_selector_expired ()
 Callback method to: process expiry of an MPR selector tuple.
uint32_t degree () const
 Return the degree of this neighbor.
uint32_t reachability () const
 Return the previously computed reachability of this neighbor.
void set_reachability (uint32_t value)
 Store the reachability of this neighbor.
bool is_advertised () const
 Return if this neighbor is advertised in TC messages.
void set_is_advertised (bool value)
 Store the "is in advertised neighbor set" status.

Protected Member Functions

void recount_degree ()
 Re-count the degree of this strict one-hop Neighbor.
bool update_cand_mpr (bool was_cand_mpr)
 Update the MPR candidacy of this neighbor.

Private Attributes

EventLoop_eventloop
Neighborhood_parent
OlsrTypes::NeighborID _id
IPv4 _main_addr
 main address of this neighbor.
bool _is_mpr
 true if neighbor is an MPR.
bool _is_sym
 true if neighbor is symmetric.
OlsrTypes::WillType _willingness
 willingness to forward traffic.
uint32_t _degree
 the degree of this neighbor.
uint32_t _reachability
 the reachability of this neighbor.
bool _is_advertised
 true if neighbor is advertised in TC messages.
XorpTimer _mpr_selector_timer
 A timer which is scheduled if and only if the neighbor selects this node as an MPR.
set< OlsrTypes::LogicalLinkID_links
 Links which reference this neighbor.
set< OlsrTypes::TwoHopLinkID_twohop_links
 Links to all N2, strict and non-strict, reachable via this N.

Detailed Description

A one-hop neighbor.


Member Function Documentation

void Neighbor::add_twohop_link ( const OlsrTypes::TwoHopLinkID  tlid)

Associate a two-hop link with a Neighbor.

MPR candidacy and degree are updated.

Parameters:
tlidthe ID of the two-hop link to associate with this Neighbor.
uint32_t Neighbor::degree ( ) const [inline]

Return the degree of this neighbor.

Returns:
The number of symmetric neighbors of this neighbor, excluding this node, and other one-hop neighbors.
size_t Neighbor::delete_all_twohop_links ( )

Disassociate all two-hop links from a Neighbor.

MPR candidacy and degree are updated.

Returns:
the number of links which have been deleted.
bool Neighbor::delete_link ( const OlsrTypes::LogicalLinkID  linkid)

Disassociate a link tuple from a Neighbor.

N_status is updated.

Parameters:
linkidthe ID of the link to disassociate from this Neighbor.
Returns:
true if there are no links to this Neighbor and it should now be deleted.
bool Neighbor::delete_twohop_link ( const OlsrTypes::TwoHopLinkID  tlid)

Disassociate a two-hop link from a Neighbor.

MPR candidacy and degree are updated.

Parameters:
tlidthe ID of the two-hop link to disassociate from this Neighbor.
Returns:
true if this Neighbor has no more two-hop links.
bool Neighbor::is_advertised ( ) const [inline]

Return if this neighbor is advertised in TC messages.

Returns:
true if this neighbor is advertised in TC messages.
bool Neighbor::is_cand_mpr ( )

Return the MPR candidacy of this neighbor.

MPR candidacy is computed whenever Neighbor's link state changes.

TODO: NOTE WELL: If a neighbor is not reachable due to no good ETX links, it MUST NOT be considered as an MPR candidate. Currently the code does not take account of this.

Returns:
true if this neighbor is a candidate MPR, that is, there is at least one link to a strict two-hop neighbor, and willingness is not WILL_NEVER.
bool Neighbor::is_mpr ( ) const [inline]

Return the previously stored result of MPR selection.

This is computed by the deferred MPR selection task in Neighborhood.

Returns:
true if this neighbor has been selected as an MPR.
bool Neighbor::is_mpr_selector ( ) const

Return the MPR selector state of this neighbor.

Returns:
true if this neighbor has previously chosen this node as an MPR in a HELLO message, and the tuple is still valid.
bool Neighbor::is_persistent_cand_mpr ( ) const [inline]
Returns:
true if this neighbor is a persistent MPR candidate.
uint32_t Neighbor::reachability ( ) const [inline]

Return the previously computed reachability of this neighbor.

Returns:
The number of strict, uncovered, two-hop neighbors to which this neighbor has a link.
void Neighbor::recount_degree ( ) [protected]

Re-count the degree of this strict one-hop Neighbor.

Section 8.3.1 defines the degree of a one-hop neighbor as the number of symmetric neighbors of the neighbor, excluding any members of the one-hop neighborhood, and excluding this node.

Triggered by a two-hop link state change. TODO: Distribute the computation by pushing the responsibility for signalling the change of state to TwoHopNeighbor, rather than doing it here.

void Neighbor::set_is_advertised ( bool  value) [inline]

Store the "is in advertised neighbor set" status.

Parameters:
valuetrue if this neighbor is advertised in TC.
void Neighbor::set_is_mpr_selector ( bool  value,
const TimeVal expiry_time 
)

Set the MPR selector state of this neighbor.

Parameters:
valuetrue if this neighbor selects this OLSR node as an MPR.
expiry_timeThe expiry time for MPR selector status. Ignored if value is false.
void Neighbor::set_reachability ( uint32_t  value) [inline]

Store the reachability of this neighbor.

Typically called during MPR selection, as reachability can only be computed during MPR selection.

Parameters:
valueThe number of strict, uncovered, two-hop neighbors to which this neighbor has a link.
void Neighbor::set_willingness ( OlsrTypes::WillType  value)

Set the willingness-to-forward for this neighbor.

This may trigger a recount of the node's MPR status; a node with willingness WILL_NEVER may never be an MPR.

Parameters:
valuethe new value for this neighbor's willingness property.
bool Neighbor::update_cand_mpr ( bool  was_cand_mpr) [protected]

Update the MPR candidacy of this neighbor.

Triggered by a one-hop or two-hop link state change. The Neighborhood is notified of the change.

Parameters:
was_cand_mprtrue if the node was an MPR candidate before any other criteria changed.
Returns:
true if the node is now an MPR candidate.
void Neighbor::update_link ( const OlsrTypes::LogicalLinkID  linkid)

Associate a link tuple with a Neighbor or update an existing one.

N_status is updated.

Parameters:
linkidthe ID of the link to associate with this Neighbor.
uint8_t Neighbor::willingness ( ) const [inline]

Get the willingness-to-forward for this neighbor.

Returns:
the neighbor's willingness.

Member Data Documentation

bool Neighbor::_is_mpr [private]

true if neighbor is an MPR.

Note: This may be out of sync with the actual MPR state; it does not get updated until an MPR selection is performed from Neighborhood (the computation is not fully distributed).


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