Unverified Commit 9e15ace3 authored by Simon Duquennoy's avatar Simon Duquennoy Committed by GitHub
Browse files

Merge pull request #224 from simonduq/contrib/routing-api

RPL as just a module: generic routing API
parents 9777ac43 08c03523
......@@ -52,7 +52,7 @@ ifneq ("$(wildcard project-conf.h)","")
CFLAGS += -DPROJECT_CONF_PATH=\"project-conf.h\"
endif
MODULES += os os/net os/net/mac os/storage
MODULES += os os/net os/net/mac os/net/routing os/storage
oname = ${patsubst %.c,%.o,${patsubst %.S,%.o,$(1)}}
......@@ -139,7 +139,7 @@ ifeq ($(WITH_IP64),1)
endif
# Configure Routing protocol
MAKE_ROUTING_NONE = 0
MAKE_ROUTING_NULLROUTING = 0
MAKE_ROUTING_RPL_CLASSIC = 1
MAKE_ROUTING_RPL_LITE = 2
......@@ -147,19 +147,18 @@ MAKE_ROUTING_RPL_LITE = 2
ifeq ($(MAKE_NET),MAKE_NET_IPV6)
MAKE_ROUTING ?= MAKE_ROUTING_RPL_LITE
else
MAKE_ROUTING ?= MAKE_ROUTING_NONE
MAKE_ROUTING ?= MAKE_ROUTING_NULLROUTING
endif
ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_CLASSIC)
CFLAGS += -DUIP_CONF_IPV6_RPL=1
CFLAGS += -DUIP_CONF_IPV6_RPL_CLASSIC=1
MODULES += os/net/rpl-classic
CFLAGS += -DROUTING_CONF_RPL_CLASSIC=1
MODULES += os/net/routing/rpl-classic
else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_LITE)
CFLAGS += -DUIP_CONF_IPV6_RPL=1
CFLAGS += -DUIP_CONF_IPV6_RPL_LITE=1
MODULES += os/net/rpl-lite
else
CFLAGS += -DUIP_CONF_IPV6_RPL=0
CFLAGS += -DROUTING_CONF_RPL_LITE=1
MODULES += os/net/routing/rpl-lite
else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_NULLROUTING)
CFLAGS += -DROUTING_CONF_NULLROUTING=1
MODULES += os/net/routing/nullrouting
endif
MODULEDIRS = $(MODULES_REL) ${wildcard ${addprefix $(CONTIKI)/, $(MODULES)}}
......
......@@ -4,7 +4,7 @@ PROJECT_SOURCEFILES += test-sf.c
CONTIKI = ../../../
MAKE_MAC = MAKE_MAC_TSCH
MAKE_ROUTING = MAKE_ROUTING_NONE
MAKE_ROUTING = MAKE_ROUTING_NULLROUTING
MODULES += os/net/mac/tsch/sixtop
include $(CONTIKI)/Makefile.include
......@@ -38,15 +38,11 @@
#include "contiki.h"
#include "node-id.h"
#include "rpl.h"
#include "rpl-dag-root.h"
#include "sys/log.h"
#include "net/ipv6/uip-ds6-route.h"
#include "net/mac/tsch/tsch.h"
#include "net/mac/tsch/tsch-log.h"
#if UIP_CONF_IPV6_RPL_LITE == 0
#include "rpl-private.h"
#endif /* UIP_CONF_IPV6_RPL_LITE == 0 */
#include "net/routing/routing.h"
#include "serial-shell.h"
#include "sf-plugtest.h"
#if CONTIKI_TARGET_SRF06_CC26XX
......@@ -81,7 +77,7 @@ PROCESS_THREAD(node_process, ev, data)
#endif
if(is_coordinator) {
rpl_dag_root_init_dag_immediately();
NETSTACK_ROUTING.root_start();
}
NETSTACK_MAC.on();
......
......@@ -38,15 +38,12 @@
#include "contiki.h"
#include "node-id.h"
#include "rpl.h"
#include "rpl-dag-root.h"
#include "sys/log.h"
#include "net/ipv6/uip-ds6-route.h"
#include "net/ipv6/uip-sr.h"
#include "net/mac/tsch/tsch.h"
#include "net/mac/tsch/tsch-log.h"
#if UIP_CONF_IPV6_RPL_LITE == 0
#include "rpl-private.h"
#endif /* UIP_CONF_IPV6_RPL_LITE == 0 */
#include "net/routing/routing.h"
#define DEBUG DEBUG_PRINT
#include "net/ipv6/uip-debug.h"
......@@ -69,7 +66,7 @@ PROCESS_THREAD(node_process, ev, data)
#endif
if(is_coordinator) {
rpl_dag_root_init_dag_immediately();
NETSTACK_ROUTING.root_start();
}
NETSTACK_MAC.on();
......@@ -80,11 +77,11 @@ PROCESS_THREAD(node_process, ev, data)
etimer_set(&et, CLOCK_SECOND * 60);
while(1) {
/* Used for non-regression testing */
#if RPL_WITH_STORING
#if (UIP_MAX_ROUTES != 0)
PRINTF("Routing entries: %u\n", uip_ds6_route_num_routes());
#endif
#if RPL_WITH_NON_STORING
PRINTF("Routing links: %u\n", rpl_ns_num_nodes());
#if (UIP_SR_LINK_NUM != 0)
PRINTF("Routing links: %u\n", uip_sr_num_nodes());
#endif
PROCESS_YIELD_UNTIL(etimer_expired(&et));
etimer_reset(&et);
......
......@@ -39,17 +39,13 @@
#include "contiki.h"
#include "node-id.h"
#include "rpl.h"
#include "rpl-dag-root.h"
#include "sys/log.h"
#include "net/ipv6/uip-ds6-route.h"
#include "net/mac/tsch/tsch.h"
#include "net/mac/tsch/tsch-log.h"
#include "net/mac/tsch/tsch-schedule.h"
#include "net/mac/tsch/sixtop/sixtop.h"
#if UIP_CONF_IPV6_RPL_LITE == 0
#include "rpl-private.h"
#endif /* UIP_CONF_IPV6_RPL_LITE == 0 */
#include "net/routing/routing.h"
#include "sf-simple.h"
......@@ -77,7 +73,7 @@ PROCESS_THREAD(node_process, ev, data)
#endif
if(is_coordinator) {
rpl_dag_root_init_dag_immediately();
NETSTACK_ROUTING.root_start();
}
NETSTACK_MAC.on();
......
......@@ -2,7 +2,7 @@
#include "contiki-net.h"
#include "ip64/ip64.h"
#include "net/netstack.h"
#include "rpl-dag-root.h"
#include "net/routing/routing.h"
#include "sys/autostart.h"
/*---------------------------------------------------------------------------*/
......@@ -14,7 +14,7 @@ PROCESS_THREAD(router_node_process, ev, data)
PROCESS_BEGIN();
/* Set us up as a RPL root node. */
rpl_dag_root_init_dag_delay();
NETSTACK_ROUTING.root_start();
/* Initialize the IP64 module so we'll start translating packets */
ip64_init();
......
......@@ -38,9 +38,8 @@
#include "contiki.h"
#include "net/ipv6/uip.h"
#include "rpl.h"
#include "rpl-dag-root.h"
#include "net/netstack.h"
#include "net/routing/routing.h"
#include "coap-constants.h"
#include "coap-engine.h"
#include "lwm2m-engine.h"
......@@ -237,8 +236,8 @@ setup_network(void)
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
#endif
rpl_dag_root_init(&ipaddr, &ipaddr);
rpl_dag_root_init_dag_immediately();
NETSTACK_ROUTING.root_set_prefix(&ipaddr, &ipaddr);
NETSTACK_ROUTING.root_start();
#endif /* UIP_CONF_ROUTER */
PRINTF("IPv6 addresses: ");
......
#include "contiki.h"
#include "rpl.h"
#include "net/routing/routing.h"
#include "random.h"
#include "net/netstack.h"
#include "net/ipv6/simple-udp.h"
......
......@@ -48,8 +48,7 @@
#define DEBUG DEBUG_PRINT
#include "net/ipv6/uip-debug.h"
#include "rpl.h"
#include "rpl-dag-root.h"
#include "net/routing/routing.h"
#define MAX_PAYLOAD_LEN 120
#define MCAST_SINK_UDP_PORT 3001 /* Host byte order */
......@@ -112,7 +111,7 @@ PROCESS_THREAD(rpl_root_process, ev, data)
PRINTF("Multicast Engine: '%s'\n", UIP_MCAST6.name);
rpl_dag_root_init_dag_immediately();
NETSTACK_ROUTING.root_start();
prepare_mcast();
......
......@@ -71,7 +71,7 @@ tcpip_handler(void)
if(uip_newdata()) {
count++;
PRINTF("In: [0x%08lx], TTL %u, total %u\n",
uip_ntohl((unsigned long) *((uint32_t *)(uip_appdata))),
(unsigned long)uip_ntohl((unsigned long) *((uint32_t *)(uip_appdata))),
UIP_IP_BUF->ttl, count);
}
return;
......
......@@ -42,11 +42,8 @@
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#if UIP_CONF_IPV6_RPL_LITE == 0
#include "rpl-private.h"
#endif /* UIP_CONF_IPV6_RPL_LITE == 0 */
#include "net/routing/routing.h"
#include "mqtt.h"
#include "rpl.h"
#include "net/ipv6/uip.h"
#include "net/ipv6/uip-icmp6.h"
#include "net/ipv6/sicslowpan.h"
......
......@@ -35,8 +35,13 @@
#include "contiki.h"
#include "contiki-lib.h"
#include "contiki-net.h"
#include "rpl.h"
#include "net/routing/routing.h"
#include "net/ipv6/uip.h"
#if ROUTING_CONF_RPL_LITE
#include "net/routing/rpl-lite/rpl.h"
#elif ROUTING_CONF_RPL_CLASSIC
#include "net/routing/rpl-classic/rpl.h"
#endif
#include <string.h>
#include <stdio.h>
......
......@@ -36,11 +36,8 @@
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#if UIP_CONF_IPV6_RPL_LITE == 0
#include "rpl-private.h"
#endif /* UIP_CONF_IPV6_RPL_LITE == 0 */
#include "net/routing/routing.h"
#include "mqtt.h"
#include "rpl.h"
#include "net/ipv6/uip.h"
#include "net/ipv6/uip-icmp6.h"
#include "sys/etimer.h"
......
......@@ -40,10 +40,7 @@
#include "net/netstack.h"
#include "net/ipv6/uip-ds6-nbr.h"
#include "net/ipv6/uip-ds6-route.h"
#include "rpl.h"
#if UIP_CONF_IPV6_RPL_LITE == 0
#include "rpl-private.h"
#endif /* UIP_CONF_IPV6_RPL_LITE == 0 */
#include "net/routing/routing.h"
#include "coap-engine.h"
#include "coap.h"
......
......@@ -8,7 +8,7 @@ CONTIKI=../../../../..
MAKE_MAC = MAKE_MAC_TSCH
MODULES += os/lib/json
MODULES_REL += .. ../tools
MODULES_REL += ..
MODULES += os/net/app-layer/coap
......
......@@ -34,7 +34,7 @@
#include "contiki.h"
#include "net/ipv6/uip.h"
#include "net/ipv6/uip-ds6.h"
#include "tools/rpl-tools.h"
#include "net/routing/routing.h"
#include "coap-engine.h"
#include "sys/ctimer.h"
#include <stdio.h>
......@@ -130,12 +130,10 @@ PROCESS_THREAD(start_app, ev, data)
/* Start net stack */
if(is_coordinator) {
uip_ipaddr_t prefix;
uip_ip6addr(&prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
rpl_tools_init(&prefix);
} else {
rpl_tools_init(NULL);
} printf("Starting RPL node\n");
NETSTACK_ROUTING.root_start();
}
NETSTACK_MAC.on();
printf("Starting RPL node\n");
coap_engine_init();
coap_activate_resource(&resource_led_toggle, "Dongle/LED-toggle");
......
......@@ -8,7 +8,7 @@ CONTIKI=../../../../..
MAKE_MAC = MAKE_MAC_TSCH
MODULES += os/lib/json
MODULES_REL += .. ../tools
MODULES_REL += ..
MODULES += os/net/app-layer/coap
......
......@@ -35,7 +35,7 @@
#include "contiki.h"
#include "net/ipv6/uip.h"
#include "net/ipv6/uip-ds6.h"
#include "tools/rpl-tools.h"
#include "net/routing/routing.h"
#include "coap-engine.h"
#include "light-sensor.h"
#include "ht-sensor.h"
......@@ -350,12 +350,10 @@ PROCESS_THREAD(start_app, ev, data)
/* Start net stack */
if(is_coordinator) {
uip_ipaddr_t prefix;
uip_ip6addr(&prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
rpl_tools_init(&prefix);
} else {
rpl_tools_init(NULL);
} printf("Starting RPL node\n");
NETSTACK_ROUTING.root_start();
}
NETSTACK_MAC.on();
printf("Starting RPL node\n");
coap_engine_init();
coap_activate_resource(&resource_light_sensor_value, "DR1175/LightSensor/Value");
......
......@@ -8,7 +8,7 @@ CONTIKI=../../../../..
MAKE_MAC = MAKE_MAC_TSCH
MODULES += os/lib/json
MODULES_REL += .. ../tools
MODULES_REL += ..
MODULES += os/net/app-layer/coap
......
......@@ -34,7 +34,7 @@
#include "contiki.h"
#include "net/ipv6/uip.h"
#include "net/ipv6/uip-ds6.h"
#include "tools/rpl-tools.h"
#include "net/routing/routing.h"
#include "coap-engine.h"
#include "dev/leds.h"
#include "button-sensor.h"
......@@ -351,12 +351,10 @@ PROCESS_THREAD(start_app, ev, data)
/* Start net stack */
if(is_coordinator) {
uip_ipaddr_t prefix;
uip_ip6addr(&prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
rpl_tools_init(&prefix);
} else {
rpl_tools_init(NULL);
} printf("Starting RPL node\n");
NETSTACK_ROUTING.root_start();
}
NETSTACK_MAC.on();
printf("Starting RPL node\n");
coap_engine_init();
coap_activate_resource(&resource_switch_sw1, "DR1199/Switch/SW1");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment