Implementation of neighbors.
More...
|
void | neighbors_init (void) |
| Initializes this module. More...
|
|
dagrank_t | neighbors_getMyDAGrank (void) |
| Retrieve this mote's current DAG rank. More...
|
|
uint8_t | neighbors_getNumNeighbors (void) |
| Retrieve the number of neighbors this mote's currently knows of. More...
|
|
bool | neighbors_getPreferredParentEui64 (open_addr_t *addressToWrite) |
| Retrieve my preferred parent's EUI64 address. More...
|
|
open_addr_t * | neighbors_getKANeighbor (uint16_t kaPeriod) |
| Find neighbor to which to send KA. More...
|
|
bool | neighbors_isStableNeighbor (open_addr_t *address) |
| Indicate whether some neighbor is a stable neighbor. More...
|
|
bool | neighbors_isPreferredParent (open_addr_t *address) |
| Indicate whether some neighbor is a preferred neighbor. More...
|
|
bool | neighbors_isNeighborWithLowerDAGrank (uint8_t index) |
| Indicate whether some neighbor has a lower DAG rank that me. More...
|
|
bool | neighbors_isNeighborWithHigherDAGrank (uint8_t index) |
| Indicate whether some neighbor has a lower DAG rank that me. More...
|
|
void | neighbors_indicateRx (open_addr_t *l2_src, int8_t rssi, asn_t *asnTimestamp, bool joinPrioPresent, uint8_t joinPrio) |
| Indicate some (non-ACK) packet was received from a neighbor. More...
|
|
void | neighbors_indicateTx (open_addr_t *dest, uint8_t numTxAttempts, bool was_finally_acked, asn_t *asnTimestamp) |
| Indicate some packet was sent to some neighbor. More...
|
|
void | neighbors_indicateRxDIO (OpenQueueEntry_t *msg) |
| Indicate I just received a RPL DIO from a neighbor. More...
|
|
void | neighbors_getNeighbor (open_addr_t *address, uint8_t addr_type, uint8_t index) |
| Write the 64-bit address of some neighbor to some location. More...
|
|
void | neighbors_updateMyDAGrankAndNeighborPreference (void) |
| Update my DAG rank and neighbor preference. More...
|
|
void | neighbors_removeOld (void) |
|
bool | debugPrint_neighbors (void) |
| Triggers this module to print status information, over serial. More...
|
|
void | debugNetPrint_neighbors (netDebugNeigborEntry_t *schlist) |
|
Implementation of neighbors.
- Author
- Thomas Watteyne watte.nosp@m.yne@.nosp@m.eecs..nosp@m.berk.nosp@m.eley..nosp@m.edu, August 2010
#define BADNEIGHBORMAXRSSI -80 |
#define DEFAULTLINKCOST 15 |
#define GOODNEIGHBORMINRSSI -90 |
#define MAXDAGRANK 0xffff |
#define MAXNUMNEIGHBORS 10 |
#define MINHOPRANKINCREASE 256 |
#define SWITCHSTABILITYTHRESHOLD 3 |
bool debugPrint_neighbors |
( |
void |
| ) |
|
Triggers this module to print status information, over serial.
debugPrint_* functions are used by the openserial module to continuously print status information about several modules in the OpenWSN stack.
- Returns
- TRUE if this function printed something, FALSE otherwise.
open_addr_t* neighbors_getKANeighbor |
( |
uint16_t |
kaPeriod | ) |
|
Find neighbor to which to send KA.
This function iterates through the neighbor table and identifies the neighbor we need to send a KA to, if any. This neighbor satisfies the following conditions:
- it is one of our preferred parents
- we haven't heard it for over kaPeriod
- Parameters
-
[in] | kaPeriod | The maximum number of slots I'm allowed not to have heard it. |
- Returns
- A pointer to the neighbor's address, or NULL if no KA is needed.
Retrieve this mote's current DAG rank.
- Returns
- This mote's current DAG rank.
void neighbors_getNeighbor |
( |
open_addr_t * |
address, |
|
|
uint8_t |
addr_type, |
|
|
uint8_t |
index |
|
) |
| |
Write the 64-bit address of some neighbor to some location.
uint8_t neighbors_getNumNeighbors |
( |
void |
| ) |
|
Retrieve the number of neighbors this mote's currently knows of.
- Returns
- The number of neighbors this mote's currently knows of.
bool neighbors_getPreferredParentEui64 |
( |
open_addr_t * |
addressToWrite | ) |
|
Retrieve my preferred parent's EUI64 address.
- Parameters
-
[out] | addressToWrite | Where to write the preferred parent's address to. |
void neighbors_indicateRx |
( |
open_addr_t * |
l2_src, |
|
|
int8_t |
rssi, |
|
|
asn_t * |
asnTs, |
|
|
bool |
joinPrioPresent, |
|
|
uint8_t |
joinPrio |
|
) |
| |
Indicate some (non-ACK) packet was received from a neighbor.
This function should be called for each received (non-ACK) packet so neighbor statistics in the neighbor table can be updated.
The fields which are updated are:
- numRx
- rssi
- asn
- stableNeighbor
- switchStabilityCounter
- Parameters
-
[in] | l2_src | MAC source address of the packet, i.e. the neighbor who sent the packet just received. |
[in] | rssi | RSSI with which this packet was received. |
[in] | asnTs | ASN at which this packet was received. |
[in] | joinPrioPresent | Whether a join priority was present in the received packet. |
[in] | joinPrio | The join priority present in the packet, if any. |
Indicate I just received a RPL DIO from a neighbor.
This function should be called for each received a DIO is received so neighbor routing information in the neighbor table can be updated.
The fields which are updated are:
- Parameters
-
[in] | msg | The received message with msg->payload pointing to the DIO header. |
void neighbors_indicateTx |
( |
open_addr_t * |
l2_dest, |
|
|
uint8_t |
numTxAttempts, |
|
|
bool |
was_finally_acked, |
|
|
asn_t * |
asnTs |
|
) |
| |
Indicate some packet was sent to some neighbor.
This function should be called for each transmitted (non-ACK) packet so neighbor statistics in the neighbor table can be updated.
The fields which are updated are:
- Parameters
-
[in] | l2_dest | MAC destination address of the packet, i.e. the neighbor who I just sent the packet to. |
[in] | numTxAttempts | Number of transmission attempts to this neighbor. |
[in] | was_finally_acked | TRUE iff the packet was ACK'ed by the neighbor on final transmission attempt. |
[in] | asnTs | ASN of the last transmission attempt. |
void neighbors_init |
( |
void |
| ) |
|
bool neighbors_isNeighborWithHigherDAGrank |
( |
uint8_t |
index | ) |
|
Indicate whether some neighbor has a lower DAG rank that me.
- Parameters
-
[in] | index | The index of that neighbor in the neighbor table. |
- Returns
- TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
bool neighbors_isNeighborWithLowerDAGrank |
( |
uint8_t |
index | ) |
|
Indicate whether some neighbor has a lower DAG rank that me.
- Parameters
-
[in] | index | The index of that neighbor in the neighbor table. |
- Returns
- TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
bool neighbors_isPreferredParent |
( |
open_addr_t * |
address | ) |
|
Indicate whether some neighbor is a preferred neighbor.
- Parameters
-
[in] | address | The EUI64 address of the neighbor. |
- Returns
- TRUE if that neighbor is preferred, FALSE otherwise.
bool neighbors_isStableNeighbor |
( |
open_addr_t * |
address | ) |
|
Indicate whether some neighbor is a stable neighbor.
- Parameters
-
[in] | address | The address of the neighbor, a full 128-bit IPv6 addres. |
- Returns
- TRUE if that neighbor is stable, FALSE otherwise.
void neighbors_removeOld |
( |
void |
| ) |
|
void neighbors_updateMyDAGrankAndNeighborPreference |
( |
void |
| ) |
|
Update my DAG rank and neighbor preference.
Call this function whenever some data is changed that could cause this mote's routing decisions to change. Examples are:
- I received a DIO which updated by neighbor table. If this DIO indicated a very low DAGrank, I may want to change by routing parent.
- I became a DAGroot, so my DAGrank should be 0.