|
xorp
|
A one-hop neighbor. More...
#include <neighbor.hh>
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. | |
A one-hop neighbor.
| void Neighbor::add_twohop_link | ( | const OlsrTypes::TwoHopLinkID | tlid | ) |
| uint32_t Neighbor::degree | ( | ) | const [inline] |
Return the degree of this neighbor.
| size_t Neighbor::delete_all_twohop_links | ( | ) |
| bool Neighbor::delete_link | ( | const OlsrTypes::LogicalLinkID | linkid | ) |
| bool Neighbor::delete_twohop_link | ( | const OlsrTypes::TwoHopLinkID | tlid | ) |
| bool Neighbor::is_advertised | ( | ) | const [inline] |
Return 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.
| 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.
| bool Neighbor::is_mpr_selector | ( | ) | const |
| bool Neighbor::is_persistent_cand_mpr | ( | ) | const [inline] |
| uint32_t Neighbor::reachability | ( | ) | const [inline] |
Return the previously computed reachability of this neighbor.
| 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] |
| void Neighbor::set_is_mpr_selector | ( | bool | value, |
| const TimeVal & | expiry_time | ||
| ) |
Set the MPR selector state of this neighbor.
| value | true if this neighbor selects this OLSR node as an MPR. |
| expiry_time | The expiry time for MPR selector status. Ignored if value is false. |
| void Neighbor::set_reachability | ( | uint32_t | value | ) | [inline] |
| void Neighbor::set_willingness | ( | OlsrTypes::WillType | value | ) |
| 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.
| was_cand_mpr | true if the node was an MPR candidate before any other criteria changed. |
| void Neighbor::update_link | ( | const OlsrTypes::LogicalLinkID | linkid | ) |
| uint8_t Neighbor::willingness | ( | ) | const [inline] |
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).