Contiki-NG
shell-commands.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017, Inria.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the Institute nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * This file is part of the Contiki operating system.
30 *
31 */
32
33/**
34 * \file
35 * The Contiki shell commands
36 * \author
37 * Simon Duquennoy <simon.duquennoy@inria.fr>
38 */
39
40/**
41 * \addtogroup shell
42 * @{
43 */
44
45#include "contiki.h"
46#include "shell.h"
47#include "shell-commands.h"
48#include "lib/list.h"
49#include "sys/log.h"
50#include "dev/watchdog.h"
51#include "net/ipv6/uip.h"
52#include "net/ipv6/uiplib.h"
53#include "net/ipv6/uip-icmp6.h"
54#include "net/ipv6/uip-ds6.h"
55#if BUILD_WITH_RESOLV
56#include "resolv.h"
57#endif /* BUILD_WITH_RESOLV */
58#if BUILD_WITH_HTTP_SOCKET
59#include "http-socket.h"
60#endif /* BUILD_WITH_HTTP_SOCKET */
61#if MAC_CONF_WITH_TSCH
62#include "net/mac/tsch/tsch.h"
63#endif /* MAC_CONF_WITH_TSCH */
64#if MAC_CONF_WITH_CSMA
65#include "net/mac/csma/csma.h"
66#endif
67#include "net/routing/routing.h"
68#include "net/mac/llsec802154.h"
69
70/* For RPL-specific commands */
71#if ROUTING_CONF_RPL_LITE
72#include "net/routing/rpl-lite/rpl.h"
73#elif ROUTING_CONF_RPL_CLASSIC
74#include "net/routing/rpl-classic/rpl.h"
75#endif
76
77#include <stdlib.h>
78
79#define PING_TIMEOUT (5 * CLOCK_SECOND)
80
81#if NETSTACK_CONF_WITH_IPV6
82static struct uip_icmp6_echo_reply_notification echo_reply_notification;
83static shell_output_func *curr_ping_output_func = NULL;
84static struct process *curr_ping_process;
85static uint8_t curr_ping_ttl;
86static uint16_t curr_ping_datalen;
87#endif /* NETSTACK_CONF_WITH_IPV6 */
88#if TSCH_WITH_SIXTOP
89static shell_command_6top_sub_cmd_t sixtop_sub_cmd = NULL;
90#endif /* TSCH_WITH_SIXTOP */
91static struct shell_command_set_t builtin_shell_command_set;
92LIST(shell_command_sets);
93#if NETSTACK_CONF_WITH_IPV6
94/*---------------------------------------------------------------------------*/
95static const char *
96ds6_nbr_state_to_str(uint8_t state)
97{
98 switch(state) {
99 case NBR_INCOMPLETE:
100 return "Incomplete";
101 case NBR_REACHABLE:
102 return "Reachable";
103 case NBR_STALE:
104 return "Stale";
105 case NBR_DELAY:
106 return "Delay";
107 case NBR_PROBE:
108 return "Probe";
109 default:
110 return "Unknown";
111 }
112}
113/*---------------------------------------------------------------------------*/
114static void
115echo_reply_handler(uip_ipaddr_t *source, uint8_t ttl, uint8_t *data, uint16_t datalen)
116{
117 if(curr_ping_output_func != NULL) {
118 curr_ping_output_func = NULL;
119 curr_ping_ttl = ttl;
120 curr_ping_datalen = datalen;
121 process_poll(curr_ping_process);
122 }
123}
124/*---------------------------------------------------------------------------*/
125static
126PT_THREAD(cmd_ping(struct pt *pt, shell_output_func output, char *args))
127{
128 static uip_ipaddr_t remote_addr;
129 static struct etimer timeout_timer;
130 char *next_args;
131
132 PT_BEGIN(pt);
133
134 SHELL_ARGS_INIT(args, next_args);
135
136 /* Get argument (remote IPv6) */
137 SHELL_ARGS_NEXT(args, next_args);
138 if(args == NULL) {
139 SHELL_OUTPUT(output, "Destination IPv6 address is not specified\n");
140 PT_EXIT(pt);
141 } else if(uiplib_ipaddrconv(args, &remote_addr) == 0) {
142 SHELL_OUTPUT(output, "Invalid IPv6 address: %s\n", args);
143 PT_EXIT(pt);
144 }
145
146 SHELL_OUTPUT(output, "Pinging ");
147 shell_output_6addr(output, &remote_addr);
148 SHELL_OUTPUT(output, "\n");
149
150 /* Send ping request */
151 curr_ping_process = PROCESS_CURRENT();
152 curr_ping_output_func = output;
153 etimer_set(&timeout_timer, PING_TIMEOUT);
154 uip_icmp6_send(&remote_addr, ICMP6_ECHO_REQUEST, 0, 4);
155 PT_WAIT_UNTIL(pt, curr_ping_output_func == NULL || etimer_expired(&timeout_timer));
156
157 if(curr_ping_output_func != NULL) {
158 SHELL_OUTPUT(output, "Timeout\n");
159 curr_ping_output_func = NULL;
160 } else {
161 SHELL_OUTPUT(output, "Received ping reply from ");
162 shell_output_6addr(output, &remote_addr);
163 SHELL_OUTPUT(output, ", len %u, ttl %u, delay %lu ms\n",
164 curr_ping_datalen, curr_ping_ttl, (1000*(clock_time() - timeout_timer.timer.start))/CLOCK_SECOND);
165 }
166
167 PT_END(pt);
168}
169#endif /* NETSTACK_CONF_WITH_IPV6 */
170
171#if ROUTING_CONF_RPL_LITE
172/*---------------------------------------------------------------------------*/
173static const char *
174rpl_state_to_str(enum rpl_dag_state state)
175{
176 switch(state) {
177 case DAG_INITIALIZED:
178 return "Initialized";
179 case DAG_JOINED:
180 return "Joined";
181 case DAG_REACHABLE:
182 return "Reachable";
183 case DAG_POISONING:
184 return "Poisoning";
185 default:
186 return "Unknown";
187 }
188}
189/*---------------------------------------------------------------------------*/
190static const char *
191rpl_mop_to_str(int mop)
192{
193 switch(mop) {
194 case RPL_MOP_NO_DOWNWARD_ROUTES:
195 return "No downward routes";
196 case RPL_MOP_NON_STORING:
197 return "Non-storing";
198 case RPL_MOP_STORING_NO_MULTICAST:
199 return "Storing";
200 case RPL_MOP_STORING_MULTICAST:
201 return "Storing+multicast";
202 default:
203 return "Unknown";
204 }
205}
206/*---------------------------------------------------------------------------*/
207static const char *
208rpl_ocp_to_str(int ocp)
209{
210 switch(ocp) {
211 case RPL_OCP_OF0:
212 return "OF0";
213 case RPL_OCP_MRHOF:
214 return "MRHOF";
215 default:
216 return "Unknown";
217 }
218}
219/*---------------------------------------------------------------------------*/
220static
221PT_THREAD(cmd_rpl_nbr(struct pt *pt, shell_output_func output, char *args))
222{
223 PT_BEGIN(pt);
224
225 if(!curr_instance.used || rpl_neighbor_count() == 0) {
226 SHELL_OUTPUT(output, "RPL neighbors: none\n");
227 } else {
228 rpl_nbr_t *nbr = nbr_table_head(rpl_neighbors);
229 SHELL_OUTPUT(output, "RPL neighbors:\n");
230 while(nbr != NULL) {
231 char buf[120];
232 rpl_neighbor_snprint(buf, sizeof(buf), nbr);
233 SHELL_OUTPUT(output, "%s\n", buf);
234 nbr = nbr_table_next(rpl_neighbors, nbr);
235 }
236 }
237
238 PT_END(pt);
239}
240/*---------------------------------------------------------------------------*/
241static
242PT_THREAD(cmd_rpl_status(struct pt *pt, shell_output_func output, char *args))
243{
244 PT_BEGIN(pt);
245
246 SHELL_OUTPUT(output, "RPL status:\n");
247 if(!curr_instance.used) {
248 SHELL_OUTPUT(output, "-- Instance: None\n");
249 } else {
250 SHELL_OUTPUT(output, "-- Instance: %u\n", curr_instance.instance_id);
251 if(NETSTACK_ROUTING.node_is_root()) {
252 SHELL_OUTPUT(output, "-- DAG root\n");
253 } else {
254 SHELL_OUTPUT(output, "-- DAG node\n");
255 }
256 SHELL_OUTPUT(output, "-- DAG: ");
257 shell_output_6addr(output, &curr_instance.dag.dag_id);
258 SHELL_OUTPUT(output, ", version %u\n", curr_instance.dag.version);
259 SHELL_OUTPUT(output, "-- Prefix: ");
260 shell_output_6addr(output, &curr_instance.dag.prefix_info.prefix);
261 SHELL_OUTPUT(output, "/%u\n", curr_instance.dag.prefix_info.length);
262 SHELL_OUTPUT(output, "-- MOP: %s\n", rpl_mop_to_str(curr_instance.mop));
263 SHELL_OUTPUT(output, "-- OF: %s\n", rpl_ocp_to_str(curr_instance.of->ocp));
264 SHELL_OUTPUT(output, "-- Hop rank increment: %u\n", curr_instance.min_hoprankinc);
265 SHELL_OUTPUT(output, "-- Default lifetime: %lu seconds\n", RPL_LIFETIME(curr_instance.default_lifetime));
266
267 SHELL_OUTPUT(output, "-- State: %s\n", rpl_state_to_str(curr_instance.dag.state));
268 SHELL_OUTPUT(output, "-- Preferred parent: ");
269 if(curr_instance.dag.preferred_parent) {
270 shell_output_6addr(output, rpl_neighbor_get_ipaddr(curr_instance.dag.preferred_parent));
271 SHELL_OUTPUT(output, " (last DTSN: %u)\n", curr_instance.dag.preferred_parent->dtsn);
272 } else {
273 SHELL_OUTPUT(output, "None\n");
274 }
275 SHELL_OUTPUT(output, "-- Rank: %u\n", curr_instance.dag.rank);
276 SHELL_OUTPUT(output, "-- Lowest rank: %u (%u)\n", curr_instance.dag.lowest_rank, curr_instance.max_rankinc);
277 SHELL_OUTPUT(output, "-- DTSN out: %u\n", curr_instance.dtsn_out);
278 SHELL_OUTPUT(output, "-- DAO sequence: last sent %u, last acked %u\n",
279 curr_instance.dag.dao_last_seqno, curr_instance.dag.dao_last_acked_seqno);
280 SHELL_OUTPUT(output, "-- Trickle timer: current %u, min %u, max %u, redundancy %u\n",
281 curr_instance.dag.dio_intcurrent, curr_instance.dio_intmin,
282 curr_instance.dio_intmin + curr_instance.dio_intdoubl, curr_instance.dio_redundancy);
283
284 }
285
286 PT_END(pt);
287}
288/*---------------------------------------------------------------------------*/
289static
290PT_THREAD(cmd_rpl_refresh_routes(struct pt *pt, shell_output_func output, char *args))
291{
292 PT_BEGIN(pt);
293
294 SHELL_OUTPUT(output, "Triggering routes refresh\n");
295 rpl_refresh_routes("Shell");
296
297 PT_END(pt);
298}
299#endif /* ROUTING_CONF_RPL_LITE */
300/*---------------------------------------------------------------------------*/
301static void
302shell_output_log_levels(shell_output_func output)
303{
304 int i = 0;
305 SHELL_OUTPUT(output, "Log levels:\n");
306 while(all_modules[i].name != NULL) {
307 SHELL_OUTPUT(output, "-- %-10s: %u (%s)\n",
308 all_modules[i].name,
309 *all_modules[i].curr_log_level,
310 log_level_to_str(*all_modules[i].curr_log_level));
311 i++;
312 }
313}
314/*---------------------------------------------------------------------------*/
315static
316PT_THREAD(cmd_log(struct pt *pt, shell_output_func output, char *args))
317{
318 static int prev_level;
319 static int level;
320 char *next_args;
321 char *ptr;
322 char *module;
323
324 PT_BEGIN(pt);
325
326 SHELL_ARGS_INIT(args, next_args);
327
328 /* Get and parse argument: module name */
329 SHELL_ARGS_NEXT(args, next_args);
330 module = args;
331 if(module == NULL) {
332 SHELL_OUTPUT(output, "Module is not specified\n");
333 PT_EXIT(pt);
334 }
335 prev_level = log_get_level(module);
336 if(module == NULL || (strcmp("all", module) && prev_level == -1)) {
337 SHELL_OUTPUT(output, "Invalid first argument: %s\n", module)
338 shell_output_log_levels(output);
339 PT_EXIT(pt);
340 }
341
342 /* Get and parse argument: log level */
343 SHELL_ARGS_NEXT(args, next_args);
344 if(args == NULL) {
345 level = -1;
346 } else {
347 level = (int)strtol(args, &ptr, 10);
348 }
349 if((level == 0 && args == ptr)
350 || level < LOG_LEVEL_NONE || level > LOG_LEVEL_DBG) {
351 SHELL_OUTPUT(output, "Invalid second argument: %s\n", args);
352 PT_EXIT(pt);
353 }
354
355 /* Set log level */
356 if(level != prev_level) {
357 log_set_level(module, level);
358#if MAC_CONF_WITH_TSCH && TSCH_LOG_PER_SLOT
359 if(!strcmp(module, "mac") || !strcmp(module, "all")) {
360 if(level >= LOG_LEVEL_DBG) {
362 SHELL_OUTPUT(output, "TSCH logging started\n");
363 } else {
365 SHELL_OUTPUT(output, "TSCH logging stopped\n");
366 }
367 }
368#endif /* MAC_CONF_WITH_TSCH && TSCH_LOG_PER_SLOT */
369 }
370
371 shell_output_log_levels(output);
372
373 PT_END(pt);
374}
375/*---------------------------------------------------------------------------*/
376static
377PT_THREAD(cmd_help(struct pt *pt, shell_output_func output, char *args))
378{
379 struct shell_command_set_t *set;
380 const struct shell_command_t *cmd;
381 PT_BEGIN(pt);
382
383 SHELL_OUTPUT(output, "Available commands:\n");
384 /* Note: we explicitly don't expend any code space to deal with shadowing */
385 for(set = list_head(shell_command_sets); set != NULL; set = list_item_next(set)) {
386 for(cmd = set->commands; cmd->name != NULL; ++cmd) {
387 SHELL_OUTPUT(output, "%s\n", cmd->help);
388 }
389 }
390
391 PT_END(pt);
392}
393#if UIP_CONF_IPV6_RPL
394/*---------------------------------------------------------------------------*/
395static
396PT_THREAD(cmd_rpl_set_root(struct pt *pt, shell_output_func output, char *args))
397{
398 static int is_on;
399 static uip_ipaddr_t prefix;
400 char *next_args;
401
402 PT_BEGIN(pt);
403
404 SHELL_ARGS_INIT(args, next_args);
405
406 /* Get first arg (0/1) */
407 SHELL_ARGS_NEXT(args, next_args);
408 if(args == NULL) {
409 SHELL_OUTPUT(output, "On-flag (0 or 1) is not specified\n");
410 PT_EXIT(pt);
411 }
412
413 if(!strcmp(args, "1")) {
414 is_on = 1;
415 } else if(!strcmp(args, "0")) {
416 is_on = 0;
417 } else {
418 SHELL_OUTPUT(output, "Invalid argument: %s\n", args);
419 PT_EXIT(pt);
420 }
421
422 /* Get first second arg (prefix) */
423 SHELL_ARGS_NEXT(args, next_args);
424 if(args != NULL) {
425 if(uiplib_ipaddrconv(args, &prefix) == 0) {
426 SHELL_OUTPUT(output, "Invalid Prefix: %s\n", args);
427 PT_EXIT(pt);
428 }
429 } else {
430 const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix();
431 uip_ip6addr_copy(&prefix, default_prefix);
432 }
433
434 if(is_on) {
435 if(!NETSTACK_ROUTING.node_is_root()) {
436 SHELL_OUTPUT(output, "Setting as DAG root with prefix ");
437 shell_output_6addr(output, &prefix);
438 SHELL_OUTPUT(output, "/64\n");
439 NETSTACK_ROUTING.root_set_prefix(&prefix, NULL);
440 NETSTACK_ROUTING.root_start();
441 } else {
442 SHELL_OUTPUT(output, "Node is already a DAG root\n");
443 }
444 } else {
445 if(NETSTACK_ROUTING.node_is_root()) {
446 SHELL_OUTPUT(output, "Setting as non-root node: leaving DAG\n");
447 NETSTACK_ROUTING.leave_network();
448 } else {
449 SHELL_OUTPUT(output, "Node is not a DAG root\n");
450 }
451 }
452
453 PT_END(pt);
454}
455/*---------------------------------------------------------------------------*/
456static
457PT_THREAD(cmd_rpl_global_repair(struct pt *pt, shell_output_func output, char *args))
458{
459 PT_BEGIN(pt);
460
461 SHELL_OUTPUT(output, "Triggering routing global repair\n");
462 NETSTACK_ROUTING.global_repair("Shell");
463
464 PT_END(pt);
465}
466/*---------------------------------------------------------------------------*/
467static
468PT_THREAD(cmd_rpl_local_repair(struct pt *pt, shell_output_func output, char *args))
469{
470 PT_BEGIN(pt);
471
472 SHELL_OUTPUT(output, "Triggering routing local repair\n");
473 NETSTACK_ROUTING.local_repair("Shell");
474
475 PT_END(pt);
476}
477#endif /* UIP_CONF_IPV6_RPL */
478/*---------------------------------------------------------------------------*/
479static
480PT_THREAD(cmd_macaddr(struct pt *pt, shell_output_func output, char *args))
481{
482 PT_BEGIN(pt);
483
484 SHELL_OUTPUT(output, "Node MAC address: ");
486 SHELL_OUTPUT(output, "\n");
487
488 PT_END(pt);
489}
490#if NETSTACK_CONF_WITH_IPV6
491/*---------------------------------------------------------------------------*/
492static
493PT_THREAD(cmd_ipaddr(struct pt *pt, shell_output_func output, char *args))
494{
495 int i;
496 uint8_t state;
497
498 PT_BEGIN(pt);
499
500 SHELL_OUTPUT(output, "Node IPv6 addresses:\n");
501 for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
502 state = uip_ds6_if.addr_list[i].state;
503 if(uip_ds6_if.addr_list[i].isused &&
504 (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
505 SHELL_OUTPUT(output, "-- ");
506 shell_output_6addr(output, &uip_ds6_if.addr_list[i].ipaddr);
507 SHELL_OUTPUT(output, "\n");
508 }
509 }
510
511 PT_END(pt);
512}
513/*---------------------------------------------------------------------------*/
514static
515PT_THREAD(cmd_ip_neighbors(struct pt *pt, shell_output_func output, char *args))
516{
518
519 PT_BEGIN(pt);
520
522 if(nbr == NULL) {
523 SHELL_OUTPUT(output, "Node IPv6 neighbors: none\n");
524 PT_EXIT(pt);
525 }
526
527 SHELL_OUTPUT(output, "Node IPv6 neighbors:\n");
528 while(nbr != NULL) {
529 SHELL_OUTPUT(output, "-- ");
531 SHELL_OUTPUT(output, " <-> ");
533 SHELL_OUTPUT(output, ", router %u, state %s ",
534 nbr->isrouter, ds6_nbr_state_to_str(nbr->state));
535 SHELL_OUTPUT(output, "\n");
537 }
538
539 PT_END(pt);
540
541}
542#endif /* NETSTACK_CONF_WITH_IPV6 */
543#if MAC_CONF_WITH_TSCH
544/*---------------------------------------------------------------------------*/
545static
546PT_THREAD(cmd_tsch_set_coordinator(struct pt *pt, shell_output_func output, char *args))
547{
548 static int is_on;
549 static int is_secured;
550 char *next_args;
551
552 PT_BEGIN(pt);
553
554 SHELL_ARGS_INIT(args, next_args);
555
556 /* Get first arg (0/1) */
557 SHELL_ARGS_NEXT(args, next_args);
558 if(args == NULL) {
559 SHELL_OUTPUT(output, "On-flag (0 or 1) is not specified\n");
560 PT_EXIT(pt);
561 }
562
563 if(!strcmp(args, "1")) {
564 is_on = 1;
565 } else if(!strcmp(args, "0")) {
566 is_on = 0;
567 } else {
568 SHELL_OUTPUT(output, "Invalid first argument: %s\n", args);
569 PT_EXIT(pt);
570 }
571
572 /* Get first second arg (prefix) */
573 SHELL_ARGS_NEXT(args, next_args);
574 if(args != NULL) {
575 if(!strcmp(args, "1")) {
576#if LLSEC802154_ENABLED
577 is_secured = 1;
578#else /* LLSEC802154_ENABLED */
579 SHELL_OUTPUT(output, "Security is not compiled in.\n");
580 is_secured = 0;
581#endif /* LLSEC802154_ENABLED */
582 } else if(!strcmp(args, "0")) {
583 is_secured = 0;
584 } else {
585 SHELL_OUTPUT(output, "Invalid second argument: %s\n", args);
586 PT_EXIT(pt);
587 }
588 } else {
589 is_secured = 0;
590 }
591
592 SHELL_OUTPUT(output, "Setting as TSCH %s (%s)\n",
593 is_on ? "coordinator" : "non-coordinator", is_secured ? "secured" : "non-secured");
594
595 tsch_set_pan_secured(is_secured);
597
598 PT_END(pt);
599}
600/*---------------------------------------------------------------------------*/
601static
602PT_THREAD(cmd_tsch_status(struct pt *pt, shell_output_func output, char *args))
603{
604 PT_BEGIN(pt);
605
606 SHELL_OUTPUT(output, "TSCH status:\n");
607
608 SHELL_OUTPUT(output, "-- Is coordinator: %u\n", tsch_is_coordinator);
609 SHELL_OUTPUT(output, "-- Is associated: %u\n", tsch_is_associated);
610 if(tsch_is_associated) {
612 SHELL_OUTPUT(output, "-- PAN ID: 0x%x\n", frame802154_get_pan_id());
613 SHELL_OUTPUT(output, "-- Is PAN secured: %u\n", tsch_is_pan_secured);
614 SHELL_OUTPUT(output, "-- Join priority: %u\n", tsch_join_priority);
615 SHELL_OUTPUT(output, "-- Time source: ");
616 if(n != NULL) {
618 SHELL_OUTPUT(output, "\n");
619 } else {
620 SHELL_OUTPUT(output, "none\n");
621 }
622 SHELL_OUTPUT(output, "-- Last synchronized: %lu seconds ago\n",
623 (clock_time() - tsch_last_sync_time) / CLOCK_SECOND);
624 SHELL_OUTPUT(output, "-- Drift w.r.t. coordinator: %ld ppm\n",
626 SHELL_OUTPUT(output, "-- Network uptime: %lu seconds\n",
627 (unsigned long)(tsch_get_network_uptime_ticks() / CLOCK_SECOND));
628 }
629
630 PT_END(pt);
631}
632#endif /* MAC_CONF_WITH_TSCH */
633#if NETSTACK_CONF_WITH_IPV6
634/*---------------------------------------------------------------------------*/
635static
636PT_THREAD(cmd_routes(struct pt *pt, shell_output_func output, char *args))
637{
638 uip_ds6_defrt_t *default_route;
639
640 PT_BEGIN(pt);
641
642 /* Our default route */
643 SHELL_OUTPUT(output, "Default route:\n");
644 default_route = uip_ds6_defrt_lookup(uip_ds6_defrt_choose());
645 if(default_route != NULL) {
646 SHELL_OUTPUT(output, "-- ");
647 shell_output_6addr(output, &default_route->ipaddr);
648 if(default_route->lifetime.interval != 0) {
649 SHELL_OUTPUT(output, " (lifetime: %lu seconds)\n", (unsigned long)default_route->lifetime.interval);
650 } else {
651 SHELL_OUTPUT(output, " (lifetime: infinite)\n");
652 }
653 } else {
654 SHELL_OUTPUT(output, "-- None\n");
655 }
656
657#if UIP_CONF_IPV6_RPL
658 if(uip_sr_num_nodes() > 0) {
659 uip_sr_node_t *link;
660 /* Our routing links */
661 SHELL_OUTPUT(output, "Routing links (%u in total):\n", uip_sr_num_nodes());
662 link = uip_sr_node_head();
663 while(link != NULL) {
664 char buf[100];
665 uip_sr_link_snprint(buf, sizeof(buf), link);
666 SHELL_OUTPUT(output, "-- %s\n", buf);
667 link = uip_sr_node_next(link);
668 }
669 } else {
670 SHELL_OUTPUT(output, "No routing links\n");
671 }
672#endif /* UIP_CONF_IPV6_RPL */
673
674#if (UIP_MAX_ROUTES != 0)
675 if(uip_ds6_route_num_routes() > 0) {
676 uip_ds6_route_t *route;
677 /* Our routing entries */
678 SHELL_OUTPUT(output, "Routing entries (%u in total):\n", uip_ds6_route_num_routes());
679 route = uip_ds6_route_head();
680 while(route != NULL) {
681 SHELL_OUTPUT(output, "-- ");
682 shell_output_6addr(output, &route->ipaddr);
683 SHELL_OUTPUT(output, " via ");
684 shell_output_6addr(output, uip_ds6_route_nexthop(route));
685 if((unsigned long)route->state.lifetime != 0xFFFFFFFF) {
686 SHELL_OUTPUT(output, " (lifetime: %lu seconds)\n", (unsigned long)route->state.lifetime);
687 } else {
688 SHELL_OUTPUT(output, " (lifetime: infinite)\n");
689 }
690 route = uip_ds6_route_next(route);
691 }
692 } else {
693 SHELL_OUTPUT(output, "No routing entries\n");
694 }
695#endif /* (UIP_MAX_ROUTES != 0) */
696
697 PT_END(pt);
698}
699/*---------------------------------------------------------------------------*/
700#if BUILD_WITH_RESOLV
701static
702PT_THREAD(cmd_resolv(struct pt *pt, shell_output_func output, char *args))
703{
704 PT_BEGIN(pt);
705 static struct etimer timeout_timer;
706 static int count, ret;
707 char *next_args;
708 static uip_ipaddr_t *remote_addr = NULL;
709 SHELL_ARGS_INIT(args, next_args);
710
711 /* Get argument (remote hostname) */
712 SHELL_ARGS_NEXT(args, next_args);
713 if(args == NULL) {
714 SHELL_OUTPUT(output, "Destination host is not specified\n");
715 PT_EXIT(pt);
716 } else {
717 ret = resolv_lookup(args, &remote_addr);
719 SHELL_OUTPUT(output, "Looking up IPv6 address for host: %s\n", args);
720 if(ret != RESOLV_STATUS_RESOLVING) {
721 resolv_query(args);
722 }
723 /* Poll 10 times for resolve results (5 seconds max)*/
724 for(count = 0; count < 10; count++) {
725 etimer_set(&timeout_timer, CLOCK_SECOND / 2);
726 PT_WAIT_UNTIL(pt, etimer_expired(&timeout_timer));
727 printf("resoliving again...\n");
728 if((ret = resolv_lookup(args, &remote_addr)) != RESOLV_STATUS_RESOLVING) {
729 break;
730 }
731 }
732 }
733 if(ret == RESOLV_STATUS_NOT_FOUND) {
734 SHELL_OUTPUT(output, "Did not find IPv6 address for host: %s\n", args);
735 } else if(ret == RESOLV_STATUS_CACHED) {
736 SHELL_OUTPUT(output, "Found IPv6 address for host: %s => ", args);
737 shell_output_6addr(output, remote_addr);
738 SHELL_OUTPUT(output, "\n");
739 }
740 }
741 PT_END(pt);
742}
743#endif /* BUILD_WITH_RESOLV */
744/*---------------------------------------------------------------------------*/
745#if BUILD_WITH_HTTP_SOCKET
746static struct http_socket s;
747static int bytes_received = 0;
748
749static void
750http_callback(struct http_socket *s, void *ptr,
751 http_socket_event_t e,
752 const uint8_t *data, uint16_t datalen)
753{
754 if(e == HTTP_SOCKET_ERR) {
755 printf("HTTP socket error\n");
756 } else if(e == HTTP_SOCKET_TIMEDOUT) {
757 printf("HTTP socket error: timed out\n");
758 } else if(e == HTTP_SOCKET_ABORTED) {
759 printf("HTTP socket error: aborted\n");
760 } else if(e == HTTP_SOCKET_HOSTNAME_NOT_FOUND) {
761 printf("HTTP socket error: hostname not found\n");
762 } else if(e == HTTP_SOCKET_CLOSED) {
763 printf("HTTP socket closed, %d bytes received\n", bytes_received);
764 } else if(e == HTTP_SOCKET_DATA) {
765 int i;
766 if(bytes_received == 0) {
767 printf("HTTP socket received data, total expects:%d\n", (int) s->header.content_length);
768 }
769
770 bytes_received += datalen;
771 for(i = 0; i < datalen; i++) {
772 printf("%c", data[i]);
773 }
774 }
775}
776/*---------------------------------------------------------------------------*/
777static
778PT_THREAD(cmd_wget(struct pt *pt, shell_output_func output, char *args))
779{
780 PT_BEGIN(pt);
781 char *next_args;
782 SHELL_ARGS_INIT(args, next_args);
783
784 /* Get argument (remote hostname and url (http://host/url) */
785 SHELL_ARGS_NEXT(args, next_args);
786 if(args == NULL) {
787 SHELL_OUTPUT(output, "URL is not specified\n");
788 PT_EXIT(pt);
789 } else {
790 bytes_received = 0;
791 SHELL_OUTPUT(output, "Fetching web page at %s\n", args);
792 http_socket_init(&s);
793 http_socket_get(&s, args, 0, 0,
794 http_callback, NULL);
795 }
796
797 PT_END(pt);
798}
799#endif /* BUILD_WITH_HTTP_SOCKET */
800/*---------------------------------------------------------------------------*/
801#endif /* NETSTACK_CONF_WITH_IPV6 */
802/*---------------------------------------------------------------------------*/
803static
804PT_THREAD(cmd_reboot(struct pt *pt, shell_output_func output, char *args))
805{
806 PT_BEGIN(pt);
807 SHELL_OUTPUT(output, "rebooting\n");
809 PT_END(pt);
810}
811#if MAC_CONF_WITH_TSCH
812/*---------------------------------------------------------------------------*/
813static
814PT_THREAD(cmd_tsch_schedule(struct pt *pt, shell_output_func output, char *args))
815{
816 struct tsch_slotframe *sf;
817
818 PT_BEGIN(pt);
819
820 if(tsch_is_locked()) {
821 PT_EXIT(pt);
822 }
823
825
826 if(sf == NULL) {
827 SHELL_OUTPUT(output, "TSCH schedule: no slotframe\n");
828 } else {
829 SHELL_OUTPUT(output, "TSCH schedule:\n");
830 while(sf != NULL) {
831 struct tsch_link *l = list_head(sf->links_list);
832
833 SHELL_OUTPUT(output, "-- Slotframe: handle %u, size %u, links:\n", sf->handle, sf->size.val);
834
835 while(l != NULL) {
836 SHELL_OUTPUT(output, "---- Options %02x, type %u, timeslot %u, channel offset %u, address ",
837 l->link_options, l->link_type, l->timeslot, l->channel_offset);
838 shell_output_lladdr(output, &l->addr);
839 SHELL_OUTPUT(output, "\n");
840 l = list_item_next(l);
841 }
842
844 }
845 }
846 PT_END(pt);
847}
848#endif /* MAC_CONF_WITH_TSCH */
849/*---------------------------------------------------------------------------*/
850#if TSCH_WITH_SIXTOP
851void
852shell_commands_set_6top_sub_cmd(shell_command_6top_sub_cmd_t sub_cmd)
853{
854 sixtop_sub_cmd = sub_cmd;
855}
856/*---------------------------------------------------------------------------*/
857static
858PT_THREAD(cmd_6top(struct pt *pt, shell_output_func output, char *args))
859{
860 char *next_args;
861
862 PT_BEGIN(pt);
863
864 SHELL_ARGS_INIT(args, next_args);
865
866 if(sixtop_sub_cmd == NULL) {
867 SHELL_OUTPUT(output, "6top command is unavailable:\n");
868 } else {
869 SHELL_OUTPUT(output, "6top: ");
870 sixtop_sub_cmd(output, args);
871 }
872 SHELL_ARGS_NEXT(args, next_args);
873
874 PT_END(pt);
875}
876#endif /* TSCH_WITH_SIXTOP */
877/*---------------------------------------------------------------------------*/
878#if LLSEC802154_ENABLED
879static
880PT_THREAD(cmd_llsec_setlv(struct pt *pt, shell_output_func output, char *args))
881{
882
883 PT_BEGIN(pt);
884
885 if(args == NULL) {
886 SHELL_OUTPUT(output, "Default LLSEC level is %d\n",
887 uipbuf_get_attr(UIPBUF_ATTR_LLSEC_LEVEL));
888 PT_EXIT(pt);
889 } else {
890 int lv = atoi(args);
891 if(lv < 0 || lv > 7) {
892 SHELL_OUTPUT(output, "Illegal LLSEC Level %d\n", lv);
893 PT_EXIT(pt);
894 } else {
895 uipbuf_set_default_attr(UIPBUF_ATTR_LLSEC_LEVEL, lv);
896 uipbuf_clear_attr();
897 SHELL_OUTPUT(output, "LLSEC default level set %d\n", lv);
898 }
899 }
900
901 PT_END(pt);
902}
903/*---------------------------------------------------------------------------*/
904static
905PT_THREAD(cmd_llsec_setkey(struct pt *pt, shell_output_func output, char *args))
906{
907 char *next_args;
908
909 PT_BEGIN(pt);
910
911 SHELL_ARGS_INIT(args, next_args);
912
913 if(args == NULL) {
914 SHELL_OUTPUT(output, "Provide an index and a 16-char string for the key\n");
915 PT_EXIT(pt);
916 } else {
917 int key;
918 SHELL_ARGS_NEXT(args, next_args);
919 if(args == NULL) {
920 SHELL_OUTPUT(output, "Key index is not specified\n");
921 PT_EXIT(pt);
922 }
923 key = atoi(args);
924 if(key < 0) {
925 SHELL_OUTPUT(output, "Illegal LLSEC Key index %d\n", key);
926 PT_EXIT(pt);
927 } else {
928#if MAC_CONF_WITH_CSMA
929 /* Get next arg (key-string) */
930 SHELL_ARGS_NEXT(args, next_args);
931 if(args == NULL) {
932 SHELL_OUTPUT(output, "Provide both an index and a key\n");
933 } else if(strlen(args) == 16) {
934 csma_security_set_key(key, (const uint8_t *) args);
935 SHELL_OUTPUT(output, "Set key for index %d\n", key);
936 } else {
937 SHELL_OUTPUT(output, "Wrong length of key: '%s' (%d)\n", args, strlen(args));
938 }
939#else
940 SHELL_OUTPUT(output, "Set key not supported.\n");
941 PT_EXIT(pt);
942#endif
943 }
944 }
945 PT_END(pt);
946}
947#endif /* LLSEC802154_ENABLED */
948/*---------------------------------------------------------------------------*/
949void
951{
952 list_init(shell_command_sets);
953 list_add(shell_command_sets, &builtin_shell_command_set);
954#if NETSTACK_CONF_WITH_IPV6
955 /* Set up Ping Reply callback */
956 uip_icmp6_echo_reply_callback_add(&echo_reply_notification,
957 echo_reply_handler);
958#endif /* NETSTACK_CONF_WITH_IPV6 */
959}
960/*---------------------------------------------------------------------------*/
961void
962shell_command_set_register(struct shell_command_set_t *set)
963{
964 list_push(shell_command_sets, set);
965}
966/*---------------------------------------------------------------------------*/
967int
968shell_command_set_deregister(struct shell_command_set_t *set)
969{
970 if(!list_contains(shell_command_sets, set)) {
971 return !0;
972 }
973 list_remove(shell_command_sets, set);
974 return 0;
975}
976/*---------------------------------------------------------------------------*/
977const struct shell_command_t *
978shell_command_lookup(const char *name)
979{
980 struct shell_command_set_t *set;
981 const struct shell_command_t *cmd;
982
983 for(set = list_head(shell_command_sets);
984 set != NULL;
985 set = list_item_next(set)) {
986 for(cmd = set->commands; cmd->name != NULL; ++cmd) {
987 if(!strcmp(cmd->name, name)) {
988 return cmd;
989 }
990 }
991 }
992 return NULL;
993}
994/*---------------------------------------------------------------------------*/
995const struct shell_command_t builtin_shell_commands[] = {
996 { "help", cmd_help, "'> help': Shows this help" },
997 { "reboot", cmd_reboot, "'> reboot': Reboot the board by watchdog_reboot()" },
998 { "log", cmd_log, "'> log module level': Sets log level (0--4) for a given module (or \"all\"). For module \"mac\", level 4 also enables per-slot logging." },
999 { "mac-addr", cmd_macaddr, "'> mac-addr': Shows the node's MAC address" },
1000#if NETSTACK_CONF_WITH_IPV6
1001 { "ip-addr", cmd_ipaddr, "'> ip-addr': Shows all IPv6 addresses" },
1002 { "ip-nbr", cmd_ip_neighbors, "'> ip-nbr': Shows all IPv6 neighbors" },
1003 { "ping", cmd_ping, "'> ping addr': Pings the IPv6 address 'addr'" },
1004 { "routes", cmd_routes, "'> routes': Shows the route entries" },
1005#if BUILD_WITH_RESOLV
1006 { "nslookup", cmd_resolv, "'> nslookup': Lookup IPv6 address of host" },
1007#endif /* BUILD_WITH_RESOLV */
1008#if BUILD_WITH_HTTP_SOCKET
1009 { "wget", cmd_wget, "'> wget url': get content of URL (only http)." },
1010#endif /* BUILD_WITH_HTTP_SOCKET */
1011#endif /* NETSTACK_CONF_WITH_IPV6 */
1012#if UIP_CONF_IPV6_RPL
1013 { "rpl-set-root", cmd_rpl_set_root, "'> rpl-set-root 0/1 [prefix]': Sets node as root (1) or not (0). A /64 prefix can be optionally specified." },
1014 { "rpl-local-repair", cmd_rpl_local_repair, "'> rpl-local-repair': Triggers a RPL local repair" },
1015#if ROUTING_CONF_RPL_LITE
1016 { "rpl-refresh-routes", cmd_rpl_refresh_routes, "'> rpl-refresh-routes': Refreshes all routes through a DTSN increment" },
1017 { "rpl-status", cmd_rpl_status, "'> rpl-status': Shows a summary of the current RPL state" },
1018 { "rpl-nbr", cmd_rpl_nbr, "'> rpl-nbr': Shows the RPL neighbor table" },
1019#endif /* ROUTING_CONF_RPL_LITE */
1020 { "rpl-global-repair", cmd_rpl_global_repair, "'> rpl-global-repair': Triggers a RPL global repair" },
1021#endif /* UIP_CONF_IPV6_RPL */
1022#if MAC_CONF_WITH_TSCH
1023 { "tsch-set-coordinator", cmd_tsch_set_coordinator, "'> tsch-set-coordinator 0/1 [0/1]': Sets node as coordinator (1) or not (0). Second, optional parameter: enable (1) or disable (0) security." },
1024 { "tsch-schedule", cmd_tsch_schedule, "'> tsch-schedule': Shows the current TSCH schedule" },
1025 { "tsch-status", cmd_tsch_status, "'> tsch-status': Shows a summary of the current TSCH state" },
1026#endif /* MAC_CONF_WITH_TSCH */
1027#if TSCH_WITH_SIXTOP
1028 { "6top", cmd_6top, "'> 6top help': Shows 6top command usage" },
1029#endif /* TSCH_WITH_SIXTOP */
1030#if LLSEC802154_ENABLED
1031 { "llsec-set-level", cmd_llsec_setlv, "'> llsec-set-level <lv>': Set the level of link layer security (show if no lv argument)"},
1032 { "llsec-set-key", cmd_llsec_setkey, "'> llsec-set-key <id> <key>': Set the key of link layer security"},
1033#endif /* LLSEC802154_ENABLED */
1034 { NULL, NULL, NULL },
1035};
1036
1037static struct shell_command_set_t builtin_shell_command_set = {
1038 .next = NULL,
1039 .commands = builtin_shell_commands,
1040};
1041/** @} */
The 802.15.4 standard CSMA protocol (nonbeacon-enabled)
clock_time_t clock_time(void)
Get the current clock time.
Definition: clock.c:118
static volatile uint64_t count
Num.
Definition: clock.c:50
#define CLOCK_SECOND
A second, measured in system clock time.
Definition: clock.h:82
int etimer_expired(struct etimer *et)
Check if an event timer has expired.
Definition: etimer.c:213
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
Definition: etimer.c:177
linkaddr_t linkaddr_node_addr
The link-layer address of the node.
Definition: linkaddr.c:48
void list_init(list_t list)
Initialize a list.
Definition: list.c:57
#define LIST(name)
Declare a linked list.
Definition: list.h:89
void list_add(list_t list, void *item)
Add an item at the end of a list.
Definition: list.c:89
void list_remove(list_t list, const void *item)
Remove a specific element from a list.
Definition: list.c:152
void * list_item_next(const void *item)
Get the next item following this item.
Definition: list.c:203
void list_push(list_t list, void *item)
Add an item to the start of the list.
Definition: list.c:108
void * list_head(const_list_t list)
Get a pointer to the first element of a list.
Definition: list.c:63
bool list_contains(const_list_t list, const void *item)
Check if the list contains an item.
Definition: list.c:209
void log_set_level(const char *module, int level)
Sets a log level at run-time.
Definition: log.c:173
const char * log_level_to_str(int level)
Returns a textual description of a log level.
Definition: log.c:204
int log_get_level(const char *module)
Returns the current log level.
Definition: log.c:188
#define PROCESS_CURRENT()
Get a pointer to the currently running process.
Definition: process.h:402
void process_poll(struct process *p)
Request a process to be polled.
Definition: process.c:371
#define PT_THREAD(name_args)
Declaration of a protothread.
Definition: pt.h:265
#define PT_EXIT(pt)
Exit the protothread.
Definition: pt.h:411
#define PT_BEGIN(pt)
Declare the start of a protothread inside the C function implementing the protothread.
Definition: pt.h:280
#define PT_WAIT_UNTIL(pt, condition)
Block and wait until condition is true.
Definition: pt.h:313
#define PT_END(pt)
Declare the end of a protothread.
Definition: pt.h:292
#define RPL_LIFETIME(lifetime)
Compute lifetime, accounting for the lifetime unit.
Definition: rpl-types.h:72
int rpl_neighbor_snprint(char *buf, int buflen, rpl_nbr_t *nbr)
Print a textual description of RPL neighbor into a string.
Definition: rpl-neighbor.c:90
rpl_dag_state
RPL DAG states.
Definition: rpl-types.h:177
uip_ipaddr_t * rpl_neighbor_get_ipaddr(rpl_nbr_t *nbr)
Returns a neighbor's (link-local) IPv6 address.
Definition: rpl-neighbor.c:252
void rpl_refresh_routes(const char *str)
Triggers a route fresh via DTSN increment.
Definition: rpl-dag.c:189
int rpl_neighbor_count(void)
Returns the number of nodes in the RPL neighbor table.
Definition: rpl-neighbor.c:168
watchdog_reboot()
Keeps control until the WDT throws a reset signal.
Definition: watchdog.c:94
void shell_output_6addr(shell_output_func output, const uip_ipaddr_t *ipaddr)
Prints an IPv6 address.
Definition: shell.c:55
void shell_output_lladdr(shell_output_func output, const linkaddr_t *lladdr)
Prints a link-layer address.
Definition: shell.c:64
void shell_commands_init(void)
Initializes Shell-commands module.
static uint8_t output(const linkaddr_t *localdest)
Take an IP packet and format it to be sent on an 802.15.4 network using 6lowpan.
Definition: sicslowpan.c:1606
struct tsch_neighbor * tsch_queue_get_time_source(void)
Get the TSCH time source (we currently assume there is only one)
Definition: tsch-queue.c:120
uint64_t tsch_get_network_uptime_ticks(void)
Get the time, in clock ticks, since the TSCH network was started.
struct tsch_slotframe * tsch_schedule_slotframe_head(void)
Access the first item in the list of slotframes.
void tsch_log_init(void)
Initialize log module.
int tsch_is_locked(void)
Checks if the TSCH lock is set.
void tsch_set_coordinator(int enable)
Set the node as PAN coordinator.
Definition: tsch.c:167
linkaddr_t * tsch_queue_get_nbr_address(const struct tsch_neighbor *n)
Get the address of a neighbor.
Definition: tsch-queue.c:135
void tsch_set_pan_secured(int enable)
Enable/disable security.
Definition: tsch.c:178
long int tsch_adaptive_timesync_get_drift_ppm(void)
Gives the estimated clock drift w.r.t.
void tsch_log_stop(void)
Stop logging module.
struct tsch_slotframe * tsch_schedule_slotframe_next(struct tsch_slotframe *sf)
Access the next item in the list of slotframes.
#define uiplib_ipaddrconv
Convert a textual representation of an IP address to a numerical representation.
Definition: uiplib.h:71
const uip_lladdr_t * uip_ds6_nbr_get_ll(const uip_ds6_nbr_t *nbr)
Get the link-layer address associated with a specified nbr cache.
Definition: uip-ds6-nbr.c:422
uip_ds6_nbr_t * uip_ds6_nbr_head(void)
Get the first neighbor cache in nbr_table.
Definition: uip-ds6-nbr.c:459
void uip_icmp6_send(const uip_ipaddr_t *dest, int type, int code, int payload_len)
Send an icmpv6 message.
Definition: uip-icmp6.c:230
const uip_ip6addr_t * uip_ds6_default_prefix()
Retrieve the Default IPv6 prefix.
Definition: uip-ds6.c:104
#define NBR_INCOMPLETE
Possible states for the nbr cache entries.
Definition: uip-ds6-nbr.h:64
uip_sr_node_t * uip_sr_node_head(void)
Returns the head of the non-storing node list.
Definition: uip-sr.c:199
int uip_sr_link_snprint(char *buf, int buflen, const uip_sr_node_t *link)
Print a textual description of a source routing link.
Definition: uip-sr.c:261
const uip_ipaddr_t * uip_ds6_nbr_get_ipaddr(const uip_ds6_nbr_t *nbr)
Get an IPv6 address of a neighbor cache.
Definition: uip-ds6-nbr.c:415
int uip_sr_num_nodes(void)
Tells how many nodes are currently stored in the graph.
Definition: uip-sr.c:63
#define ADDR_TENTATIVE
Possible states for the an address (RFC 4862)
Definition: uip-ds6.h:156
uip_ds6_netif_t uip_ds6_if
The single interface.
Definition: uip-ds6.c:75
uip_sr_node_t * uip_sr_node_next(const uip_sr_node_t *item)
Returns the next element of the non-storing node list.
Definition: uip-sr.c:205
void uip_icmp6_echo_reply_callback_add(struct uip_icmp6_echo_reply_notification *n, uip_icmp6_echo_reply_callback_t c)
Add a callback function for ping replies.
Definition: uip-icmp6.c:302
#define ICMP6_ECHO_REQUEST
Echo request.
Definition: uip-icmp6.h:57
uip_ds6_nbr_t * uip_ds6_nbr_next(uip_ds6_nbr_t *nbr)
Get the next neighbor cache of a specified one.
Definition: uip-ds6-nbr.c:474
void resolv_query(const char *name)
Queues a name so that a question for the name will be sent out.
Definition: resolv.c:1189
resolv_status_t resolv_lookup(const char *name, uip_ipaddr_t **ipaddr)
Look up a hostname in the array of known hostnames.
Definition: resolv.c:1263
Linked list manipulation routines.
Common functionality of 802.15.4-compliant llsec_drivers.
Header file for the logging system.
uIP DNS resolver code header file.
@ RESOLV_STATUS_RESOLVING
This hostname is in the process of being resolved.
Definition: resolv.h:73
@ RESOLV_STATUS_NOT_FOUND
The server has returned a not-found response for this domain name.
Definition: resolv.h:70
@ RESOLV_STATUS_CACHED
Hostname is fresh and usable.
Definition: resolv.h:54
@ RESOLV_STATUS_UNCACHED
Hostname was not found in the cache.
Definition: resolv.h:57
Routing driver header file.
Main header file for the Contiki shell.
Main header file for the Contiki shell.
A timer.
Definition: etimer.h:76
int(* root_start)(void)
Set the node as root and start a network.
Definition: routing.h:76
void(* leave_network)(void)
Leave the network the node is part of.
Definition: routing.h:102
void(* root_set_prefix)(uip_ipaddr_t *prefix, uip_ipaddr_t *iid)
Set the prefix, for nodes that will operate as root.
Definition: routing.h:70
void(* global_repair)(const char *str)
Triggers a global topology repair.
Definition: routing.h:120
void(* local_repair)(const char *str)
Triggers a RPL local topology repair.
Definition: routing.h:126
int(* node_is_root)(void)
Tells whether the node is a network root or not.
Definition: routing.h:82
All information related to a RPL neighbor.
Definition: rpl-types.h:136
TSCH neighbor information.
Definition: tsch-types.h:109
802.15.4e slotframe (contains links)
Definition: tsch-types.h:84
An entry in the default router list.
The default nbr_table entry (when UIP_DS6_NBR_MULTI_IPV6_ADDRS is disabled), that implements nbr cach...
Definition: uip-ds6-nbr.h:105
An entry in the routing table.
A node in a source routing graph, stored at the root and representing all child-parent relationship.
Definition: uip-sr.h:92
Main API declarations for TSCH.
Header file for IPv6-related data structures.
Header file for ICMPv6 message and error handing (RFC 4443)
static uip_ds6_nbr_t * nbr
Pointer to llao option in uip_buf.
Definition: uip-nd6.c:106
Header file for the uIP TCP/IP stack.
Header file for the IP address manipulation library.