Move RPL border router from example to os/services

This commit is contained in:
Simon Duquennoy 2017-12-19 09:02:21 -08:00
parent 89c4f5e509
commit 6de6e15ce7
27 changed files with 76 additions and 10 deletions

View File

@ -170,6 +170,9 @@ CONTIKI_SOURCEFILES += $(MODULES_SOURCES)
# Include module-specific makefiles
MODULES_INCLUDES = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/Makefile.${notdir $(d)}}}
include $(MODULES_INCLUDES)
# Iterate once more: include the modules added from the previous include.
# Only works with one level of nested module inclusion.
include $(MODULES_INCLUDES)
# C-include module-specific macros using -imacros
MODULES_IMACROS = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/module-macros.h}}

View File

@ -61,6 +61,7 @@
#include "dev/vib-sensor.h"
#include "sys/node-id.h"
#include "services/rpl-border-router/rpl-border-router.h"
#if BUILD_WITH_ORCHESTRA
#include "orchestra.h"
#endif /* BUILD_WITH_ORCHESTRA */
@ -240,6 +241,9 @@ contiki_init()
/* Start serial process */
serial_line_init();
#if BUILD_WITH_RPL_BORDER_ROUTER
rpl_border_router_init();
#endif /* BUILD_WITH_RPL_BORDER_ROUTER */
#if BUILD_WITH_ORCHESTRA
orchestra_init();
#endif /* BUILD_WITH_ORCHESTRA */

View File

@ -2,12 +2,12 @@ CONTIKI_PROJECT = border-router
all: $(CONTIKI_PROJECT)
CONTIKI = ../..
# Include RPL BR module
MODULES += os/services/rpl-border-router
# Include webserver module
MODULES_REL += webserver
# Include optional target-specific module
include $(CONTIKI)/Makefile.identify-target
ifneq ($(TARGET),native)
MODULES_REL += embedded
endif
MODULES_REL += $(TARGET)
MODULES_REL += common
include $(CONTIKI)/Makefile.include

View File

@ -46,8 +46,6 @@ PROCESS_THREAD(contiki_ng_br, ev, data)
{
PROCESS_BEGIN();
PROCESS_NAME(border_router_process);
process_start(&border_router_process, NULL);
#if BORDER_ROUTER_CONF_WEBSERVER
PROCESS_NAME(webserver_nogui_process);
process_start(&webserver_nogui_process, NULL);

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2010, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifndef PROJECT_CONF_H_
#define PROJECT_CONF_H_
#ifndef WEBSERVER_CONF_CFS_CONNS
#define WEBSERVER_CONF_CFS_CONNS 2
#endif
#ifndef BORDER_ROUTER_CONF_WEBSERVER
#define BORDER_ROUTER_CONF_WEBSERVER 1
#endif
#if BORDER_ROUTER_CONF_WEBSERVER
#define UIP_CONF_TCP 1
#endif
#endif /* PROJECT_CONF_H_ */

View File

@ -47,6 +47,7 @@
#include "sys/stack-check.h"
#include "dev/watchdog.h"
#include "services/rpl-border-router/rpl-border-router.h"
#include "services/orchestra/orchestra.h"
#include "services/shell/serial-shell.h"
@ -110,6 +111,11 @@ main(void)
platform_init_stage_three();
#if BUILD_WITH_RPL_BORDER_ROUTER
rpl_border_router_init();
LOG_DBG("With RPL Border Router\n");
#endif /* BUILD_WITH_RPL_BORDER_ROUTER */
#if BUILD_WITH_ORCHESTRA
orchestra_init();
LOG_DBG("With Orchestra\n");

View File

@ -39,7 +39,7 @@
#include "rpl.h"
#include "dev/button-sensor.h"
#include "dev/slip.h"
#include "border-router-common.h"
#include "rpl-border-router.h"
/*---------------------------------------------------------------------------*/
/* Log configuration */

View File

@ -41,7 +41,7 @@
#include "contiki.h"
#include "contiki-net.h"
#include "rpl.h"
#include "border-router-common.h"
#include "rpl-border-router.h"
#include "cmd.h"
#include "border-router.h"
#include "border-router-cmds.h"

View File

@ -31,7 +31,7 @@
*/
#include "contiki.h"
#include "border-router-common.h"
#include "rpl-border-router.h"
#include "rpl-dag-root.h"
/* Log configuration */
@ -67,3 +67,11 @@ set_prefix_64(uip_ipaddr_t *prefix_64)
rpl_dag_root_init(prefix_64, NULL);
rpl_dag_root_init_dag_immediately();
}
/*---------------------------------------------------------------------------*/
void
rpl_border_router_init(void)
{
PROCESS_NAME(border_router_process);
process_start(&border_router_process, NULL);
}
/*---------------------------------------------------------------------------*/

View File

@ -36,5 +36,6 @@
extern uint8_t prefix_set;
void rpl_border_router_init(void);
void print_local_addresses(void);
void set_prefix_64(uip_ipaddr_t *prefix_64);