2015-05-22 21:48:30 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Cenk Gündoğan <cnkgndgn@gmail.com>
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License v2.1. See the file LICENSE in the top level directory for
|
|
|
|
* more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup sys_shell_commands.h
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
*
|
|
|
|
* @author Cenk Gündoğan <cnkgndgn@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
2015-08-17 15:41:29 +02:00
|
|
|
#include "net/gnrc/ipv6/netif.h"
|
|
|
|
#include "net/gnrc/rpl.h"
|
|
|
|
#include "net/gnrc/rpl/structs.h"
|
|
|
|
#include "net/gnrc/rpl/dodag.h"
|
2015-05-22 21:48:30 +02:00
|
|
|
#include "utlist.h"
|
|
|
|
#include "trickle.h"
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
int _gnrc_rpl_init(char *arg)
|
2015-05-22 21:48:30 +02:00
|
|
|
{
|
2015-08-17 15:41:29 +02:00
|
|
|
gnrc_ipv6_netif_t *entry = NULL;
|
2015-05-22 21:48:30 +02:00
|
|
|
kernel_pid_t iface_pid = (kernel_pid_t) atoi(arg);
|
2015-08-17 15:41:29 +02:00
|
|
|
entry = gnrc_ipv6_netif_get(iface_pid);
|
2015-05-22 21:48:30 +02:00
|
|
|
|
|
|
|
if (entry == NULL) {
|
|
|
|
puts("unknown interface specified");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
gnrc_rpl_init(iface_pid);
|
2015-05-22 21:48:30 +02:00
|
|
|
printf("successfully initialized RPL on interface %d\n", iface_pid);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
int _gnrc_rpl_dodag_root(char *arg1, char *arg2)
|
2015-05-22 21:48:30 +02:00
|
|
|
{
|
|
|
|
uint8_t instance_id = (uint8_t) atoi(arg1);
|
|
|
|
ipv6_addr_t dodag_id;
|
|
|
|
|
|
|
|
if (ipv6_addr_from_str(&dodag_id, arg2) == NULL) {
|
2015-09-08 09:20:20 +02:00
|
|
|
puts("error: <dodag_id> must be a valid IPv6 address");
|
2015-05-22 21:48:30 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
gnrc_rpl_instance_t *inst = NULL;
|
|
|
|
inst = gnrc_rpl_root_init(instance_id, &dodag_id, false, false);
|
|
|
|
if (inst == NULL) {
|
2015-05-22 21:48:30 +02:00
|
|
|
char addr_str[IPV6_ADDR_MAX_STR_LEN];
|
|
|
|
printf("error: could not add DODAG (%s) to instance (%d)\n",
|
|
|
|
ipv6_addr_to_str(addr_str, &dodag_id, sizeof(addr_str)), instance_id);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("successfully added a new RPL DODAG\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-23 14:25:39 +02:00
|
|
|
#ifdef MODULE_GNRC_RPL_P2P
|
|
|
|
int _gnrc_rpl_find(char *arg1, char *arg2)
|
|
|
|
{
|
|
|
|
uint8_t instance_id = (uint8_t) atoi(arg1);
|
|
|
|
ipv6_addr_t dodag_id;
|
|
|
|
ipv6_addr_t target;
|
|
|
|
|
|
|
|
if (ipv6_addr_from_str(&dodag_id, arg1) == NULL) {
|
|
|
|
puts("<dodag_id> must be a valid IPv6 address");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ipv6_addr_from_str(&target, arg2) == NULL) {
|
|
|
|
puts("<target> must be a valid IPv6 address");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gnrc_rpl_instance_t *instance = NULL;
|
|
|
|
if ((instance = gnrc_rpl_p2p_root_init(0, &dodag_id, &target, true)) == NULL) {
|
|
|
|
char addr_str[IPV6_ADDR_MAX_STR_LEN];
|
|
|
|
printf("error: could not add DODAG (%s) to instance (%d)\n",
|
|
|
|
ipv6_addr_to_str(addr_str, &dodag_id, sizeof(addr_str)), instance_id);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("successfully initiated a P2P-RPL Route Discovery\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
int _gnrc_rpl_instance_remove(char *arg1)
|
2015-05-22 21:48:30 +02:00
|
|
|
{
|
2015-09-08 09:20:20 +02:00
|
|
|
uint8_t instance_id = (uint8_t) atoi(arg1);
|
2015-08-17 15:41:29 +02:00
|
|
|
gnrc_rpl_instance_t *inst;
|
2015-05-22 21:48:30 +02:00
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) {
|
2015-05-22 21:48:30 +02:00
|
|
|
printf("error: could not find the instance (%d)\n", instance_id);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
if (gnrc_rpl_instance_remove(inst) == false) {
|
2015-05-22 21:48:30 +02:00
|
|
|
printf("error: could not remove instance (%d)\n", instance_id);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("success: removed instance (%d)\n", instance_id);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
int _gnrc_rpl_trickle_reset(char *arg1)
|
2015-05-22 21:48:30 +02:00
|
|
|
{
|
2015-09-08 09:20:20 +02:00
|
|
|
uint8_t instance_id = (uint8_t) atoi(arg1);
|
2015-08-17 15:41:29 +02:00
|
|
|
gnrc_rpl_instance_t *inst;
|
2015-05-22 21:48:30 +02:00
|
|
|
char addr_str[IPV6_ADDR_MAX_STR_LEN];
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) {
|
2015-05-22 21:48:30 +02:00
|
|
|
puts("error: could not find the <instance_id>");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
trickle_reset_timer(&(inst->dodag.trickle));
|
2015-05-22 21:48:30 +02:00
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
printf("success: reset trickle timer of DODAG (%s) from instance (%d)\n",
|
|
|
|
ipv6_addr_to_str(addr_str, &(inst->dodag.dodag_id), sizeof(addr_str)),
|
2015-05-22 21:48:30 +02:00
|
|
|
instance_id);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
int _gnrc_rpl_trickle_stop(char *arg1)
|
2015-05-22 21:48:30 +02:00
|
|
|
{
|
2015-09-08 09:20:20 +02:00
|
|
|
uint8_t instance_id = (uint8_t) atoi(arg1);
|
2015-08-17 15:41:29 +02:00
|
|
|
gnrc_rpl_instance_t *inst;
|
2015-05-22 21:48:30 +02:00
|
|
|
char addr_str[IPV6_ADDR_MAX_STR_LEN];
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) {
|
2015-05-22 21:48:30 +02:00
|
|
|
puts("error: could not find the <instance_id>");
|
|
|
|
return 1;
|
|
|
|
}
|
2015-08-27 22:29:08 +02:00
|
|
|
trickle_stop(&(inst->dodag.trickle));
|
2015-05-22 21:48:30 +02:00
|
|
|
|
|
|
|
printf("success: stopped trickle timer of DODAG (%s) from instance (%d)\n",
|
2015-08-27 22:29:08 +02:00
|
|
|
ipv6_addr_to_str(addr_str, &(inst->dodag.dodag_id), sizeof(addr_str)),
|
2015-05-22 21:48:30 +02:00
|
|
|
instance_id);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
int _gnrc_rpl_trickle_start(char *arg1)
|
2015-05-22 21:48:30 +02:00
|
|
|
{
|
2015-09-08 09:20:20 +02:00
|
|
|
uint8_t instance_id = (uint8_t) atoi(arg1);
|
2015-08-17 15:41:29 +02:00
|
|
|
gnrc_rpl_instance_t *inst;
|
2015-05-22 21:48:30 +02:00
|
|
|
char addr_str[IPV6_ADDR_MAX_STR_LEN];
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) {
|
2015-05-22 21:48:30 +02:00
|
|
|
puts("error: could not find the <instance_id>");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
trickle_start(gnrc_rpl_pid, &(inst->dodag.trickle), GNRC_RPL_MSG_TYPE_TRICKLE_INTERVAL,
|
|
|
|
GNRC_RPL_MSG_TYPE_TRICKLE_CALLBACK, (1 << inst->dodag.dio_min),
|
|
|
|
inst->dodag.dio_interval_doubl, inst->dodag.dio_redun);
|
2015-05-22 21:48:30 +02:00
|
|
|
|
|
|
|
printf("success: started trickle timer of DODAG (%s) from instance (%d)\n",
|
2015-08-27 22:29:08 +02:00
|
|
|
ipv6_addr_to_str(addr_str, &(inst->dodag.dodag_id), sizeof(addr_str)),
|
2015-05-22 21:48:30 +02:00
|
|
|
instance_id);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
int _gnrc_rpl_send_dis(void)
|
2015-05-22 21:48:30 +02:00
|
|
|
{
|
2016-03-22 10:17:32 +01:00
|
|
|
gnrc_rpl_send_DIS(NULL, (ipv6_addr_t *) &ipv6_addr_all_rpl_nodes);
|
2015-05-22 21:48:30 +02:00
|
|
|
|
|
|
|
puts("success: send a DIS\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
int _gnrc_rpl_dodag_show(void)
|
2015-05-22 21:48:30 +02:00
|
|
|
{
|
|
|
|
printf("instance table:\t");
|
2015-08-17 15:41:29 +02:00
|
|
|
for (uint8_t i = 0; i < GNRC_RPL_INSTANCES_NUMOF; ++i) {
|
|
|
|
if (gnrc_rpl_instances[i].state == 0) {
|
2015-05-22 21:48:30 +02:00
|
|
|
printf("[ ]");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf("[X]");
|
|
|
|
}
|
2015-11-09 13:07:10 +01:00
|
|
|
putchar('\t');
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
|
|
|
|
2015-11-09 13:07:10 +01:00
|
|
|
putchar('\n');
|
|
|
|
|
2015-05-22 21:48:30 +02:00
|
|
|
printf("parent table:\t");
|
2015-08-17 15:41:29 +02:00
|
|
|
for (uint8_t i = 0; i < GNRC_RPL_PARENTS_NUMOF; ++i) {
|
|
|
|
if (gnrc_rpl_parents[i].state == 0) {
|
2015-05-22 21:48:30 +02:00
|
|
|
printf("[ ]");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf("[X]");
|
|
|
|
}
|
2015-11-09 13:07:10 +01:00
|
|
|
putchar('\t');
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
putchar('\n');
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
gnrc_rpl_dodag_t *dodag = NULL;
|
2015-05-22 21:48:30 +02:00
|
|
|
char addr_str[IPV6_ADDR_MAX_STR_LEN];
|
2015-11-17 14:39:32 +01:00
|
|
|
int8_t cleanup;
|
2015-09-04 10:52:01 +02:00
|
|
|
uint64_t tc, ti, xnow = xtimer_now64();
|
2015-09-04 13:20:49 +02:00
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
for (uint8_t i = 0; i < GNRC_RPL_INSTANCES_NUMOF; ++i) {
|
|
|
|
if (gnrc_rpl_instances[i].state == 0) {
|
2015-05-22 21:48:30 +02:00
|
|
|
continue;
|
|
|
|
}
|
2015-08-27 22:29:08 +02:00
|
|
|
|
|
|
|
dodag = &gnrc_rpl_instances[i].dodag;
|
|
|
|
|
2016-03-23 09:57:25 +01:00
|
|
|
printf("instance [%d | Iface: %" PRIkernel_pid " | mop: %d | ocp: %d | mhri: %d | mri %d]\n",
|
|
|
|
gnrc_rpl_instances[i].id, dodag->iface,
|
|
|
|
gnrc_rpl_instances[i].mop, gnrc_rpl_instances[i].of->ocp,
|
|
|
|
gnrc_rpl_instances[i].min_hop_rank_inc, gnrc_rpl_instances[i].max_rank_inc);
|
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
tc = (((uint64_t) dodag->trickle.msg_callback_timer.long_target << 32)
|
|
|
|
| dodag->trickle.msg_callback_timer.target) - xnow;
|
|
|
|
tc = (int64_t) tc < 0 ? 0 : tc / SEC_IN_USEC;
|
|
|
|
|
|
|
|
ti = (((uint64_t) dodag->trickle.msg_interval_timer.long_target << 32)
|
|
|
|
| dodag->trickle.msg_interval_timer.target) - xnow;
|
|
|
|
ti = (int64_t) ti < 0 ? 0 : ti / SEC_IN_USEC;
|
|
|
|
|
2015-11-17 14:39:32 +01:00
|
|
|
cleanup = dodag->instance->cleanup < 0 ? 0 : dodag->instance->cleanup;
|
2015-08-27 22:29:08 +02:00
|
|
|
|
2016-03-09 18:45:34 +01:00
|
|
|
printf("\tdodag [%s | R: %d | OP: %s | PIO: %s | CL: %ds | "
|
2015-12-05 07:35:31 +01:00
|
|
|
"TR(I=[%d,%d], k=%d, c=%d, TC=%" PRIu32 "s, TI=%" PRIu32 "s)]\n",
|
2015-08-27 22:29:08 +02:00
|
|
|
ipv6_addr_to_str(addr_str, &dodag->dodag_id, sizeof(addr_str)),
|
|
|
|
dodag->my_rank, (dodag->node_status == GNRC_RPL_LEAF_NODE ? "Leaf" : "Router"),
|
2016-03-15 15:18:59 +01:00
|
|
|
((dodag->dio_opts & GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO) ? "on" : "off"),
|
2016-03-09 18:45:34 +01:00
|
|
|
(int) cleanup, (1 << dodag->dio_min), dodag->dio_interval_doubl, dodag->trickle.k,
|
2015-12-05 07:35:31 +01:00
|
|
|
dodag->trickle.c, (uint32_t) (tc & 0xFFFFFFFF), (uint32_t) (ti & 0xFFFFFFFF));
|
2015-08-27 22:29:08 +02:00
|
|
|
|
|
|
|
gnrc_rpl_parent_t *parent;
|
|
|
|
LL_FOREACH(gnrc_rpl_instances[i].dodag.parents, parent) {
|
2015-11-09 17:53:00 +01:00
|
|
|
printf("\t\tparent [addr: %s | rank: %d | lifetime: %" PRIu32 "s]\n",
|
2015-08-27 22:29:08 +02:00
|
|
|
ipv6_addr_to_str(addr_str, &parent->addr, sizeof(addr_str)),
|
2015-11-09 17:53:00 +01:00
|
|
|
parent->rank, ((int32_t) (parent->lifetime - (((uint32_t) xnow / SEC_IN_USEC))))
|
|
|
|
< 0 ? 0 : (parent->lifetime - ((uint32_t) xnow / SEC_IN_USEC)));
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
int _gnrc_rpl_operation(bool leaf, char *arg1)
|
2015-08-22 09:56:43 +02:00
|
|
|
{
|
2015-08-27 22:29:08 +02:00
|
|
|
uint8_t instance_id = (uint8_t) atoi(arg1);
|
2015-08-22 09:56:43 +02:00
|
|
|
gnrc_rpl_instance_t *inst;
|
|
|
|
|
|
|
|
if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) {
|
2015-08-27 22:29:08 +02:00
|
|
|
printf("error: could not find the instance (%d)\n", instance_id);
|
2015-08-22 09:56:43 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (leaf) {
|
2015-08-27 22:29:08 +02:00
|
|
|
gnrc_rpl_leaf_operation(&inst->dodag);
|
2015-08-22 09:56:43 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-08-27 22:29:08 +02:00
|
|
|
gnrc_rpl_router_operation(&inst->dodag);
|
2015-08-22 09:56:43 +02:00
|
|
|
}
|
|
|
|
|
2015-08-27 22:29:08 +02:00
|
|
|
printf("success: operate in instance (%d) as %s\n", instance_id, leaf ? "leaf" : "router");
|
2015-08-22 09:56:43 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-03 08:37:59 +01:00
|
|
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
2016-02-03 08:13:35 +01:00
|
|
|
int _gnrc_rpl_set_pio(char *inst_id, bool status)
|
|
|
|
{
|
|
|
|
uint8_t instance_id = (uint8_t) atoi(inst_id);
|
|
|
|
gnrc_rpl_instance_t *inst;
|
|
|
|
|
|
|
|
if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) {
|
|
|
|
printf("error: could not find the instance (%d)\n", instance_id);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gnrc_rpl_config_pio(&inst->dodag, status);
|
|
|
|
|
|
|
|
printf("success: %sactivated PIO transmissions\n", status ? "" : "de");
|
|
|
|
return 0;
|
|
|
|
}
|
2016-02-03 08:37:59 +01:00
|
|
|
#endif
|
2016-02-03 08:13:35 +01:00
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
int _gnrc_rpl(int argc, char **argv)
|
2015-05-22 21:48:30 +02:00
|
|
|
{
|
|
|
|
if ((argc < 2) || (strcmp(argv[1], "show") == 0)) {
|
2015-08-17 15:41:29 +02:00
|
|
|
return _gnrc_rpl_dodag_show();
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
|
|
|
else if ((argc == 3) && strcmp(argv[1], "init") == 0) {
|
2015-08-17 15:41:29 +02:00
|
|
|
return _gnrc_rpl_init(argv[2]);
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
|
|
|
else if ((argc == 4) && strcmp(argv[1], "root") == 0) {
|
2015-08-17 15:41:29 +02:00
|
|
|
return _gnrc_rpl_dodag_root(argv[2], argv[3]);
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
|
|
|
else if (strcmp(argv[1], "rm") == 0) {
|
2015-08-27 22:29:08 +02:00
|
|
|
if (argc == 3) {
|
2015-08-17 15:41:29 +02:00
|
|
|
return _gnrc_rpl_instance_remove(argv[2]);
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp(argv[1], "trickle") == 0) {
|
2015-08-27 22:29:08 +02:00
|
|
|
if ((argc == 4) && (strcmp(argv[2], "reset") == 0)) {
|
|
|
|
return _gnrc_rpl_trickle_reset(argv[3]);
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
2015-08-27 22:29:08 +02:00
|
|
|
else if ((argc == 4) && (strcmp(argv[2], "stop") == 0)) {
|
|
|
|
return _gnrc_rpl_trickle_stop(argv[3]);
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
2015-08-27 22:29:08 +02:00
|
|
|
else if ((argc == 4) && (strcmp(argv[2], "start") == 0)) {
|
|
|
|
return _gnrc_rpl_trickle_start(argv[3]);
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp(argv[1], "send") == 0) {
|
|
|
|
if ((argc == 3) && (strcmp(argv[2], "dis") == 0)) {
|
2015-08-17 15:41:29 +02:00
|
|
|
return _gnrc_rpl_send_dis();
|
2015-05-22 21:48:30 +02:00
|
|
|
}
|
|
|
|
}
|
2015-08-22 09:56:43 +02:00
|
|
|
else if (strcmp(argv[1], "leaf") == 0) {
|
2015-08-27 22:29:08 +02:00
|
|
|
if (argc == 3) {
|
|
|
|
return _gnrc_rpl_operation(true, argv[2]);
|
2015-08-22 09:56:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp(argv[1], "router") == 0) {
|
2015-08-27 22:29:08 +02:00
|
|
|
if (argc == 3) {
|
|
|
|
return _gnrc_rpl_operation(false, argv[2]);
|
2015-08-22 09:56:43 +02:00
|
|
|
}
|
|
|
|
}
|
2016-02-03 08:13:35 +01:00
|
|
|
else if (strcmp(argv[1], "set") == 0) {
|
|
|
|
if (argc > 2) {
|
2016-02-03 08:37:59 +01:00
|
|
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
2016-02-03 08:13:35 +01:00
|
|
|
if (strcmp(argv[2], "pio") == 0) {
|
|
|
|
if ((argc == 5) && (strcmp(argv[3], "on") == 0)) {
|
|
|
|
return _gnrc_rpl_set_pio(argv[4], true);
|
|
|
|
}
|
|
|
|
else if ((argc == 5) && (strcmp(argv[3], "off") == 0)) {
|
|
|
|
return _gnrc_rpl_set_pio(argv[4], false);
|
|
|
|
}
|
|
|
|
}
|
2016-02-03 08:37:59 +01:00
|
|
|
#endif
|
2016-02-03 08:13:35 +01:00
|
|
|
}
|
|
|
|
}
|
2015-05-22 21:48:30 +02:00
|
|
|
|
2016-02-03 08:58:51 +01:00
|
|
|
puts("* help\t\t\t\t\t- show usage");
|
|
|
|
puts("* init <if_id>\t\t\t\t- initialize RPL on the given interface");
|
|
|
|
puts("* leaf <instance_id>\t\t\t- operate as leaf in the instance");
|
|
|
|
puts("* trickle reset <instance_id>\t\t- reset the trickle timer");
|
|
|
|
puts("* trickle start <instance_id>\t\t- start the trickle timer");
|
|
|
|
puts("* trickle stop <instance_id>\t\t- stop the trickle timer");
|
|
|
|
puts("* rm <instance_id>\t\t\t- delete the given instance and related dodag");
|
|
|
|
puts("* root <inst_id> <dodag_id>\t\t- add a dodag to a new or existing instance");
|
|
|
|
puts("* router <instance_id>\t\t\t- operate as router in the instance");
|
|
|
|
puts("* send dis\t\t\t\t- send a multicast DIS");
|
2016-02-03 08:37:59 +01:00
|
|
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
2016-02-03 08:58:51 +01:00
|
|
|
puts("* set pio <on/off> <instance_id>\t- (de-)activate PIO transmissions in DIOs");
|
2016-02-03 08:37:59 +01:00
|
|
|
#endif
|
2016-02-03 08:58:51 +01:00
|
|
|
puts("* show\t\t\t\t\t- show instance and dodag tables");
|
2015-05-22 21:48:30 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|