diff --git a/examples/osd/native-border-router/README.md b/examples/osd/native-border-router/README.md new file mode 100644 index 000000000..eeb1f84e6 --- /dev/null +++ b/examples/osd/native-border-router/README.md @@ -0,0 +1,32 @@ +This code connects a 802.15.4 radio over TTY with the full uIPv6 stack of +Contiki including 6LoWPAN and 802.15.4 framing / parsing. The native border +router also acts as a RPL Root and handles the routing and maintains the RPL +network. Finally the native border router connects the full 6LoWPAN/RPL +network to the host (linux/os-x) network stack making it possible for +applications on the host to transparently reach all the nodes in the +6LoWPAN/RPL network. + +This is designed to interact with the a ../slip-radio example running on a +mote that is either directly USB/TTY connected, or is remote via a TCP +connect. What's on the SLIP interface is really not Serial Line IP, but SLIP +framed 15.4 packets. + +The border router supports a number of commands on it's stdin. +Each are prefixed by !: +* !G - global RPL repair root. +* !M - set MAC address (if coming from RADIO, i.e. SLIP link) +* !C - show channel (if coming from RADIO, i.e. SLIP link) +* !D - sensor data received +* !Q - exit + +Queries are prefixed by ?: +* ?M is used for requesting the MAC address from the radio in order to use it for uIP6 and its stateless address auto configuration of its IPv6 address. This will make the native border router have the address that correspond to the MAC address of the slip-radio. (response is !M from the slip-radio) + +* ?C is used for requesting the currently used channel for the slip-radio. The response is !C with a channel number (from the slip-radio). + +* !C is used for setting the channel of the slip-radio (useful if the motes are using another channel than the one used in the slip-radio). + +Linux: +apt-get install ncurses-dev +make + diff --git a/examples/osd/native-border-router/run.sh b/examples/osd/native-border-router/run.sh deleted file mode 100755 index 768ad2e82..000000000 --- a/examples/osd/native-border-router/run.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -make clean TARGET=native -make TARGET=native -mv border-router.native border-router - diff --git a/examples/osd/native-border-router/tun-bridge.c b/examples/osd/native-border-router/tun-bridge.c index 22cb4289b..711f17dec 100644 --- a/examples/osd/native-border-router/tun-bridge.c +++ b/examples/osd/native-border-router/tun-bridge.c @@ -222,13 +222,15 @@ tun_init() } /*---------------------------------------------------------------------------*/ -void +static int tun_output(uint8_t *data, int len) { /* fprintf(stderr, "*** Writing to tun...%d\n", len); */ if(write(tunfd, data, len) != len) { err(1, "serial_to_tun: write"); + return -1; } + return 0; } /*---------------------------------------------------------------------------*/ int @@ -246,13 +248,14 @@ init(void) { } /*---------------------------------------------------------------------------*/ -static void +static int output(void) { PRINTF("SUT: %u\n", uip_len); if(uip_len > 0) { - tun_output(&uip_buf[UIP_LLH_LEN], uip_len); + return tun_output(&uip_buf[UIP_LLH_LEN], uip_len); } + return 0; } diff --git a/examples/osd/slip-radio/README.md b/examples/osd/slip-radio/README.md new file mode 100644 index 000000000..5e3e0a5f6 --- /dev/null +++ b/examples/osd/slip-radio/README.md @@ -0,0 +1,6 @@ +This project is intended to run on a mode that is connected to a native host system +by SLIP. The SLIP is really SERIAL LINE 15.4, as this just turns the mote into a smart +radio, running the RPL and 6lowpan stack on the Host. This goes with native-border-router. + + + diff --git a/examples/osd/slip-radio/no-framer.c b/examples/osd/slip-radio/no-framer.c index 7f3447e97..69f4b7e98 100644 --- a/examples/osd/slip-radio/no-framer.c +++ b/examples/osd/slip-radio/no-framer.c @@ -124,6 +124,5 @@ parse(void) const struct framer no_framer = { hdr_length, create, - framer_canonical_create_and_secure, parse }; diff --git a/examples/osd/slip-radio/slip-radio.c b/examples/osd/slip-radio/slip-radio.c index 255cfefb5..b20e559ec 100644 --- a/examples/osd/slip-radio/slip-radio.c +++ b/examples/osd/slip-radio/slip-radio.c @@ -162,7 +162,7 @@ slip_input_callback(void) { PRINTF("SR-SIN: %u '%c%c'\n", uip_len, uip_buf[0], uip_buf[1]); cmd_input(uip_buf, uip_len); - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ static void