42#include "contiki-net.h"
45#include "rpl-border-router.h"
62#define LOG_MODULE "BR"
63#define LOG_LEVEL LOG_LEVEL_INFO
69extern long slip_received;
71static bool is_mac_set;
73extern int contiki_argc;
74extern char **contiki_argv;
76CMD_HANDLERS(border_router_cmd_handler);
78PROCESS(border_router_process,
"Border router process");
84#if BORDER_ROUTER_SERIAL_RADIO
89 write_to_slip((uint8_t *)
"?M", 2);
94border_router_set_mac(
const uint8_t *data)
108 NETSTACK_ROUTING.init();
115border_router_print_stat()
117 printf(
"bytes received over SLIP: %ld\n", slip_received);
118 printf(
"bytes sent over SLIP: %ld\n", slip_sent);
134 LOG_INFO(
"RPL-Border router started\n");
136 slip_config_handle_arguments(contiki_argc, contiki_argv);
144 LOG_ERR(
"Failed to initialize NAT64\n");
155#if BORDER_ROUTER_SERIAL_RADIO
165 const char *config_ipaddr = tun6_net_get_prefix();
166 if(config_ipaddr != NULL) {
170 LOG_INFO(
"Setting prefix ");
171 LOG_INFO_6ADDR(&prefix);
173 set_prefix_64(&prefix);
175 LOG_ERR(
"Parse error: %s\n", config_ipaddr);
180 print_local_addresses();
CBOR-over-SLIP protocol for talking to the serialradio firmware (examples/serialradio) from the nativ...
void br_cbor_send_router_mode(uint8_t msg_id, bool enable)
Enable or disable border-router radio mode (ROUTER_MODE).
void br_cbor_send_get_addr64(uint8_t msg_id)
Request the radio's EUI-64 link-layer address (GET_ADDR64).
void br_cbor_send_set_param(uint8_t msg_id, uint16_t param, int32_t value)
Set a radio parameter on the serial radio (SET_PARAM).
Sets up some commands for the border router.
Border router header file.
802.15.4 frame creation and parsing functions
#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.
bool nat64_platform_init(void)
Initialize the platform layer.
bool nat64_is_enabled(void)
Check whether the NAT64 gateway has been enabled at runtime.
#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.
@ RADIO_PARAM_CHANNEL
Channel used for radio communication.
@ RADIO_PARAM_PAN_ID
The personal area network identifier (PAN ID), which is used by the h/w frame filtering functionality...
#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.
#define IEEE802154_DEFAULT_CHANNEL
The default channel for IEEE 802.15.4 networks.
Header file for the radio API.
Routing driver header file.