|
|
Neighbor (EventLoop& ev,
Neighborhood* parent,
const OlsrTypes::NeighborID nid,
const IPv4& main_addr,
const OlsrTypes::LogicalLinkID linkid)
| Neighbor |
inline OlsrTypes::NeighborID id ()
| id |
[const]
inline const IPv4 main_addr ()
| main_addr |
[const]
OlsrTypes::NeighborType neighbor_type ()
| neighbor_type |
[const]
inline uint8_t willingness ()
| willingness |
[const]
Get the willingness-to-forward for this neighbor.
Returns: the neighbor's willingness.
void set_willingness (OlsrTypes::WillType value)
| set_willingness |
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:
value | the new value for this neighbor's willingness property. |
bool is_mpr_selector ()
| 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.
void set_is_mpr_selector (bool value, const TimeVal& expiry_time)
| set_is_mpr_selector |
Set the MPR selector state of this neighbor.
Parameters:
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. |
inline bool is_mpr ()
| is_mpr |
[const]
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.
inline void set_is_mpr (bool value)
| set_is_mpr |
inline bool is_persistent_cand_mpr ()
| is_persistent_cand_mpr |
[const]
Returns: true if this neighbor is a persistent MPR candidate.
bool is_cand_mpr ()
| 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.
inline bool is_sym ()
| is_sym |
[const]
inline void set_is_sym (bool value)
| set_is_sym |
inline const set<OlsrTypes::LogicalLinkID>& links ()
| links |
[const]
inline const set<OlsrTypes::TwoHopLinkID>& twohop_links ()
| twohop_links |
[const]
void update_link (const OlsrTypes::LogicalLinkID linkid)
| update_link |
Associate a link tuple with a Neighbor or update an existing one. N_status is updated.
Parameters:
linkid | the ID of the link to associate with this Neighbor. |
bool delete_link (const OlsrTypes::LogicalLinkID linkid)
| delete_link |
Disassociate a link tuple from a Neighbor. N_status is updated.
Parameters:
linkid | the 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.
void add_twohop_link (const OlsrTypes::TwoHopLinkID tlid)
| add_twohop_link |
Associate a two-hop link with a Neighbor. MPR candidacy and degree are updated.
Parameters:
tlid | the ID of the two-hop link to associate with this Neighbor. |
bool delete_twohop_link (const OlsrTypes::TwoHopLinkID tlid)
| delete_twohop_link |
Disassociate a two-hop link from a Neighbor. MPR candidacy and degree are updated.
Parameters:
tlid | the ID of the two-hop link to disassociate from this Neighbor. |
Returns: true if this Neighbor has no more two-hop links.
size_t delete_all_twohop_links ()
| 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.
void event_mpr_selector_expired ()
| event_mpr_selector_expired |
Callback method to: process expiry of an MPR selector tuple.
inline uint32_t degree ()
| degree |
[const]
Return the degree of this neighbor.
Returns: The number of symmetric neighbors of this neighbor, excluding this node, and other one-hop neighbors.
inline uint32_t reachability ()
| reachability |
[const]
Return the previously computed reachability of this neighbor.
Returns: The number of strict, uncovered, two-hop neighbors to which this neighbor has a link.
inline void set_reachability (uint32_t value)
| set_reachability |
Store the reachability of this neighbor.
Typically called during MPR selection, as reachability can only be computed during MPR selection.
Parameters:
value | The number of strict, uncovered, two-hop neighbors to which this neighbor has a link. |
inline bool is_advertised ()
| is_advertised |
[const]
Return if this neighbor is advertised in TC messages.
Returns: true if this neighbor is advertised in TC messages.
inline void set_is_advertised (bool value)
| set_is_advertised |
Store the "is in advertised neighbor set" status.
Parameters:
value | true if this neighbor is advertised in TC. |
void recount_degree ()
| 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.
bool update_cand_mpr (bool was_cand_mpr)
| update_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_mpr | true if the node was an MPR candidate before any other criteria changed. |
Returns: true if the node is now an MPR candidate.