From ef5eaff1bca5187bfb1eaa637c96cc8c18883c55 Mon Sep 17 00:00:00 2001
From: Fabian Brandt <fabbrandt@gmail.com>
Date: Tue, 25 Mar 2014 16:22:54 +0100
Subject: [PATCH] ETX-functionality is now part of a common routing-module

---
 Makefile.dep                                     | 8 ++++++++
 examples/rpl_udp/Makefile                        | 1 -
 sys/Makefile                                     | 3 +++
 sys/net/{routing/rpl => include}/etx_beaconing.h | 0
 sys/net/routing/Makefile                         | 3 +++
 sys/net/routing/{rpl => }/etx_beaconing.c        | 3 +--
 sys/net/routing/rpl/rpl.c                        | 2 +-
 7 files changed, 16 insertions(+), 4 deletions(-)
 rename sys/net/{routing/rpl => include}/etx_beaconing.h (100%)
 create mode 100644 sys/net/routing/Makefile
 rename sys/net/routing/{rpl => }/etx_beaconing.c (99%)

diff --git a/Makefile.dep b/Makefile.dep
index 0c0516ba8f..82bf855983 100644
--- a/Makefile.dep
+++ b/Makefile.dep
@@ -34,6 +34,14 @@ ifneq (,$(filter sixlowborder,$(USEMODULE)))
     endif
 endif
 
+ifneq (,$(filter rpl,$(USEMODULE)))
+    USEMODULE += routing
+endif
+
+ifneq (,$(filter routing,$(USEMODULE)))
+    USEMODULE += sixlowpan
+endif
+
 ifneq (,$(filter sixlowpan,$(USEMODULE)))
     ifeq (,$(filter ieee802154,$(USEMODULE)))
         USEMODULE += ieee802154
diff --git a/examples/rpl_udp/Makefile b/examples/rpl_udp/Makefile
index f64cfcac0e..f2745cb930 100644
--- a/examples/rpl_udp/Makefile
+++ b/examples/rpl_udp/Makefile
@@ -54,7 +54,6 @@ USEMODULE += posix
 USEMODULE += ps
 USEMODULE += vtimer
 USEMODULE += defaulttransceiver
-USEMODULE += sixlowpan
 USEMODULE += rpl
 USEMODULE += destiny
 
diff --git a/sys/Makefile b/sys/Makefile
index 08f0d791fe..8729f6ddcd 100644
--- a/sys/Makefile
+++ b/sys/Makefile
@@ -62,6 +62,9 @@ endif
 ifneq (,$(filter rpl,$(USEMODULE)))
     DIRS += net/routing/rpl
 endif
+ifneq (,$(filter routing,$(USEMODULE)))
+	DIRS += net/routing
+endif
 ifneq (,$(filter ieee802154,$(USEMODULE)))
     DIRS += net/link_layer/ieee802154
 endif
diff --git a/sys/net/routing/rpl/etx_beaconing.h b/sys/net/include/etx_beaconing.h
similarity index 100%
rename from sys/net/routing/rpl/etx_beaconing.h
rename to sys/net/include/etx_beaconing.h
diff --git a/sys/net/routing/Makefile b/sys/net/routing/Makefile
new file mode 100644
index 0000000000..c6e31807e8
--- /dev/null
+++ b/sys/net/routing/Makefile
@@ -0,0 +1,3 @@
+MODULE:=$(shell basename $(CURDIR))
+
+include $(RIOTBASE)/Makefile.base
diff --git a/sys/net/routing/rpl/etx_beaconing.c b/sys/net/routing/etx_beaconing.c
similarity index 99%
rename from sys/net/routing/rpl/etx_beaconing.c
rename to sys/net/routing/etx_beaconing.c
index 7fe3e23db1..f6e91b7f4d 100644
--- a/sys/net/routing/rpl/etx_beaconing.c
+++ b/sys/net/routing/etx_beaconing.c
@@ -101,7 +101,6 @@ transceiver_command_t tcmd;
 //Message to send probes with
 msg_t mesg;
 
-//RPL-address
 static ipv6_addr_t *own_address;
 
 static etx_probe_t *etx_get_send_buf(void)
@@ -113,7 +112,7 @@ static etx_probe_t *etx_get_rec_buf(void)
     return ((etx_probe_t *) &(etx_rec_buf[0]));
 }
 
-void show_candidates(void)
+void etx_show_candidates(void)
 {
     etx_neighbor_t *candidate;
     etx_neighbor_t *end;
diff --git a/sys/net/routing/rpl/rpl.c b/sys/net/routing/rpl/rpl.c
index d67d70065d..db879c3f3d 100644
--- a/sys/net/routing/rpl/rpl.c
+++ b/sys/net/routing/rpl/rpl.c
@@ -209,7 +209,7 @@ uint8_t rpl_init(int if_id)
 
     /* INSERT NEW OBJECTIVE FUNCTIONS HERE */
     objective_functions[0] = rpl_get_of0();
-    /* objective_functions[1] = rpl_get_of_ETX() */
+    objective_functions[1] = rpl_get_of_mrhof();
 
     sixlowpan_lowpan_init_interface(if_id);
     /* need link local prefix to query _our_ corresponding address  */
-- 
GitLab