update llayer

This commit is contained in:
Harald Pichler 2014-11-20 13:43:53 +01:00
parent d8e0dd7005
commit e58322260f

View file

@ -50,14 +50,11 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "dev/leds.h"
#define DEBUG DEBUG_NONE
#include "net/ip/uip-debug.h"
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
static uip_ipaddr_t prefix;
static uint8_t prefix_set;
@ -147,7 +144,6 @@ ipaddr_add(const uip_ipaddr_t *addr)
static
PT_THREAD(generate_routes(struct httpd_state *s))
{
static int i;
static uip_ds6_route_t *r;
static uip_ds6_nbr_t *nbr;
#if BUF_USES_STACK
@ -251,7 +247,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
ADD("/%u (via ", r->length);
ipaddr_add(uip_ds6_route_nexthop(r));
if(1 || (r->state.lifetime < 600)) {
ADD(") %lus\n", r->state.lifetime);
ADD(") %lus\n", (unsigned long)r->state.lifetime);
} else {
ADD(")\n");
}
@ -322,21 +318,28 @@ request_prefix(void)
void
set_prefix_64(uip_ipaddr_t *prefix_64)
{
rpl_dag_t *dag;
uip_ipaddr_t ipaddr;
memcpy(&prefix, prefix_64, 16);
memcpy(&ipaddr, prefix_64, 16);
prefix_set = 1;
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
dag = rpl_set_root(RPL_DEFAULT_INSTANCE, &ipaddr);
if(dag != NULL) {
rpl_set_prefix(dag, &prefix, 64);
PRINTF("created a new RPL dag\n");
}
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(border_router_process, ev, data)
{
static struct etimer et;
rpl_dag_t *dag;
PROCESS_BEGIN();
leds_off(LEDS_RED);
/* While waiting for the prefix to be sent through the SLIP connection, the future
* border router can join an existing DAG as a parent or child, or acquire a default
* router that will later take precedence over the SLIP fallback interface.
@ -365,12 +368,6 @@ PROCESS_THREAD(border_router_process, ev, data)
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
}
dag = rpl_set_root(RPL_DEFAULT_INSTANCE,(uip_ip6addr_t *)dag_id);
if(dag != NULL) {
rpl_set_prefix(dag, &prefix, 64);
PRINTF("created a new RPL dag\n");
}
/* Now turn the radio on, but disable radio duty cycling.
* Since we are the DAG root, reception delays would constrain mesh throughbut.
*/