diff --git a/Makefile.include b/Makefile.include index 86f080ee3..f24507a1a 100644 --- a/Makefile.include +++ b/Makefile.include @@ -62,24 +62,9 @@ THREADS = mt.c LIBS = memb.c mmem.c timer.c list.c etimer.c ctimer.c energest.c rtimer.c stimer.c \ print-stats.c ifft.c crc16.c random.c checkpoint.c ringbuf.c DEV = nullradio.c -NET = netstack.c uip-debug.c packetbuf.c queuebuf.c packetqueue.c -ifeq ($(UIP_CONF_IPV6),1) - CFLAGS += -DUIP_CONF_IPV6=1 - UIP = uip6.c tcpip.c psock.c uip-udp-packet.c uip-split.c \ - resolv.c tcpdump.c uiplib.c simple-udp.c - NET += $(UIP) uip-icmp6.c uip-nd6.c uip-packetqueue.c \ - sicslowpan.c neighbor-attr.c neighbor-info.c uip-ds6.c uip-ds6-route.c - ifneq ($(UIP_CONF_RPL),0) - CFLAGS += -DUIP_CONF_IPV6_RPL=1 - include $(CONTIKI)/core/net/rpl/Makefile.rpl - endif # UIP_CONF_RPL -else # UIP_CONF_IPV6 - UIP = uip.c uiplib.c resolv.c tcpip.c psock.c hc.c uip-split.c uip-fw.c \ - uip-fw-drv.c uip_arp.c tcpdump.c uip-neighbor.c uip-udp-packet.c \ - uip-over-mesh.c dhcpc.c simple-udp.c - NET += $(UIP) uaodv.c uaodv-rt.c -endif # UIP_CONF_IPV6 +include $(CONTIKI)/core/net/Makefile.uip +include $(CONTIKI)/core/net/rpl/Makefile.rpl CTK = ctk.c CTKVNC = $(CTK) ctk-vncserver.c libconio.c vnc-server.c vnc-out.c ctk-vncfont.c diff --git a/core/net/Makefile.uip b/core/net/Makefile.uip new file mode 100644 index 000000000..469a29b22 --- /dev/null +++ b/core/net/Makefile.uip @@ -0,0 +1,33 @@ +NET = \ +dhcpc.c \ +hc.c \ +neighbor-attr.c \ +neighbor-info.c \ +netstack.c \ +packetbuf.c \ +packetqueue.c \ +psock.c \ +queuebuf.c \ +resolv.c \ +sicslowpan.c \ +simple-udp.c \ +tcpdump.c \ +tcpip.c \ +uaodv-rt.c \ +uaodv.c \ +uip-debug.c \ +uip-ds6-route.c \ +uip-ds6.c \ +uip-fw-drv.c \ +uip-fw.c \ +uip-icmp6.c \ +uip-nd6.c \ +uip-neighbor.c \ +uip-over-mesh.c \ +uip-packetqueue.c \ +uip-split.c \ +uip-udp-packet.c \ +uip.c \ +uip6.c \ +uip_arp.c \ +uiplib.c diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 16ab54eaf..2f77bd0fc 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -57,6 +57,7 @@ #include "net/neighbor-info.h" +#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ extern rpl_of_t RPL_OF; static rpl_of_t * const objective_functions[] = {&RPL_OF}; @@ -1230,3 +1231,4 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) p->dtsn = dio->dtsn; } /*---------------------------------------------------------------------------*/ +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index 8a161b665..95221a82d 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -62,6 +62,7 @@ #define UIP_EXT_HDR_OPT_PADN_BUF ((struct uip_ext_hdr_opt_padn *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset]) #define UIP_EXT_HDR_OPT_RPL_BUF ((struct uip_ext_hdr_opt_rpl *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset]) /*---------------------------------------------------------------------------*/ +#if UIP_CONF_IPV6 int rpl_verify_header(int uip_ext_opt_offset) { @@ -313,3 +314,4 @@ rpl_invert_header(void) } } /*---------------------------------------------------------------------------*/ +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 80334591b..11c414222 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -57,6 +57,7 @@ #include "net/uip-debug.h" +#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ #define RPL_DIO_GROUNDED 0x80 #define RPL_DIO_MOP_SHIFT 3 @@ -841,3 +842,4 @@ uip_rpl_input(void) uip_len = 0; } +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/rpl/rpl-timers.c b/core/net/rpl/rpl-timers.c index fc584e0bd..51f440f3f 100644 --- a/core/net/rpl/rpl-timers.c +++ b/core/net/rpl/rpl-timers.c @@ -44,6 +44,8 @@ #include "lib/random.h" #include "sys/ctimer.h" +#if UIP_CONF_IPV6 + #define DEBUG DEBUG_NONE #include "net/uip-debug.h" @@ -235,3 +237,4 @@ rpl_schedule_dao(rpl_instance_t *instance) } } /*---------------------------------------------------------------------------*/ +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index 7d76c3a27..f7b8bb722 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -52,6 +52,8 @@ #include #include +#if UIP_CONF_IPV6 + #if RPL_CONF_STATS rpl_stats_t rpl_stats; #endif @@ -262,3 +264,4 @@ rpl_init(void) #endif } /*---------------------------------------------------------------------------*/ +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/sicslowpan.c b/core/net/sicslowpan.c index 370792df5..1d643b409 100644 --- a/core/net/sicslowpan.c +++ b/core/net/sicslowpan.c @@ -68,6 +68,10 @@ #include "net/neighbor-info.h" #include "net/netstack.h" +#if UIP_CONF_IPV6 + +#include + #define DEBUG 0 #if DEBUG /* PRINTFI and PRINTFO are defined for input and output to debug one without changing the timing of the other */ @@ -1886,3 +1890,4 @@ const struct network_driver sicslowpan_driver = { }; /*--------------------------------------------------------------------*/ /** @} */ +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/tcpip.c b/core/net/tcpip.c index fc6db0ad2..f600dcea7 100644 --- a/core/net/tcpip.c +++ b/core/net/tcpip.c @@ -765,7 +765,7 @@ PROCESS_THREAD(tcpip_process, ev, data) UIP_FALLBACK_INTERFACE.init(); #endif /* initialize RPL if configured for using RPL */ -#if UIP_CONF_IPV6_RPL +#if UIP_CONF_IPV6 && UIP_CONF_IPV6_RPL rpl_init(); #endif /* UIP_CONF_IPV6_RPL */ diff --git a/core/net/uip-ds6-route.c b/core/net/uip-ds6-route.c index a83c28ffb..047baa910 100644 --- a/core/net/uip-ds6-route.c +++ b/core/net/uip-ds6-route.c @@ -35,6 +35,7 @@ #include "lib/list.h" #include "lib/memb.h" +#if UIP_CONF_IPV6 #include @@ -368,4 +369,4 @@ uip_ds6_defrt_periodic(void) } /*---------------------------------------------------------------------------*/ - +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/uip-ds6.c b/core/net/uip-ds6.c index 81ca9d2c2..644e49e00 100644 --- a/core/net/uip-ds6.c +++ b/core/net/uip-ds6.c @@ -48,6 +48,8 @@ #include "net/uip-ds6.h" #include "net/uip-packetqueue.h" +#if UIP_CONF_IPV6 + #define DEBUG DEBUG_NONE #include "net/uip-debug.h" @@ -876,3 +878,4 @@ uip_ds6_compute_reachable_time(void) /** @} */ +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/uip-fw-drv.c b/core/net/uip-fw-drv.c index 7cc78bf00..7324fb7bb 100644 --- a/core/net/uip-fw-drv.c +++ b/core/net/uip-fw-drv.c @@ -34,6 +34,8 @@ #include "net/uip-fw.h" +#if !UIP_CONF_IPV6 + PROCESS(uip_fw_process, "IP forwarding"); /*---------------------------------------------------------------------------*/ @@ -48,3 +50,5 @@ PROCESS_THREAD(uip_fw_process, ev, data) PROCESS_END(); } /*---------------------------------------------------------------------------*/ + +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/uip-icmp6.c b/core/net/uip-icmp6.c index 59a71013d..3b7b2b4da 100644 --- a/core/net/uip-icmp6.c +++ b/core/net/uip-icmp6.c @@ -70,6 +70,7 @@ static uip_ipaddr_t tmp_ipaddr; #include "rpl/rpl.h" #endif /* UIP_CONF_IPV6_RPL */ +#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ void uip_icmp6_echo_request_input(void) @@ -272,3 +273,4 @@ uip_icmp6_send(uip_ipaddr_t *dest, int type, int code, int payload_len) /*---------------------------------------------------------------------------*/ /** @} */ +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/uip-nd6.c b/core/net/uip-nd6.c index d0b7dac99..868032872 100644 --- a/core/net/uip-nd6.c +++ b/core/net/uip-nd6.c @@ -74,6 +74,7 @@ #include "net/uip-ds6.h" #include "lib/random.h" +#if UIP_CONF_IPV6 /*------------------------------------------------------------------*/ #define DEBUG 0 #include "net/uip-debug.h" @@ -662,6 +663,7 @@ uip_nd6_ra_output(uip_ipaddr_t * dest) nd6_opt_offset = UIP_ND6_RA_LEN; +#if !UIP_CONF_ROUTER /* Prefix list */ for(prefix = uip_ds6_prefix_list; prefix < uip_ds6_prefix_list + UIP_DS6_PREFIX_NB; prefix++) { @@ -678,6 +680,7 @@ uip_nd6_ra_output(uip_ipaddr_t * dest) uip_len += UIP_ND6_OPT_PREFIX_INFO_LEN; } } +#endif /* !UIP_CONF_ROUTER */ /* Source link-layer option */ create_llao((uint8_t *)UIP_ND6_OPT_HDR_BUF, UIP_ND6_OPT_SLLAO); @@ -960,3 +963,4 @@ discard: #endif /* !UIP_CONF_ROUTER */ /** @} */ +#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/uip.h b/core/net/uip.h index a9aef800d..dc25e2f1f 100644 --- a/core/net/uip.h +++ b/core/net/uip.h @@ -1017,11 +1017,11 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport); (addr1)->u16[1] == (addr2)->u16[1]) #define uip_ip6addr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0) -#if !UIP_CONF_IPV6 -#define uip_ipaddr_cmp(addr1, addr2) uip_ip4addr_cmp(addr1, addr2) -#else /* !UIP_CONF_IPV6 */ +#if UIP_CONF_IPV6 #define uip_ipaddr_cmp(addr1, addr2) uip_ip6addr_cmp(addr1, addr2) -#endif /* !UIP_CONF_IPV6 */ +#else /* UIP_CONF_IPV6 */ +#define uip_ipaddr_cmp(addr1, addr2) uip_ip4addr_cmp(addr1, addr2) +#endif /* UIP_CONF_IPV6 */ /** * Compare two IP addresses with netmasks @@ -1936,7 +1936,7 @@ CCIF extern uip_lladdr_t uip_lladdr; -#ifdef UIP_CONF_IPV6 +#if UIP_CONF_IPV6 /** Length of the link local prefix */ #define UIP_LLPREF_LEN 10 diff --git a/core/net/uip6.c b/core/net/uip6.c index af6f442e0..f0519fcfc 100644 --- a/core/net/uip6.c +++ b/core/net/uip6.c @@ -78,6 +78,7 @@ #include +#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ /* For Debug, logging, statistics */ /*---------------------------------------------------------------------------*/ @@ -2303,3 +2304,4 @@ uip_send(const void *data, int len) } /*---------------------------------------------------------------------------*/ /** @} */ +#endif /* UIP_CONF_IPV6 */