42#include "contiki-net.h"
45#include "rpl-border-router.h"
54#define LOG_MODULE "BR"
55#define LOG_LEVEL LOG_LEVEL_INFO
61extern long slip_received;
63static bool is_mac_set;
65extern int contiki_argc;
66extern char **contiki_argv;
68CMD_HANDLERS(border_router_cmd_handler);
70PROCESS(border_router_process,
"Border router process");
76 write_to_slip((uint8_t *)
"?M", 2);
80border_router_set_mac(
const uint8_t *data)
94 NETSTACK_ROUTING.
init();
101border_router_print_stat()
103 printf(
"bytes received over SLIP: %ld\n", slip_received);
104 printf(
"bytes sent over SLIP: %ld\n", slip_sent);
120 LOG_INFO(
"RPL-Border router started\n");
122 slip_config_handle_arguments(contiki_argc, contiki_argv);
133 const char *config_ipaddr = tun6_net_get_prefix();
134 if(config_ipaddr != NULL) {
138 LOG_INFO(
"Setting prefix ");
139 LOG_INFO_6ADDR(&prefix);
141 set_prefix_64(&prefix);
143 LOG_ERR(
"Parse error: %s\n", config_ipaddr);
148 print_local_addresses();
Sets up some commands for the border router.
Border router header file.
#define CLOCK_SECOND
A second, measured in system clock time.
static bool etimer_expired(struct etimer *et)
Check if an event timer has expired.
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
static void linkaddr_set_node_addr(linkaddr_t *addr)
Set the address of the current node.
#define PROCESS(name, strname)
Declare a process.
#define PROCESS_PAUSE()
Yield the process for a short while.
#define PROCESS_BEGIN()
Define the beginning of a process.
#define PROCESS_WAIT_EVENT_UNTIL(c)
Wait for an event to be posted to the process, with an extra condition.
#define PROCESS_END()
Define the end of a process.
void process_start(struct process *p, process_data_t data)
Start a process.
#define PROCESS_CONTEXT_BEGIN(p)
Switch context to another process.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_CONTEXT_END(p)
End a context switch.
#define uiplib_ipaddrconv
Convert a textual representation of an IP address to a numerical representation.
uip_lladdr_t uip_lladdr
Host L2 address.
void uip_ds6_init(void)
Initialize data structures.
Header file for the logging system.
Routing driver header file.
void(* init)(void)
Initialize the routing protocol.