Preliminary support for RPL node types. This change allows a node to be in any of three given types:

* Mesh: this is the normal case. Nodes route data on behalf of others and the node can be reached via a DAO route.
* Leaf: the node does not route data on behalf of others, but others can route data to the node (it has a RPL DAO route).
* Feather: this is a new type of node. A feather node routes data on behalf of others, but does not install DAO routes in the network. Feather nodes allow having a larger number of nodes than the RPL network can sustain in terms of routing tables.

This commit introduces the RPL node types and the feather mode, but does not add support for the leaf node type.
This commit is contained in:
Adam Dunkels 2013-11-20 14:10:39 +01:00
parent af24d07848
commit faff1c2a7e
4 changed files with 83 additions and 0 deletions

View file

@ -57,6 +57,47 @@
rpl_stats_t rpl_stats;
#endif
static enum rpl_mode mode = RPL_MODE_MESH;
/*---------------------------------------------------------------------------*/
enum rpl_mode
rpl_get_mode(void)
{
return mode;
}
/*---------------------------------------------------------------------------*/
enum rpl_mode
rpl_set_mode(enum rpl_mode m)
{
enum rpl_mode oldmode = mode;
/* We need to do different things depending on what mode we are
switching to. */
if(m == RPL_MODE_MESH) {
/* If we switcht to mesh mode, we should send out a DAO message to
inform our parent that we now are reachable. Before we do this,
we must set the mode variable, since DAOs will not be send if
we are in feather mode. */
PRINTF("RPL: switching to mesh mode\n");
mode = m;
if(default_instance != NULL) {
rpl_schedule_dao_immediately(default_instance);
}
} else if(m == RPL_MODE_FEATHER) {
PRINTF("RPL: switching to feather mode\n");
mode = m;
if(default_instance != NULL) {
rpl_cancel_dao(default_instance);
}
} else {
mode = m;
}
return oldmode;
}
/*---------------------------------------------------------------------------*/
void
rpl_purge_routes(void)