rpl: p2p-rpl shell extension
This commit is contained in:
parent
b5c09bfc41
commit
c8c8a183d9
@ -23,6 +23,11 @@
|
|||||||
#include "net/gnrc/rpl/dodag.h"
|
#include "net/gnrc/rpl/dodag.h"
|
||||||
#include "utlist.h"
|
#include "utlist.h"
|
||||||
#include "trickle.h"
|
#include "trickle.h"
|
||||||
|
#ifdef MODULE_GNRC_RPL_P2P
|
||||||
|
#include "net/gnrc/rpl/p2p.h"
|
||||||
|
#include "net/gnrc/rpl/p2p_dodag.h"
|
||||||
|
#include "net/gnrc/rpl/p2p_structs.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
int _gnrc_rpl_init(char *arg)
|
int _gnrc_rpl_init(char *arg)
|
||||||
{
|
{
|
||||||
@ -80,8 +85,7 @@ int _gnrc_rpl_find(char *arg1, char *arg2)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gnrc_rpl_instance_t *instance = NULL;
|
if (gnrc_rpl_p2p_root_init(0, &dodag_id, &target, true) == NULL) {
|
||||||
if ((instance = gnrc_rpl_p2p_root_init(0, &dodag_id, &target, true)) == NULL) {
|
|
||||||
char addr_str[IPV6_ADDR_MAX_STR_LEN];
|
char addr_str[IPV6_ADDR_MAX_STR_LEN];
|
||||||
printf("error: could not add DODAG (%s) to instance (%d)\n",
|
printf("error: could not add DODAG (%s) to instance (%d)\n",
|
||||||
ipv6_addr_to_str(addr_str, &dodag_id, sizeof(addr_str)), instance_id);
|
ipv6_addr_to_str(addr_str, &dodag_id, sizeof(addr_str)), instance_id);
|
||||||
@ -203,7 +207,22 @@ int _gnrc_rpl_dodag_show(void)
|
|||||||
}
|
}
|
||||||
putchar('\t');
|
putchar('\t');
|
||||||
}
|
}
|
||||||
|
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|
||||||
|
#ifdef MODULE_GNRC_RPL_P2P
|
||||||
|
printf("p2p-rpl table:\t");
|
||||||
|
for (int8_t i = 0; i < GNRC_RPL_P2P_EXTS_NUMOF; ++i) {
|
||||||
|
if (gnrc_rpl_p2p_exts[i].state == 0) {
|
||||||
|
printf("[ ]");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("[X]");
|
||||||
|
}
|
||||||
|
putchar('\t');
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|
||||||
gnrc_rpl_dodag_t *dodag = NULL;
|
gnrc_rpl_dodag_t *dodag = NULL;
|
||||||
@ -241,6 +260,16 @@ int _gnrc_rpl_dodag_show(void)
|
|||||||
(int) cleanup, (1 << dodag->dio_min), dodag->dio_interval_doubl, dodag->trickle.k,
|
(int) cleanup, (1 << dodag->dio_min), dodag->dio_interval_doubl, dodag->trickle.k,
|
||||||
dodag->trickle.c, (uint32_t) (tc & 0xFFFFFFFF), (uint32_t) (ti & 0xFFFFFFFF));
|
dodag->trickle.c, (uint32_t) (tc & 0xFFFFFFFF), (uint32_t) (ti & 0xFFFFFFFF));
|
||||||
|
|
||||||
|
#ifdef MODULE_GNRC_RPL_P2P
|
||||||
|
if (dodag->instance->mop == GNRC_RPL_P2P_MOP) {
|
||||||
|
gnrc_rpl_p2p_ext_t *p2p_ext = gnrc_rpl_p2p_ext_get(dodag);
|
||||||
|
printf("\tP2P-Ext [%s | HBH: %s | R: %s | L: %us]\n",
|
||||||
|
ipv6_addr_to_str(addr_str, &p2p_ext->target, sizeof(addr_str)),
|
||||||
|
p2p_ext->hop_by_hop ? "True" : "False",
|
||||||
|
p2p_ext->reply ? "True" : "False", p2p_ext->lifetime_sec);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gnrc_rpl_parent_t *parent;
|
gnrc_rpl_parent_t *parent;
|
||||||
LL_FOREACH(gnrc_rpl_instances[i].dodag.parents, parent) {
|
LL_FOREACH(gnrc_rpl_instances[i].dodag.parents, parent) {
|
||||||
printf("\t\tparent [addr: %s | rank: %d | lifetime: %" PRIu32 "s]\n",
|
printf("\t\tparent [addr: %s | rank: %d | lifetime: %" PRIu32 "s]\n",
|
||||||
@ -347,7 +376,17 @@ int _gnrc_rpl(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef MODULE_GNRC_RPL_P2P
|
||||||
|
else if (strcmp(argv[1], "find") == 0) {
|
||||||
|
if (argc == 4) {
|
||||||
|
return _gnrc_rpl_find(argv[2], argv[3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MODULE_GNRC_RPL_P2P
|
||||||
|
puts("* find <dodag_id> <target>\t\t\t- initiate a P2P-RPL route discovery");
|
||||||
|
#endif
|
||||||
puts("* help\t\t\t\t\t- show usage");
|
puts("* help\t\t\t\t\t- show usage");
|
||||||
puts("* init <if_id>\t\t\t\t- initialize RPL on the given interface");
|
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("* leaf <instance_id>\t\t\t- operate as leaf in the instance");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user