diff --git a/.travis.yml b/.travis.yml index 386829b5d..bb3900287 100644 --- a/.travis.yml +++ b/.travis.yml @@ -115,6 +115,6 @@ env: - BUILD_TYPE='compile-8051-ports' BUILD_CATEGORY='compile' BUILD_ARCH='8051' - BUILD_TYPE='compile-arm-apcs-ports' BUILD_CATEGORY='compile' BUILD_ARCH='arm-apcs' - BUILD_TYPE='compile-6502-ports' BUILD_CATEGORY='compile' BUILD_ARCH='6502' - - BUILD_TYPE='compile-arm-ports' BUILD_CATEGORY='compile' BUILD_ARCH='arm' +# - BUILD_TYPE='compile-arm-ports' BUILD_CATEGORY='compile' BUILD_ARCH='arm' - BUILD_TYPE='slip-radio' MAKE_TARGETS='cooja' - BUILD_TYPE='llsec' MAKE_TARGETS='cooja' diff --git a/Makefile.include b/Makefile.include index a3a8adad7..9c0838d3c 100644 --- a/Makefile.include +++ b/Makefile.include @@ -14,10 +14,6 @@ ifeq ($(TARGET),) endif endif -ifeq ($(UIP_CONF_IPV6),1) - CFLAGS += -DUIP_CONF_IPV6=1 -endif - ifeq ($(DEFINES),) -include Makefile.$(TARGET).defines ifneq ($(DEFINES),) @@ -67,6 +63,43 @@ CFLAGS += -DCONTIKI=1 -DCONTIKI_TARGET_$(TARGET_UPPERCASE)=1 MODULES += core/sys core/dev core/lib +# Include IPv6, IPv4, and/or Rime + +HAS_STACK = 0 +ifeq ($(CONTIKI_WITH_IPV4),1) + HAS_STACK = 1 + CFLAGS += -DNETSTACK_CONF_WITH_IPV4=1 + MODULES += core/net/ipv4 core/net/ip +endif + +ifeq ($(CONTIKI_WITH_RIME),1) + HAS_STACK = 1 + CFLAGS += -DNETSTACK_CONF_WITH_RIME=1 + MODULES += core/net/rime +endif + +# Make IPv6 the default stack +ifeq ($(HAS_STACK),0) +ifneq ($(CONTIKI_WITH_IPV6),0) +CONTIKI_WITH_IPV6 = 1 +endif +endif + +ifeq ($(CONTIKI_WITH_IPV6),1) + CFLAGS += -DNETSTACK_CONF_WITH_IPV6=1 + ifneq ($(CONTIKI_WITH_RPL),0) + CONTIKI_WITH_RPL = 1 + endif + MODULES += core/net/ipv6 core/net/ip +endif + +ifeq ($(CONTIKI_WITH_RPL),1) + CFLAGS += -DUIP_CONF_IPV6_RPL=1 + MODULES += core/net/rpl +else + CFLAGS += -DUIP_CONF_IPV6_RPL=0 +endif + CONTIKI_SOURCEFILES += $(CONTIKIFILES) CONTIKIDIRS += ${addprefix $(CONTIKI)/core/,dev lib net net/llsec net/mac net/rime \ diff --git a/apps/er-coap/er-coap.h b/apps/er-coap/er-coap.h index e74e521d2..48f6e4b4a 100644 --- a/apps/er-coap/er-coap.h +++ b/apps/er-coap/er-coap.h @@ -67,7 +67,7 @@ /* direct access into the buffer */ #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[uip_l2_l3_hdr_len]) #else #define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN]) diff --git a/apps/powertrace/powertrace.c b/apps/powertrace/powertrace.c index d5b0a46ec..139d96af8 100644 --- a/apps/powertrace/powertrace.c +++ b/apps/powertrace/powertrace.c @@ -51,7 +51,7 @@ struct powertrace_sniff_stats { uint32_t num_input, num_output; uint32_t input_txtime, input_rxtime; uint32_t output_txtime, output_rxtime; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint16_t proto; /* includes proto + possibly flags */ #endif uint16_t channel; @@ -135,7 +135,7 @@ powertrace_print(char *str) for(s = list_head(stats_list); s != NULL; s = list_item_next(s)) { -#if ! UIP_CONF_IPV6 +#if ! NETSTACK_CONF_WITH_IPV6 printf("%s %lu SP %d.%d %lu %u %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu (channel %d radio %d.%02d%% / %d.%02d%%)\n", str, clock_time(), linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], seqno, s->channel, @@ -249,7 +249,7 @@ add_packet_stats(int input_or_output) put it on the list. */ for(s = list_head(stats_list); s != NULL; s = list_item_next(s)) { if(s->channel == packetbuf_attr(PACKETBUF_ATTR_CHANNEL) -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 && s->proto == packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID) #endif ) { @@ -262,7 +262,7 @@ add_packet_stats(int input_or_output) if(s != NULL) { memset(s, 0, sizeof(struct powertrace_sniff_stats)); s->channel = packetbuf_attr(PACKETBUF_ATTR_CHANNEL); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 s->proto = packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID); #endif list_add(stats_list, s); @@ -283,7 +283,7 @@ output_sniffer(int mac_status) add_packet_stats(OUTPUT); } /*---------------------------------------------------------------------------*/ -#if ! UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_RIME static void sniffprint(char *prefix, int seqno) { @@ -347,7 +347,7 @@ powertrace_printsniff(powertrace_onoff_t onoff) break; } } -#endif +#endif /* NETSTACK_CONF_WITH_RIME */ /*---------------------------------------------------------------------------*/ RIME_SNIFFER(powersniff, input_sniffer, output_sniffer); /*---------------------------------------------------------------------------*/ diff --git a/apps/servreg-hack/servreg-hack.c b/apps/servreg-hack/servreg-hack.c index 190d01d04..f93bf20c3 100644 --- a/apps/servreg-hack/servreg-hack.c +++ b/apps/servreg-hack/servreg-hack.c @@ -379,3 +379,5 @@ PROCESS_THREAD(servreg_hack_process, ev, data) PROCESS_END(); } /*---------------------------------------------------------------------------*/ + +/** @} */ diff --git a/apps/shell/Makefile.shell b/apps/shell/Makefile.shell index 97cd5663f..39d444781 100644 --- a/apps/shell/Makefile.shell +++ b/apps/shell/Makefile.shell @@ -1,19 +1,35 @@ -shell_src = shell.c shell-reboot.c \ - shell-vars.c shell-ps.c shell-rime.c shell-sendtest.c \ +shell_src = shell.c shell-reboot.c shell-vars.c shell-ps.c \ shell-blink.c shell-text.c shell-time.c \ - shell-file.c shell-netfile.c shell-run.c \ - shell-rime-ping.c shell-rime-sniff.c shell-rime-netcmd.c \ - shell-rime-debug.c shell-rime-debug-runicast.c shell-coffee.c \ - shell-wget.c shell-httpd.c shell-irc.c \ + shell-file.c shell-run.c \ + shell-coffee.c \ shell-power.c \ - shell-tcpsend.c shell-udpsend.c shell-ping.c shell-netstat.c \ - shell-rime-sendcmd.c shell-download.c shell-rime-neighbors.c \ - shell-rime-unicast.c \ shell-base64.c \ - shell-netperf.c shell-memdebug.c \ - shell-powertrace.c shell-collect-view.c shell-crc.c + shell-memdebug.c \ + shell-powertrace.c shell-crc.c shell_dsc = shell-dsc.c + +ifeq ($(CONTIKI_WITH_RIME),1) +shell_src += shell-rime.c shell-sendtest.c shell-netfile.c \ + shell-rime-ping.c shell-rime-sniff.c shell-rime-netcmd.c \ + shell-rime-debug.c shell-rime-debug-runicast.c \ + shell-rime-sendcmd.c shell-download.c shell-rime-neighbors.c \ + shell-rime-unicast.c shell-netperf.c \ + shell-collect-view.c + +APPS += collect-view +include $(CONTIKI)/apps/collect-view/Makefile.collect-view +endif +ifeq ($(CONTIKI_WITH_IPV4),1) + SHELL_WITH_IP = 1 +endif +ifeq ($(CONTIKI_WITH_IPV6),1) + SHELL_WITH_IP = 1 +endif + +ifeq ($(SHELL_WITH_IP),1) +shell_src += shell-wget.c shell-httpd.c shell-irc.c \ + shell-tcpsend.c shell-udpsend.c shell-ping.c shell-netstat.c APPS += webserver include $(CONTIKI)/apps/webserver/Makefile.webserver ifndef PLATFORM_BUILD @@ -38,13 +54,11 @@ ifndef PLATFORM_BUILD override telnet_src = telnet.c endif +endif + APPS += powertrace include $(CONTIKI)/apps/powertrace/Makefile.powertrace - -APPS += collect-view -include $(CONTIKI)/apps/collect-view/Makefile.collect-view - ifeq ($(TARGET),sky) shell_src += shell-sky.c shell-exec.c endif diff --git a/apps/shell/shell-ping.c b/apps/shell/shell-ping.c index 8f202d162..5f73cc6f2 100644 --- a/apps/shell/shell-ping.c +++ b/apps/shell/shell-ping.c @@ -62,7 +62,7 @@ static unsigned char running; /*---------------------------------------------------------------------------*/ static void send_ping(uip_ipaddr_t *dest_addr) -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 { static uint16_t count; UIP_IP_BUF->vtc = 0x60; @@ -92,7 +92,7 @@ send_ping(uip_ipaddr_t *dest_addr) tcpip_ipv6_output(); } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ { static uint16_t ipid = 0; static uint16_t seqno = 0; @@ -128,7 +128,7 @@ send_ping(uip_ipaddr_t *dest_addr) tcpip_output(); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ PROCESS_THREAD(shell_ping_process, ev, data) { diff --git a/apps/webserver-nano/webserver-nogui.c b/apps/webserver-nano/webserver-nogui.c index fd1cf029a..9b1e1d348 100644 --- a/apps/webserver-nano/webserver-nogui.c +++ b/apps/webserver-nano/webserver-nogui.c @@ -64,7 +64,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file) { /* Print out IP address of requesting host. */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #if WEBSERVER_CONF_ADDRESSES char buf[48]; uint8_t j; @@ -78,7 +78,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file) char buf[20]; sprintf(buf, "%d.%d.%d.%d: ", requester->u8[0], requester->u8[1], requester->u8[2], requester->u8[3]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ //log_message(buf, file); printf("%s%s\n", buf, file); } diff --git a/apps/webserver/httpd-cgi.c b/apps/webserver/httpd-cgi.c index 909ceb762..d0e7e9532 100644 --- a/apps/webserver/httpd-cgi.c +++ b/apps/webserver/httpd-cgi.c @@ -157,7 +157,7 @@ make_tcp_stats(void *arg) struct httpd_state *s = (struct httpd_state *)arg; conn = &uip_conns[s->u.count]; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 char buf[48]; httpd_sprint_ip6(conn->ripaddr, buf); return snprintf((char *)uip_appdata, uip_mss(), @@ -184,7 +184,7 @@ make_tcp_stats(void *arg) conn->timer, (uip_outstanding(conn))? '*':' ', (uip_stopped(conn))? '!':' '); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } /*---------------------------------------------------------------------------*/ static @@ -226,7 +226,7 @@ PT_THREAD(processes(struct httpd_state *s, char *ptr)) } PSOCK_END(&s->sout); } -#if WEBSERVER_CONF_STATUSPAGE && UIP_CONF_IPV6 +#if WEBSERVER_CONF_STATUSPAGE && NETSTACK_CONF_WITH_IPV6 /* These cgi's are invoked by the status.shtml page in /apps/webserver/httpd-fs. * To keep the webserver build small that 160 byte page is not present in the * default httpd-fsdata.c file. Run the PERL script /../../tools/makefsdata from the @@ -357,7 +357,7 @@ httpd_cgi_add(struct httpd_cgi_call *c) } } /*---------------------------------------------------------------------------*/ -#if WEBSERVER_CONF_STATUSPAGE && UIP_CONF_IPV6 +#if WEBSERVER_CONF_STATUSPAGE && NETSTACK_CONF_WITH_IPV6 static const char adrs_name[] HTTPD_STRING_ATTR = "addresses"; static const char nbrs_name[] HTTPD_STRING_ATTR = "neighbors"; static const char rtes_name[] HTTPD_STRING_ATTR = "routes"; @@ -365,7 +365,7 @@ static const char rtes_name[] HTTPD_STRING_ATTR = "routes"; HTTPD_CGI_CALL(file, file_name, file_stats); HTTPD_CGI_CALL(tcp, tcp_name, tcp_stats); HTTPD_CGI_CALL(proc, proc_name, processes); -#if WEBSERVER_CONF_STATUSPAGE && UIP_CONF_IPV6 +#if WEBSERVER_CONF_STATUSPAGE && NETSTACK_CONF_WITH_IPV6 HTTPD_CGI_CALL(adrs, adrs_name, addresses); HTTPD_CGI_CALL(nbrs, nbrs_name, neighbors); HTTPD_CGI_CALL(rtes, rtes_name, routes); @@ -377,7 +377,7 @@ httpd_cgi_init(void) httpd_cgi_add(&file); httpd_cgi_add(&tcp); httpd_cgi_add(&proc); -#if WEBSERVER_CONF_STATUSPAGE && UIP_CONF_IPV6 +#if WEBSERVER_CONF_STATUSPAGE && NETSTACK_CONF_WITH_IPV6 httpd_cgi_add(&adrs); httpd_cgi_add(&nbrs); httpd_cgi_add(&rtes); diff --git a/apps/webserver/httpd.c b/apps/webserver/httpd.c index d9c67e369..b307f60a9 100644 --- a/apps/webserver/httpd.c +++ b/apps/webserver/httpd.c @@ -342,7 +342,7 @@ httpd_init(void) memb_init(&conns); httpd_cgi_init(); } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /*---------------------------------------------------------------------------*/ uint8_t httpd_sprint_ip6(uip_ip6addr_t addr, char * result) @@ -374,5 +374,5 @@ httpd_sprint_ip6(uip_ip6addr_t addr, char * result) *result=0; return (result - starting); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ diff --git a/apps/webserver/httpd.h b/apps/webserver/httpd.h index 05080b038..20d1ad272 100644 --- a/apps/webserver/httpd.h +++ b/apps/webserver/httpd.h @@ -59,8 +59,8 @@ struct httpd_state { void httpd_init(void); void httpd_appcall(void *state); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint8_t httpd_sprint_ip6(uip_ip6addr_t addr, char * result); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #endif /* HTTPD_H_ */ diff --git a/apps/webserver/webserver-nogui.c b/apps/webserver/webserver-nogui.c index ba2f5c9e5..535a46be6 100644 --- a/apps/webserver/webserver-nogui.c +++ b/apps/webserver/webserver-nogui.c @@ -67,7 +67,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file) #if LOG_CONF_ENABLED /* Print out IP address of requesting host. */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 char buf[48]; uint8_t j; j=httpd_sprint_ip6((uip_ip6addr_t)*requester, buf); @@ -76,7 +76,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file) char buf[20]; sprintf(buf, "%d.%d.%d.%d: ", requester->u8[0], requester->u8[1], requester->u8[2], requester->u8[3]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ log_message(buf, file); #endif /* LOG_CONF_ENABLED */ diff --git a/core/contiki-default-conf.h b/core/contiki-default-conf.h index 93fb2a839..df7fe9e6d 100644 --- a/core/contiki-default-conf.h +++ b/core/contiki-default-conf.h @@ -123,11 +123,11 @@ * project-specific configuration to save memory. */ -/* UIP_CONF_IPV6 specifies whether or not IPv6 should be used. If IPv6 +/* NETSTACK_CONF_WITH_IPV6 specifies whether or not IPv6 should be used. If IPv6 is not used, IPv4 is used instead. */ -#ifndef UIP_CONF_IPV6 -#define UIP_CONF_IPV6 0 -#endif /* UIP_CONF_IPV6 */ +#ifndef NETSTACK_CONF_WITH_IPV6 +#define NETSTACK_CONF_WITH_IPV6 0 +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* UIP_CONF_BUFFER_SIZE specifies how much memory should be reserved for the uIP packet buffer. This sets an upper bound on the largest diff --git a/core/contiki-net.h b/core/contiki-net.h index d783b35b2..d38d89344 100644 --- a/core/contiki-net.h +++ b/core/contiki-net.h @@ -45,10 +45,10 @@ #include "net/ip/uip-udp-packet.h" #include "net/ip/simple-udp.h" -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-icmp6.h" #include "net/ipv6/uip-ds6.h" -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include "net/ip/resolv.h" diff --git a/core/dev/slip.c b/core/dev/slip.c index e70010b51..6b8a24ceb 100644 --- a/core/dev/slip.c +++ b/core/dev/slip.c @@ -96,7 +96,6 @@ slip_set_input_callback(void (*c)(void)) /* slip_send: forward (IPv4) packets with {UIP_FW_NETIF(..., slip_send)} * was used in slip-bridge.c */ -//#if WITH_UIP uint8_t slip_send(void) { @@ -125,7 +124,6 @@ slip_send(void) return UIP_FW_OK; } -//#endif /* WITH_UIP */ /*---------------------------------------------------------------------------*/ uint8_t slip_write(const void *_ptr, int len) @@ -264,7 +262,7 @@ PROCESS_THREAD(slip_process, ev, data) /* Move packet from rxbuf to buffer provided by uIP. */ uip_len = slip_poll_handler(&uip_buf[UIP_LLH_LEN], UIP_BUFSIZE - UIP_LLH_LEN); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 if(uip_len == 4 && strncmp((char*)&uip_buf[UIP_LLH_LEN], "?IPA", 4) == 0) { char buf[8]; memcpy(&buf[0], "=IPA", 4); @@ -298,7 +296,7 @@ PROCESS_THREAD(slip_process, ev, data) uip_len = 0; SLIP_STATISTICS(slip_ip_drop++); } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ if(uip_len > 0) { if(input_callback) { input_callback(); @@ -309,7 +307,7 @@ PROCESS_THREAD(slip_process, ev, data) tcpip_input(); #endif } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } PROCESS_END(); diff --git a/core/lib/mmem.c b/core/lib/mmem.c index a6ff1b59c..20c7390fd 100644 --- a/core/lib/mmem.c +++ b/core/lib/mmem.c @@ -151,8 +151,13 @@ mmem_free(struct mmem *m) void mmem_init(void) { + static int inited = 0; + if(inited) { + return; + } list_init(mmemlist); avail_memory = MMEM_SIZE; + inited = 1; } /*---------------------------------------------------------------------------*/ diff --git a/core/net/ip/resolv.c b/core/net/ip/resolv.c index e860cee56..5df53ecac 100644 --- a/core/net/ip/resolv.c +++ b/core/net/ip/resolv.c @@ -185,7 +185,7 @@ strcasecmp(const char *s1, const char *s2) #define DNS_TYPE_ANY 255 #define DNS_TYPE_NSEC 47 -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define NATIVE_DNS_TYPE DNS_TYPE_AAAA /* IPv6 */ #else #define NATIVE_DNS_TYPE DNS_TYPE_A /* IPv4 */ @@ -227,19 +227,16 @@ struct dns_hdr { uint16_t numextrarr; }; -#define RESOLV_ENCODE_INDEX(i) (uip_htons(i+1)) -#define RESOLV_DECODE_INDEX(i) (unsigned char)(uip_ntohs(i-1)) - /** These default values for the DNS server are Google's public DNS: * */ static uip_ipaddr_t resolv_default_dns_server = -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 { { 0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88 } }; -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ { { 8, 8, 8, 8 } }; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /** \internal The DNS answer message structure. */ struct dns_answer { @@ -249,7 +246,7 @@ struct dns_answer { uint16_t class; uint16_t ttl[2]; uint16_t len; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint8_t ipaddr[16]; #else uint8_t ipaddr[4]; @@ -264,6 +261,7 @@ struct namemap { #define STATE_DONE 4 uint8_t state; uint8_t tmr; + uint16_t id; uint8_t retries; uint8_t seqno; #if RESOLV_SUPPORTS_RECORD_EXPIRATION @@ -315,13 +313,13 @@ enum { static uint8_t mdns_state; static const uip_ipaddr_t resolv_mdns_addr = -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb } }; #include "net/ipv6/uip-ds6.h" -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ { { 224, 0, 0, 251 } }; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ static int mdns_needs_host_announce; PROCESS(mdns_probe_process, "mDNS probe"); @@ -506,9 +504,7 @@ start_name_collision_check(clock_time_t after) static unsigned char * mdns_write_announce_records(unsigned char *queryptr, uint8_t *count) { - struct dns_answer *ans; - -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint8_t i; for(i = 0; i < UIP_DS6_ADDR_NB; ++i) { @@ -524,7 +520,6 @@ mdns_write_announce_records(unsigned char *queryptr, uint8_t *count) *queryptr++ = 0xc0; *queryptr++ = sizeof(struct dns_hdr); } - ans = (struct dns_answer *)queryptr; *queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE) >> 8); *queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE)); @@ -545,7 +540,9 @@ mdns_write_announce_records(unsigned char *queryptr, uint8_t *count) ++(*count); } } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ + struct dns_answer *ans; + queryptr = encode_name(queryptr, resolv_hostname); ans = (struct dns_answer *)queryptr; ans->type = UIP_HTONS(NATIVE_DNS_TYPE); @@ -556,7 +553,7 @@ mdns_write_announce_records(unsigned char *queryptr, uint8_t *count) uip_gethostaddr((uip_ipaddr_t *) ans->ipaddr); queryptr = (unsigned char *)ans + sizeof(*ans); ++(*count); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ return queryptr; } /*---------------------------------------------------------------------------*/ @@ -585,17 +582,17 @@ mdns_prep_host_announce_packet(void) 0x00, 0x04, -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 0x00, 0x00, 0x00, 0x08, -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ 0x40, 0x00, 0x00, 0x00, -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } }; @@ -603,8 +600,6 @@ mdns_prep_host_announce_packet(void) uint8_t total_answers = 0; - struct dns_answer *ans; - /* Be aware that, unless `ARCH_DOESNT_NEED_ALIGNED_STRUCTS` is set, * writing directly to the uint16_t members of this struct is an error. */ struct dns_hdr *hdr = (struct dns_hdr *)uip_appdata; @@ -703,7 +698,8 @@ check_entries(void) } hdr = (struct dns_hdr *)uip_appdata; memset(hdr, 0, sizeof(struct dns_hdr)); - hdr->id = RESOLV_ENCODE_INDEX(i); + hdr->id = random_rand(); + namemapptr->id = hdr->id; #if RESOLV_CONF_SUPPORTS_MDNS if(!namemapptr->is_mdns || namemapptr->is_probe) { hdr->flags1 = DNS_FLAG1_RD; @@ -903,10 +899,13 @@ newdata(void) } else #endif /* RESOLV_CONF_SUPPORTS_MDNS */ { - /* The ID in the DNS header should be our entry into the name table. */ - i = RESOLV_DECODE_INDEX(hdr->id); - - namemapptr = &names[i]; + for(i = 0; i < RESOLV_ENTRIES; ++i) { + namemapptr = &names[i]; + if(namemapptr->state == STATE_ASKING && + namemapptr->id == hdr->id) { + break; + } + } if(i >= RESOLV_ENTRIES || i < 0 || namemapptr->state != STATE_ASKING) { PRINTF("resolver: DNS response has bad ID (%04X) \n", uip_ntohs(hdr->id)); @@ -1141,7 +1140,7 @@ PROCESS_THREAD(resolv_process, ev, data) PRINTF("resolver: Supports MDNS.\n"); uip_udp_bind(resolv_conn, UIP_HTONS(MDNS_PORT)); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uip_ds6_maddr_add(&resolv_mdns_addr); #else /* TODO: Is there anything we need to do here for IPv4 multicast? */ @@ -1200,6 +1199,16 @@ PROCESS_THREAD(resolv_process, ev, data) PROCESS_END(); } /*---------------------------------------------------------------------------*/ +static void +init(void) +{ + static uint8_t initialized = 0; + if(!initialized) { + process_start(&resolv_process, NULL); + initialized = 1; + } +} +/*---------------------------------------------------------------------------*/ #if RESOLV_AUTO_REMOVE_TRAILING_DOTS static const char * remove_trailing_dots(const char *name) { @@ -1233,6 +1242,8 @@ resolv_query(const char *name) register struct namemap *nameptr = 0; + init(); + lseq = lseqi = 0; /* Remove trailing dots, if present. */ @@ -1316,12 +1327,12 @@ resolv_lookup(const char *name, uip_ipaddr_t ** ipaddr) #if UIP_CONF_LOOPBACK_INTERFACE if(strcmp(name, "localhost")) { static uip_ipaddr_t loopback = -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } }; -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ { { 127, 0, 0, 1 } }; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ if(ipaddr) { *ipaddr = &loopback; } @@ -1369,7 +1380,8 @@ resolv_lookup(const char *name, uip_ipaddr_t ** ipaddr) #if VERBOSE_DEBUG switch (ret) { - case RESOLV_STATUS_CACHED:{ + case RESOLV_STATUS_CACHED: + if(ipaddr) { PRINTF("resolver: Found \"%s\" in cache.\n", name); const uip_ipaddr_t *addr = *ipaddr; @@ -1428,7 +1440,7 @@ resolv_found(char *name, uip_ipaddr_t * ipaddr) #if RESOLV_CONF_SUPPORTS_MDNS if(strncasecmp(resolv_hostname, name, strlen(resolv_hostname)) == 0 && ipaddr -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 && !uip_ds6_is_my_addr(ipaddr) #else && uip_ipaddr_cmp(&uip_hostaddr, ipaddr) != 0 diff --git a/core/net/ip/simple-udp.h b/core/net/ip/simple-udp.h index a0d578a46..ad4ac53ac 100644 --- a/core/net/ip/simple-udp.h +++ b/core/net/ip/simple-udp.h @@ -44,7 +44,7 @@ /** - * \defgroup simple-udp + * \defgroup simple-udp A simple UDP API * * The default Contiki UDP API is difficult to use. The simple-udp * module provides a significantly simpler API. diff --git a/core/net/ip/tcp-socket.c b/core/net/ip/tcp-socket.c index f914ae206..44010ce1c 100644 --- a/core/net/ip/tcp-socket.c +++ b/core/net/ip/tcp-socket.c @@ -56,10 +56,10 @@ call_event(struct tcp_socket *s, tcp_socket_event_t event) static void senddata(struct tcp_socket *s) { - int len; + int len = MIN(s->output_data_max_seg, uip_mss()); if(s->output_data_len > 0) { - len = MIN(s->output_data_len, uip_mss()); + len = MIN(s->output_data_len, len); s->output_data_send_nxt = len; uip_send(s->output_data_ptr, len); } @@ -148,12 +148,14 @@ appcall(void *state) s->listen_port != 0 && s->listen_port == uip_htons(uip_conn->lport)) { s->flags &= ~TCP_SOCKET_FLAGS_LISTENING; + s->output_data_max_seg = uip_mss(); tcp_markconn(uip_conn, s); call_event(s, TCP_SOCKET_CONNECTED); break; } } } else { + s->output_data_max_seg = uip_mss(); call_event(s, TCP_SOCKET_CONNECTED); } diff --git a/core/net/ip/tcp-socket.h b/core/net/ip/tcp-socket.h index aea678049..208bc8288 100644 --- a/core/net/ip/tcp-socket.h +++ b/core/net/ip/tcp-socket.h @@ -95,6 +95,7 @@ struct tcp_socket { uint16_t output_data_maxlen; uint16_t output_data_len; uint16_t output_data_send_nxt; + uint16_t output_data_max_seg; uint8_t flags; uint16_t listen_port; diff --git a/core/net/ip/tcpip.c b/core/net/ip/tcpip.c index 7a889c84c..6f2744785 100644 --- a/core/net/ip/tcpip.c +++ b/core/net/ip/tcpip.c @@ -42,7 +42,7 @@ #include "net/ip/uip-split.h" #include "net/ip/uip-packetqueue.h" -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-nd6.h" #include "net/ipv6/uip-ds6.h" #endif @@ -80,7 +80,7 @@ process_event_t tcpip_icmp6_event; /* Periodic check of active connections. */ static struct etimer periodic; -#if UIP_CONF_IPV6 && UIP_CONF_IPV6_REASSEMBLY +#if NETSTACK_CONF_WITH_IPV6 && UIP_CONF_IPV6_REASSEMBLY /* Timer for reassembly. */ extern struct etimer uip_reass_timer; #endif @@ -107,7 +107,7 @@ enum { }; /* Called on IP packet output. */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 static uint8_t (* outputfunc)(const uip_lladdr_t *a); @@ -194,7 +194,7 @@ packet_input(void) #if UIP_CONF_TCP_SPLIT uip_split_output(); #else /* UIP_CONF_TCP_SPLIT */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 tcpip_ipv6_output(); #else PRINTF("tcpip packet_input forward output len %d\n", uip_len); @@ -213,7 +213,7 @@ packet_input(void) #if UIP_CONF_TCP_SPLIT uip_split_output(); #else /* UIP_CONF_TCP_SPLIT */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 tcpip_ipv6_output(); #else PRINTF("tcpip packet_input output len %d\n", uip_len); @@ -331,11 +331,11 @@ udp_broadcast_new(uint16_t port, void *appstate) uip_ipaddr_t addr; struct uip_udp_conn *conn; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uip_create_linklocal_allnodes_mcast(&addr); #else uip_ipaddr(&addr, 255,255,255,255); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ conn = udp_new(&addr, port, appstate); if(conn != NULL) { udp_bind(conn, port); @@ -434,7 +434,7 @@ eventhandler(process_event_t ev, process_data_t data) connections. */ etimer_restart(&periodic); uip_periodic(i); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 tcpip_ipv6_output(); #else if(uip_len > 0) { @@ -442,7 +442,7 @@ eventhandler(process_event_t ev, process_data_t data) tcpip_output(); PRINTF("tcpip_output after periodic len %d\n", uip_len); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } } #endif /* UIP_TCP */ @@ -451,7 +451,7 @@ eventhandler(process_event_t ev, process_data_t data) #endif /* UIP_CONF_IP_FORWARD */ } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #if UIP_CONF_IPV6_REASSEMBLY /* * check the timer for reassembly @@ -483,7 +483,7 @@ eventhandler(process_event_t ev, process_data_t data) uip_ds6_periodic(); tcpip_ipv6_output(); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } break; @@ -491,14 +491,14 @@ eventhandler(process_event_t ev, process_data_t data) case TCP_POLL: if(data != NULL) { uip_poll_conn(data); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 tcpip_ipv6_output(); -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ if(uip_len > 0) { PRINTF("tcpip_output from tcp poll len %d\n", uip_len); tcpip_output(); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Start the periodic polling, if it isn't already active. */ start_periodic_tcp_timer(); } @@ -508,7 +508,7 @@ eventhandler(process_event_t ev, process_data_t data) case UDP_POLL: if(data != NULL) { uip_udp_periodic_conn(data); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 tcpip_ipv6_output(); #else if(uip_len > 0) { @@ -530,12 +530,12 @@ tcpip_input(void) { process_post_synch(&tcpip_process, PACKET_INPUT, NULL); uip_len = 0; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uip_ext_len = 0; -#endif /*UIP_CONF_IPV6*/ +#endif /*NETSTACK_CONF_WITH_IPV6*/ } /*---------------------------------------------------------------------------*/ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 void tcpip_ipv6_output(void) { @@ -616,7 +616,7 @@ tcpip_ipv6_output(void) rpl_repair_root(instance->instance_id); } -#endif /* UIP_CONF_RPL */ +#endif /* UIP_CONF_IPV6_RPL */ uip_ds6_route_rm(route); /* We don't have a nexthop to send the packet to, so we drop @@ -729,7 +729,7 @@ tcpip_ipv6_output(void) uip_len = 0; uip_ext_len = 0; } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ #if UIP_UDP void @@ -818,7 +818,7 @@ PROCESS_THREAD(tcpip_process, ev, data) UIP_FALLBACK_INTERFACE.init(); #endif /* initialize RPL if configured for using RPL */ -#if UIP_CONF_IPV6 && UIP_CONF_IPV6_RPL +#if NETSTACK_CONF_WITH_IPV6 && UIP_CONF_IPV6_RPL rpl_init(); #endif /* UIP_CONF_IPV6_RPL */ diff --git a/core/net/ip/tcpip.h b/core/net/ip/tcpip.h index fc053bcf1..3fd64bce8 100644 --- a/core/net/ip/tcpip.h +++ b/core/net/ip/tcpip.h @@ -340,7 +340,7 @@ CCIF void tcpip_input(void); * \brief Output packet to layer 2 * The eventual parameter is the MAC address of the destination. */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint8_t tcpip_output(const uip_lladdr_t *); void tcpip_set_outputfunc(uint8_t (* f)(const uip_lladdr_t *)); #else @@ -351,7 +351,7 @@ void tcpip_set_outputfunc(uint8_t (* f)(void)); /** * \brief This function does address resolution and then calls tcpip_output */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 void tcpip_ipv6_output(void); #endif diff --git a/core/net/ip/uip-debug.c b/core/net/ip/uip-debug.c index a9a6d5ed0..6460f2bb4 100644 --- a/core/net/ip/uip-debug.c +++ b/core/net/ip/uip-debug.c @@ -47,7 +47,7 @@ uip_debug_ipaddr_print(const uip_ipaddr_t *addr) printf("(NULL IP addr)"); return; } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint16_t a; unsigned int i; int f; @@ -66,9 +66,9 @@ uip_debug_ipaddr_print(const uip_ipaddr_t *addr) PRINTA("%x", a); } } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ PRINTA("%u.%u.%u.%u", addr->u8[0], addr->u8[1], addr->u8[2], addr->u8[3]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } /*---------------------------------------------------------------------------*/ void diff --git a/core/net/ip/uip-split.c b/core/net/ip/uip-split.c index 178d989b0..1150dd337 100644 --- a/core/net/ip/uip-split.c +++ b/core/net/ip/uip-split.c @@ -73,33 +73,33 @@ uip_split_output(void) /* Create the first packet. This is done by altering the length field of the IP header and updating the checksums. */ uip_len = len1 + UIP_TCPIP_HLEN; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* For IPv6, the IP length field does not include the IPv6 IP header length. */ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ BUF->len[0] = uip_len >> 8; BUF->len[1] = uip_len & 0xff; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Recalculate the TCP checksum. */ BUF->tcpchksum = 0; BUF->tcpchksum = ~(uip_tcpchksum()); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 /* Recalculate the IP checksum. */ BUF->ipchksum = 0; BUF->ipchksum = ~(uip_ipchksum()); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Transmit the first packet. */ /* uip_fw_output();*/ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 tcpip_ipv6_output(); #else tcpip_output(); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Now, create the second packet. To do this, it is not enough to just alter the length field, but we must also update the TCP @@ -107,15 +107,15 @@ uip_split_output(void) memory. This place is detemined by the length of the first packet (len1). */ uip_len = len2 + UIP_TCPIP_HLEN; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* For IPv6, the IP length field does not include the IPv6 IP header length. */ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ BUF->len[0] = uip_len >> 8; BUF->len[1] = uip_len & 0xff; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* uip_appdata += len1;*/ memcpy(uip_appdata, (uint8_t *)uip_appdata + len1, len2); @@ -130,29 +130,29 @@ uip_split_output(void) BUF->tcpchksum = 0; BUF->tcpchksum = ~(uip_tcpchksum()); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 /* Recalculate the IP checksum. */ BUF->ipchksum = 0; BUF->ipchksum = ~(uip_ipchksum()); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Transmit the second packet. */ /* uip_fw_output();*/ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 tcpip_ipv6_output(); #else tcpip_output(); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ return; } #endif /* UIP_TCP */ /* uip_fw_output();*/ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 tcpip_ipv6_output(); #else tcpip_output(); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } /*-----------------------------------------------------------------------------*/ diff --git a/core/net/ip/uip-udp-packet.c b/core/net/ip/uip-udp-packet.c index b327b652d..5cbf63763 100644 --- a/core/net/ip/uip-udp-packet.c +++ b/core/net/ip/uip-udp-packet.c @@ -66,7 +66,7 @@ uip_udp_packet_send(struct uip_udp_conn *c, const void *data, int len) } #endif /* UIP_IPV6_MULTICAST */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 tcpip_ipv6_output(); #else if(uip_len > 0) { diff --git a/core/net/ip/uip.h b/core/net/ip/uip.h index 9412416f1..cfd095de2 100644 --- a/core/net/ip/uip.h +++ b/core/net/ip/uip.h @@ -53,12 +53,12 @@ #define UIP_H_ /* Header sizes. */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define UIP_IPH_LEN 40 #define UIP_FRAGH_LEN 8 -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_IPH_LEN 20 /* Size of IP header */ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_UDPH_LEN 8 /* Size of UDP header */ #define UIP_TCPH_LEN 20 /* Size of TCP header */ @@ -75,7 +75,7 @@ + IP header */ #define UIP_LLIPH_LEN (UIP_LLH_LEN + UIP_IPH_LEN) /* size of L2 + IP header */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /** * The sums below are quite used in ND. When used for uip_buf, we * include link layer length when used for uip_len, we do not, hence @@ -86,7 +86,7 @@ #define uip_l2_l3_icmp_hdr_len (UIP_LLH_LEN + UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN) #define uip_l3_hdr_len (UIP_IPH_LEN + uip_ext_len) #define uip_l3_icmp_hdr_len (UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN) -#endif /*UIP_CONF_IPV6*/ +#endif /*NETSTACK_CONF_WITH_IPV6*/ #include "net/ip/uipopt.h" @@ -108,11 +108,11 @@ typedef union uip_ip6addr_t { uint16_t u16[8]; } uip_ip6addr_t; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 typedef uip_ip6addr_t uip_ipaddr_t; -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ typedef uip_ip4addr_t uip_ipaddr_t; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ @@ -1056,11 +1056,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 +#if NETSTACK_CONF_WITH_IPV6 #define uip_ipaddr_cmp(addr1, addr2) uip_ip6addr_cmp(addr1, addr2) -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define uip_ipaddr_cmp(addr1, addr2) uip_ip4addr_cmp(addr1, addr2) -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /** * Compare two IP addresses with netmasks @@ -1494,13 +1494,13 @@ struct uip_stats { checksum. */ } udp; /**< UDP statistics. */ #endif /* UIP_UDP */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 struct { uip_stats_t drop; /**< Number of dropped ND6 packets. */ uip_stats_t recv; /**< Number of recived ND6 packets */ uip_stats_t sent; /**< Number of sent ND6 packets */ } nd6; -#endif /*UIP_CONF_IPV6*/ +#endif /*NETSTACK_CONF_WITH_IPV6*/ }; @@ -1610,7 +1610,7 @@ void uip_process(uint8_t flag); /* The TCP and IP headers. */ struct uip_tcpip_hdr { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* IPv6 header. */ uint8_t vtc, tcflow; @@ -1618,7 +1618,7 @@ struct uip_tcpip_hdr { uint8_t len[2]; uint8_t proto, ttl; uip_ip6addr_t srcipaddr, destipaddr; -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* IPv4 header. */ uint8_t vhl, tos, @@ -1629,7 +1629,7 @@ struct uip_tcpip_hdr { proto; uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* TCP header. */ uint16_t srcport, @@ -1646,7 +1646,7 @@ struct uip_tcpip_hdr { /* The ICMP and IP headers. */ struct uip_icmpip_hdr { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* IPv6 header. */ uint8_t vtc, tcf; @@ -1654,7 +1654,7 @@ struct uip_icmpip_hdr { uint8_t len[2]; uint8_t proto, ttl; uip_ip6addr_t srcipaddr, destipaddr; -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* IPv4 header. */ uint8_t vhl, tos, @@ -1665,21 +1665,21 @@ struct uip_icmpip_hdr { proto; uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* ICMP header. */ uint8_t type, icode; uint16_t icmpchksum; -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 uint16_t id, seqno; uint8_t payload[1]; -#endif /* !UIP_CONF_IPV6 */ +#endif /* !NETSTACK_CONF_WITH_IPV6 */ }; /* The UDP and IP headers. */ struct uip_udpip_hdr { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* IPv6 header. */ uint8_t vtc, tcf; @@ -1687,7 +1687,7 @@ struct uip_udpip_hdr { uint8_t len[2]; uint8_t proto, ttl; uip_ip6addr_t srcipaddr, destipaddr; -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* IP header. */ uint8_t vhl, tos, @@ -1698,7 +1698,7 @@ struct uip_udpip_hdr { proto; uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* UDP header. */ uint16_t srcport, @@ -1714,7 +1714,7 @@ struct uip_udpip_hdr { */ /* The IP header */ struct uip_ip_hdr { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* IPV6 header */ uint8_t vtc; uint8_t tcflow; @@ -1722,7 +1722,7 @@ struct uip_ip_hdr { uint8_t len[2]; uint8_t proto, ttl; uip_ip6addr_t srcipaddr, destipaddr; -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* IPV4 header */ uint8_t vhl, tos, @@ -1733,7 +1733,7 @@ struct uip_ip_hdr { proto; uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ }; @@ -1842,9 +1842,9 @@ struct uip_tcp_hdr { struct uip_icmp_hdr { uint8_t type, icode; uint16_t icmpchksum; -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 uint16_t id, seqno; -#endif /* !UIP_CONF_IPV6 */ +#endif /* !NETSTACK_CONF_WITH_IPV6 */ }; @@ -1880,7 +1880,7 @@ struct uip_udp_hdr { #define UIP_PROTO_ICMP6 58 -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /** @{ */ /** \brief extension headers types */ #define UIP_PROTO_HBHO 0 @@ -1917,7 +1917,7 @@ struct uip_udp_hdr { /** @} */ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #if UIP_FIXEDADDR @@ -1937,7 +1937,7 @@ CCIF extern uip_lladdr_t uip_lladdr; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /** Length of the link local prefix */ #define UIP_LLPREF_LEN 10 @@ -2162,7 +2162,7 @@ CCIF extern uip_lladdr_t uip_lladdr; (((a)->u8[14]) == ((b)->u8[14])) && \ (((a)->u8[15]) == ((b)->u8[15]))) -#endif /*UIP_CONF_IPV6*/ +#endif /*NETSTACK_CONF_WITH_IPV6*/ /** * Calculate the Internet checksum over a buffer. diff --git a/core/net/ip/uiplib.c b/core/net/ip/uiplib.c index 44b1b54e1..35a56be4c 100644 --- a/core/net/ip/uiplib.c +++ b/core/net/ip/uiplib.c @@ -41,7 +41,7 @@ #include "net/ip/uip-debug.h" /*-----------------------------------------------------------------------------------*/ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 int uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *ipaddr) { @@ -103,7 +103,7 @@ uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *ipaddr) return 1; } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /*-----------------------------------------------------------------------------------*/ /* Parse a IPv4-address from a string. Returns the number of characters read * for the address. */ diff --git a/core/net/ip/uiplib.h b/core/net/ip/uiplib.h index 4ef55b93e..98adec02d 100644 --- a/core/net/ip/uiplib.h +++ b/core/net/ip/uiplib.h @@ -67,11 +67,11 @@ * \retval 0 If the IP address could not be parsed. * \retval Non-zero If the IP address was parsed. */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define uiplib_ipaddrconv uiplib_ip6addrconv -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define uiplib_ipaddrconv uiplib_ip4addrconv -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ CCIF int uiplib_ip4addrconv(const char *addrstr, uip_ip4addr_t *addr); CCIF int uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *addr); diff --git a/core/net/ip/uipopt.h b/core/net/ip/uipopt.h index b78da452e..7a523b254 100644 --- a/core/net/ip/uipopt.h +++ b/core/net/ip/uipopt.h @@ -282,9 +282,9 @@ void uip_log(char *msg); /** The maximum transmission unit at the IP Layer*/ #define UIP_LINK_MTU 1280 -#ifndef UIP_CONF_IPV6 +#ifndef NETSTACK_CONF_WITH_IPV6 /** Do we use IPv6 or not (default: no) */ -#define UIP_CONF_IPV6 0 +#define NETSTACK_CONF_WITH_IPV6 0 #endif #ifndef UIP_CONF_IPV6_QUEUE_PKT @@ -351,7 +351,7 @@ void uip_log(char *msg); #ifdef UIP_CONF_UDP_CHECKSUMS #define UIP_UDP_CHECKSUMS (UIP_CONF_UDP_CHECKSUMS) #else -#define UIP_UDP_CHECKSUMS (UIP_CONF_IPV6) +#define UIP_UDP_CHECKSUMS (NETSTACK_CONF_WITH_IPV6) #endif /** diff --git a/core/net/ip64/ip64-addrmap.c b/core/net/ip64/ip64-addrmap.c index 4578d1296..d7cfcb74f 100644 --- a/core/net/ip64/ip64-addrmap.c +++ b/core/net/ip64/ip64-addrmap.c @@ -35,6 +35,8 @@ #include "ip64-conf.h" +#include "lib/random.h" + #include #ifdef IP64_ADDRMAP_CONF_ENTRIES @@ -173,10 +175,8 @@ ip64_addrmap_lookup_port(uint16_t mapped_port, uint8_t protocol) static void increase_mapped_port(void) { - mapped_port++; - if(mapped_port >= LAST_MAPPED_PORT) { - mapped_port = FIRST_MAPPED_PORT; - } + mapped_port = (random_rand() % (LAST_MAPPED_PORT - FIRST_MAPPED_PORT)) + + FIRST_MAPPED_PORT; } /*---------------------------------------------------------------------------*/ struct ip64_addrmap_entry * diff --git a/core/net/ipv4/uip-fw-drv.c b/core/net/ipv4/uip-fw-drv.c index d4f62b945..72a104eed 100644 --- a/core/net/ipv4/uip-fw-drv.c +++ b/core/net/ipv4/uip-fw-drv.c @@ -34,7 +34,7 @@ #include "net/ipv4/uip-fw.h" -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 PROCESS(uip_fw_process, "IP forwarding"); @@ -51,4 +51,4 @@ PROCESS_THREAD(uip_fw_process, ev, data) } /*---------------------------------------------------------------------------*/ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ diff --git a/core/net/ipv4/uip-over-mesh.c b/core/net/ipv4/uip-over-mesh.c index 8fe373238..92c5dbfd4 100644 --- a/core/net/ipv4/uip-over-mesh.c +++ b/core/net/ipv4/uip-over-mesh.c @@ -260,7 +260,9 @@ uip_over_mesh_send(void) an underlying power-saving MAC layer knows that it should be waiting for an ACK. */ if(BUF->proto == UIP_PROTO_TCP) { +#if NETSTACK_CONF_WITH_RIME packetbuf_set_attr(PACKETBUF_ATTR_ERELIABLE, 1); +#endif /* NETSTACK_CONF_WITH_RIME */ packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1); /* packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE_STREAM);*/ } diff --git a/core/net/ipv4/uip.c b/core/net/ipv4/uip.c index c28595ea2..f1bb7257a 100644 --- a/core/net/ipv4/uip.c +++ b/core/net/ipv4/uip.c @@ -75,15 +75,15 @@ #include "net/ipv4/uip_arp.h" #include "net/ip/uip_arch.h" -#if !UIP_CONF_IPV6 /* If UIP_CONF_IPV6 is defined, we compile the +#if !NETSTACK_CONF_WITH_IPV6 /* If NETSTACK_CONF_WITH_IPV6 is defined, we compile the uip6.c file instead of this one. Therefore this #ifndef removes the entire compilation output of the uip.c file */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv4/uip-neighbor.h" -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include @@ -106,12 +106,12 @@ uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask; #endif /* UIP_FIXEDADDR */ const uip_ipaddr_t uip_broadcast_addr = -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ { { 0xff, 0xff, 0xff, 0xff } }; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ const uip_ipaddr_t uip_all_zeroes_addr = { { 0x0, /* rest is 0 */ } }; #if UIP_FIXEDETHADDR @@ -322,11 +322,11 @@ upper_layer_chksum(uint8_t proto) uint16_t upper_layer_len; uint16_t sum; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]); -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* First sum pseudoheader. */ @@ -342,14 +342,14 @@ upper_layer_chksum(uint8_t proto) return (sum == 0) ? 0xffff : uip_htons(sum); } /*---------------------------------------------------------------------------*/ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint16_t uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ uint16_t uip_tcpchksum(void) @@ -529,7 +529,7 @@ uip_listen(uint16_t port) /*---------------------------------------------------------------------------*/ /* XXX: IP fragment reassembly: not well-tested. */ -#if UIP_REASSEMBLY && !UIP_CONF_IPV6 +#if UIP_REASSEMBLY && !NETSTACK_CONF_WITH_IPV6 #define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN) static uint8_t uip_reassbuf[UIP_REASS_BUFSIZE]; static uint8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; @@ -828,7 +828,7 @@ uip_process(uint8_t flag) /* Start of IP input header processing code. */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* Check validity of the IP header. */ if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */ UIP_STAT(++uip_stat.ip.drop); @@ -836,7 +836,7 @@ uip_process(uint8_t flag) UIP_LOG("ipv6: invalid version."); goto drop; } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Check validity of the IP header. */ if(BUF->vhl != 0x45) { /* IP version and header length. */ UIP_STAT(++uip_stat.ip.drop); @@ -844,7 +844,7 @@ uip_process(uint8_t flag) UIP_LOG("ip: invalid version or header length."); goto drop; } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Check the size of the packet. If the size reported to us in uip_len is smaller the size reported in the IP header, we assume @@ -855,7 +855,7 @@ uip_process(uint8_t flag) if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) { uip_len = (BUF->len[0] << 8) + BUF->len[1]; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uip_len += 40; /* The length reported in the IPv6 header is the length of the payload that follows the header. However, uIP uses the uip_len variable @@ -865,13 +865,13 @@ uip_process(uint8_t flag) contains the length of the entire packet. But for IPv6 we need to add the size of the IPv6 header (40 bytes). */ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } else { UIP_LOG("ip: packet shorter than reported in IP header."); goto drop; } -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 /* Check the fragment flag. */ if((BUF->ipoffset[0] & 0x3f) != 0 || BUF->ipoffset[1] != 0) { @@ -887,13 +887,13 @@ uip_process(uint8_t flag) goto drop; #endif /* UIP_REASSEMBLY */ } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ if(uip_ipaddr_cmp(&uip_hostaddr, &uip_all_zeroes_addr)) { /* If we are configured to use ping IP address configuration and hasn't been assigned an IP address yet, we accept all ICMP packets. */ -#if UIP_PINGADDRCONF && !UIP_CONF_IPV6 +#if UIP_PINGADDRCONF && !NETSTACK_CONF_WITH_IPV6 if(BUF->proto == UIP_PROTO_ICMP) { UIP_LOG("ip: possible ping config packet received."); goto icmp_input; @@ -924,12 +924,12 @@ uip_process(uint8_t flag) #endif /* UIP_BROADCAST */ /* Check if the packet is destined for our IP address. */ -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr)) { UIP_STAT(++uip_stat.ip.drop); goto drop; } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* For IPv6, packet reception is a little trickier as we need to make sure that we listen to certain multicast addresses (all hosts multicast address, and the solicited-node multicast @@ -940,10 +940,10 @@ uip_process(uint8_t flag) UIP_STAT(++uip_stat.ip.drop); goto drop; } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header checksum. */ UIP_STAT(++uip_stat.ip.drop); @@ -951,7 +951,7 @@ uip_process(uint8_t flag) UIP_LOG("ip: bad checksum."); goto drop; } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #if UIP_TCP if(BUF->proto == UIP_PROTO_TCP) { /* Check for TCP packet. If so, @@ -967,7 +967,7 @@ uip_process(uint8_t flag) } #endif /* UIP_UDP */ -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 /* ICMPv4 processing code follows. */ if(BUF->proto != UIP_PROTO_ICMP) { /* We only allow ICMP packets from here. */ @@ -1018,7 +1018,7 @@ uip_process(uint8_t flag) goto ip_send_nolen; /* End of IPv4 input header processing code. */ -#else /* !UIP_CONF_IPV6 */ +#else /* !NETSTACK_CONF_WITH_IPV6 */ /* This is IPv6 ICMPv6 processing code. */ DEBUG_PRINTF("icmp6_input: length %d\n", uip_len); @@ -1086,7 +1086,7 @@ uip_process(uint8_t flag) /* End of IPv6 ICMP processing. */ -#endif /* !UIP_CONF_IPV6 */ +#endif /* !NETSTACK_CONF_WITH_IPV6 */ #if UIP_UDP /* UDP input processing. */ @@ -1137,7 +1137,7 @@ uip_process(uint8_t flag) } UIP_LOG("udp: no matching connection found"); UIP_STAT(++uip_stat.udp.drop); -#if UIP_CONF_ICMP_DEST_UNREACH && !UIP_CONF_IPV6 +#if UIP_CONF_ICMP_DEST_UNREACH && !NETSTACK_CONF_WITH_IPV6 /* Copy fields from packet header into payload of this ICMP packet. */ memcpy(&(ICMPBUF->payload[0]), ICMPBUF, UIP_IPH_LEN + 8); @@ -1183,15 +1183,15 @@ uip_process(uint8_t flag) } uip_len = uip_slen + UIP_IPUDPH_LEN; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* For IPv6, the IP length field does not include the IPv6 IP header length. */ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ BUF->len[0] = (uip_len >> 8); BUF->len[1] = (uip_len & 0xff); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ BUF->ttl = uip_udp_conn->ttl; BUF->proto = UIP_PROTO_UDP; @@ -1875,8 +1875,6 @@ uip_process(uint8_t flag) BUF->seqno[2] = uip_connr->snd_nxt[2]; BUF->seqno[3] = uip_connr->snd_nxt[3]; - BUF->proto = UIP_PROTO_TCP; - BUF->srcport = uip_connr->lport; BUF->destport = uip_connr->rport; @@ -1893,16 +1891,18 @@ uip_process(uint8_t flag) } tcp_send_noconn: + BUF->proto = UIP_PROTO_TCP; + BUF->ttl = UIP_TTL; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* For IPv6, the IP length field does not include the IPv6 IP header length. */ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ BUF->len[0] = (uip_len >> 8); BUF->len[1] = (uip_len & 0xff); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ BUF->urgp[0] = BUF->urgp[1] = 0; @@ -1912,11 +1912,11 @@ uip_process(uint8_t flag) #endif ip_send_nolen: -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 BUF->vtc = 0x60; BUF->tcflow = 0x00; BUF->flow = 0x00; -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ BUF->vhl = 0x45; BUF->tos = 0; BUF->ipoffset[0] = BUF->ipoffset[1] = 0; @@ -1927,11 +1927,11 @@ uip_process(uint8_t flag) BUF->ipchksum = 0; BUF->ipchksum = ~(uip_ipchksum()); DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum()); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ UIP_STAT(++uip_stat.tcp.sent); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 send: -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len, (BUF->len[0] << 8) | BUF->len[1]); @@ -1973,6 +1973,6 @@ uip_send(const void *data, int len) } } /*---------------------------------------------------------------------------*/ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /** @}*/ diff --git a/core/net/ipv6/multicast/roll-tm.c b/core/net/ipv6/multicast/roll-tm.c index 1fcde5e44..cfb4e66d5 100644 --- a/core/net/ipv6/multicast/roll-tm.c +++ b/core/net/ipv6/multicast/roll-tm.c @@ -67,7 +67,6 @@ #define VERBOSE_PRINT_SEED(...) #endif -#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ /* Data Representation */ /*---------------------------------------------------------------------------*/ @@ -1448,5 +1447,3 @@ const struct uip_mcast6_driver roll_tm_driver = { in, }; /*---------------------------------------------------------------------------*/ - -#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/ipv6/multicast/smrf.c b/core/net/ipv6/multicast/smrf.c index 8a80a4142..9e49fdc40 100644 --- a/core/net/ipv6/multicast/smrf.c +++ b/core/net/ipv6/multicast/smrf.c @@ -52,7 +52,6 @@ #define DEBUG DEBUG_NONE #include "net/ip/uip-debug.h" -#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ /* Macros */ /*---------------------------------------------------------------------------*/ @@ -207,5 +206,3 @@ const struct uip_mcast6_driver smrf_driver = { in, }; /*---------------------------------------------------------------------------*/ - -#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/ipv6/multicast/uip-mcast6-route.c b/core/net/ipv6/multicast/uip-mcast6-route.c index f99a92818..e414fbf17 100644 --- a/core/net/ipv6/multicast/uip-mcast6-route.c +++ b/core/net/ipv6/multicast/uip-mcast6-route.c @@ -45,7 +45,6 @@ #include #include -#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ /* Size of the multicast routing table */ #ifdef UIP_MCAST6_ROUTE_CONF_ROUTES @@ -129,5 +128,3 @@ uip_mcast6_route_init() list_init(mcast_route_list); } /*---------------------------------------------------------------------------*/ - -#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/ipv6/sicslowpan.c b/core/net/ipv6/sicslowpan.c index 18c8f7732..3be5a0f2a 100644 --- a/core/net/ipv6/sicslowpan.c +++ b/core/net/ipv6/sicslowpan.c @@ -69,8 +69,6 @@ #include "net/ipv6/sicslowpan.h" #include "net/netstack.h" -#if UIP_CONF_IPV6 - #include #define DEBUG DEBUG_NONE @@ -1929,4 +1927,3 @@ const struct network_driver sicslowpan_driver = { }; /*--------------------------------------------------------------------*/ /** @} */ -#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/ipv6/uip-ds6-nbr.c b/core/net/ipv6/uip-ds6-nbr.c index d6ca16a4d..86f915d10 100644 --- a/core/net/ipv6/uip-ds6-nbr.c +++ b/core/net/ipv6/uip-ds6-nbr.c @@ -201,12 +201,25 @@ uip_ds6_link_neighbor_callback(int status, int numtx) LINK_NEIGHBOR_CALLBACK(dest, status, numtx); #if UIP_DS6_LL_NUD + /* From RFC4861, page 72, last paragraph of section 7.3.3: + * + * "In some cases, link-specific information may indicate that a path to + * a neighbor has failed (e.g., the resetting of a virtual circuit). In + * such cases, link-specific information may be used to purge Neighbor + * Cache entries before the Neighbor Unreachability Detection would do + * so. However, link-specific information MUST NOT be used to confirm + * the reachability of a neighbor; such information does not provide + * end-to-end confirmation between neighboring IP layers." + * + * However, we assume that receiving a link layer ack ensures the delivery + * of the transmitted packed to the IP stack of the neighbour. This is a + * fair assumption and allows battery powered nodes save some battery by + * not re-testing the state of a neighbour periodically if it + * acknowledges link packets. */ if(status == MAC_TX_OK) { uip_ds6_nbr_t *nbr; nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest); - if(nbr != NULL && - (nbr->state == NBR_STALE || nbr->state == NBR_DELAY || - nbr->state == NBR_PROBE)) { + if(nbr != NULL && nbr->state != NBR_INCOMPLETE) { nbr->state = NBR_REACHABLE; stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000); PRINTF("uip-ds6-neighbor : received a link layer ACK : "); @@ -227,10 +240,32 @@ uip_ds6_neighbor_periodic(void) switch(nbr->state) { case NBR_REACHABLE: if(stimer_expired(&nbr->reachable)) { +#if UIP_CONF_IPV6_RPL + /* when a neighbor leave it's REACHABLE state and is a default router, + instead of going to STALE state it enters DELAY state in order to + force a NUD on it. Otherwise, if there is no upward traffic, the + node never knows if the default router is still reachable. This + mimics the 6LoWPAN-ND behavior. + */ + if(uip_ds6_defrt_lookup(&nbr->ipaddr) != NULL) { + PRINTF("REACHABLE: defrt moving to DELAY ("); + PRINT6ADDR(&nbr->ipaddr); + PRINTF(")\n"); + nbr->state = NBR_DELAY; + stimer_set(&nbr->reachable, UIP_ND6_DELAY_FIRST_PROBE_TIME); + nbr->nscount = 0; + } else { + PRINTF("REACHABLE: moving to STALE ("); + PRINT6ADDR(&nbr->ipaddr); + PRINTF(")\n"); + nbr->state = NBR_STALE; + } +#else /* UIP_CONF_IPV6_RPL */ PRINTF("REACHABLE: moving to STALE ("); PRINT6ADDR(&nbr->ipaddr); PRINTF(")\n"); nbr->state = NBR_STALE; +#endif /* UIP_CONF_IPV6_RPL */ } break; #if UIP_ND6_SEND_NA diff --git a/core/net/ipv6/uip-ds6-route.c b/core/net/ipv6/uip-ds6-route.c index 2bec5862a..ecb7d354b 100644 --- a/core/net/ipv6/uip-ds6-route.c +++ b/core/net/ipv6/uip-ds6-route.c @@ -36,8 +36,6 @@ #include "lib/memb.h" #include "net/nbr-table.h" -#if UIP_CONF_IPV6 - #include /* The nbr_routes holds a neighbor table to be able to maintain @@ -216,6 +214,10 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr) uip_ipaddr_prefixcmp(addr, &r->ipaddr, r->length)) { longestmatch = r->length; found_route = r; + /* check if total match - e.g. all 128 bits do match */ + if(longestmatch == 128) { + break; + } } } @@ -229,13 +231,14 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr) PRINTF("uip-ds6-route: No route found\n"); } - if(found_route != NULL) { - /* If we found a route, we put it at the end of the routeslist + if(found_route != NULL && found_route != list_head(routelist)) { + /* If we found a route, we put it at the start of the routeslist list. The list is ordered by how recently we looked them up: - the least recently used route will be at the start of the - list. */ + the least recently used route will be at the end of the + list - for fast lookups (assuming multiple packets to the same node). */ + list_remove(routelist, found_route); - list_add(routelist, found_route); + list_push(routelist, found_route); } return found_route; @@ -282,7 +285,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, least recently used route is the first route on the list. */ uip_ds6_route_t *oldest; - oldest = uip_ds6_route_head(); + oldest = list_tail(routelist); /* uip_ds6_route_head(); */ PRINTF("uip_ds6_route_add: dropping route to "); PRINT6ADDR(&oldest->ipaddr); PRINTF("\n"); @@ -328,7 +331,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, return NULL; } - list_add(routelist, r); + /* add new routes first - assuming that there is a reason to add this + and that there is a packet coming soon. */ + list_push(routelist, r); nbrr = memb_alloc(&neighborroutememb); if(nbrr == NULL) { @@ -386,7 +391,7 @@ uip_ds6_route_rm(uip_ds6_route_t *route) PRINT6ADDR(&route->ipaddr); PRINTF("\n"); - /* Remove the neighbor from the route list */ + /* Remove the route from the route list */ list_remove(routelist, route); /* Find the corresponding neighbor_route and remove it. */ @@ -624,5 +629,3 @@ uip_ds6_defrt_periodic(void) } } /*---------------------------------------------------------------------------*/ - -#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/ipv6/uip-ds6.c b/core/net/ipv6/uip-ds6.c index 644a3952d..d5b848b9a 100644 --- a/core/net/ipv6/uip-ds6.c +++ b/core/net/ipv6/uip-ds6.c @@ -50,8 +50,6 @@ #include "net/ipv6/uip-ds6.h" #include "net/ip/uip-packetqueue.h" -#if UIP_CONF_IPV6 - #define DEBUG DEBUG_NONE #include "net/ip/uip-debug.h" @@ -188,12 +186,12 @@ uip_ds6_periodic(void) uip_ds6_neighbor_periodic(); -#if UIP_CONF_ROUTER & UIP_ND6_SEND_RA +#if UIP_CONF_ROUTER && UIP_ND6_SEND_RA /* Periodic RA sending */ if(stimer_expired(&uip_ds6_timer_ra) && (uip_len == 0)) { uip_ds6_send_ra_periodic(); } -#endif /* UIP_CONF_ROUTER & UIP_ND6_SEND_RA */ +#endif /* UIP_CONF_ROUTER && UIP_ND6_SEND_RA */ etimer_reset(&uip_ds6_timer_periodic); return; } @@ -704,6 +702,5 @@ uip_ds6_compute_reachable_time(void) UIP_ND6_MIN_RANDOM_FACTOR(uip_ds6_if.base_reachable_time)); } /*---------------------------------------------------------------------------*/ -#endif /* UIP_CONF_IPV6 */ /** @}*/ diff --git a/core/net/ipv6/uip-icmp6.c b/core/net/ipv6/uip-icmp6.c index a3d78ee39..b14ac2d64 100644 --- a/core/net/ipv6/uip-icmp6.c +++ b/core/net/ipv6/uip-icmp6.c @@ -68,8 +68,6 @@ #include "rpl/rpl.h" #endif /* UIP_CONF_IPV6_RPL */ -#if UIP_CONF_IPV6 - /** \brief temporary IP address */ static uip_ipaddr_t tmp_ipaddr; @@ -421,4 +419,3 @@ uip_icmp6_init() } /*---------------------------------------------------------------------------*/ /** @} */ -#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/ipv6/uip-icmp6.h b/core/net/ipv6/uip-icmp6.h index 525f8766d..aa44bff5a 100644 --- a/core/net/ipv6/uip-icmp6.h +++ b/core/net/ipv6/uip-icmp6.h @@ -112,7 +112,7 @@ typedef struct uip_icmp6_error{ * \brief Send an icmpv6 error message * \param type type of the error message * \param code of the error message - * \param type 32 bit parameter of the error message, semantic depends on error + * \param param 32 bit parameter of the error message, semantic depends on error */ void uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param); diff --git a/core/net/ipv6/uip-nd6.c b/core/net/ipv6/uip-nd6.c index 2731bb045..273b45134 100644 --- a/core/net/ipv6/uip-nd6.c +++ b/core/net/ipv6/uip-nd6.c @@ -74,7 +74,6 @@ #include "net/ipv6/uip-ds6.h" #include "lib/random.h" -#if UIP_CONF_IPV6 /*------------------------------------------------------------------*/ #define DEBUG 0 #include "net/ip/uip-debug.h" @@ -1036,4 +1035,3 @@ uip_nd6_init() } /*---------------------------------------------------------------------------*/ /** @} */ -#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/ipv6/uip-nd6.h b/core/net/ipv6/uip-nd6.h index 4be5d1741..0ece86522 100644 --- a/core/net/ipv6/uip-nd6.h +++ b/core/net/ipv6/uip-nd6.h @@ -76,15 +76,27 @@ #else #define UIP_ND6_SEND_NA UIP_CONF_ND6_SEND_NA #endif +#ifndef UIP_CONF_ND6_MAX_RA_INTERVAL #define UIP_ND6_MAX_RA_INTERVAL 600 +#else +#define UIP_ND6_MAX_RA_INTERVAL UIP_CONF_ND6_MAX_RA_INTERVAL +#endif +#ifndef UIP_CONF_ND6_MIN_RA_INTERVAL #define UIP_ND6_MIN_RA_INTERVAL (UIP_ND6_MAX_RA_INTERVAL / 3) +#else +#define UIP_ND6_MIN_RA_INTERVAL UIP_CONF_ND6_MIN_RA_INTERVAL +#endif #define UIP_ND6_M_FLAG 0 #define UIP_ND6_O_FLAG 0 #define UIP_ND6_ROUTER_LIFETIME 3 * UIP_ND6_MAX_RA_INTERVAL #define UIP_ND6_MAX_INITIAL_RA_INTERVAL 16 /*seconds*/ #define UIP_ND6_MAX_INITIAL_RAS 3 /*transmissions*/ +#ifndef UIP_CONF_ND6_MIN_DELAY_BETWEEN_RAS #define UIP_ND6_MIN_DELAY_BETWEEN_RAS 3 /*seconds*/ +#else +#define UIP_ND6_MIN_DELAY_BETWEEN_RAS UIP_CONF_ND6_MIN_DELAY_BETWEEN_RAS +#endif //#define UIP_ND6_MAX_RA_DELAY_TIME 0.5 /*seconds*/ #define UIP_ND6_MAX_RA_DELAY_TIME_MS 500 /*milli seconds*/ /** @} */ diff --git a/core/net/ipv6/uip6.c b/core/net/ipv6/uip6.c index 0ee1d3102..2debd54d7 100644 --- a/core/net/ipv6/uip6.c +++ b/core/net/ipv6/uip6.c @@ -80,7 +80,6 @@ #include -#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ /* For Debug, logging, statistics */ /*---------------------------------------------------------------------------*/ @@ -1207,7 +1206,11 @@ uip_process(uint8_t flag) } #if UIP_CONF_IPV6_RPL - rpl_update_header_empty(); + if(rpl_update_header_empty()) { + /* Packet can not be forwarded */ + PRINTF("RPL Forward Option Error\n"); + goto drop; + } #endif /* UIP_CONF_IPV6_RPL */ UIP_IP_BUF->ttl = UIP_IP_BUF->ttl - 1; @@ -2236,8 +2239,6 @@ uip_process(uint8_t flag) UIP_TCP_BUF->seqno[2] = uip_connr->snd_nxt[2]; UIP_TCP_BUF->seqno[3] = uip_connr->snd_nxt[3]; - UIP_IP_BUF->proto = UIP_PROTO_TCP; - UIP_TCP_BUF->srcport = uip_connr->lport; UIP_TCP_BUF->destport = uip_connr->rport; @@ -2259,6 +2260,8 @@ uip_process(uint8_t flag) } tcp_send_noconn: + UIP_IP_BUF->proto = UIP_PROTO_TCP; + UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit; UIP_IP_BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); UIP_IP_BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); @@ -2333,4 +2336,3 @@ uip_send(const void *data, int len) } /*---------------------------------------------------------------------------*/ /** @} */ -#endif /* UIP_CONF_IPV6 */ diff --git a/core/net/llsec/anti-replay.c b/core/net/llsec/anti-replay.c index 45168ef57..c56d90e0b 100644 --- a/core/net/llsec/anti-replay.c +++ b/core/net/llsec/anti-replay.c @@ -87,7 +87,7 @@ anti_replay_was_replayed(struct anti_replay_info *info) received_counter = anti_replay_get_counter(); - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { /* broadcast */ if(received_counter <= info->last_broadcast_counter) { return 1; diff --git a/core/net/mac/contikimac/contikimac-framer.c b/core/net/mac/contikimac/contikimac-framer.c index 86121df5e..0a47866f9 100644 --- a/core/net/mac/contikimac/contikimac-framer.c +++ b/core/net/mac/contikimac/contikimac-framer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut. + * Copyright (c) 2010, Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,6 +26,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * This file is part of the Contiki operating system. + * */ /** @@ -78,6 +80,12 @@ struct hdr { uint8_t len; }; +/*---------------------------------------------------------------------------*/ +static int +hdr_length(void) +{ + return DECORATED_FRAMER.length() + sizeof(struct hdr); +} /*---------------------------------------------------------------------------*/ static int create(void) @@ -172,6 +180,7 @@ parse(void) } /*---------------------------------------------------------------------------*/ const struct framer contikimac_framer = { + hdr_length, create, create_and_secure, parse diff --git a/core/net/mac/contikimac/contikimac-framer.h b/core/net/mac/contikimac/contikimac-framer.h index 5bc84f67f..ea9429997 100644 --- a/core/net/mac/contikimac/contikimac-framer.h +++ b/core/net/mac/contikimac/contikimac-framer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut. + * Copyright (c) 2010, Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,6 +26,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * This file is part of the Contiki operating system. + * */ /** diff --git a/core/net/mac/contikimac/contikimac.c b/core/net/mac/contikimac/contikimac.c index eb79f60e1..05365c5fa 100644 --- a/core/net/mac/contikimac/contikimac.c +++ b/core/net/mac/contikimac/contikimac.c @@ -522,7 +522,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, /* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */ packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); #endif - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { is_broadcast = 1; PRINTDEBUG("contikimac: send broadcast\n"); @@ -530,7 +530,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, return MAC_TX_COLLISION; } } else { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 PRINTDEBUG("contikimac: send unicast to %02x%02x:%02x%02x:%02x%02x:%02x%02x\n", packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1], @@ -540,14 +540,17 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[5], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[6], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[7]); -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ PRINTDEBUG("contikimac: send unicast to %u.%u\n", packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } - is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || - packetbuf_attr(PACKETBUF_ATTR_ERELIABLE); + is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) +#if NETSTACK_CONF_WITH_RIME + || packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) +#endif /* NETSTACK_CONF_WITH_RIME */ + ; if(!packetbuf_attr(PACKETBUF_ATTR_IS_CREATED_AND_SECURED)) { packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); @@ -878,8 +881,7 @@ input_packet(void) packetbuf_totlen() > 0 && (linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_node_addr) || - linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), - &linkaddr_null))) { + packetbuf_holds_broadcast())) { /* This is a regular packet that is destined to us or to the broadcast address. */ diff --git a/core/net/mac/cxmac/cxmac.c b/core/net/mac/cxmac/cxmac.c index 7bb55f227..ebf7651dd 100644 --- a/core/net/mac/cxmac/cxmac.c +++ b/core/net/mac/cxmac/cxmac.c @@ -433,11 +433,11 @@ send_packet(void) /* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */ packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); #endif - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { is_broadcast = 1; PRINTDEBUG("cxmac: send broadcast\n"); } else { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 PRINTDEBUG("cxmac: send unicast to %02x%02x:%02x%02x:%02x%02x:%02x%02x\n", packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1], @@ -451,7 +451,7 @@ send_packet(void) PRINTDEBUG("cxmac: send unicast to %u.%u\n", packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } /* is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);*/ @@ -625,7 +625,9 @@ send_packet(void) that will need an upper layer ACK (as signified by the PACKETBUF_ATTR_RELIABLE packet attribute), we keep the radio on. */ if(got_strobe_ack && (packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || - packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) || +#if NETSTACK_CONF_WITH_RIME + packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) || +#endif /* NETSTACK_CONF_WITH_RIME */ packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_STREAM)) { on(); /* Wait for ACK packet */ diff --git a/core/net/mac/framer-802154.c b/core/net/mac/framer-802154.c index f1da770a7..03b091feb 100644 --- a/core/net/mac/framer-802154.c +++ b/core/net/mac/framer-802154.c @@ -104,7 +104,7 @@ create_frame(int type, int do_create) /* Build the FCF. */ params.fcf.frame_type = packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE); params.fcf.frame_pending = packetbuf_attr(PACKETBUF_ATTR_PENDING); - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { params.fcf.ack_required = 0; } else { params.fcf.ack_required = packetbuf_attr(PACKETBUF_ATTR_MAC_ACK); @@ -159,11 +159,7 @@ create_frame(int type, int do_create) } params.dest_pid = mac_dst_pan_id; - /* - * If the output address is NULL in the Rime buf, then it is broadcast - * on the 802.15.4 network. - */ - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { /* Broadcast requires short address mode. */ params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE; params.dest_addr[0] = 0xFF; diff --git a/core/net/mac/nullrdc.c b/core/net/mac/nullrdc.c index 7f92495e8..3403b764e 100644 --- a/core/net/mac/nullrdc.c +++ b/core/net/mac/nullrdc.c @@ -132,8 +132,7 @@ send_one_packet(mac_callback_t sent, void *ptr) NETSTACK_RADIO.prepare(packetbuf_hdrptr(), packetbuf_totlen()); - is_broadcast = linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), - &linkaddr_null); + is_broadcast = packetbuf_holds_broadcast(); if(NETSTACK_RADIO.receiving_packet() || (!is_broadcast && NETSTACK_RADIO.pending_packet())) { @@ -282,8 +281,7 @@ packet_input(void) #if NULLRDC_ADDRESS_FILTER } else if(!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_node_addr) && - !linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), - &linkaddr_null)) { + !packetbuf_holds_broadcast()) { PRINTF("nullrdc: not for us\n"); #endif /* NULLRDC_ADDRESS_FILTER */ } else { diff --git a/core/net/mac/sicslowmac/sicslowmac.c b/core/net/mac/sicslowmac/sicslowmac.c index 56db88ff5..9d88a6b78 100644 --- a/core/net/mac/sicslowmac/sicslowmac.c +++ b/core/net/mac/sicslowmac/sicslowmac.c @@ -123,11 +123,7 @@ send_packet(mac_callback_t sent, void *ptr) params.fcf.src_addr_mode = FRAME802154_LONGADDRMODE; params.dest_pid = mac_dst_pan_id; - /* - * If the output address is NULL in the Rime buf, then it is broadcast - * on the 802.15.4 network. - */ - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { /* Broadcast requires short address mode. */ params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE; params.dest_addr[0] = 0xFF; diff --git a/core/net/packetbuf.c b/core/net/packetbuf.c index e67c8cf12..43994f61e 100644 --- a/core/net/packetbuf.c +++ b/core/net/packetbuf.c @@ -320,4 +320,11 @@ packetbuf_addr(uint8_t type) } /*---------------------------------------------------------------------------*/ #endif /* PACKETBUF_CONF_ATTRS_INLINE */ +int +packetbuf_holds_broadcast(void) +{ + return linkaddr_cmp(&packetbuf_addrs[PACKETBUF_ADDR_RECEIVER - PACKETBUF_ADDR_FIRST].addr, &linkaddr_null); +} +/*---------------------------------------------------------------------------*/ + /** @} */ diff --git a/core/net/packetbuf.h b/core/net/packetbuf.h index 2bfffd2dd..048493897 100644 --- a/core/net/packetbuf.h +++ b/core/net/packetbuf.h @@ -354,9 +354,11 @@ enum { PACKETBUF_ATTR_RELIABLE, PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_PACKET_TYPE, +#if NETSTACK_CONF_WITH_RIME PACKETBUF_ATTR_REXMIT, PACKETBUF_ATTR_MAX_REXMIT, PACKETBUF_ATTR_NUM_REXMIT, +#endif /* NETSTACK_CONF_WITH_RIME */ PACKETBUF_ATTR_PENDING, PACKETBUF_ATTR_FRAME_TYPE, #if LLSEC802154_SECURITY_LEVEL @@ -371,18 +373,22 @@ enum { #endif /* LLSEC802154_SECURITY_LEVEL */ /* Scope 2 attributes: used between end-to-end nodes. */ +#if NETSTACK_CONF_WITH_RIME PACKETBUF_ATTR_HOPS, PACKETBUF_ATTR_TTL, PACKETBUF_ATTR_EPACKET_ID, PACKETBUF_ATTR_EPACKET_TYPE, PACKETBUF_ATTR_ERELIABLE, +#endif /* NETSTACK_CONF_WITH_RIME */ /* These must be last */ PACKETBUF_ADDR_SENDER, PACKETBUF_ADDR_RECEIVER, +#if NETSTACK_CONF_WITH_RIME PACKETBUF_ADDR_ESENDER, PACKETBUF_ADDR_ERECEIVER, - +#endif /* NETSTACK_CONF_WITH_RIME */ + PACKETBUF_ATTR_MAX }; @@ -404,7 +410,11 @@ enum { }; #endif /* LLSEC802154_USES_EXPLICIT_KEYS */ +#if NETSTACK_CONF_WITH_RIME #define PACKETBUF_NUM_ADDRS 4 +#else /* NETSTACK_CONF_WITH_RIME */ +#define PACKETBUF_NUM_ADDRS 2 +#endif /* NETSTACK_CONF_WITH_RIME */ #define PACKETBUF_NUM_ATTRS (PACKETBUF_ATTR_MAX - PACKETBUF_NUM_ADDRS) #define PACKETBUF_ADDR_FIRST PACKETBUF_ADDR_SENDER @@ -453,6 +463,12 @@ int packetbuf_set_addr(uint8_t type, const linkaddr_t *addr); const linkaddr_t *packetbuf_addr(uint8_t type); #endif /* PACKETBUF_CONF_ATTRS_INLINE */ +/** + * \brief Checks whether the current packet is a broadcast. + * \retval 0 iff current packet is not a broadcast + */ +int packetbuf_holds_broadcast(void); + void packetbuf_attr_clear(void); void packetbuf_attr_copyto(struct packetbuf_attr *attrs, diff --git a/core/net/rime/collect.c b/core/net/rime/collect.c index aa858e905..325996246 100644 --- a/core/net/rime/collect.c +++ b/core/net/rime/collect.c @@ -48,8 +48,7 @@ #include "net/rime/collect.h" #include "net/rime/collect-neighbor.h" #include "net/rime/collect-link-estimate.h" - -#include "net/packetqueue.h" +#include "net/rime/packetqueue.h" #include "dev/radio-sensor.h" diff --git a/core/net/rime/collect.h b/core/net/rime/collect.h index 176e4b9ab..333d71628 100644 --- a/core/net/rime/collect.h +++ b/core/net/rime/collect.h @@ -63,7 +63,7 @@ #include "net/rime/runicast.h" #include "net/rime/neighbor-discovery.h" #include "net/rime/collect-neighbor.h" -#include "net/packetqueue.h" +#include "net/rime/packetqueue.h" #include "sys/ctimer.h" #include "lib/list.h" diff --git a/core/net/packetqueue.c b/core/net/rime/packetqueue.c similarity index 99% rename from core/net/packetqueue.c rename to core/net/rime/packetqueue.c index 1ca491c7f..2f4d36755 100644 --- a/core/net/packetqueue.c +++ b/core/net/rime/packetqueue.c @@ -43,7 +43,7 @@ */ #include "sys/ctimer.h" -#include "net/packetqueue.h" +#include "net/rime/packetqueue.h" /*---------------------------------------------------------------------------*/ void diff --git a/core/net/packetqueue.h b/core/net/rime/packetqueue.h similarity index 100% rename from core/net/packetqueue.h rename to core/net/rime/packetqueue.h diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 3869fdc7e..eb92e2f10 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -59,7 +59,6 @@ #define DEBUG DEBUG_NONE #include "net/ip/uip-debug.h" -#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ extern rpl_of_t RPL_OF; static rpl_of_t * const objective_functions[] = {&RPL_OF}; @@ -93,6 +92,13 @@ rpl_dag_init(void) nbr_table_register(rpl_parents, (nbr_table_callback *)nbr_callback); } /*---------------------------------------------------------------------------*/ +rpl_parent_t * +rpl_get_parent(uip_lladdr_t *addr) +{ + rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (linkaddr_t *)addr); + return p; +} +/*---------------------------------------------------------------------------*/ rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr) { @@ -326,6 +332,7 @@ rpl_repair_root(uint8_t instance_id) PRINTF("RPL: rpl_repair_root triggered but not root\n"); return 0; } + RPL_STAT(rpl_stats.root_repairs++); RPL_LOLLIPOP_INCREMENT(instance->current_dag->version); RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); @@ -513,6 +520,7 @@ rpl_free_instance(rpl_instance_t *instance) ctimer_stop(&instance->dio_timer); ctimer_stop(&instance->dao_timer); + ctimer_stop(&instance->dao_lifetime_timer); if(default_instance == instance) { default_instance = NULL; @@ -1311,5 +1319,4 @@ rpl_lock_parent(rpl_parent_t *p) nbr_table_lock(rpl_parents, p); } /*---------------------------------------------------------------------------*/ -#endif /* UIP_CONF_IPV6 */ /** @} */ diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index dde2777f9..1b41d05e1 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -48,6 +48,7 @@ #include "net/ip/tcpip.h" #include "net/ipv6/uip-ds6.h" #include "net/rpl/rpl-private.h" +#include "net/packetbuf.h" #define DEBUG DEBUG_NONE #include "net/ip/uip-debug.h" @@ -64,7 +65,6 @@ #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) { @@ -105,19 +105,12 @@ rpl_verify_header(int uip_ext_opt_offset) route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); if(route != NULL) { uip_ds6_route_rm(route); - - /* If we are the root and just needed to remove a DAO route, - chances are that the network needs to be repaired. The - rpl_repair_root() function will cause a global repair if we - happen to be the root node of the dag. */ - PRINTF("RPL: initiate global repair\n"); - rpl_repair_root(instance->instance_id); } - - /* Remove the forwarding error flag and return 0 to let the packet - be forwarded again. */ - UIP_EXT_HDR_OPT_RPL_BUF->flags &= ~RPL_HDR_OPT_FWD_ERR; - return 0; + RPL_STAT(rpl_stats.forward_errors++); + /* Trigger DAO retransmission */ + rpl_reset_dio_timer(instance); + /* drop the packet as it is not routable */ + return 1; } if(!instance->current_dag->joined) { @@ -144,13 +137,14 @@ rpl_verify_header(int uip_ext_opt_offset) sender_rank, instance->current_dag->rank, sender_closer); if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) { + RPL_STAT(rpl_stats.loop_errors++); PRINTF("RPL: Rank error signalled in RPL option!\n"); - /* We should try to repair it, not implemented for the moment */ + /* Packet must be dropped and dio trickle timer reset, see RFC6550 - 11.2.2.2 */ rpl_reset_dio_timer(instance); - /* Forward the packet anyway. */ - return 0; + return 1; } PRINTF("RPL: Single error tolerated\n"); + RPL_STAT(rpl_stats.loop_warnings++); UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_RANK_ERR; return 0; } @@ -183,12 +177,13 @@ set_rpl_opt(unsigned uip_ext_opt_offset) } } /*---------------------------------------------------------------------------*/ -void +int rpl_update_header_empty(void) { rpl_instance_t *instance; int uip_ext_opt_offset; int last_uip_ext_len; + rpl_parent_t *parent; last_uip_ext_len = uip_ext_len; uip_ext_len = 0; @@ -201,22 +196,22 @@ rpl_update_header_empty(void) if(UIP_HBHO_BUF->len != RPL_HOP_BY_HOP_LEN - 8) { PRINTF("RPL: Hop-by-hop extension header has wrong size\n"); uip_ext_len = last_uip_ext_len; - return; + return 0; } if(UIP_EXT_HDR_OPT_RPL_BUF->opt_type != UIP_EXT_HDR_OPT_RPL) { PRINTF("RPL: Non RPL Hop-by-hop option support not implemented\n"); uip_ext_len = last_uip_ext_len; - return; + return 0; } if(UIP_EXT_HDR_OPT_RPL_BUF->opt_len != RPL_HDR_OPT_LEN) { PRINTF("RPL: RPL Hop-by-hop option has wrong length\n"); uip_ext_len = last_uip_ext_len; - return; + return 0; } instance = rpl_get_instance(UIP_EXT_HDR_OPT_RPL_BUF->instance); if(instance == NULL || !instance->used || !instance->current_dag->joined) { PRINTF("RPL: Unable to add hop-by-hop extension header: incorrect instance\n"); - return; + return 0; } break; default: @@ -224,11 +219,11 @@ rpl_update_header_empty(void) if(uip_len + RPL_HOP_BY_HOP_LEN > UIP_BUFSIZE) { PRINTF("RPL: Packet too long: impossible to add hop-by-hop option\n"); uip_ext_len = last_uip_ext_len; - return; + return 0; } set_rpl_opt(uip_ext_opt_offset); uip_ext_len = last_uip_ext_len + RPL_HOP_BY_HOP_LEN; - return; + return 0; } switch(UIP_EXT_HDR_OPT_BUF->type) { @@ -244,6 +239,15 @@ rpl_update_header_empty(void) if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) { UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_FWD_ERR; PRINTF("RPL forwarding error\n"); + /* We should send back the packet to the originating parent, + but it is not feasible yet, so we send a No-Path DAO instead */ + PRINTF("RPL generate No-Path DAO\n"); + parent = rpl_get_parent((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); + if(parent != NULL) { + dao_output_target(parent, &UIP_IP_BUF->destipaddr, RPL_ZERO_LIFETIME); + } + /* Drop packet */ + return 1; } } else { /* Set the down extension flag correctly as described in Section @@ -262,11 +266,11 @@ rpl_update_header_empty(void) } uip_ext_len = last_uip_ext_len; - return; + return 0; default: PRINTF("RPL: Multi Hop-by-hop options not implemented\n"); uip_ext_len = last_uip_ext_len; - return; + return 0; } } /*---------------------------------------------------------------------------*/ @@ -375,6 +379,5 @@ rpl_insert_header(void) } } /*---------------------------------------------------------------------------*/ -#endif /* UIP_CONF_IPV6 */ /** @}*/ diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index d80180155..8fdefdedc 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -61,7 +61,6 @@ #include "net/ip/uip-debug.h" -#if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ #define RPL_DIO_GROUNDED 0x80 #define RPL_DIO_MOP_SHIFT 3 @@ -779,6 +778,7 @@ dao_input(void) rep->state.lifetime = RPL_LIFETIME(instance, lifetime); rep->state.learned_from = learned_from; + rep->state.nopath_received = 0; #if RPL_CONF_MULTICAST fwd_dao: @@ -958,6 +958,5 @@ rpl_icmp6_register_handlers() uip_icmp6_register_input_handler(&dao_ack_handler); } /*---------------------------------------------------------------------------*/ -#endif /* UIP_CONF_IPV6 */ /** @}*/ diff --git a/core/net/rpl/rpl-private.h b/core/net/rpl/rpl-private.h index 7b26c3730..a9ca3f375 100644 --- a/core/net/rpl/rpl-private.h +++ b/core/net/rpl/rpl-private.h @@ -242,6 +242,10 @@ struct rpl_stats { uint16_t malformed_msgs; uint16_t resets; uint16_t parent_switch; + uint16_t forward_errors; + uint16_t loop_errors; + uint16_t loop_warnings; + uint16_t root_repairs; }; typedef struct rpl_stats rpl_stats_t; diff --git a/core/net/rpl/rpl-timers.c b/core/net/rpl/rpl-timers.c index 1926d3495..ea7bfe7f2 100644 --- a/core/net/rpl/rpl-timers.c +++ b/core/net/rpl/rpl-timers.c @@ -47,8 +47,6 @@ #include "lib/random.h" #include "sys/ctimer.h" -#if UIP_CONF_IPV6 - #define DEBUG DEBUG_NONE #include "net/ip/uip-debug.h" @@ -147,7 +145,7 @@ handle_dio_timer(void *ptr) if(instance->dio_send) { /* send DIO if counter is less than desired redundancy */ - if(instance->dio_counter < instance->dio_redundancy) { + if(instance->dio_redundancy != 0 && instance->dio_counter < instance->dio_redundancy) { #if RPL_CONF_STATS instance->dio_totsend++; #endif /* RPL_CONF_STATS */ @@ -325,6 +323,5 @@ rpl_cancel_dao(rpl_instance_t *instance) ctimer_stop(&instance->dao_lifetime_timer); } /*---------------------------------------------------------------------------*/ -#endif /* UIP_CONF_IPV6 */ /** @}*/ diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index d54cb5327..f71c5fb4c 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -55,8 +55,6 @@ #include #include -#if UIP_CONF_IPV6 - #if RPL_CONF_STATS rpl_stats_t rpl_stats; #endif @@ -316,6 +314,5 @@ rpl_init(void) RPL_OF.reset(NULL); } /*---------------------------------------------------------------------------*/ -#endif /* UIP_CONF_IPV6 */ /** @}*/ diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index c6f2b94fc..512c2f5f1 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -240,13 +240,14 @@ int rpl_repair_root(uint8_t instance_id); int rpl_set_default_route(rpl_instance_t *instance, uip_ipaddr_t *from); rpl_dag_t *rpl_get_any_dag(void); rpl_instance_t *rpl_get_instance(uint8_t instance_id); -void rpl_update_header_empty(void); +int rpl_update_header_empty(void); int rpl_update_header_final(uip_ipaddr_t *addr); int rpl_verify_header(int); void rpl_insert_header(void); void rpl_remove_header(void); uint8_t rpl_invert_header(void); uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr); +rpl_parent_t *rpl_get_parent(uip_lladdr_t *addr); rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr); uint16_t rpl_get_parent_link_metric(const uip_lladdr_t *addr); void rpl_dag_init(void); diff --git a/cpu/6502/Makefile.6502 b/cpu/6502/Makefile.6502 index e7f3f56a6..4d9034a8f 100644 --- a/cpu/6502/Makefile.6502 +++ b/cpu/6502/Makefile.6502 @@ -51,7 +51,7 @@ CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c cfs-posix-dir.c \ $(CONTIKI_TARGET_SOURCEFILES) $(CONTIKI_CPU_SOURCEFILES) \ $(ETHERNET_SOURCEFILES) -MODULES += core/ctk core/net/ip core/net/ipv4 core/net/ipv6 +MODULES += core/ctk # Set target-specific variable values ${addprefix $(OBJECTDIR)/,${call oname, $(ETHERNET_SOURCEFILES)}}: ASFLAGS += -D DYN_DRV=0 diff --git a/cpu/6502/ethconfig/Makefile b/cpu/6502/ethconfig/Makefile index 7a0df8d8f..9fff9eee6 100644 --- a/cpu/6502/ethconfig/Makefile +++ b/cpu/6502/ethconfig/Makefile @@ -2,4 +2,5 @@ CONTIKI_PROJECT = ethconfig all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/cpu/6502/ipconfig/Makefile b/cpu/6502/ipconfig/Makefile index a946180a2..751061ad0 100644 --- a/cpu/6502/ipconfig/Makefile +++ b/cpu/6502/ipconfig/Makefile @@ -2,4 +2,5 @@ CONTIKI_PROJECT = ipconfig all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/cpu/6502/net/ethernet-drv.c b/cpu/6502/net/ethernet-drv.c index e12122001..d5e2b80fa 100644 --- a/cpu/6502/net/ethernet-drv.c +++ b/cpu/6502/net/ethernet-drv.c @@ -59,12 +59,12 @@ pollhandler(void) uip_len = ethernet_poll(); if(uip_len > 0) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src); tcpip_input(); } else -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { uip_len -= sizeof(struct uip_eth_hdr); tcpip_input(); diff --git a/cpu/arm/at91sam7s/Makefile.at91sam7s b/cpu/arm/at91sam7s/Makefile.at91sam7s index 95f30a36c..8ce761be7 100644 --- a/cpu/arm/at91sam7s/Makefile.at91sam7s +++ b/cpu/arm/at91sam7s/Makefile.at91sam7s @@ -76,7 +76,7 @@ CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) -I$(CONTIKI_CPU)/loader \ -I$(CONTIKI_CPU)/dbg-io \ -I$(CONTIKI)/platform/$(TARGET) \ ${addprefix -I,$(APPDIRS)} \ - -DWITH_UIP -DWITH_ASCII -DMCK=$(MCK) \ + -DWITH_ASCII -DMCK=$(MCK) \ -Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET) CFLAGS += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN diff --git a/cpu/arm/common/usb/cdc-eth/cdc-eth.c b/cpu/arm/common/usb/cdc-eth/cdc-eth.c index 2d720ce20..1b074e7a9 100644 --- a/cpu/arm/common/usb/cdc-eth/cdc-eth.c +++ b/cpu/arm/common/usb/cdc-eth/cdc-eth.c @@ -117,12 +117,12 @@ PROCESS_THREAD(usb_eth_process, ev , data) uip_len = sizeof(recv_data) - recv_buffer.left; /* printf("Received: %d bytes\n", uip_len); */ memcpy(uip_buf, recv_data, uip_len); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src); tcpip_input(); } else -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { uip_len -= sizeof(struct uip_eth_hdr); tcpip_input(); diff --git a/cpu/arm/stm32f103/Makefile.stm32f103 b/cpu/arm/stm32f103/Makefile.stm32f103 index cfba80f5b..6f56bcfdf 100644 --- a/cpu/arm/stm32f103/Makefile.stm32f103 +++ b/cpu/arm/stm32f103/Makefile.stm32f103 @@ -75,7 +75,7 @@ CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) -I$(CONTIKI_CPU)/loader \ -I$(CONTIKI_CPU)/dbg-io \ -I$(CONTIKI)/platform/$(TARGET) \ ${addprefix -I,$(APPDIRS)} \ - -DWITH_UIP -DWITH_ASCII -DMCK=$(MCK) \ + -DWITH_ASCII -DMCK=$(MCK) \ -Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET) CFLAGS += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN diff --git a/cpu/avr/Makefile.avr b/cpu/avr/Makefile.avr index d3ef8235f..ca6fd4dd7 100644 --- a/cpu/avr/Makefile.avr +++ b/cpu/avr/Makefile.avr @@ -101,6 +101,7 @@ CFLAGSNO = -Wall -mmcu=$(MCU) -gdwarf-2 -fno-strict-aliasing \ -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) $(USB_INCLUDES) \ $(CONTIKI_PLAT_DEFS) CFLAGS += $(CFLAGSNO) -O$(OPTI) +ASFLAGS += -mmcu=$(MCU) ifndef BOOTLOADER_START BOOTLOADER_START = 0x1F800 endif diff --git a/cpu/avr/dev/clock.c b/cpu/avr/dev/clock.c index ea646562c..16dfe1d6a 100644 --- a/cpu/avr/dev/clock.c +++ b/cpu/avr/dev/clock.c @@ -72,7 +72,7 @@ #include /* Two tick counters avoid a software divide when CLOCK_SECOND is not a power of two. */ -#if CLOCK_SECOND && (CLOCK_SECOND - 1) +#if CLOCK_SECOND & (CLOCK_SECOND - 1) #define TWO_COUNTERS 1 #endif diff --git a/cpu/avr/dev/usb/rndis/rndis_task.h b/cpu/avr/dev/usb/rndis/rndis_task.h index 28148f1da..b77682790 100644 --- a/cpu/avr/dev/usb/rndis/rndis_task.h +++ b/cpu/avr/dev/usb/rndis/rndis_task.h @@ -56,7 +56,7 @@ //_____ M A C R O S ________________________________________________________ -#define USB_ETH_MTU UIP_BUFSIZE+4 +#define USB_ETH_MTU (UIP_BUFSIZE + 4) /*! Hook Documentation diff --git a/cpu/avr/radio/mac/sicslowmac.c b/cpu/avr/radio/mac/sicslowmac.c index 0d21d997e..9a176277a 100644 --- a/cpu/avr/radio/mac/sicslowmac.c +++ b/cpu/avr/radio/mac/sicslowmac.c @@ -426,11 +426,7 @@ sicslowmac_dataRequest(void) params.fcf.srcAddrMode = LONGADDRMODE; params.dest_pid = ieee15_4ManagerAddress.get_dst_panid(); - /* - * If the output address is NULL in the Rime buf, then it is broadcast - * on the 802.15.4 network. - */ - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null) ) { + if(packetbuf_holds_broadcast()) { /* Broadcast requires short address mode. */ params.fcf.destAddrMode = SHORTADDRMODE; params.dest_pid = BROADCASTPANDID; diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index e3ed931f1..e4181868c 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -1679,7 +1679,7 @@ rf230_cca(void) /* Use ED register to determine result. 77dBm is poweron csma default.*/ #ifdef RF230_CONF_CCA_THRES - if (hal_register_read(RG_PHY_ED_LEVEL)<(91+RF230_CONF_CCA_THRES) cca=0xff; + if (hal_register_read(RG_PHY_ED_LEVEL)<(91+RF230_CONF_CCA_THRES)) cca=0xff; #else if (hal_register_read(RG_PHY_ED_LEVEL)<(91-77)) cca=0xff; #endif @@ -1701,9 +1701,9 @@ rf230_cca(void) /* If already in receive mode can read the current ED register without delay */ /* CCA energy threshold = -91dB + 2*SR_CCA_ED_THRESH. Reset defaults to -77dB */ #ifdef RF230_CONF_CCA_THRES - if (hal_register_read(RG_PHY_ED_LEVEL)<(91+RF230_CONF_CCA_THRES) cca=0xff; + if (hal_register_read(RG_PHY_ED_LEVEL)<(91+RF230_CONF_CCA_THRES)) cca=0xff; #else - if (hal_register_read(RG_PHY_ED_LEVEL)<(91-77)) cca=0xff; + if (hal_register_read(RG_PHY_ED_LEVEL)<(91-77)) cca=0xff; #endif #endif diff --git a/cpu/cc2430/Makefile.cc2430 b/cpu/cc2430/Makefile.cc2430 index 1cd207356..1a1c12b1e 100644 --- a/cpu/cc2430/Makefile.cc2430 +++ b/cpu/cc2430/Makefile.cc2430 @@ -35,9 +35,9 @@ endef ### Banking Guesswork: ### Examples outside examples/sensinode do not specify banking. ### We automatically turn it on if its unspecified and if we are building with -### UIP_CONF_IPV6 +### CONTIKI_WITH_IPV6 ifndef HAVE_BANKING - ifeq ($(UIP_CONF_IPV6),1) + ifeq ($(CONTIKI_WITH_IPV6),1) HAVE_BANKING=1 else HAVE_BANKING=0 diff --git a/cpu/cc2538/dev/ana-regs.h b/cpu/cc2538/dev/ana-regs.h index 1fb8496fa..e8f84a46a 100644 --- a/cpu/cc2538/dev/ana-regs.h +++ b/cpu/cc2538/dev/ana-regs.h @@ -43,7 +43,7 @@ * \name ANA_REGS register offsets * @{ */ -#define ANA_REGS_IVCTRL 0x00000004 +#define ANA_REGS_IVCTRL 0x400D6004 /** @} */ /*---------------------------------------------------------------------------*/ /** diff --git a/cpu/cc253x/Makefile.cc253x b/cpu/cc253x/Makefile.cc253x index 9d3c3a819..e9aaa8c0f 100644 --- a/cpu/cc253x/Makefile.cc253x +++ b/cpu/cc253x/Makefile.cc253x @@ -51,9 +51,9 @@ endif ### Banking Guesswork: ### Generic examples do not specify banking. ### We automatically turn it on if its unspecified and if we are building with -### UIP_CONF_IPV6 +### CONTIKI_WITH_IPV6 ifndef HAVE_BANKING - ifeq ($(UIP_CONF_IPV6),1) + ifeq ($(CONTIKI_WITH_IPV6),1) HAVE_BANKING=1 else HAVE_BANKING=0 diff --git a/cpu/mc1322x/slip-uart1.c b/cpu/mc1322x/slip-uart1.c index 542a690ba..99eacfdfe 100644 --- a/cpu/mc1322x/slip-uart1.c +++ b/cpu/mc1322x/slip-uart1.c @@ -57,7 +57,7 @@ slip_arch_writeb(unsigned char c) * */ /*---------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 int putchar(int c) { @@ -83,7 +83,7 @@ putchar(int c) return c; } -#endif +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ /** * Initalize the RS232 port and the SLIP driver. diff --git a/cpu/msp430/f2xxx/uart0.c b/cpu/msp430/f2xxx/uart0.c index 0a17636fb..249362c0f 100644 --- a/cpu/msp430/f2xxx/uart0.c +++ b/cpu/msp430/f2xxx/uart0.c @@ -100,8 +100,8 @@ uart0_writeb(unsigned char c) #endif /* TX_WITH_INTERRUPT */ } /*---------------------------------------------------------------------------*/ -#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */ -#endif /* ! WITH_UIP */ +#if ! NETSTACK_CONF_WITH_IPV4 /* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */ +#endif /* ! NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ /** * Initalize the RS232 port. diff --git a/cpu/msp430/f2xxx/uart1.c b/cpu/msp430/f2xxx/uart1.c index 3085663bf..42ba9b5b0 100644 --- a/cpu/msp430/f2xxx/uart1.c +++ b/cpu/msp430/f2xxx/uart1.c @@ -97,8 +97,8 @@ uart1_writeb(unsigned char c) #endif /* TX_WITH_INTERRUPT */ } /*---------------------------------------------------------------------------*/ -#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */ -#endif /* ! WITH_UIP */ +#if ! NETSTACK_CONF_WITH_IPV4 /* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */ +#endif /* ! NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ /** * Initalize the RS232 port. diff --git a/cpu/msp430/slip_uart0.c b/cpu/msp430/slip_uart0.c index c7b003f06..f764176c5 100644 --- a/cpu/msp430/slip_uart0.c +++ b/cpu/msp430/slip_uart0.c @@ -49,7 +49,7 @@ slip_arch_writeb(unsigned char c) * */ /*---------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 int putchar(int c) { @@ -75,7 +75,7 @@ putchar(int c) return c; } -#endif +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ /** * Initalize the RS232 port and the SLIP driver. diff --git a/cpu/msp430/slip_uart1.c b/cpu/msp430/slip_uart1.c index 3a4c238c9..9289521c2 100644 --- a/cpu/msp430/slip_uart1.c +++ b/cpu/msp430/slip_uart1.c @@ -49,7 +49,7 @@ slip_arch_writeb(unsigned char c) * */ /*---------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 int putchar(int c) { @@ -75,7 +75,7 @@ putchar(int c) return c; } -#endif +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ /** * Initalize the RS232 port and the SLIP driver. diff --git a/cpu/native/net/tapdev-drv.c b/cpu/native/net/tapdev-drv.c index 0588030cb..8a7aeed53 100644 --- a/cpu/native/net/tapdev-drv.c +++ b/cpu/native/net/tapdev-drv.c @@ -34,11 +34,11 @@ #include "net/ip/uip.h" #include "net/ip/uipopt.h" -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #include "tapdev6.h" #else #include "tapdev.h" -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include "tapdev-drv.h" @@ -48,7 +48,7 @@ PROCESS(tapdev_process, "TAP driver"); /*---------------------------------------------------------------------------*/ -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 uint8_t tapdev_output(void) { @@ -64,16 +64,16 @@ pollhandler(void) uip_len = tapdev_poll(); if(uip_len > 0) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { tcpip_input(); } else -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { uip_len -= sizeof(struct uip_eth_hdr); tcpip_input(); } else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) { -#if !UIP_CONF_IPV6 //math +#if !NETSTACK_CONF_WITH_IPV6 //math uip_arp_arpin(); /* If the above function invocation resulted in data that should be sent out on the network, the global variable @@ -95,7 +95,7 @@ PROCESS_THREAD(tapdev_process, ev, data) PROCESS_BEGIN(); tapdev_init(); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 tcpip_set_outputfunc(tapdev_output); #else tcpip_set_outputfunc(tapdev_send); diff --git a/cpu/native/net/tapdev.c b/cpu/native/net/tapdev.c index 7ddf7ea10..e58b3c475 100644 --- a/cpu/native/net/tapdev.c +++ b/cpu/native/net/tapdev.c @@ -36,7 +36,7 @@ #include "net/ip/uip.h" #include "net/ip/uipopt.h" -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 #include #include @@ -204,4 +204,4 @@ tapdev_exit(void) } /*---------------------------------------------------------------------------*/ -#endif /* !UIP_CONF_IPV6 */ +#endif /* !NETSTACK_CONF_WITH_IPV6 */ diff --git a/cpu/native/net/tapdev6.c b/cpu/native/net/tapdev6.c index 41fbd7ae6..8ff74e09c 100644 --- a/cpu/native/net/tapdev6.c +++ b/cpu/native/net/tapdev6.c @@ -36,7 +36,7 @@ #include "net/ip/uip.h" #include "net/ip/uipopt.h" -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #include #include @@ -419,4 +419,4 @@ tapdev_exit(void) } /*---------------------------------------------------------------------------*/ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ diff --git a/cpu/native/net/wpcap-drv.c b/cpu/native/net/wpcap-drv.c index 3362ec9c5..0b3cf926a 100644 --- a/cpu/native/net/wpcap-drv.c +++ b/cpu/native/net/wpcap-drv.c @@ -64,7 +64,7 @@ PROCESS(wpcap_process, "WinPcap driver"); /*---------------------------------------------------------------------------*/ -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 uint8_t wpcap_output(void) { @@ -73,7 +73,7 @@ wpcap_output(void) return 0; } -#endif /* !UIP_CONF_IPV6 */ +#endif /* !NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ static void pollhandler(void) @@ -83,16 +83,16 @@ pollhandler(void) uip_len = wpcap_poll(); if(uip_len > 0) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { // printf("wpcap poll calls tcpip"); tcpip_input(); } else -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { uip_len -= sizeof(struct uip_eth_hdr); tcpip_input(); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 } else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) { uip_arp_arpin(); //math /* If the above function invocation resulted in data that @@ -101,7 +101,7 @@ pollhandler(void) if(uip_len > 0) { wpcap_send(); } -#endif /* !UIP_CONF_IPV6 */ +#endif /* !NETSTACK_CONF_WITH_IPV6 */ } else { uip_len = 0; } @@ -125,16 +125,16 @@ pollhandler(void) tcpip_input(); } else goto bail; -#elif UIP_CONF_IPV6 +#elif NETSTACK_CONF_WITH_IPV6 if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { tcpip_input(); } else goto bail; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { uip_len -= sizeof(struct uip_eth_hdr); tcpip_input(); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 } else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) { uip_arp_arpin(); //math /* If the above function invocation resulted in data that @@ -143,7 +143,7 @@ pollhandler(void) if(uip_len > 0) { wfall_send(); } -#endif /* !UIP_CONF_IPV6 */ +#endif /* !NETSTACK_CONF_WITH_IPV6 */ } else { bail: uip_len = 0; @@ -161,13 +161,13 @@ PROCESS_THREAD(wpcap_process, ev, data) wpcap_init(); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 tcpip_set_outputfunc(wpcap_output); #else #if !FALLBACK_HAS_ETHERNET_HEADERS tcpip_set_outputfunc(wpcap_send); #endif -#endif /* !UIP_CONF_IPV6 */ +#endif /* !NETSTACK_CONF_WITH_IPV6 */ process_poll(&wpcap_process); diff --git a/cpu/native/net/wpcap.c b/cpu/native/net/wpcap.c index ddb698a05..073a615ee 100644 --- a/cpu/native/net/wpcap.c +++ b/cpu/native/net/wpcap.c @@ -68,7 +68,7 @@ #define FALLBACK_HAS_ETHERNET_HEADERS 1 #endif -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #include struct in6_addr addr6; char addr6str[64]; @@ -122,7 +122,7 @@ sprint_ip6addr(struct in6_addr addr, char * result) return (result - starting); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #ifdef __CYGWIN__ @@ -158,7 +158,7 @@ static struct pcap *pcap; /* uip_lladdr is defined in uip.c. It is not used in uip6.c. * If needed for some purpose it can be defined here */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 //struct uip_eth_addr uip_lladdr; #endif @@ -174,7 +174,7 @@ static int (* pcap_sendpacket)(struct pcap *, unsigned char *, int); #ifdef UIP_FALLBACK_INTERFACE static struct pcap *pfall; struct in_addr addrfall; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 struct in_addr6 addrfall6; #endif @@ -265,7 +265,7 @@ set_ethaddr(struct in_addr addr) adapters->PhysicalAddress[2], adapters->PhysicalAddress[3], adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]); log_message("set_ethaddr: ethernetaddr: ", buffer); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 // int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i]; #else uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress)); @@ -281,7 +281,7 @@ set_ethaddr(struct in_addr addr) } } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /*---------------------------------------------------------------------------*/ static void set_ethaddr6(struct in_addr6 addr) @@ -327,7 +327,7 @@ set_ethaddr6(struct in_addr6 addr) adapters->PhysicalAddress[2], adapters->PhysicalAddress[3], adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]); log_message("set_ethaddr: ethernetaddr: ", buffer); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 // int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i]; //does this need doing? #else uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress)); @@ -396,7 +396,7 @@ init_pcap(struct in_addr addr) } #endif -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 } else if(paddr->addr != NULL && paddr->addr->sa_family == AF_INET6) { struct in6_addr interface_addr; @@ -431,7 +431,7 @@ init_pcap(struct in_addr addr) return; } #endif -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } } } @@ -457,13 +457,13 @@ wpcap_init(void) #ifdef __CYGWIN__ if ((*__argv)[1]) { addr.s_addr = inet_addr((*__argv)[1]); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uiplib_ipaddrconv((*__argv)[1],(uip_ipaddr_t*) &addr6.s6_addr); #endif #ifdef UIP_FALLBACK_INTERFACE if ((*__argv)[2]) { addrfall.s_addr = inet_addr((*__argv)[2]); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uiplib_ipaddrconv((*__argv)[2],(uip_ipaddr_t*) &addrfall6.s6_addr); #endif } @@ -473,13 +473,13 @@ wpcap_init(void) #else /* __CYGWIN__ */ /* VC++ build on win32 platform. Currently the platform has no ipv6 support */ addr.s_addr = inet_addr(__argv[1]); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 if((__argv)[1]) uiplib_ipaddrconv((__argv)[1],(uip_ipaddr_t*) &addr6.s6_addr); #endif #ifdef UIP_FALLBACK_INTERFACE addrfall.s_addr = inet_addr(__argv[2]); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 if((__argv)[2]) uiplib_ipaddrconv((__argv)[2],(uip_ipaddr_t*) &addrfall6.s6_addr); #endif @@ -498,7 +498,7 @@ wpcap_init(void) #endif /* Use build defaults if not enough addresses passed */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #ifdef UIP_FALLBACK_INTERFACE if(addrfall.s_addr == INADDR_NONE) { @@ -561,7 +561,7 @@ wpcap_init(void) #endif log_message("usage: \n-->I'll try guessing ", inet_ntoa(addr)); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #if DEBUG log_message("wpcap_init:Using ipv4 ", inet_ntoa(addr)); @@ -610,7 +610,7 @@ wpcap_poll(void) return 0; } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* Since pcap_setdirection(PCAP_D_IN) is not implemented in winpcap all outgoing packets * will be echoed back. The stack will ignore any packets not addressed to it, but initial * ipv6 neighbor solicitations are addressed to everyone and the echoed NS sent on startup @@ -649,7 +649,7 @@ wpcap_poll(void) } #endif -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ if(packet_header->caplen > UIP_BUFSIZE) { return 0; @@ -673,7 +673,7 @@ wfall_poll(void) case 0: return 0; } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #if FALLBACK_HAS_ETHERNET_HEADERS #define ETHERNET_LLADDR_LEN 6 #else @@ -692,7 +692,7 @@ wfall_poll(void) PRINTF("Discarding echoed packet\n"); return 0; } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ if(packet_header->caplen > UIP_BUFSIZE) { return 0; @@ -706,7 +706,7 @@ wfall_poll(void) #endif /*---------------------------------------------------------------------------*/ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint8_t wpcap_send(const uip_lladdr_t *lladdr) { @@ -777,7 +777,7 @@ wfall_send(const uip_lladdr_t *lladdr) return 0; } #endif -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ void wpcap_send(void) { @@ -792,7 +792,7 @@ wpcap_send(void) error_exit("error on send\n"); } } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ void wpcap_exit(void) diff --git a/cpu/native/net/wpcap.h b/cpu/native/net/wpcap.h index 964e6b0fc..6b943948c 100644 --- a/cpu/native/net/wpcap.h +++ b/cpu/native/net/wpcap.h @@ -38,7 +38,7 @@ void wpcap_init(void); uint16_t wpcap_poll(void); uint16_t wfall_poll(void); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint8_t wpcap_send(const uip_lladdr_t *lladdr); uint8_t wfall_send(const uip_lladdr_t *lladdr); #else diff --git a/cpu/stm32w108/dev/uart1.c b/cpu/stm32w108/dev/uart1.c index 87b05e4f6..f94d99d8c 100644 --- a/cpu/stm32w108/dev/uart1.c +++ b/cpu/stm32w108/dev/uart1.c @@ -120,9 +120,9 @@ uart1_writeb(unsigned char c) #endif /* TX_WITH_INTERRUPT */ } /*---------------------------------------------------------------------------*/ -#if ! WITH_UIP -/* If WITH_UIP is defined, putchar() is defined by the SLIP driver */ -#endif /* ! WITH_UIP */ +#if ! NETSTACK_CONF_WITH_IPV4 +/* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */ +#endif /* ! NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ /* * Initalize the RS232 port. diff --git a/doc/Makefile b/doc/Makefile index ed00d677c..ef248c0fd 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -33,7 +33,7 @@ init: @echo "> Scanning files" # This target requires and graphviz and doxygen -doxygen.log: docdirs = $(sort ,$(foreach dir,$(basedirs),${shell find ../${dir} -type d -not -path "*/.*" -not -path "*/obj_*"})) +doxygen.log: docdirs = $(sort $(foreach dir,$(basedirs),${shell find ../${dir} -type d -not -path "*/.*" -not -path "*/obj_*"})) doxygen.log: docsrc = $(docdirs) $(foreach dir,$(docdirs),${shell find $(dir) -type f $(filetypes)}) $(manuals) doxygen.log: @doxygen Doxyfile diff --git a/doc/uip6-doc.txt b/doc/uip6-doc.txt index e4009aeb3..a933417c5 100644 --- a/doc/uip6-doc.txt +++ b/doc/uip6-doc.txt @@ -36,9 +36,9 @@ are part of the uIP IPv6 stack. A complete description can be found in the corresponding IETF standards which are available at http://www.ietf.org/rfc.html. -\note The #UIP_CONF_IPV6 compilation flag is used to enable IPv6 (and -disable IPv4). It is also recommended to set #UIP_CONF_IPV6_CHECKS to -1 if one cannot guarantee that the incoming packets are correctly formed. +\note The #NETSTACK_CONF_WITH_IPV6 compilation flag is used to enable IPv6. +It is also recommended to set #UIP_CONF_IPV6_CHECKS to 1 +if one cannot guarantee that the incoming packets are correctly formed. \subsection ipv6 IPv6 (RFC 2460) The IP packets are processed in the #uip_process function. @@ -236,15 +236,15 @@ This section just lists all IPv6 related compile time flags. Each flag function is documented in this page in the appropriate section. \code /*Boolean flags*/ -UIP_CONF_IPV6 +NETSTACK_CONF_WITH_IPV6 UIP_CONF_IPV6_CHECKS UIP_CONF_IPV6_QUEUE_PKT UIP_CONF_IPV6_REASSEMBLY /*Integer flags*/ -UIP_NETIF_MAX_ADDRESSES -UIP_ND6_MAX_PREFIXES -UIP_ND6_MAX_NEIGHBORS -UIP_ND6_MAX_DEFROUTER +UIP_CONF_NETIF_MAX_ADDRESSES +UIP_CONF_ND6_MAX_PREFIXES +UIP_CONF_ND6_MAX_DEFROUTERS +NBR_TABLE_CONF_MAX_NEIGHBORS \endcode
@@ -257,10 +257,10 @@ reass "fragment reassembly" is enabled an additional buffer of the same size is used. The only difference with the IPv4 code is the per %neighbor buffering -that is available when #UIP_CONF_QUEUE_PKT is set to 1. This +that is available when #UIP_CONF_IPV6_QUEUE_PKT is set to 1. This additional buffering is used to queue one packet per %neighbor while performing address resolution for it. This is a very costly feature as -it increases the RAM usage by approximately #UIP_ND6_MAX_NEIGHBORS * +it increases the RAM usage by approximately #NBR_TABLE_CONF_MAX_NEIGHBORS * #UIP_LINK_MTU bytes.
@@ -340,7 +340,7 @@ We will soon support RFC4944 transmission of IPv6 packets over 802.15.4\n IP layer
\li IPv6 RFC2460 (MUST): When the compile flags UIP_CONF_IPV6_CHECKS and UIP_CONF_REASSEMBLY are set, full support -\li Neighbor Discovery RFC4861 (MUST): When the UIP_CONF_CHECKS and UIP_CONF_QUEUE_PKT flag are set, full support except redirect function +\li Neighbor Discovery RFC4861 (MUST): When the UIP_CONF_CHECKS and UIP_CONF_IPV6_QUEUE_PKT flag are set, full support except redirect function \li Address Autoconfiguration RFC4862 (MUST): When the UIP_CONF_CHECKS flag is set, full support except sending MLD report (see MLD) \li Path MTU Discovery RFC 1981 (SHOULD): no support \li Jumbograms RFC 2675 (MAY): no support @@ -377,7 +377,5 @@ We pass all the tests for phase 2 except:
-@{ */ /** @} */ -/** @} */ \ No newline at end of file diff --git a/examples/antelope/netdb/Makefile b/examples/antelope/netdb/Makefile index 8d49a4ccb..8491b36bf 100644 --- a/examples/antelope/netdb/Makefile +++ b/examples/antelope/netdb/Makefile @@ -5,4 +5,5 @@ SMALL = 1 all: netdb-client netdb-server +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/antelope/shell/Makefile b/examples/antelope/shell/Makefile index 95a2d9ccc..864f829ea 100644 --- a/examples/antelope/shell/Makefile +++ b/examples/antelope/shell/Makefile @@ -7,4 +7,5 @@ SMALL = 1 all: shell-db +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/cc2530dk/Makefile b/examples/cc2530dk/Makefile index acffeada8..b21442c36 100644 --- a/examples/cc2530dk/Makefile +++ b/examples/cc2530dk/Makefile @@ -3,4 +3,5 @@ CONTIKI_PROJECT = hello-world blink-hello timer-test sensors-demo all: $(CONTIKI_PROJECT) CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/cc2530dk/border-router/Makefile b/examples/cc2530dk/border-router/Makefile index e37325dc6..7cb55a0e9 100644 --- a/examples/cc2530dk/border-router/Makefile +++ b/examples/cc2530dk/border-router/Makefile @@ -2,8 +2,6 @@ DEFINES+=PROJECT_CONF_H=\"project-conf.h\" # We need uIPv6, therefore we also need banking HAVE_BANKING=1 -UIP_CONF_IPV6=1 -UIP_CONF_RPL=1 PROJECT_SOURCEFILES += slip-bridge.c @@ -12,5 +10,5 @@ CONTIKI_PROJECT = border-router all: $(CONTIKI_PROJECT) CONTIKI = ../../.. - +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/cc2530dk/cc2531-usb-demo/Makefile b/examples/cc2530dk/cc2531-usb-demo/Makefile index c6cbb7f84..7e0b7824c 100644 --- a/examples/cc2530dk/cc2531-usb-demo/Makefile +++ b/examples/cc2530dk/cc2531-usb-demo/Makefile @@ -5,4 +5,5 @@ DEFINES+=MODELS_CONF_CC2531_USB_STICK=1 all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/cc2530dk/sniffer/Makefile b/examples/cc2530dk/sniffer/Makefile index d9491a92c..f57ded291 100644 --- a/examples/cc2530dk/sniffer/Makefile +++ b/examples/cc2530dk/sniffer/Makefile @@ -7,4 +7,5 @@ all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/cc2530dk/udp-ipv6/Makefile b/examples/cc2530dk/udp-ipv6/Makefile index 90a2ccba9..0540fdd20 100644 --- a/examples/cc2530dk/udp-ipv6/Makefile +++ b/examples/cc2530dk/udp-ipv6/Makefile @@ -1,8 +1,6 @@ DEFINES+=PROJECT_CONF_H=\"project-conf.h\" HAVE_BANKING=1 -UIP_CONF_IPV6=1 -UIP_CONF_RPL=1 PROJECT_SOURCEFILES += ping6.c @@ -11,5 +9,7 @@ CONTIKI_PROJECT = client server all: $(CONTIKI_PROJECT) CONTIKI = ../../.. - +CONTIKI_WITH_IPV6 = 1 +# needed for rimestats +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/cc2538dk/Makefile b/examples/cc2538dk/Makefile index 45caa77c6..338b0a55c 100644 --- a/examples/cc2538dk/Makefile +++ b/examples/cc2538dk/Makefile @@ -4,4 +4,5 @@ CONTIKI_PROJECT = cc2538-demo timer-test all: $(CONTIKI_PROJECT) CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/cc2538dk/sniffer/Makefile b/examples/cc2538dk/sniffer/Makefile index 7414eca46..d40baddd8 100644 --- a/examples/cc2538dk/sniffer/Makefile +++ b/examples/cc2538dk/sniffer/Makefile @@ -6,5 +6,5 @@ CONTIKI_PROJECT = sniffer all: $(CONTIKI_PROJECT) CONTIKI = ../../.. - +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/cc2538dk/udp-ipv6-echo-server/Makefile b/examples/cc2538dk/udp-ipv6-echo-server/Makefile index 530fd9785..32b3ca79f 100644 --- a/examples/cc2538dk/udp-ipv6-echo-server/Makefile +++ b/examples/cc2538dk/udp-ipv6-echo-server/Makefile @@ -1,10 +1,7 @@ -UIP_CONF_IPV6=1 -UIP_CONF_RPL=1 - CONTIKI_PROJECT = udp-echo-server all: $(CONTIKI_PROJECT) CONTIKI = ../../.. - +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/collect/Makefile b/examples/collect/Makefile index 4e535f711..f2f88e074 100644 --- a/examples/collect/Makefile +++ b/examples/collect/Makefile @@ -4,4 +4,5 @@ all: $(CONTIKI_PROJECT) APPS = serial-shell powertrace collect-view CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/eeprom-test/Makefile b/examples/eeprom-test/Makefile index 46c909138..a99ce8944 100644 --- a/examples/eeprom-test/Makefile +++ b/examples/eeprom-test/Makefile @@ -3,4 +3,5 @@ all: $(CONTIKI_PROJECT) TARGET=mbxxx CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/email/Makefile b/examples/email/Makefile index 0c466edfd..3adf8d847 100644 --- a/examples/email/Makefile +++ b/examples/email/Makefile @@ -4,4 +4,5 @@ all: $(CONTIKI_PROJECT) APPS = email CONTIKI = ../.. +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/er-rest-example/Makefile b/examples/er-rest-example/Makefile index 7c533a8e4..a20d814ee 100644 --- a/examples/er-rest-example/Makefile +++ b/examples/er-rest-example/Makefile @@ -3,12 +3,6 @@ all: er-example-server er-example-client CONTIKI=../.. -# Contiki IPv6 configuration -WITH_UIP6=1 -UIP_CONF_IPV6=1 -CFLAGS += -DUIP_CONF_IPV6=1 -CFLAGS += -DUIP_CONF_IPV6_RPL=1 - CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" # automatically build RESTful resources @@ -37,6 +31,7 @@ APPS += rest-engine #CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 #CUSTOM_RULE_S_TO_OBJECTDIR_O = 1 +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include # minimal-net target is currently broken in Contiki @@ -46,7 +41,7 @@ ${info INFO: er-example compiling with large buffers} CFLAGS += -DUIP_CONF_BUFFER_SIZE=1300 CFLAGS += -DREST_MAX_CHUNK_SIZE=1024 CFLAGS += -DCOAP_MAX_HEADER_SIZE=176 -CFLAGS += -DUIP_CONF_IPV6_RPL=0 +CONTIKI_WITH_RPL=0 endif # optional rules to get assembly diff --git a/examples/example-shell/Makefile b/examples/example-shell/Makefile index eaf62548f..9849e6092 100644 --- a/examples/example-shell/Makefile +++ b/examples/example-shell/Makefile @@ -3,5 +3,6 @@ all: $(CONTIKI_PROJECT) APPS = serial-shell CONTIKI = ../.. - +CONTIKI_WITH_RIME = 1 +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/extended-rf-api/Makefile b/examples/extended-rf-api/Makefile index 53ef73cea..b18e4b642 100644 --- a/examples/extended-rf-api/Makefile +++ b/examples/extended-rf-api/Makefile @@ -5,4 +5,5 @@ CONTIKI_PROJECT = extended-rf-api all: $(CONTIKI_PROJECT) CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/ftp/Makefile b/examples/ftp/Makefile index 1504495f4..ff671c9bf 100644 --- a/examples/ftp/Makefile +++ b/examples/ftp/Makefile @@ -4,4 +4,5 @@ all: $(CONTIKI_PROJECT) APPS = ftp CONTIKI = ../.. +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/hello-world/Makefile b/examples/hello-world/Makefile index fc17d7ae6..0a79167ae 100644 --- a/examples/hello-world/Makefile +++ b/examples/hello-world/Makefile @@ -1,7 +1,5 @@ CONTIKI_PROJECT = hello-world all: $(CONTIKI_PROJECT) -#UIP_CONF_IPV6=1 - CONTIKI = ../.. include $(CONTIKI)/Makefile.include diff --git a/examples/ipv6/json-ws/Makefile b/examples/ipv6/json-ws/Makefile index 2f1ba6582..d8619097d 100644 --- a/examples/ipv6/json-ws/Makefile +++ b/examples/ipv6/json-ws/Makefile @@ -1,6 +1,5 @@ CONTIKI=../../.. -UIP_CONF_IPV6=1 SMALL=1 PROJECT_SOURCEFILES += json-ws.c @@ -26,4 +25,5 @@ ifneq ($(TARGET),) all: websense-$(TARGET) endif +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/ipv6/multicast/Makefile b/examples/ipv6/multicast/Makefile index 4bd9ce515..dca6f7e72 100644 --- a/examples/ipv6/multicast/Makefile +++ b/examples/ipv6/multicast/Makefile @@ -1,5 +1,4 @@ DEFINES+=PROJECT_CONF_H=\"project-conf.h\" -UIP_CONF_IPV6=1 CONTIKI_PROJECT = root intermediate sink all: $(CONTIKI_PROJECT) @@ -8,4 +7,5 @@ CONTIKI = ../../.. MODULES += core/net/ipv6/multicast +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/ipv6/multicast/intermediate.c b/examples/ipv6/multicast/intermediate.c index 6d8f27284..5c45aa75d 100644 --- a/examples/ipv6/multicast/intermediate.c +++ b/examples/ipv6/multicast/intermediate.c @@ -47,9 +47,9 @@ #include "contiki-net.h" #include "net/ipv6/multicast/uip-mcast6.h" -#if !UIP_CONF_IPV6 || !UIP_CONF_ROUTER || !UIP_CONF_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL +#if !NETSTACK_CONF_WITH_IPV6 || !UIP_CONF_ROUTER || !UIP_CONF_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL #error "This example can not work with the current contiki configuration" -#error "Check the values of: UIP_CONF_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL" +#error "Check the values of: NETSTACK_CONF_WITH_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL" #endif /*---------------------------------------------------------------------------*/ PROCESS(mcast_intermediate_process, "Intermediate Process"); diff --git a/examples/ipv6/multicast/project-conf.h b/examples/ipv6/multicast/project-conf.h index 84686ce21..8df6d01b4 100644 --- a/examples/ipv6/multicast/project-conf.h +++ b/examples/ipv6/multicast/project-conf.h @@ -52,7 +52,6 @@ #undef UIP_CONF_IPV6_RPL #undef UIP_CONF_ND6_SEND_RA #undef UIP_CONF_ROUTER -#define UIP_CONF_IPV6_RPL 1 #define UIP_CONF_ND6_SEND_RA 0 #define UIP_CONF_ROUTER 1 #define UIP_MCAST6_ROUTE_CONF_ROUTES 1 diff --git a/examples/ipv6/multicast/root.c b/examples/ipv6/multicast/root.c index 1c70ed388..0f27e7d17 100644 --- a/examples/ipv6/multicast/root.c +++ b/examples/ipv6/multicast/root.c @@ -63,9 +63,9 @@ static struct uip_udp_conn * mcast_conn; static char buf[MAX_PAYLOAD_LEN]; static uint32_t seq_id; -#if !UIP_CONF_IPV6 || !UIP_CONF_ROUTER || !UIP_CONF_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL +#if !NETSTACK_CONF_WITH_IPV6 || !UIP_CONF_ROUTER || !UIP_CONF_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL #error "This example can not work with the current contiki configuration" -#error "Check the values of: UIP_CONF_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL" +#error "Check the values of: NETSTACK_CONF_WITH_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL" #endif /*---------------------------------------------------------------------------*/ PROCESS(rpl_root_process, "RPL ROOT, Multicast Sender"); diff --git a/examples/ipv6/multicast/sink.c b/examples/ipv6/multicast/sink.c index 455e94441..4c272869a 100644 --- a/examples/ipv6/multicast/sink.c +++ b/examples/ipv6/multicast/sink.c @@ -57,9 +57,9 @@ static uint16_t count; #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) -#if !UIP_CONF_IPV6 || !UIP_CONF_ROUTER || !UIP_CONF_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL +#if !NETSTACK_CONF_WITH_IPV6 || !UIP_CONF_ROUTER || !UIP_CONF_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL #error "This example can not work with the current contiki configuration" -#error "Check the values of: UIP_CONF_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL" +#error "Check the values of: NETSTACK_CONF_WITH_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL" #endif /*---------------------------------------------------------------------------*/ PROCESS(mcast_sink_process, "Multicast Sink"); diff --git a/examples/ipv6/native-border-router/Makefile b/examples/ipv6/native-border-router/Makefile index 191d9c819..d781ed35c 100644 --- a/examples/ipv6/native-border-router/Makefile +++ b/examples/ipv6/native-border-router/Makefile @@ -4,9 +4,6 @@ APPS = slip-cmd CONTIKI=../../.. -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL -DUIP_CONF_IPV6 -DWITH_UIP6 - #linker optimizations SMALL=1 @@ -23,6 +20,7 @@ APPS += $(WITH_WEBSERVER) CFLAGS += -DWEBSERVER=2 endif +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include connect-router: border-router.native diff --git a/examples/ipv6/rpl-border-router/Makefile b/examples/ipv6/rpl-border-router/Makefile index f296b0bb3..ce90a4eac 100644 --- a/examples/ipv6/rpl-border-router/Makefile +++ b/examples/ipv6/rpl-border-router/Makefile @@ -3,9 +3,6 @@ all: $(CONTIKI_PROJECT) CONTIKI=../../.. -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL - #linker optimizations SMALL=1 @@ -26,10 +23,12 @@ PROJECT_SOURCEFILES += slip-bridge.c WITH_WEBSERVER=1 ifeq ($(WITH_WEBSERVER),1) +CFLAGS += -DUIP_CONF_TCP=1 CFLAGS += -DWEBSERVER=1 PROJECT_SOURCEFILES += httpd-simple.c else ifneq ($(WITH_WEBSERVER), 0) APPS += $(WITH_WEBSERVER) +CFLAGS += -DUIP_CONF_TCP=1 CFLAGS += -DWEBSERVER=2 endif @@ -37,6 +36,7 @@ ifeq ($(PREFIX),) PREFIX = aaaa::1/64 endif +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include $(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c diff --git a/examples/ipv6/rpl-collect/Makefile b/examples/ipv6/rpl-collect/Makefile index 7ed3f6ae1..ce20c79e2 100644 --- a/examples/ipv6/rpl-collect/Makefile +++ b/examples/ipv6/rpl-collect/Makefile @@ -3,14 +3,11 @@ APPS = powertrace collect-view CONTIKI_PROJECT = udp-sender udp-sink PROJECT_SOURCEFILES += collect-common.c -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL - ifdef PERIOD CFLAGS=-DPERIOD=$(PERIOD) endif all: $(CONTIKI_PROJECT) +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include - diff --git a/examples/ipv6/rpl-udp/Makefile b/examples/ipv6/rpl-udp/Makefile index 6dfe77c47..9670d71e3 100644 --- a/examples/ipv6/rpl-udp/Makefile +++ b/examples/ipv6/rpl-udp/Makefile @@ -2,10 +2,6 @@ all: udp-client udp-server APPS=servreg-hack CONTIKI=../../.. -UIP_CONF_IPV6=1 - -CFLAGS+= -DUIP_CONF_IPV6_RPL - ifdef WITH_COMPOWER APPS+=powertrace CFLAGS+= -DCONTIKIMAC_CONF_COMPOWER=1 -DWITH_COMPOWER=1 -DQUEUEBUF_CONF_NUM=4 @@ -18,4 +14,5 @@ ifdef PERIOD CFLAGS+=-DPERIOD=$(PERIOD) endif +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/ipv6/simple-udp-rpl/Makefile b/examples/ipv6/simple-udp-rpl/Makefile index 9cc51e534..72e0cda32 100644 --- a/examples/ipv6/simple-udp-rpl/Makefile +++ b/examples/ipv6/simple-udp-rpl/Makefile @@ -2,7 +2,5 @@ all: broadcast-example unicast-sender unicast-receiver APPS=servreg-hack CONTIKI=../../.. -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL - +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/ipv6/sky-websense/Makefile b/examples/ipv6/sky-websense/Makefile index 21fee6e7c..17385c016 100644 --- a/examples/ipv6/sky-websense/Makefile +++ b/examples/ipv6/sky-websense/Makefile @@ -2,9 +2,6 @@ all: sky-websense CONTIKI=../../.. -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL - APPS += webbrowser CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" @@ -12,6 +9,7 @@ CONTIKI_SOURCEFILES += wget.c PROJECTDIRS += ../rpl-border-router PROJECT_SOURCEFILES += httpd-simple.c +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include $(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c diff --git a/examples/ipv6/slip-radio/Makefile b/examples/ipv6/slip-radio/Makefile index 5456466ab..9d6f8ca88 100644 --- a/examples/ipv6/slip-radio/Makefile +++ b/examples/ipv6/slip-radio/Makefile @@ -8,9 +8,6 @@ endif CONTIKI=../../.. -UIP_CONF_IPV6=1 -UIP_CONF_RPL=0 - #linker optimizations SMALL=1 @@ -26,4 +23,6 @@ ifeq ($(TARGET),econotag) PROJECT_SOURCEFILES += slip-radio-mc1322x.c endif +CONTIKI_WITH_RPL = 0 +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/ipv6/slip-radio/project-conf.h b/examples/ipv6/slip-radio/project-conf.h index 4a2950c59..66cd61cbc 100644 --- a/examples/ipv6/slip-radio/project-conf.h +++ b/examples/ipv6/slip-radio/project-conf.h @@ -39,9 +39,6 @@ #undef UIP_CONF_ROUTER #define UIP_CONF_ROUTER 0 -#undef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 0 - #define CMD_CONF_OUTPUT slip_radio_cmd_output /* add the cmd_handler_cc2420 + some sensors if TARGET_SKY */ diff --git a/examples/irc/Makefile b/examples/irc/Makefile index 842bbb0b1..bad574e70 100644 --- a/examples/irc/Makefile +++ b/examples/irc/Makefile @@ -4,4 +4,5 @@ all: $(CONTIKI_PROJECT) APPS = irc CONTIKI = ../.. +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/llsec/ccm-star-tests/encryption/Makefile b/examples/llsec/ccm-star-tests/encryption/Makefile index 0fd359f16..078714794 100644 --- a/examples/llsec/ccm-star-tests/encryption/Makefile +++ b/examples/llsec/ccm-star-tests/encryption/Makefile @@ -4,11 +4,8 @@ all: $(CONTIKI_PROJECT) CONTIKI = ../../../.. CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" -WITH_UIP6=1 -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL - #linker optimizations SMALL=1 +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/llsec/ccm-star-tests/verification/Makefile b/examples/llsec/ccm-star-tests/verification/Makefile index 0fd359f16..078714794 100644 --- a/examples/llsec/ccm-star-tests/verification/Makefile +++ b/examples/llsec/ccm-star-tests/verification/Makefile @@ -4,11 +4,8 @@ all: $(CONTIKI_PROJECT) CONTIKI = ../../../.. CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" -WITH_UIP6=1 -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL - #linker optimizations SMALL=1 +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/mbxxx/acc-sensor/Makefile b/examples/mbxxx/acc-sensor/Makefile index 1e332446c..e3b40cde8 100644 --- a/examples/mbxxx/acc-sensor/Makefile +++ b/examples/mbxxx/acc-sensor/Makefile @@ -3,4 +3,5 @@ CONTIKI_PROJECT = acc-example all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/mbxxx/button/Makefile b/examples/mbxxx/button/Makefile index 25d0441de..303ec7e5e 100644 --- a/examples/mbxxx/button/Makefile +++ b/examples/mbxxx/button/Makefile @@ -3,4 +3,5 @@ CONTIKI_PROJECT = test-button all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/mbxxx/coffee-test/Makefile b/examples/mbxxx/coffee-test/Makefile index 1962568bd..3e72baacd 100644 --- a/examples/mbxxx/coffee-test/Makefile +++ b/examples/mbxxx/coffee-test/Makefile @@ -4,4 +4,5 @@ all: $(CONTIKI_PROJECT) COFFEE=1 CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/mbxxx/mbxxx-shell/Makefile b/examples/mbxxx/mbxxx-shell/Makefile index 08d2e6541..93de19bda 100644 --- a/examples/mbxxx/mbxxx-shell/Makefile +++ b/examples/mbxxx/mbxxx-shell/Makefile @@ -9,4 +9,5 @@ PROJECT_SOURCEFILES = shell-sensors.c all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/mbxxx/mbxxx-websense/Makefile b/examples/mbxxx/mbxxx-websense/Makefile index a1d4b3af9..6239a7043 100644 --- a/examples/mbxxx/mbxxx-websense/Makefile +++ b/examples/mbxxx/mbxxx-websense/Makefile @@ -2,8 +2,6 @@ all: mbxxx-websense CONTIKI=../../.. -UIP_CONF_IPV6=1 - APPS += webserver webbrowser CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" @@ -11,6 +9,7 @@ CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" PROJECTDIRS += ../../ipv6/rpl-border-router PROJECT_SOURCEFILES += httpd-simple.c +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include $(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c diff --git a/examples/mbxxx/shell-exec/Makefile b/examples/mbxxx/shell-exec/Makefile index 763e2e003..f9110f058 100644 --- a/examples/mbxxx/shell-exec/Makefile +++ b/examples/mbxxx/shell-exec/Makefile @@ -11,6 +11,7 @@ APPS = serial-shell PROJECT_SOURCEFILES = shell-exec.c CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include %.shell-upload: %.ce diff --git a/examples/mbxxx/telnet-server/Makefile b/examples/mbxxx/telnet-server/Makefile index 122054910..6322d4c8c 100644 --- a/examples/mbxxx/telnet-server/Makefile +++ b/examples/mbxxx/telnet-server/Makefile @@ -1,6 +1,4 @@ CONTIKI_PROJECT = telnet-server - -UIP_CONF_IPV6=1 APPS = telnetd @@ -11,4 +9,5 @@ PROJECT_SOURCEFILES = shell-sensors.c all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/mbxxx/temperature/Makefile b/examples/mbxxx/temperature/Makefile index 7b1518efd..82fc9b4b1 100644 --- a/examples/mbxxx/temperature/Makefile +++ b/examples/mbxxx/temperature/Makefile @@ -3,4 +3,5 @@ CONTIKI_PROJECT = temp-sensor all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/mbxxx/udp-ipv6-sleep/Makefile b/examples/mbxxx/udp-ipv6-sleep/Makefile index 476065d4a..53d35ce9a 100644 --- a/examples/mbxxx/udp-ipv6-sleep/Makefile +++ b/examples/mbxxx/udp-ipv6-sleep/Makefile @@ -1,8 +1,7 @@ all: udp-server udp-client -UIP_CONF_IPV6=1 - DEFINES=UIP_CONF_ND6_REACHABLE_TIME=0xffffffff CONTIKI = ../../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/mbxxx/webserver-ajax/Makefile b/examples/mbxxx/webserver-ajax/Makefile index 06962bae8..c579c7a3f 100644 --- a/examples/mbxxx/webserver-ajax/Makefile +++ b/examples/mbxxx/webserver-ajax/Makefile @@ -2,16 +2,13 @@ CONTIKI_PROJECT = mbxxx-webserver all: $(CONTIKI_PROJECT) DEFINES=PROJECT_CONF_H=\"webserver-ajax-conf.h\" -UIP_CONF_IPV6=1 #APPS = webserver PROJECTDIRS = . $(CONTIKI)/apps/webserver PROJECT_SOURCEFILES = ajax-cgi.c httpd-fs.c http-strings.c \ httpd.c webserver-dsc.c webserver-nogui.c - - - CONTIKI = ../../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/mbxxx/webserver-ajax/ajax-cgi.c b/examples/mbxxx/webserver-ajax/ajax-cgi.c index 3d482b376..e1b3ec4b0 100644 --- a/examples/mbxxx/webserver-ajax/ajax-cgi.c +++ b/examples/mbxxx/webserver-ajax/ajax-cgi.c @@ -164,7 +164,7 @@ make_neighbor(void *arg) return 0; } -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 return snprintf((char *)uip_appdata, uip_mss(), "
  • %d.%d\r\n", n->addr.u8[0], n->addr.u8[1], @@ -212,7 +212,7 @@ make_neighbor(void *arg) n->addr.u8[6], n->addr.u8[7]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } /*---------------------------------------------------------------------------*/ static diff --git a/examples/multi-threading/Makefile b/examples/multi-threading/Makefile index c6371bafa..30a68e393 100644 --- a/examples/multi-threading/Makefile +++ b/examples/multi-threading/Makefile @@ -2,4 +2,5 @@ CONTIKI_PROJECT = multi-threading all: $(CONTIKI_PROJECT) CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/netperf/Makefile b/examples/netperf/Makefile index 8a6461d87..007dcc4bf 100644 --- a/examples/netperf/Makefile +++ b/examples/netperf/Makefile @@ -3,4 +3,5 @@ all: $(CONTIKI_PROJECT) APPS=serial-shell CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/ping-ipv6/Makefile b/examples/ping-ipv6/Makefile index 91dc81a4e..b500dd409 100644 --- a/examples/ping-ipv6/Makefile +++ b/examples/ping-ipv6/Makefile @@ -1,7 +1,6 @@ all: example-ping6 APPS=ping6 -UIP_CONF_IPV6=1 - CONTIKI = ../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/powertrace/Makefile b/examples/powertrace/Makefile index 0eeeeb177..93816ff82 100644 --- a/examples/powertrace/Makefile +++ b/examples/powertrace/Makefile @@ -3,4 +3,5 @@ APPS+=powertrace all: $(CONTIKI_PROJECT) CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/ravenusbstick/Makefile.ravenusbstick b/examples/ravenusbstick/Makefile.ravenusbstick index f1237125f..d00ba6cba 100644 --- a/examples/ravenusbstick/Makefile.ravenusbstick +++ b/examples/ravenusbstick/Makefile.ravenusbstick @@ -1,12 +1,10 @@ all: ravenusbstick #Define CONTIKI_NO_NET=1 for a passthrough ipv6/6lowpan interface using fakeuip.c -#Define UIP_CONF_IPV6=1 to include the uip6 stack (for rpl, internal webserver) +#Define CONTIKI_WITH_IPV6 = 1 to include the uip6 stack (for rpl, internal webserver) #Do make clean when switching to remove the duplicate library modules CONTIKI_NO_NET=1 -#UIP_CONF_IPV6=1 - -CFLAGS=-DUIP_CONF_IPV6=0 -DUIP_CONF_IPV6_RPL=0 +CONTIKI_WITH_IPV6=0 CONTIKI = ../.. diff --git a/examples/rest-example/Makefile b/examples/rest-example/Makefile index bd020537c..745091636 100644 --- a/examples/rest-example/Makefile +++ b/examples/rest-example/Makefile @@ -6,8 +6,6 @@ endif CONTIKI=../.. -UIP_CONF_IPV6=1 - WITH_COAP = 1 CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" @@ -20,6 +18,7 @@ CFLAGS += -DWITH_HTTP APPS += rest-http endif +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include $(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c diff --git a/examples/rime/Makefile b/examples/rime/Makefile index df4cb3af1..e35d8f1e9 100644 --- a/examples/rime/Makefile +++ b/examples/rime/Makefile @@ -4,4 +4,5 @@ all: example-abc example-mesh example-collect example-trickle example-polite \ example-rudolph0 example-rudolph1 example-rudolph2 example-rucb \ example-runicast example-unicast example-neighbors +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/rssi-scanner/Makefile b/examples/rssi-scanner/Makefile new file mode 100644 index 000000000..2513eba11 --- /dev/null +++ b/examples/rssi-scanner/Makefile @@ -0,0 +1,23 @@ +DEFINES=PROJECT_CONF_H=\"project-conf.h\" + +ifndef TARGET +TARGET = z1 +endif + +CONTIKI = ../.. + +CONTIKI_PROJECT = rssi-scanner-cc2420 + +all: $(CONTIKI_PROJECT) + +%.class: %.java + javac $(basename $<).java + +viewrssi3d: ViewRSSI3D.class + make login | java ViewRSSI3D + +viewrssi: ViewRSSI.class + make login | java ViewRSSI + +include $(CONTIKI)/Makefile.include + diff --git a/examples/z1/rssi_scanner/ViewRSSI.java b/examples/rssi-scanner/ViewRSSI.java similarity index 94% rename from examples/z1/rssi_scanner/ViewRSSI.java rename to examples/rssi-scanner/ViewRSSI.java index e768594b6..0b881ef7e 100644 --- a/examples/z1/rssi_scanner/ViewRSSI.java +++ b/examples/rssi-scanner/ViewRSSI.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2007, Swedish Institute of Computer Science. * Copyright (c) 2010, University of Luebeck, Germany. * All rights reserved. * @@ -25,9 +26,14 @@ * 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. - * - * Author: Carlo Alberto Boano , Joakim Eriksson, - * + */ + +/** + * \file + * ViewRSSI java application + * \author + * Joakim Eriksson + * Carlo Alberto Boano */ import javax.swing.*; diff --git a/examples/z1/rssi_scanner/ViewRSSI3D.java b/examples/rssi-scanner/ViewRSSI3D.java similarity index 98% rename from examples/z1/rssi_scanner/ViewRSSI3D.java rename to examples/rssi-scanner/ViewRSSI3D.java index 425d1a276..2defe6bcb 100644 --- a/examples/z1/rssi_scanner/ViewRSSI3D.java +++ b/examples/rssi-scanner/ViewRSSI3D.java @@ -1,7 +1,7 @@ /** * 3D RSSI Viewer - view RSSI values of 802.15.4 channels * --------------------------------------------------- - * Note: run the rssi-scanner on a Sky or sentilla node connected to USB + * Note: run the rssi-scanner on a Sky, Z1 or sentilla node connected to USB * then start with * make login | java ViewRSSI3D * diff --git a/examples/z1/rssi_scanner/project-conf.h b/examples/rssi-scanner/project-conf.h similarity index 100% rename from examples/z1/rssi_scanner/project-conf.h rename to examples/rssi-scanner/project-conf.h diff --git a/examples/z1/rssi_scanner/rssi-scanner.c b/examples/rssi-scanner/rssi-scanner-cc2420.c similarity index 86% rename from examples/z1/rssi_scanner/rssi-scanner.c rename to examples/rssi-scanner/rssi-scanner-cc2420.c index bbca9cdb6..fbbfddf00 100644 --- a/examples/z1/rssi_scanner/rssi-scanner.c +++ b/examples/rssi-scanner/rssi-scanner-cc2420.c @@ -54,15 +54,22 @@ static void set_frq(int c) { int f; - // We can read even other channels with CC2420! - // Fc = 2048 + FSCTRL ; Fc = 2405 + 5(k-11) MHz, k=11,12, ... , 26 - f = c + 352; // Start from 2400 MHz to 2485 MHz, - //FASTSPI_SETREG(CC2420_FSCTRL, f); - //FASTSPI_STROBE(CC2420_SRXON); - CC2420_WRITE_REG(CC2420_FSCTRL, f); - CC2420_STROBE(CC2420_SRXON); -} + /* We can read even other channels with CC2420! */ + /* Fc = 2048 + FSCTRL ; Fc = 2405 + 5(k-11) MHz, k=11,12, ... , 26 */ + f = c + 352; /* Start from 2400 MHz to 2485 MHz, */ + /* Write the new channel value */ + CC2420_SPI_ENABLE(); + SPI_WRITE_FAST(CC2420_FSCTRL); + SPI_WRITE_FAST((uint8_t)(f >> 8)); + SPI_WRITE_FAST((uint8_t)(f & 0xff)); + SPI_WAITFORTx_ENDED(); + SPI_WRITE(0); + + /* Send the strobe */ + SPI_WRITE(CC2420_SRXON); + CC2420_SPI_DISABLE(); +} static void do_rssi(void) { @@ -74,7 +81,6 @@ do_rssi(void) } printf("\n"); } - /*---------------------------------------------------------------------------*/ PROCESS(scanner_process, "RSSI Scanner"); AUTOSTART_PROCESSES(&scanner_process); diff --git a/examples/seedeye/powerswitch/Makefile b/examples/seedeye/powerswitch/Makefile index a7b4c9fbe..6e12ccc81 100644 --- a/examples/seedeye/powerswitch/Makefile +++ b/examples/seedeye/powerswitch/Makefile @@ -7,13 +7,8 @@ all: remotepowerswitch CONTIKI=../../../ CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" -# for some platforms -UIP_CONF_IPV6=1 - WITH_COAP=13 -UIP_CONF_RPL=1 - # REST framework, requires WITH_COAP ifeq ($(WITH_COAP), 13) ${info INFO: compiling with CoAP-13} @@ -49,4 +44,5 @@ endif APPS += erbium +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/Makefile b/examples/sensinode/Makefile index 773998539..cd1472d33 100644 --- a/examples/sensinode/Makefile +++ b/examples/sensinode/Makefile @@ -13,4 +13,5 @@ CONTIKI_PROJECT += timer-test blink-hello broadcast-rime all: $(CONTIKI_PROJECT) CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/border-router/Makefile b/examples/sensinode/border-router/Makefile index 18ae8b86c..38ebe9e27 100644 --- a/examples/sensinode/border-router/Makefile +++ b/examples/sensinode/border-router/Makefile @@ -7,8 +7,6 @@ DEFINES+=MODEL_N601,PROJECT_CONF_H # We need uIPv6, therefore we also need banking HAVE_BANKING=1 -UIP_CONF_IPV6=1 -UIP_CONF_RPL=1 PROJECT_SOURCEFILES += slip-bridge.c @@ -17,4 +15,5 @@ all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/cc2431-location-engine/Makefile b/examples/sensinode/cc2431-location-engine/Makefile index 8fc75d484..4a14b80a9 100644 --- a/examples/sensinode/cc2431-location-engine/Makefile +++ b/examples/sensinode/cc2431-location-engine/Makefile @@ -14,4 +14,5 @@ all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/disco/Makefile b/examples/sensinode/disco/Makefile index f95b14023..9c1903d4b 100644 --- a/examples/sensinode/disco/Makefile +++ b/examples/sensinode/disco/Makefile @@ -6,8 +6,6 @@ endif DEFINES+=MODEL_N740 HAVE_BANKING=1 -UIP_CONF_IPV6=1 -UIP_CONF_RPL=1 OFFSET_FIRMWARE=1 CONTIKI_PROJECT = disco-example @@ -16,4 +14,5 @@ all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/energy-scan/Makefile b/examples/sensinode/energy-scan/Makefile index 9020155e3..e91d74b96 100644 --- a/examples/sensinode/energy-scan/Makefile +++ b/examples/sensinode/energy-scan/Makefile @@ -13,4 +13,5 @@ all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/event-post/Makefile b/examples/sensinode/event-post/Makefile index 15113d249..114de943f 100644 --- a/examples/sensinode/event-post/Makefile +++ b/examples/sensinode/event-post/Makefile @@ -13,5 +13,5 @@ CONTIKI_PROJECT = event-post all: $(CONTIKI_PROJECT) CONTIKI = ../../.. - +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/sensors-ipv6/Makefile b/examples/sensinode/sensors-ipv6/Makefile index 608de5c0d..4332e42c9 100644 --- a/examples/sensinode/sensors-ipv6/Makefile +++ b/examples/sensinode/sensors-ipv6/Makefile @@ -7,7 +7,6 @@ DEFINES+=MODEL_N740,PROJECT_CONF_H # This example won't fit in flash without banking so we turn it on HAVE_BANKING=1 -UIP_CONF_IPV6=1 CONTIKI_SOURCEFILES += sensors-driver.c @@ -15,5 +14,5 @@ CONTIKI_PROJECT = sensors-ipv6 all: $(CONTIKI_PROJECT) CONTIKI = ../../.. - +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/sensors/Makefile b/examples/sensinode/sensors/Makefile index 90c05ae80..8502ff884 100644 --- a/examples/sensinode/sensors/Makefile +++ b/examples/sensinode/sensors/Makefile @@ -13,5 +13,5 @@ CONTIKI_PROJECT = sensors-example all: $(CONTIKI_PROJECT) CONTIKI = ../../.. - +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/serial-flash/Makefile b/examples/sensinode/serial-flash/Makefile index b8c8d2fbe..9e80a9c6d 100644 --- a/examples/sensinode/serial-flash/Makefile +++ b/examples/sensinode/serial-flash/Makefile @@ -10,4 +10,5 @@ CONTIKI_PROJECT = flash all: $(CONTIKI_PROJECT) CONTIKI = ../../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/sniffer/Makefile b/examples/sensinode/sniffer/Makefile index 07f074069..5170c55b1 100644 --- a/examples/sensinode/sniffer/Makefile +++ b/examples/sensinode/sniffer/Makefile @@ -12,5 +12,5 @@ CONTIKI_PROJECT = sniffer all: $(CONTIKI_PROJECT) CONTIKI = ../../.. - +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sensinode/udp-ipv6/Makefile b/examples/sensinode/udp-ipv6/Makefile index 2f47d11b0..ae0bfad0f 100644 --- a/examples/sensinode/udp-ipv6/Makefile +++ b/examples/sensinode/udp-ipv6/Makefile @@ -7,8 +7,6 @@ DEFINES+=MODEL_N740,PROJECT_CONF_H # This example won't fit in flash without banking so we turn it on HAVE_BANKING=1 -UIP_CONF_IPV6=1 -UIP_CONF_RPL=1 CONTIKI_SOURCEFILES += ping6.c @@ -16,5 +14,7 @@ CONTIKI_PROJECT = client server all: $(CONTIKI_PROJECT) CONTIKI = ../../.. - +CONTIKI_WITH_IPV6 = 1 +# needed for rimestats +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/servreg-hack/Makefile b/examples/servreg-hack/Makefile index 84e057391..9c528ebba 100644 --- a/examples/servreg-hack/Makefile +++ b/examples/servreg-hack/Makefile @@ -1,10 +1,9 @@ CONTIKI_PROJECT = example-servreg-client all: $(CONTIKI_PROJECT) -UIP_CONF_IPV6=1 - APPS=servreg-hack CONTIKI = ../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include -include /home/user/nes/testbed-scripts/Makefile.include diff --git a/examples/settings-example/Makefile b/examples/settings-example/Makefile index 540adff63..ac53960ee 100644 --- a/examples/settings-example/Makefile +++ b/examples/settings-example/Makefile @@ -2,4 +2,5 @@ CONTIKI_PROJECT = settings-example all: $(CONTIKI_PROJECT) CFLAGS += -DCONTIKI_CONF_SETTINGS_MANAGER=1 CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sky-ip/Makefile b/examples/sky-ip/Makefile index 1602cd120..795e72da0 100644 --- a/examples/sky-ip/Makefile +++ b/examples/sky-ip/Makefile @@ -2,7 +2,7 @@ CONTIKI_PROJECT = sky-webserver all: sky-webserver sky-telnet-server telnet PLATFORM_BUILD=1 # This is needed to avoid the shell to include the httpd-cfs version of the webserver APPS = webserver telnetd -CFLAGS = -DWITH_UIP=1 -I. +CFLAGS = -I. SMALL=1 DEFINES=NETSTACK_CONF_RDC=cxmac_driver,NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE=8 @@ -19,6 +19,8 @@ DEFINES=NETSTACK_CONF_RDC=cxmac_driver,NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE=8 # endif CONTIKI = ../.. +CONTIKI_WITH_IPV4 = 1 +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include sky-webserver.$(TARGET): $(OBJECTDIR)/ajax-cgi.o diff --git a/examples/sky-shell-exec/Makefile b/examples/sky-shell-exec/Makefile index f2608f905..115d67a59 100644 --- a/examples/sky-shell-exec/Makefile +++ b/examples/sky-shell-exec/Makefile @@ -7,6 +7,7 @@ DEFINES=ELFLOADER_DATAMEMORY_SIZE=0x100,ELFLOADER_TEXTMEMORY_SIZE=0x100 APPS = serial-shell CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include %.shell-upload: %.ce diff --git a/examples/sky-shell-webserver/Makefile b/examples/sky-shell-webserver/Makefile index 224409442..6bec0ff96 100644 --- a/examples/sky-shell-webserver/Makefile +++ b/examples/sky-shell-webserver/Makefile @@ -2,11 +2,13 @@ CONTIKI_PROJECT = sky-shell-webserver all: $(CONTIKI_PROJECT) PROJECT_SOURCEFILES = webserver-nogui.c HTTPD_CFS=1 -CFLAGS = -DWITH_UIP=1 -DRESOLV_CONF_SUPPORTS_MDNS=0 +CFLAGS = -DRESOLV_CONF_SUPPORTS_MDNS=0 DEFINES=NETSTACK_MAC=nullmac_driver,NETSTACK_RDC=nullrdc_driver SMALL=1 CONTIKI = ../.. APPS = webserver serial-shell +CONTIKI_WITH_IPV4 = 1 +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include - + diff --git a/examples/sky-shell-webserver/sky-shell-webserver.c b/examples/sky-shell-webserver/sky-shell-webserver.c index 708f53d5e..57f85c368 100644 --- a/examples/sky-shell-webserver/sky-shell-webserver.c +++ b/examples/sky-shell-webserver/sky-shell-webserver.c @@ -51,7 +51,7 @@ PROCESS_THREAD(sky_shell_process, ev, data) { PROCESS_BEGIN(); - /* WITH_UIP=1 assumes incoming SLIP serial data. + /* NETSTACK_CONF_WITH_IPV4=1 assumes incoming SLIP serial data. * We override this assumption by restoring default serial input handler. */ uart1_set_input(serial_line_input_byte); serial_line_init(); diff --git a/examples/sky-shell/Makefile b/examples/sky-shell/Makefile index f7833e36d..6e1fc09bf 100644 --- a/examples/sky-shell/Makefile +++ b/examples/sky-shell/Makefile @@ -4,6 +4,7 @@ all: $(CONTIKI_PROJECT) APPS = serial-shell powertrace collect-view CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include -include /home/user/nes/testbed-scripts/Makefile.include diff --git a/examples/sky/Makefile b/examples/sky/Makefile index f66dff5a1..dd09f0792 100644 --- a/examples/sky/Makefile +++ b/examples/sky/Makefile @@ -11,10 +11,6 @@ all: blink sky-collect #rt-leds test-button test-cfs tcprudolph0 echo $(basename $<)/$(basename $<).ihex 600 > $(basename $<)/runfile ; \ tar czf $@ $(basename $<) -%.class: %.java - javac $(basename $<).java - -viewrssi: ViewRSSI.class - make login | java ViewRSSI - +CONTIKI_WITH_IPV4 = 1 +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/sky/ViewRSSI.java b/examples/sky/ViewRSSI.java deleted file mode 100644 index 53d6e4603..000000000 --- a/examples/sky/ViewRSSI.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * RSSI Viewer - view RSSI values of 802.15.4 channels - * --------------------------------------------------- - * Note: run the rssi-scanner on a Sky or sentilla node connected to USB - * then start with - * make ViewRSSI.class - * make login | java ViewRSSI - * or - * make viewrssi - * - * Created: Fri Apr 24 00:40:01 2009, Joakim Eriksson - * - * @author Joakim Eriksson, SICS - * @version 1.0 - */ -import javax.swing.*; -import java.awt.*; -import java.io.*; - -public class ViewRSSI extends JPanel { - - private int[] rssi = new int[80]; - private int[] rssiMax = new int[80]; - /* 55 is added by the scanner. 45 is the offset of the CC2420 */ - private final int DELTA = -55 -45; - - /* this is the max value of the RSSI from the cc2420 */ - private static final int RSSI_MAX_VALUE = 200; - - public ViewRSSI() { - } - - public void paint(Graphics g) { - - int h = getHeight(); - int w = getWidth(); - double factor = (h - 20.0) / RSSI_MAX_VALUE; - double sSpacing = (w - 15) / 80.0; - int sWidth = (int) (sSpacing - 1); - if (sWidth == 0) - sWidth = 1; - - Graphics2D g2d=(Graphics2D)g; - Font myFont=new Font("Arial", Font.PLAIN, 8); - g2d.setFont( myFont ); - - g.setColor(Color.white); - g.fillRect(0, 0, w, h); - - g.setColor(Color.gray); - double xpos = 10; - for (int i = 0, n = rssi.length; i < n; i++) { - int rssi = (int) (rssiMax[i] * factor); - g.fillRect((int) xpos, h - 20 - rssi, sWidth, rssi + 1); - g2d.drawString(Integer.toString(rssiMax[i] + DELTA), (int)xpos,h - 20 - rssi - 5 ); - xpos += sSpacing; - } - - - xpos = 10; - for (int i = 0, n = rssi.length; i < n; i++) { - g.setColor(Color.black); - int rssiVal = (int) (rssi[i] * factor); - g.fillRect((int) xpos, h - 20 - rssiVal, sWidth, rssiVal + 1); - g2d.drawString(Integer.toString(rssi[i] + DELTA), (int)xpos,h - 20 - rssiVal - 8 ); - g.setColor(Color.white); - g2d.drawString(Float.toString((float)i / 5 + (float)56/5), (int)xpos,h - 20 - 5 ); - xpos += sSpacing; - } - } - - private void handleInput() throws IOException { - BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); - while (true) { - String line = reader.readLine(); - if (line.startsWith("RSSI:")) { - try { - String[] parts = line.substring(5).split(" "); - for (int i = 0, n = parts.length; i < n; i++) { - rssi[i] = 3 * Integer.parseInt(parts[i]); - if (rssi[i] >= rssiMax[i]) - rssiMax[i] = rssi[i]; - else if (rssiMax[i] > 0) - rssiMax[i]--; - } - } catch (Exception e) { - /* report but do not fail... */ - e.printStackTrace(); - } - repaint(); - } - } - } - - public static void main(String[] args) throws IOException { - JFrame win = new JFrame("RSSI Viewer"); - ViewRSSI panel; - win.setBounds(10, 10, 300, 300); - win.getContentPane().add(panel = new ViewRSSI()); - win.setVisible(true); - win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - panel.handleInput(); - } -} diff --git a/examples/sky/rssi-scanner.c b/examples/sky/rssi-scanner.c deleted file mode 100644 index 92da5aa3e..000000000 --- a/examples/sky/rssi-scanner.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2007, 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. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Scanning 2.4 GHz radio frequencies using CC2420 and prints - * the values - * \author - * Joakim Eriksson, joakime@sics.se - */ - -#include "contiki.h" -#include "net/rime/rime.h" -#include "net/netstack.h" - -#include "dev/leds.h" -#include "cc2420.h" -#include "cc2420_const.h" -#include "dev/spi.h" -#include - -/*---------------------------------------------------------------------------*/ -/* This assumes that the CC2420 is always on and "stable" */ -static void -set_frq(int c) -{ - int f; - /* fine graied channel - can we even read other channels with CC2420 ? */ - f = c + 302 + 0x4000; - - CC2420_WRITE_REG(CC2420_FSCTRL, f); - CC2420_STROBE(CC2420_SRXON); -} - -static void -do_rssi(void) -{ - int channel; - printf("RSSI:"); - for(channel = 0; channel <= 79; ++channel) { - set_frq(channel + 55); - printf("%d ", cc2420_rssi() + 55); - } - printf("\n"); -} - -/*---------------------------------------------------------------------------*/ -PROCESS(scanner_process, "RSSI Scanner"); -AUTOSTART_PROCESSES(&scanner_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(scanner_process, ev, data) -{ - PROCESS_BEGIN(); - /* switch mac layer off, and turn radio on */ - NETSTACK_MAC.off(0); - cc2420_on(); - - while(1) { - do_rssi(); - PROCESS_PAUSE(); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/tcp-socket/Makefile b/examples/tcp-socket/Makefile index 544963f05..9e04825df 100644 --- a/examples/tcp-socket/Makefile +++ b/examples/tcp-socket/Makefile @@ -1,5 +1,5 @@ all: tcp-server CONTIKI=../.. - +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/telnet-server/Makefile b/examples/telnet-server/Makefile index 543dc8f49..b2f75b294 100644 --- a/examples/telnet-server/Makefile +++ b/examples/telnet-server/Makefile @@ -3,7 +3,6 @@ all: $(CONTIKI_PROJECT) APPS = telnetd program-handler -WITH_UIP=1 - CONTIKI = ../.. +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/trickle-library/Makefile b/examples/trickle-library/Makefile index 69a4e0402..6c08a2c46 100644 --- a/examples/trickle-library/Makefile +++ b/examples/trickle-library/Makefile @@ -1,9 +1,8 @@ -UIP_CONF_IPV6=1 - CONTIKI_PROJECT = trickle-library all: $(CONTIKI_PROJECT) CONTIKI = ../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/udp-ipv6/Makefile b/examples/udp-ipv6/Makefile index 627e1c5f6..62118cb49 100644 --- a/examples/udp-ipv6/Makefile +++ b/examples/udp-ipv6/Makefile @@ -1,6 +1,5 @@ all: udp-server udp-client -UIP_CONF_IPV6=1 - CONTIKI = ../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/udp-stream/Makefile b/examples/udp-stream/Makefile index e1a1c9855..1a9b6e59b 100644 --- a/examples/udp-stream/Makefile +++ b/examples/udp-stream/Makefile @@ -6,8 +6,8 @@ ifndef TARGET TARGET = sky endif -UIP_CONF_IPV6 = 1 CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" SMALL = 1 +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/webbrowser/Makefile b/examples/webbrowser/Makefile index a7216d061..5067c2d9c 100644 --- a/examples/webbrowser/Makefile +++ b/examples/webbrowser/Makefile @@ -4,4 +4,5 @@ all: $(CONTIKI_PROJECT) APPS = webbrowser CONTIKI = ../.. +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/webserver-ipv6-raven/Makefile.webserver b/examples/webserver-ipv6-raven/Makefile.webserver index 2ec84da1a..2001d6c7b 100644 --- a/examples/webserver-ipv6-raven/Makefile.webserver +++ b/examples/webserver-ipv6-raven/Makefile.webserver @@ -3,9 +3,7 @@ all: webserver6 APPS=raven-webserver raven-lcd-interface TARGET=avr-raven -UIP_CONF_IPV6=1 -#UIP_CONF_RPL=0 //RPL is now the default. #RF230BB=1 //Use radio driver that communicates with the core MAC layer. Now the default. #COFFEE_FILES=1 //Static coffee file system in EEPROM #COFFEE_FILES=2 //Dynamic coffee file system in EEPROM @@ -14,5 +12,5 @@ UIP_CONF_IPV6=1 #COFFEE_ADDRESS=0xnnnn //Override default coffee file system starting address CONTIKI = ../.. - +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/webserver-ipv6/Makefile b/examples/webserver-ipv6/Makefile index 25a545c27..c764d9514 100644 --- a/examples/webserver-ipv6/Makefile +++ b/examples/webserver-ipv6/Makefile @@ -34,15 +34,15 @@ all : $(CONTIKI_PROJECT) @if (test -n "$(ELF_SIZE)");then $(ELF_SIZE) $(CONTIKI_PROJECT).$(TARGET);fi endif -UIP_CONF_IPV6=1 -DEFINES=WITH_UIP6 +DEFINES=UIP_CONF_TCP=1 # Make no RPL the default for minimal-net builds ifeq ($(TARGET),minimal-net) -ifndef UIP_CONF_RPL -UIP_CONF_RPL=0 +ifndef CONTIKI_WITH_RPL +CONTIKI_WITH_RPL = 0 endif endif CONTIKI = ../.. +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/webserver/Makefile b/examples/webserver/Makefile index a5d599b93..0645e2b51 100644 --- a/examples/webserver/Makefile +++ b/examples/webserver/Makefile @@ -16,6 +16,7 @@ ifeq ($(HTTPD-CFS),1) endif CONTIKI = ../.. +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include # Intentionally httpd.c and httpd-cfs.c implement the same interface. When diff --git a/examples/wget/Makefile b/examples/wget/Makefile index 1d55fde87..91e844062 100644 --- a/examples/wget/Makefile +++ b/examples/wget/Makefile @@ -4,4 +4,5 @@ all: $(CONTIKI_PROJECT) APPS = webbrowser CONTIKI = ../.. +CONTIKI_WITH_IPV4 = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/z1/Makefile b/examples/z1/Makefile index 2f37d4da7..523a72a76 100644 --- a/examples/z1/Makefile +++ b/examples/z1/Makefile @@ -15,4 +15,5 @@ endif all: $(CONTIKI_PROJECT) CONTIKI = ../.. +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/z1/ipv6/z1-websense/Makefile b/examples/z1/ipv6/z1-websense/Makefile index 2f48df333..bc6bd979c 100644 --- a/examples/z1/ipv6/z1-websense/Makefile +++ b/examples/z1/ipv6/z1-websense/Makefile @@ -2,8 +2,6 @@ all: z1-websense CONTIKI=../../../.. -UIP_CONF_IPV6=1 - SMALL=1 APPS += webserver webbrowser @@ -13,6 +11,7 @@ CONTIKI_SOURCEFILES += wget.c PROJECTDIRS += ../../../ipv6/rpl-border-router PROJECT_SOURCEFILES += httpd-simple.c +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include $(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c diff --git a/examples/z1/rssi_scanner/Makefile b/examples/z1/rssi_scanner/Makefile deleted file mode 100644 index 2e66213f5..000000000 --- a/examples/z1/rssi_scanner/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -DEFINES=PROJECT_CONF_H=\"project-conf.h\" - -# Define the target platform -ifndef TARGET -TARGET=z1 -endif - -CONTIKI_SOURCEFILES += cc2420-arch.c sensors.c sht11.c -PROJECT_SOURCEFILES = i2cmaster.c tmp102.c adxl345.c battery-sensor.c sky-sensors.c #potentiometer-sensor.c - -# Give a name to your project -CONTIKI = ../../../../contiki-2.x/ -CONTIKI_PROJECT = rssi-scanner - -# Compile project typing "make" -all: $(CONTIKI_PROJECT) - -# Upload project typing "make upload" -upload: $(CONTIKI_PROJECT).upload - -%.class: %.java - javac $(basename $<).java - -viewrssi3d: ViewRSSI3D.class - make login | java ViewRSSI3D - -viewrssi: ViewRSSI.class - make login | java ViewRSSI - -# ContikiProjects: including the makefile -#include ../../../Makefile.projects -include $(CONTIKI)/Makefile.include - diff --git a/examples/z1/tutorials/Makefile b/examples/z1/tutorials/Makefile index 66023ece8..ad2fb57a8 100644 --- a/examples/z1/tutorials/Makefile +++ b/examples/z1/tutorials/Makefile @@ -9,6 +9,7 @@ CONTIKI_SOURCEFILES += cc2420-arch.c sensors.c sht11.c PROJECT_SOURCEFILES = i2cmaster.c tmp102.c adxl345.c battery-sensor.c sky-sensors.c #potentiometer-sensor.c all: example-unicast2 +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/platform/avr-atmega128rfa1/Makefile.avr-atmega128rfa1 b/platform/avr-atmega128rfa1/Makefile.avr-atmega128rfa1 index b9a792c85..f99e85291 100644 --- a/platform/avr-atmega128rfa1/Makefile.avr-atmega128rfa1 +++ b/platform/avr-atmega128rfa1/Makefile.avr-atmega128rfa1 @@ -31,3 +31,4 @@ AVRDUDE_MCU=m128rfa1 include $(CONTIKIAVR)/Makefile.avr include $(CONTIKIAVR)/radio/Makefile.radio +MODULES += core/net/mac core/net core/net/mac/sicslowmac core/net/mac/contikimac diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-nogui.c b/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-nogui.c index 557e08560..a92cd8449 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-nogui.c +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-nogui.c @@ -68,7 +68,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file) { /* Print out IP address of requesting host. */ #if LOG_CONF_ENABLED -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 char buf[48]; uint8_t j; j=httpd_cgi_sprint_ip6((uip_ip6addr_t)*requester, buf); @@ -77,7 +77,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file) char buf[20]; sprintf(buf, "%d.%d.%d.%d: ", requester->u8[0], requester->u8[1], requester->u8[2], requester->u8[3]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ log_message(buf, file); #endif /* LOG_CONF_ENABLED */ diff --git a/platform/avr-atmega128rfa1/contiki-conf.h b/platform/avr-atmega128rfa1/contiki-conf.h index bb08df5a3..47f5c6584 100644 --- a/platform/avr-atmega128rfa1/contiki-conf.h +++ b/platform/avr-atmega128rfa1/contiki-conf.h @@ -142,7 +142,7 @@ typedef unsigned short uip_stats_t; /* Allow MCU sleeping between channel checks */ #define RDC_CONF_MCU_SLEEP 1 -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 #define UIP_CONF_ICMP6 1 #define UIP_CONF_UDP 1 @@ -243,7 +243,13 @@ typedef unsigned short uip_stats_t; #define WITH_PHASE_OPTIMIZATION 0 #define CONTIKIMAC_CONF_COMPOWER 1 #define RIMESTATS_CONF_ENABLED 1 -#define NETSTACK_CONF_FRAMER framer_802154 + +#if NETSTACK_CONF_WITH_IPV6 +#define NETSTACK_CONF_FRAMER framer802154 +#else /* NETSTACK_CONF_WITH_IPV6 */ +#define NETSTACK_CONF_FRAMER contikimac_framer +#endif /* NETSTACK_CONF_WITH_IPV6 */ + #define NETSTACK_CONF_RADIO rf230_driver #define CHANNEL_802_15_4 26 /* The radio needs to interrupt during an rtimer interrupt */ diff --git a/platform/avr-atmega128rfa1/contiki-main.c b/platform/avr-atmega128rfa1/contiki-main.c index 5724dc7ca..8d2d8f9b7 100644 --- a/platform/avr-atmega128rfa1/contiki-main.c +++ b/platform/avr-atmega128rfa1/contiki-main.c @@ -264,7 +264,7 @@ uint8_t i; PRINTA("Random EUI64 address generated\n"); } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &addr.u8, sizeof(linkaddr_t)); #elif WITH_NODE_ID node_id=get_panaddr_from_eeprom(); @@ -278,7 +278,7 @@ uint8_t i; rf230_set_channel(params_get_channel()); rf230_set_txpower(params_get_txpower()); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 PRINTA("EUI-64 MAC: %x-%x-%x-%x-%x-%x-%x-%x\n",addr.u8[0],addr.u8[1],addr.u8[2],addr.u8[3],addr.u8[4],addr.u8[5],addr.u8[6],addr.u8[7]); #else PRINTA("MAC address "); @@ -308,7 +308,9 @@ uint8_t i; #endif /* ANNOUNCE_BOOT */ +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); +#endif #ifdef RAVEN_LCD_INTERFACE process_start(&raven_lcd_process, NULL); @@ -391,7 +393,7 @@ uint8_t i; #endif } -#if ROUTES && UIP_CONF_IPV6 +#if ROUTES && NETSTACK_CONF_WITH_IPV6 static void ipaddr_add(const uip_ipaddr_t *addr) { @@ -419,9 +421,9 @@ ipaddr_add(const uip_ipaddr_t *addr) int main(void) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uip_ds6_nbr_t *nbr; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ initialize(); while(1) { @@ -506,7 +508,7 @@ extern volatile unsigned long radioontime; clocktime+=1; #endif -#if PINGS && UIP_CONF_IPV6 +#if PINGS && NETSTACK_CONF_WITH_IPV6 extern void raven_ping6(void); if ((clocktime%PINGS)==1) { PRINTF("**Ping\n"); @@ -514,7 +516,7 @@ if ((clocktime%PINGS)==1) { } #endif -#if ROUTES && UIP_CONF_IPV6 +#if ROUTES && NETSTACK_CONF_WITH_IPV6 if ((clocktime%ROUTES)==2) { extern uip_ds6_netif_t uip_ds6_if; diff --git a/platform/avr-raven/Makefile.avr-raven b/platform/avr-raven/Makefile.avr-raven index 465e4e7ac..cf3c276c3 100644 --- a/platform/avr-raven/Makefile.avr-raven +++ b/platform/avr-raven/Makefile.avr-raven @@ -35,5 +35,5 @@ AVRDUDE_MCU=m1284p include $(CONTIKIAVR)/Makefile.avr include $(CONTIKIAVR)/radio/Makefile.radio -MODULES += core/net/ipv6 core/net/ipv4 core/net/ip core/net/mac core/net core/net/rime core/net/mac/sicslowmac \ +MODULES += core/net/mac core/net core/net/mac/sicslowmac \ core/net/llsec diff --git a/platform/avr-raven/apps/raven-webserver/webserver-nogui.c b/platform/avr-raven/apps/raven-webserver/webserver-nogui.c index 557e08560..a92cd8449 100644 --- a/platform/avr-raven/apps/raven-webserver/webserver-nogui.c +++ b/platform/avr-raven/apps/raven-webserver/webserver-nogui.c @@ -68,7 +68,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file) { /* Print out IP address of requesting host. */ #if LOG_CONF_ENABLED -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 char buf[48]; uint8_t j; j=httpd_cgi_sprint_ip6((uip_ip6addr_t)*requester, buf); @@ -77,7 +77,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file) char buf[20]; sprintf(buf, "%d.%d.%d.%d: ", requester->u8[0], requester->u8[1], requester->u8[2], requester->u8[3]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ log_message(buf, file); #endif /* LOG_CONF_ENABLED */ diff --git a/platform/avr-raven/contiki-conf.h b/platform/avr-raven/contiki-conf.h index c6ef38eba..40469aa21 100644 --- a/platform/avr-raven/contiki-conf.h +++ b/platform/avr-raven/contiki-conf.h @@ -157,19 +157,18 @@ typedef unsigned short uip_stats_t; #define PACKETBUF_CONF_HDR_SIZE 0 //RF230 combined driver/mac handles headers internally #endif /*RF230BB */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 #define UIP_CONF_ICMP6 1 #define UIP_CONF_UDP 1 #define UIP_CONF_TCP 1 -//#define UIP_CONF_IPV6_RPL 0 #define NETSTACK_CONF_NETWORK sicslowpan_driver #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 #else /* ip4 should build but is largely untested */ #define LINKADDR_CONF_SIZE 2 #define NETSTACK_CONF_NETWORK rime_driver -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_LL_802154 1 #define UIP_CONF_LLH_LEN 0 @@ -259,7 +258,13 @@ typedef unsigned short uip_stats_t; #define WITH_PHASE_OPTIMIZATION 0 #define CONTIKIMAC_CONF_COMPOWER 1 #define RIMESTATS_CONF_ENABLED 1 -#define NETSTACK_CONF_FRAMER framer_802154 + +#if NETSTACK_CONF_WITH_IPV6 +#define NETSTACK_CONF_FRAMER framer802154 +#else /* NETSTACK_CONF_WITH_IPV6 */ +#define NETSTACK_CONF_FRAMER contikimac_framer +#endif /* NETSTACK_CONF_WITH_IPV6 */ + #define NETSTACK_CONF_RADIO rf230_driver #define CHANNEL_802_15_4 26 /* The radio needs to interrupt during an rtimer interrupt */ diff --git a/platform/avr-raven/contiki-raven-main.c b/platform/avr-raven/contiki-raven-main.c index 37f37dd48..14c34fb4b 100644 --- a/platform/avr-raven/contiki-raven-main.c +++ b/platform/avr-raven/contiki-raven-main.c @@ -265,7 +265,7 @@ uint8_t i; PRINTA("Random EUI64 address generated\n"); } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &addr.u8, sizeof(linkaddr_t)); linkaddr_set_node_addr(&addr); rf230_set_pan_addr(params_get_panid(),params_get_panaddr(),(uint8_t *)&addr.u8); @@ -284,7 +284,7 @@ uint8_t i; rf230_set_channel(params_get_channel()); rf230_set_txpower(params_get_txpower()); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 PRINTA("EUI-64 MAC: %x-%x-%x-%x-%x-%x-%x-%x\n",addr.u8[0],addr.u8[1],addr.u8[2],addr.u8[3],addr.u8[4],addr.u8[5],addr.u8[6],addr.u8[7]); #else PRINTA("MAC address "); @@ -316,13 +316,17 @@ uint8_t i; // rime_init(rime_udp_init(NULL)); // uip_router_register(&rimeroute); +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); +#endif #else /* !RF230BB */ /* Original RF230 combined mac/radio driver */ /* mac process must be started before tcpip process! */ process_start(&mac_process, NULL); +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); +#endif #endif /* RF230BB */ #ifdef RAVEN_LCD_INTERFACE @@ -401,7 +405,7 @@ uint8_t i; } } -#if ROUTES && UIP_CONF_IPV6 +#if ROUTES && NETSTACK_CONF_WITH_IPV6 static void ipaddr_add(const uip_ipaddr_t *addr) { @@ -429,9 +433,9 @@ ipaddr_add(const uip_ipaddr_t *addr) int main(void) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uip_ds6_nbr_t *nbr; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ initialize(); while(1) { @@ -502,7 +506,7 @@ extern volatile unsigned long radioontime; clocktime+=1; #endif -#if PINGS && UIP_CONF_IPV6 +#if PINGS && NETSTACK_CONF_WITH_IPV6 extern void raven_ping6(void); if ((clocktime%PINGS)==1) { PRINTF("**Ping\n"); @@ -510,7 +514,7 @@ if ((clocktime%PINGS)==1) { } #endif -#if ROUTES && UIP_CONF_IPV6 +#if ROUTES && NETSTACK_CONF_WITH_IPV6 if ((clocktime%ROUTES)==2) { extern uip_ds6_netif_t uip_ds6_if; diff --git a/platform/avr-ravenusb/Makefile.avr-ravenusb b/platform/avr-ravenusb/Makefile.avr-ravenusb index 8777e1b97..b6301b329 100644 --- a/platform/avr-ravenusb/Makefile.avr-ravenusb +++ b/platform/avr-ravenusb/Makefile.avr-ravenusb @@ -42,7 +42,7 @@ CONTIKI_PLAT_DEFS = -DF_CPU=8000000UL -DAVRGCC -DAUTO_CRC_PADDING=2 -DJACKDAW=1 #The no-net build using fakeuip.c is always ipv6 CFLAGS += -I$(CONTIKI)/core/net/ipv6 -I$(CONTIKI)/core/net/ip -I$(CONTIKI)/core/net/ipv4 ifdef CONTIKI_NO_NET -CONTIKI_PLAT_DEFS+= -DUIP_CONF_IPV6=1 +CONTIKI_PLAT_DEFS+= -DNETSTACK_CONF_WITH_IPV6=1 endif @@ -67,8 +67,7 @@ include $(CONTIKIAVR)/Makefile.avr include $(CONTIKIAVR)/radio/Makefile.radio ifndef CONTIKI_NO_NET -MODULES+=core/net/ip core/net/ipv4 core/net core/net/ipv6 \ - core/net/rime core/net/mac core/net/mac/sicslowmac \ +MODULES+=core/net/mac core/net/mac/sicslowmac \ core/net/llsec else vpath %.c $(CONTIKI)/core/net/ipv6 diff --git a/platform/avr-ravenusb/contiki-conf.h b/platform/avr-ravenusb/contiki-conf.h index 9669becc9..03001d02a 100644 --- a/platform/avr-ravenusb/contiki-conf.h +++ b/platform/avr-ravenusb/contiki-conf.h @@ -217,19 +217,18 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len); #define PACKETBUF_CONF_HDR_SIZE 0 //RF230 combined driver/mac handles headers internally #endif /*RF230BB */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 #define UIP_CONF_ICMP6 1 #define UIP_CONF_UDP 1 #define UIP_CONF_TCP 0 -//#define UIP_CONF_IPV6_RPL 0 #define NETSTACK_CONF_NETWORK sicslowpan_driver #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 #else /* ip4 should build but is thoroughly untested */ #define LINKADDR_CONF_SIZE 2 #define NETSTACK_CONF_NETWORK rime_driver -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* See uip-ds6.h */ #define NBR_TABLE_CONF_MAX_NEIGHBORS 2 @@ -312,7 +311,13 @@ typedef unsigned short uip_stats_t; #define NETSTACK_CONF_MAC nullmac_driver //#define NETSTACK_CONF_MAC csma_driver #define NETSTACK_CONF_RDC contikimac_driver -#define NETSTACK_CONF_FRAMER framer_802154 + +#if NETSTACK_CONF_WITH_IPV6 +#define NETSTACK_CONF_FRAMER framer802154 +#else /* NETSTACK_CONF_WITH_IPV6 */ +#define NETSTACK_CONF_FRAMER contikimac_framer +#endif /* NETSTACK_CONF_WITH_IPV6 */ + #define NETSTACK_CONF_RADIO rf230_driver #define CHANNEL_802_15_4 26 /* Enable extended mode with autoack, but no csma/autoretry */ @@ -374,13 +379,12 @@ typedef unsigned short uip_stats_t; //#pragma mark RPL Settings /* ************************************************************************** */ -#define UIP_CONF_IPV6_RPL 0 #if UIP_CONF_IPV6_RPL /* Not completely working yet. Works on Ubuntu after $ifconfig usb0 -arp to drop the neighbor solitications */ /* Dropping the NS on other OSs is more complicated, see http://www.sics.se/~adam/wiki/index.php/Jackdaw_RNDIS_RPL_border_router */ -/* RPL requires the uip stack. Change #CONTIKI_NO_NET=1 to UIP_CONF_IPV6=1 in the examples makefile, +/* RPL requires the uip stack. Change #CONTIKI_NO_NET=1 to NETSTACK_CONF_WITH_IPV6=1 in the examples makefile, or include the needed source files in /plaftorm/avr-ravenusb/Makefile.avr-ravenusb */ /* For the present the buffer_length calcs in rpl-icmp6.c will need adjustment by the length difference between 6lowpan (0) and ethernet (14) link-layer headers: diff --git a/platform/avr-ravenusb/contiki-raven-main.c b/platform/avr-ravenusb/contiki-raven-main.c index c55448e3d..6e7f9d28c 100644 --- a/platform/avr-ravenusb/contiki-raven-main.c +++ b/platform/avr-ravenusb/contiki-raven-main.c @@ -500,7 +500,7 @@ uint16_t p=(uint16_t)&__bss_end; //Fix MAC address init_net(); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &tmp_addr.u8, 8); #endif @@ -552,7 +552,9 @@ uint16_t p=(uint16_t)&__bss_end; #else /* RF230BB */ /* The order of starting these is important! */ process_start(&mac_process, NULL); +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); +#endif #endif /* RF230BB */ /* Start ethernet network and storage process */ diff --git a/platform/avr-ravenusb/httpd-simple-avr.c b/platform/avr-ravenusb/httpd-simple-avr.c index 3d36076eb..3d225a4f4 100644 --- a/platform/avr-ravenusb/httpd-simple-avr.c +++ b/platform/avr-ravenusb/httpd-simple-avr.c @@ -253,7 +253,7 @@ PT_THREAD(generate_routes(struct httpd_state *s)) PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) TOP1); PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) TOP2); -#if UIP_CONF_IPV6 //allow ip4 builds +#if NETSTACK_CONF_WITH_IPV6 //allow ip4 builds blen = 0; ADD("

    Neighbors [%u max]

    ",NBR_TABLE_CONF_MAX_NEIGHBORS); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); @@ -296,11 +296,11 @@ PT_THREAD(generate_routes(struct httpd_state *s)) PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ blen = 0;i++; ADD("

    Hey, you got ip4 working!

    "); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) BOTTOM); diff --git a/platform/avr-ravenusb/sicslow_ethernet.c b/platform/avr-ravenusb/sicslow_ethernet.c index 9acfcd1e8..46b9244cc 100644 --- a/platform/avr-ravenusb/sicslow_ethernet.c +++ b/platform/avr-ravenusb/sicslow_ethernet.c @@ -381,7 +381,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) /* Simple Address Translation */ if(memcmp((uint8_t *)&simple_trans_ethernet_addr, &(((struct uip_eth_hdr *) ethHeader)->dest.addr[0]), 6) == 0) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 //Addressed to us: make 802.15.4 address from IPv6 Address destAddr.addr[0] = UIP_IP_BUF->destipaddr.u8[8] ^ 0x02; destAddr.addr[1] = UIP_IP_BUF->destipaddr.u8[9]; @@ -445,7 +445,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) #endif } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* Send the packet to the uip6 stack if it exists, else send to 6lowpan */ #if UIP_CONF_IPV6_RPL /* Save the destination address, to trap ponging it back to the interface */ @@ -456,9 +456,9 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) // PRINTF("Output to %x %x %x %x %x %x %x %x\n",destAddr.addr[0],destAddr.addr[1],destAddr.addr[2],destAddr.addr[3],destAddr.addr[4],destAddr.addr[5],destAddr.addr[6],destAddr.addr[7]); tcpip_output(destAddrPtr); #endif -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ tcpip_output(); //Allow non-ipv6 builds (Hello World) -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #if !RF230BB usb_eth_stat.txok++; @@ -481,11 +481,8 @@ void mac_LowpanToEthernet(void) //Setup generic ethernet stuff ETHBUF(uip_buf)->type = uip_htons(UIP_ETHTYPE_IPV6); - //Check for broadcast message - #if RF230BB - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { -// if(linkaddr_cmp((const linkaddr_t *)destAddr, &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { #else if( ( parsed_frame->fcf->destAddrMode == SHORTADDRMODE) && ( parsed_frame->dest_addr->addr16 == 0xffff) ) { @@ -493,7 +490,7 @@ void mac_LowpanToEthernet(void) ETHBUF(uip_buf)->dest.addr[0] = 0x33; ETHBUF(uip_buf)->dest.addr[1] = 0x33; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 ETHBUF(uip_buf)->dest.addr[2] = UIP_IP_BUF->destipaddr.u8[12]; ETHBUF(uip_buf)->dest.addr[3] = UIP_IP_BUF->destipaddr.u8[13]; ETHBUF(uip_buf)->dest.addr[4] = UIP_IP_BUF->destipaddr.u8[14]; @@ -712,7 +709,7 @@ int8_t mac_translateIcmpLinkLayer(lltype_t target) //We broke ICMP checksum, be sure to fix that UIP_ICMP_BUF->icmpchksum = 0; -#if UIP_CONF_IPV6 //allow non ipv6 builds +#if NETSTACK_CONF_WITH_IPV6 //allow non ipv6 builds UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); #endif @@ -977,7 +974,7 @@ mac_log_802_15_4_tx(const uint8_t* buffer, size_t total_len) { ETHBUF(raw_buf)->type = uip_htons(0x809A); //UIP_ETHTYPE_802154 0x809A /* Check for broadcast message */ - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { ETHBUF(raw_buf)->dest.addr[0] = 0x33; ETHBUF(raw_buf)->dest.addr[1] = 0x33; ETHBUF(raw_buf)->dest.addr[2] = 0x00; @@ -1018,7 +1015,7 @@ mac_log_802_15_4_rx(const uint8_t* buf, size_t len) { ETHBUF(raw_buf)->type = uip_htons(0x809A); //UIP_ETHTYPE_802154 0x809A /* Check for broadcast message */ - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { ETHBUF(raw_buf)->dest.addr[0] = 0x33; ETHBUF(raw_buf)->dest.addr[1] = 0x33; ETHBUF(raw_buf)->dest.addr[2] = 0x00; diff --git a/platform/avr-rcb/contiki-conf.h b/platform/avr-rcb/contiki-conf.h index d10edf4f1..2556c310b 100644 --- a/platform/avr-rcb/contiki-conf.h +++ b/platform/avr-rcb/contiki-conf.h @@ -92,7 +92,7 @@ void clock_adjust_ticks(clock_time_t howmany); #define CCIF #define CLIF -//#define UIP_CONF_IPV6 1 //Let makefile determine this so ipv4 hello-world will compile +//#define NETSTACK_CONF_WITH_IPV6 1 //Let makefile determine this so ipv4 hello-world will compile #define LINKADDR_CONF_SIZE 8 #define PACKETBUF_CONF_HDR_SIZE 0 @@ -124,7 +124,7 @@ void clock_adjust_ticks(clock_time_t howmany); #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 -#if UIP_CONF_IPV6 //tcpip.c error on ipv4 build if UIP_CONF_ICMP6 defined +#if NETSTACK_CONF_WITH_IPV6 //tcpip.c error on ipv4 build if UIP_CONF_ICMP6 defined #define UIP_CONF_ICMP6 1 #endif diff --git a/platform/avr-rcb/contiki-rcb-main.c b/platform/avr-rcb/contiki-rcb-main.c index 4a6a98e22..7516c27dc 100644 --- a/platform/avr-rcb/contiki-rcb-main.c +++ b/platform/avr-rcb/contiki-rcb-main.c @@ -74,9 +74,17 @@ FUSES = PROCESS(rcb_leds, "RCB leds process"); #if RF230BB +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 PROCINIT(&etimer_process, &tcpip_process, &rcb_leds); #else +PROCINIT(&etimer_process, &rcb_leds); +#endif +#else +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 PROCINIT(&etimer_process, &mac_process, &tcpip_process, &rcb_leds); +#else +PROCINIT(&etimer_process, &mac_process, &rcb_leds); +#endif #endif /* Put default MAC address in EEPROM */ @@ -115,7 +123,7 @@ PROCESS_THREAD(rcb_leds, ev, data) while(1) { PROCESS_YIELD(); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 if (ev == ICMP6_ECHO_REQUEST) { #else if (1) { diff --git a/platform/avr-zigbit/contiki-avr-zigbit-main.c b/platform/avr-zigbit/contiki-avr-zigbit-main.c index 9b8f3e9e4..a12010809 100644 --- a/platform/avr-zigbit/contiki-avr-zigbit-main.c +++ b/platform/avr-zigbit/contiki-avr-zigbit-main.c @@ -82,9 +82,17 @@ FUSES = }; #if RF230BB +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 //PROCINIT(&etimer_process, &tcpip_process ); #else +//PROCINIT(&etimer_process ); +#endif +#else +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 PROCINIT(&etimer_process, &mac_process, &tcpip_process ); +#else +PROCINIT(&etimer_process, &mac_process ); +#endif #endif /* Put default MAC address in EEPROM */ uint8_t mac_address[8] EEMEM = {0x02, 0x11, 0x22, 0xff, 0xfe, 0x33, 0x44, 0x55}; @@ -124,7 +132,7 @@ init_lowlevel(void) memset(&addr, 0, sizeof(linkaddr_t)); eeprom_read_block ((void *)&addr.u8, &mac_address, 8); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &addr.u8, 8); #endif rf230_set_pan_addr(IEEE802154_PANID, 0, (uint8_t *)&addr.u8); @@ -162,13 +170,15 @@ init_lowlevel(void) rime_init(rime_udp_init(NULL)); uip_router_register(&rimeroute); #endif - +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); - +#endif #else /* mac process must be started before tcpip process! */ process_start(&mac_process, NULL); +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); +#endif #endif /*RF230BB*/ } diff --git a/platform/avr-zigbit/contiki-conf.h b/platform/avr-zigbit/contiki-conf.h index af5be6f7b..57178721d 100644 --- a/platform/avr-zigbit/contiki-conf.h +++ b/platform/avr-zigbit/contiki-conf.h @@ -98,8 +98,8 @@ void clock_adjust_ticks(clock_time_t howmany); #define LINKADDR_CONF_SIZE 8 #define PACKETBUF_CONF_HDR_SIZE 0 -//define UIP_CONF_IPV6 1 //Let the makefile do this, allows hello-world to compile -#if UIP_CONF_IPV6 +//define NETSTACK_CONF_WITH_IPV6 1 //Let the makefile do this, allows hello-world to compile +#if NETSTACK_CONF_WITH_IPV6 #define UIP_CONF_ICMP6 1 #define UIP_CONF_UDP 1 #define UIP_CONF_TCP 1 @@ -113,7 +113,7 @@ void clock_adjust_ticks(clock_time_t howmany); #define UIP_CONF_LLH_LEN 0 /* No radio cycling */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define NETSTACK_CONF_NETWORK sicslowpan_driver #else #define NETSTACK_CONF_NETWORK rime_driver diff --git a/platform/cc2530dk/Makefile.cc2530dk b/platform/cc2530dk/Makefile.cc2530dk index 8423843eb..77c7d6e14 100644 --- a/platform/cc2530dk/Makefile.cc2530dk +++ b/platform/cc2530dk/Makefile.cc2530dk @@ -19,7 +19,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) CLEAN += *.cc2530dk -ifeq ($(UIP_CONF_IPV6),1) +ifeq ($(CONTIKI_WITH_IPV6),1) CONTIKI_TARGET_SOURCEFILES += viztool.c endif @@ -47,5 +47,5 @@ CONTIKI_CPU=$(CONTIKI)/cpu/cc253x include $(CONTIKI_CPU)/Makefile.cc253x # Default modules -MODULES += core/net/ip core/net/ipv6 core/net/rime core/net core/net/mac core/net/rpl \ +MODULES += core/net core/net/mac \ core/net/llsec diff --git a/platform/cc2530dk/contiki-conf.h b/platform/cc2530dk/contiki-conf.h index d176a6756..ef933dc1c 100644 --- a/platform/cc2530dk/contiki-conf.h +++ b/platform/cc2530dk/contiki-conf.h @@ -157,19 +157,19 @@ #endif /* Viztool on by default for IPv6 builds */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #ifndef VIZTOOL_CONF_ON #define VIZTOOL_CONF_ON 1 #endif /* VIZTOOL_CONF_ON */ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Network Stack */ #ifndef NETSTACK_CONF_NETWORK -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define NETSTACK_CONF_NETWORK sicslowpan_driver #else #define NETSTACK_CONF_NETWORK rime_driver -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #endif /* NETSTACK_CONF_NETWORK */ #ifndef NETSTACK_CONF_MAC @@ -193,7 +193,9 @@ #define NETSTACK_CONF_RADIO cc2530_rf_driver /* RF Config */ -#define IEEE802154_CONF_PANID 0x5449 /* TI */ +#ifndef IEEE802154_CONF_PANID +#define IEEE802154_CONF_PANID 0xABCD +#endif #ifndef CC2530_RF_CONF_CHANNEL #define CC2530_RF_CONF_CHANNEL 25 @@ -203,7 +205,7 @@ #define CC2530_RF_CONF_AUTOACK 1 #endif /* CC2530_CONF_AUTOACK */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* Addresses, Sizes and Interfaces */ /* 8-byte addresses here, 2 otherwise */ #define LINKADDR_CONF_SIZE 8 @@ -267,13 +269,13 @@ #define QUEUEBUF_CONF_NUM 6 #endif -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 108 #define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 #define QUEUEBUF_CONF_NUM 8 -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Prevent SDCC compile error when UIP_CONF_ROUTER == 0 */ #if !UIP_CONF_ROUTER diff --git a/platform/cc2530dk/contiki-main.c b/platform/cc2530dk/contiki-main.c index 22f458da8..88c7763a4 100644 --- a/platform/cc2530dk/contiki-main.c +++ b/platform/cc2530dk/contiki-main.c @@ -260,11 +260,11 @@ main(void) CC_NON_BANKED ADC_SENSOR_ACTIVATE(); #endif -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr)); queuebuf_init(); process_start(&tcpip_process, NULL); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #if VIZTOOL_CONF_ON process_start(&viztool_process, NULL); diff --git a/platform/cc2530dk/uip-debug.c b/platform/cc2530dk/uip-debug.c index ee7942664..5f5b23ca8 100644 --- a/platform/cc2530dk/uip-debug.c +++ b/platform/cc2530dk/uip-debug.c @@ -43,7 +43,7 @@ void uip_debug_ipaddr_print(const uip_ipaddr_t *addr) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint16_t a; unsigned int i; int f; @@ -63,9 +63,9 @@ uip_debug_ipaddr_print(const uip_ipaddr_t *addr) puthex(a & 0xFF); } } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ PRINTA("%u.%u.%u.%u", addr->u8[0], addr->u8[1], addr->u8[2], addr->u8[3]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } /*---------------------------------------------------------------------------*/ void diff --git a/platform/cc2538dk/Makefile.cc2538dk b/platform/cc2538dk/Makefile.cc2538dk index e5c5a7ab9..a760ee5a1 100644 --- a/platform/cc2538dk/Makefile.cc2538dk +++ b/platform/cc2538dk/Makefile.cc2538dk @@ -27,8 +27,8 @@ endif CONTIKI_CPU=$(CONTIKI)/cpu/cc2538 include $(CONTIKI_CPU)/Makefile.cc2538 -MODULES += core/net core/net/ipv6 core/net/mac core/net/ip \ - core/net/rpl core/net/rime core/net/mac/contikimac \ +MODULES += core/net core/net/mac \ + core/net/mac/contikimac \ core/net/llsec BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py diff --git a/platform/cc2538dk/contiki-conf.h b/platform/cc2538dk/contiki-conf.h index 141a62ce2..84d78d9a1 100644 --- a/platform/cc2538dk/contiki-conf.h +++ b/platform/cc2538dk/contiki-conf.h @@ -288,11 +288,11 @@ typedef uint32_t rtimer_clock_t; * @{ */ #ifndef NETSTACK_CONF_NETWORK -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define NETSTACK_CONF_NETWORK sicslowpan_driver #else #define NETSTACK_CONF_NETWORK rime_driver -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #endif /* NETSTACK_CONF_NETWORK */ #ifndef NETSTACK_CONF_MAC @@ -316,8 +316,12 @@ typedef uint32_t rtimer_clock_t; #endif #ifndef NETSTACK_CONF_FRAMER +#if NETSTACK_CONF_WITH_IPV6 #define NETSTACK_CONF_FRAMER framer_802154 -#endif +#else /* NETSTACK_CONF_WITH_IPV6 */ +#define NETSTACK_CONF_FRAMER contikimac_framer +#endif /* NETSTACK_CONF_WITH_IPV6 */ +#endif /* NETSTACK_CONF_FRAMER */ #define NETSTACK_CONF_RADIO cc2538_rf_driver /** @} */ @@ -386,7 +390,7 @@ typedef uint32_t rtimer_clock_t; */ /* RF Config */ #ifndef IEEE802154_CONF_PANID -#define IEEE802154_CONF_PANID 0x5449 /**< Default PAN ID: TI */ +#define IEEE802154_CONF_PANID 0xABCD #endif #ifndef CC2538_RF_CONF_CHANNEL @@ -413,11 +417,11 @@ typedef uint32_t rtimer_clock_t; */ /* Don't let contiki-default-conf.h decide if we are an IPv6 build */ -#ifndef UIP_CONF_IPV6 -#define UIP_CONF_IPV6 0 +#ifndef NETSTACK_CONF_WITH_IPV6 +#define NETSTACK_CONF_WITH_IPV6 0 #endif -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* Addresses, Sizes and Interfaces */ /* 8-byte addresses here, 2 otherwise */ #define LINKADDR_CONF_SIZE 8 @@ -441,10 +445,6 @@ typedef uint32_t rtimer_clock_t; #define UIP_CONF_ROUTER 1 #endif -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif - #define UIP_CONF_ND6_SEND_RA 0 #define UIP_CONF_IP_FORWARD 0 #define RPL_CONF_STATS 0 @@ -498,7 +498,7 @@ typedef uint32_t rtimer_clock_t; #define QUEUEBUF_CONF_NUM 8 #endif /*---------------------------------------------------------------------------*/ -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ #define UIP_CONF_IP_FORWARD 1 @@ -512,7 +512,7 @@ typedef uint32_t rtimer_clock_t; #define QUEUEBUF_CONF_NUM 8 #endif -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /** @} */ /*---------------------------------------------------------------------------*/ diff --git a/platform/cc2538dk/contiki-main.c b/platform/cc2538dk/contiki-main.c index 88163e217..c66faed33 100644 --- a/platform/cc2538dk/contiki-main.c +++ b/platform/cc2538dk/contiki-main.c @@ -202,11 +202,11 @@ main(void) set_rf_params(); netstack_init(); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr)); queuebuf_init(); process_start(&tcpip_process, NULL); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ process_start(&sensors_process, NULL); diff --git a/platform/cooja/Makefile.cooja b/platform/cooja/Makefile.cooja index bfaa76044..574def7c7 100644 --- a/platform/cooja/Makefile.cooja +++ b/platform/cooja/Makefile.cooja @@ -74,21 +74,29 @@ CONTIKI_CPU=$(CONTIKI)/cpu/x86 CFLAGSNO = $(EXTRA_CC_ARGS) -Wall -g -I/usr/local/include -DCLASSNAME=$(CLASSNAME) CFLAGS += $(CFLAGSNO) -ifeq ($(UIP_CONF_IPV6),1) - CFLAGS += -DWITH_UIP6=1 -endif -ifdef WITH_UIP - CFLAGS += -DWITH_UIP=1 -endif +MODULES += core/net core/net/mac \ + core/net/llsec ## Copied from Makefile.include, since Cooja overrides CFLAGS et al -ifeq ($(UIP_CONF_IPV6),1) - CFLAGS += -DUIP_CONF_IPV6=1 - ifneq ($(UIP_CONF_RPL),0) - CFLAGS += -DUIP_CONF_IPV6_RPL=1 - endif # UIP_CONF_RPL -endif # UIP_CONF_IPV6 +HAS_STACK = 0 +ifeq ($(CONTIKI_WITH_IPV4),1) + HAS_STACK = 1 + CFLAGS += -DNETSTACK_CONF_WITH_IPV4=1 +endif -MODULES += core/net core/net/ip core/net/ipv4 \ - core/net/ipv6 core/net/mac core/net/rime core/net/rpl \ - core/net/llsec +ifeq ($(CONTIKI_WITH_RIME),1) + HAS_STACK = 1 + CFLAGS += -DNETSTACK_CONF_WITH_RIME=1 +endif + +# Make IPv6 the default stack +ifeq ($(HAS_STACK),0) +CONTIKI_WITH_IPV6 = 1 +endif + +ifeq ($(CONTIKI_WITH_IPV6),1) + CFLAGS += -DNETSTACK_CONF_WITH_IPV6=1 + ifneq ($(CONTIKI_WITH_RPL),0) + CFLAGS += -DUIP_CONF_IPV6_RPL=1 + endif +endif diff --git a/platform/cooja/contiki-conf.h b/platform/cooja/contiki-conf.h index 1dde2917a..d6601bdca 100644 --- a/platform/cooja/contiki-conf.h +++ b/platform/cooja/contiki-conf.h @@ -47,11 +47,11 @@ #define w_memcpy memcpy -#if WITH_UIP -#if WITH_UIP6 -#error WITH_UIP && WITH_IP6: Bad configuration -#endif /* WITH_UIP6 */ -#endif /* WITH_UIP */ +#if NETSTACK_CONF_WITH_IPV4 +#if NETSTACK_CONF_WITH_IPV6 +#error NETSTACK_CONF_WITH_IPV4 && NETSTACK_CONF_WITH_IPV6: Bad configuration +#endif /* NETSTACK_CONF_WITH_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ #ifdef NETSTACK_CONF_H @@ -63,7 +63,7 @@ #else /* NETSTACK_CONF_H */ /* Default network config */ -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #define NULLRDC_CONF_802154_AUTOACK 1 #define NULLRDC_CONF_SEND_802154_ACK 1 @@ -78,9 +78,9 @@ #define NETSTACK_CONF_RADIO cooja_radio_driver #define NETSTACK_CONF_FRAMER framer_802154 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 /* Network setup for IPv4 */ #define NETSTACK_CONF_NETWORK rime_driver /* NOTE: uip_over_mesh. else: uip_driver */ @@ -89,7 +89,7 @@ #define NETSTACK_CONF_RADIO cooja_radio_driver #define UIP_CONF_IP_FORWARD 1 -#else /* WITH_UIP */ +#else /* NETSTACK_CONF_WITH_IPV4 */ /* Network setup for Rime */ #define NETSTACK_CONF_NETWORK rime_driver @@ -98,15 +98,15 @@ #define NETSTACK_CONF_RADIO cooja_radio_driver /*#define NETSTACK_CONF_FRAMER framer_nullmac*/ -#endif /* WITH_UIP */ -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #endif /* NETSTACK_CONF_H */ #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 /* Default network config */ -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 @@ -116,7 +116,7 @@ #define NETSTACK_CONF_RDC nullrdc_driver #define NETSTACK_CONF_RADIO cooja_radio_driver #define NETSTACK_CONF_FRAMER framer_802154 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #define LINKADDR_CONF_SIZE 8 @@ -124,9 +124,6 @@ #define UIP_CONF_LLH_LEN 0 #define UIP_CONF_ROUTER 1 -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ #ifndef NBR_TABLE_CONF_MAX_NEIGHBORS @@ -174,7 +171,7 @@ #define SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS 8 #endif /* SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS */ -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define PACKETBUF_CONF_ATTRS_INLINE 1 @@ -232,8 +229,8 @@ typedef unsigned long rtimer_clock_t; #define UIP_CONF_TCP_SPLIT 0 -#if UIP_CONF_IPV6 -#endif /* UIP_CONF_IPV6 */ +#if NETSTACK_CONF_WITH_IPV6 +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Turn off example-provided putchars */ #define SLIP_BRIDGE_CONF_NO_PUTCHAR 1 diff --git a/platform/cooja/contiki-cooja-main.c b/platform/cooja/contiki-cooja-main.c index 0f1e4eb3e..084c605cc 100644 --- a/platform/cooja/contiki-cooja-main.c +++ b/platform/cooja/contiki-cooja-main.c @@ -75,10 +75,10 @@ #define Java_org_contikios_cooja_corecomm_CLASSNAME_tick COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_tick) #define Java_org_contikios_cooja_corecomm_CLASSNAME_setReferenceAddress COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_setReferenceAddress) -#ifndef WITH_UIP -#define WITH_UIP 0 +#ifndef NETSTACK_CONF_WITH_IPV4 +#define NETSTACK_CONF_WITH_IPV4 0 #endif -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 #include "dev/rs232.h" #include "dev/slip.h" #include "net/ip/uip.h" @@ -92,16 +92,16 @@ static struct uip_fw_netif meshif = #define UIP_OVER_MESH_CHANNEL 8 static uint8_t is_gateway; -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ -#ifndef WITH_UIP6 -#define WITH_UIP6 0 +#ifndef NETSTACK_CONF_WITH_IPV6 +#define NETSTACK_CONF_WITH_IPV6 0 #endif -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ip/uip.h" #include "net/ipv6/uip-ds6.h" #define PRINT6ADDR(addr) printf("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Simulation mote interfaces */ SIM_INTERFACE_NAME(moteid_interface); @@ -139,7 +139,7 @@ static struct cooja_mt_thread process_run_thread; #define MIN(a, b) ( (a)<(b) ? (a) : (b) ) /*---------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 static void set_gateway(void) { @@ -153,7 +153,7 @@ set_gateway(void) is_gateway = 1; } } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ static void print_processes(struct process * const processes[]) @@ -186,15 +186,15 @@ set_rime_addr(void) int i; memset(&addr, 0, sizeof(linkaddr_t)); -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 for(i = 0; i < sizeof(uip_lladdr.addr); i += 2) { addr.u8[i + 1] = node_id & 0xff; addr.u8[i + 0] = node_id >> 8; } -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ addr.u8[0] = node_id & 0xff; addr.u8[1] = node_id >> 8; -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ linkaddr_set_node_addr(&addr); printf("Rime started with address "); for(i = 0; i < sizeof(addr.u8) - 1; i++) { @@ -246,7 +246,7 @@ contiki_init() CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1: NETSTACK_RDC.channel_check_interval())); -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 /* IPv4 CONFIGURATION */ { uip_ipaddr_t hostaddr, netmask; @@ -273,9 +273,9 @@ contiki_init() rs232_set_input(slip_input_byte); printf("IPv4 address: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&hostaddr)); } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* IPv6 CONFIGURATION */ { int i; @@ -317,7 +317,7 @@ contiki_init() ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]); } } -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Initialize eeprom */ eeprom_init(); diff --git a/platform/cooja/dev/ip.c b/platform/cooja/dev/ip.c index de513d074..7a637c8ac 100644 --- a/platform/cooja/dev/ip.c +++ b/platform/cooja/dev/ip.c @@ -37,31 +37,31 @@ const struct simInterface ip_interface; // COOJA variables -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 char simIPChanged; char simIP[16]; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 char simIPChanged; char simIP[4]; -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*-----------------------------------------------------------------------------------*/ static void doInterfaceActionsBeforeTick(void) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* check if IPv6 address should change */ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 /* check if IPv4 address should change */ /* @@ -73,7 +73,7 @@ doInterfaceActionsBeforeTick(void) } */ -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ } /*-----------------------------------------------------------------------------------*/ static void diff --git a/platform/cooja/sys/log.c b/platform/cooja/sys/log.c index a5f11958d..7d03ae2ce 100644 --- a/platform/cooja/sys/log.c +++ b/platform/cooja/sys/log.c @@ -36,13 +36,13 @@ #define IMPLEMENT_PRINTF 1 -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 /* uIP packets via SLIP */ #include "uip.h" #define MAX_LOG_LENGTH (2*UIP_BUFSIZE) -#else /* WITH_UIP */ +#else /* NETSTACK_CONF_WITH_IPV4 */ #define MAX_LOG_LENGTH 1024 -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ #if MAX_LOG_LENGTH < 1024 #undef MAX_LOG_LENGTH diff --git a/platform/econotag/Makefile.econotag b/platform/econotag/Makefile.econotag index 53493e6f1..1567de910 100644 --- a/platform/econotag/Makefile.econotag +++ b/platform/econotag/Makefile.econotag @@ -14,12 +14,8 @@ CONTIKI_PLAT_DEFS = MCU=arm7tdmi-s -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - include $(CONTIKIMC1322X)/Makefile.mc1322x -MODULES+=core/net/ip core/net/ipv4 core/net core/net/rpl \ - core/net/ipv6 core/net/rime core/net/mac \ +MODULES+=core/net \ + core/net/mac \ core/net/llsec diff --git a/platform/econotag/contiki-conf.h b/platform/econotag/contiki-conf.h index 45968d401..871145f20 100644 --- a/platform/econotag/contiki-conf.h +++ b/platform/econotag/contiki-conf.h @@ -108,7 +108,7 @@ #define LINKADDR_CONF_SIZE 8 -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver #define NETSTACK_CONF_MAC nullmac_driver @@ -121,7 +121,7 @@ #define CXMAC_CONF_ANNOUNCEMENTS 0 #define XMAC_CONF_ANNOUNCEMENTS 0 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ #define NETSTACK_CONF_NETWORK rime_driver @@ -144,7 +144,7 @@ #define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define QUEUEBUF_CONF_NUM 16 @@ -169,7 +169,7 @@ #define PROCESS_CONF_NUMEVENTS 8 #define PROCESS_CONF_STATS 1 -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 @@ -180,10 +180,6 @@ #define UIP_CONF_ROUTER 1 #endif -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif - #define NBR_TABLE_CONF_MAX_NEIGHBORS 30 #define UIP_CONF_MAX_ROUTES 30 @@ -191,7 +187,7 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #define UIP_CONF_IPV6_QUEUE_PKT 0 #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_REASSEMBLY 0 @@ -213,10 +209,10 @@ #endif /* SICSLOWPAN_CONF_FRAG */ #define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 1300 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_ICMP_DEST_UNREACH 1 diff --git a/platform/econotag/main.c b/platform/econotag/main.c index a3218fdb0..55b9737c8 100644 --- a/platform/econotag/main.c +++ b/platform/econotag/main.c @@ -124,7 +124,7 @@ int main(void) { /* configure address on maca hardware and RIME */ contiki_maca_set_mac_address(mc1322x_config.eui); -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &linkaddr_node_addr.u8, sizeof(uip_lladdr.addr)); queuebuf_init(); NETSTACK_RDC.init(); @@ -137,7 +137,7 @@ int main(void) { #if DEBUG_ANNOTATE print_lladdrs(); #endif -#endif /* endif WITH_UIP6 */ +#endif /* endif NETSTACK_CONF_WITH_IPV6 */ process_start(&sensors_process, NULL); diff --git a/platform/ev-aducrf101mkxz/Makefile.ev-aducrf101mkxz b/platform/ev-aducrf101mkxz/Makefile.ev-aducrf101mkxz index dfa36785e..6e5246e85 100644 --- a/platform/ev-aducrf101mkxz/Makefile.ev-aducrf101mkxz +++ b/platform/ev-aducrf101mkxz/Makefile.ev-aducrf101mkxz @@ -48,19 +48,10 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) CONTIKI_PLAT_DEFS = -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - include $(CONTIKI)/cpu/arm/aducrf101/Makefile.aducrf101 MODULES += \ core/net \ - core/net/rpl \ - core/net/ip \ - core/net/ipv4 \ - core/net/ipv6 \ - core/net/rime \ core/net/mac \ core/net/mac/sicslowmac \ core/net/llsec diff --git a/platform/ev-aducrf101mkxz/contiki-conf.h b/platform/ev-aducrf101mkxz/contiki-conf.h index 7cdc5ea7f..c0df15b8a 100644 --- a/platform/ev-aducrf101mkxz/contiki-conf.h +++ b/platform/ev-aducrf101mkxz/contiki-conf.h @@ -55,7 +55,7 @@ #define LINKADDR_CONF_SIZE 8 -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver #define NETSTACK_CONF_MAC nullmac_driver @@ -68,7 +68,7 @@ #define CXMAC_CONF_ANNOUNCEMENTS 0 #define XMAC_CONF_ANNOUNCEMENTS 0 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ #define NETSTACK_CONF_NETWORK rime_driver @@ -91,7 +91,7 @@ #define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 16 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define QUEUEBUF_CONF_NUM 4 @@ -116,7 +116,7 @@ #define PROCESS_CONF_NUMEVENTS 8 #define PROCESS_CONF_STATS 1 -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 @@ -127,10 +127,6 @@ #define UIP_CONF_ROUTER 1 #endif -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif - #define NBR_TABLE_CONF_MAX_NEIGHBORS 16 #define UIP_CONF_MAX_ROUTES 16 @@ -138,7 +134,7 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #define UIP_CONF_IPV6_QUEUE_PKT 0 #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_REASSEMBLY 0 @@ -160,10 +156,10 @@ #endif /* SICSLOWPAN_CONF_FRAG */ #define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 140 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_ICMP_DEST_UNREACH 1 diff --git a/platform/ev-aducrf101mkxz/contiki-main.c b/platform/ev-aducrf101mkxz/contiki-main.c index 134380501..c1db305e6 100644 --- a/platform/ev-aducrf101mkxz/contiki-main.c +++ b/platform/ev-aducrf101mkxz/contiki-main.c @@ -49,9 +49,9 @@ #include "dev/button-sensor.h" #include "dev/leds.h" -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-ds6.h" -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include "net/rime/rime.h" @@ -75,7 +75,7 @@ set_rime_addr(void) int i; memset(&addr, 0, sizeof(linkaddr_t)); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(addr.u8, serial_id, sizeof(addr.u8)); #else if(node_id == 0) { @@ -115,7 +115,7 @@ main(int argc, char **argv) uart_init(115200); clock_init(); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #if UIP_CONF_IPV6_RPL printf(CONTIKI_VERSION_STRING " started with IPV6, RPL\n"); #else @@ -142,7 +142,7 @@ main(int argc, char **argv) printf("MAC %s RDC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name); -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, serial_id, sizeof(uip_lladdr.addr)); process_start(&tcpip_process, NULL); @@ -159,7 +159,7 @@ main(int argc, char **argv) /* make it hardcoded... */ lladdr->state = ADDR_AUTOCONF; } -#else +#elif NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); #endif diff --git a/platform/eval-adf7xxxmb4z/Makefile.eval-adf7xxxmb4z b/platform/eval-adf7xxxmb4z/Makefile.eval-adf7xxxmb4z index 0d7ec1faa..42478c940 100644 --- a/platform/eval-adf7xxxmb4z/Makefile.eval-adf7xxxmb4z +++ b/platform/eval-adf7xxxmb4z/Makefile.eval-adf7xxxmb4z @@ -51,10 +51,6 @@ CONTIKIBOARD = . CONTIKI_PLAT_DEFS = -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - include $(CONTIKIRL78)/Makefile.rl78 PROG_UART ?= /dev/ttyUSB1 @@ -62,6 +58,6 @@ PROG_UART ?= /dev/ttyUSB1 run: $(CONTIKI_PROJECT).$(TARGET).srec ~/adi-contiki/github/rl78flash/rl78flash -vv -i -m3 $(PROG_UART) -b500000 -a $< -MODULES+=core/net/ip core/net/ipv4 core/net core/net/rpl \ - core/net/ipv6 core/net/rime core/net/mac core/net/mac/sicslowmac \ +MODULES+=core/net \ + core/net/mac core/net/mac/sicslowmac \ core/net/llsec diff --git a/platform/eval-adf7xxxmb4z/contiki-conf.h b/platform/eval-adf7xxxmb4z/contiki-conf.h index 3fbe695c9..e983d7eba 100644 --- a/platform/eval-adf7xxxmb4z/contiki-conf.h +++ b/platform/eval-adf7xxxmb4z/contiki-conf.h @@ -58,7 +58,7 @@ #define LINKADDR_CONF_SIZE 8 -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver #define NETSTACK_CONF_MAC nullmac_driver @@ -71,7 +71,7 @@ #define CXMAC_CONF_ANNOUNCEMENTS 0 #define XMAC_CONF_ANNOUNCEMENTS 0 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ #define NETSTACK_CONF_NETWORK rime_driver @@ -94,7 +94,7 @@ #define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define QUEUEBUF_CONF_NUM 16 @@ -119,7 +119,7 @@ #define PROCESS_CONF_NUMEVENTS 8 #define PROCESS_CONF_STATS 1 -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 @@ -130,10 +130,6 @@ #define UIP_CONF_ROUTER 1 #endif -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif - #define NBR_TABLE_CONF_MAX_NEIGHBORS 30 #define UIP_CONF_MAX_ROUTES 30 @@ -141,7 +137,7 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #define UIP_CONF_IPV6_QUEUE_PKT 0 #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_REASSEMBLY 0 @@ -163,10 +159,10 @@ #endif /* SICSLOWPAN_CONF_FRAG */ #define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 1300 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_ICMP_DEST_UNREACH 1 diff --git a/platform/eval-adf7xxxmb4z/contiki-main.c b/platform/eval-adf7xxxmb4z/contiki-main.c index e82d78aa9..0a7d3f203 100644 --- a/platform/eval-adf7xxxmb4z/contiki-main.c +++ b/platform/eval-adf7xxxmb4z/contiki-main.c @@ -45,9 +45,9 @@ #include "dev/button-sensor.h" -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-ds6.h" -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include "net/rime/rime.h" #include "uart0.h" @@ -76,7 +76,7 @@ set_rime_addr(void) int i; memset(&addr, 0, sizeof(linkaddr_t)); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(addr.u8, serial_id, sizeof(addr.u8)); #else if(node_id == 0) { @@ -158,7 +158,7 @@ main(int argc, char **argv) PM3 &= ~BIT(0); /* LED7 */ PM5 &= ~BIT(0); /* LED8 */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #if UIP_CONF_IPV6_RPL printf(CONTIKI_VERSION_STRING " started with IPV6, RPL" NEWLINE); #else @@ -183,7 +183,7 @@ main(int argc, char **argv) netstack_init(); printf("MAC %s RDC %s NETWORK %s" NEWLINE, NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name); -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, serial_id, sizeof(uip_lladdr.addr)); process_start(&tcpip_process, NULL); @@ -201,7 +201,7 @@ main(int argc, char **argv) printf("%02x%02x" NEWLINE, lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]); } -#else +#elif NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); #endif diff --git a/platform/exp5438/Makefile.exp5438 b/platform/exp5438/Makefile.exp5438 index e62f9aec4..04296f41f 100644 --- a/platform/exp5438/Makefile.exp5438 +++ b/platform/exp5438/Makefile.exp5438 @@ -1,8 +1,8 @@ # $Id: Makefile.z1,v 1.4 2010/11/07 08:40:24 enricmcalvo Exp $ # msp430flasher -n msp430x5437 -w "Firmware.txt" -v -z [VCC] -MODULES += core/net core/net/ip core/net/ipv6 core/net/ipv4 \ - core/net/mac core/net/rpl core/net/rime core/net/mac/contikimac \ +MODULES += core/net \ + core/net/mac core/net/mac/contikimac \ core/net/llsec dev/cc2420 ifdef IAR @@ -44,10 +44,6 @@ ifndef CONTIKI_TARGET_MAIN CONTIKI_TARGET_MAIN = contiki-exp5438-main.c endif -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) ifdef IAR diff --git a/platform/exp5438/contiki-conf.h b/platform/exp5438/contiki-conf.h index 29901103a..ff23e07a6 100644 --- a/platform/exp5438/contiki-conf.h +++ b/platform/exp5438/contiki-conf.h @@ -26,7 +26,11 @@ #endif /* NETSTACK_CONF_RADIO */ #ifndef NETSTACK_CONF_FRAMER +#if NETSTACK_CONF_WITH_IPV6 #define NETSTACK_CONF_FRAMER framer_802154 +#else /* NETSTACK_CONF_WITH_IPV6 */ +#define NETSTACK_CONF_FRAMER contikimac_framer +#endif /* NETSTACK_CONF_WITH_IPV6 */ #endif /* NETSTACK_CONF_FRAMER */ #ifndef CC2420_CONF_AUTOACK @@ -35,7 +39,7 @@ #define NULLRDC_CONF_802154_AUTOACK 1 -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver @@ -52,7 +56,7 @@ #define QUEUEBUF_CONF_NUM 8 #endif -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ @@ -85,7 +89,7 @@ #define CC2420_CONF_SFD_TIMESTAMPS 1 #endif /* TIMESYNCH_CONF_ENABLED */ -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define PACKETBUF_CONF_ATTRS_INLINE 1 @@ -131,7 +135,7 @@ #define PROCESS_CONF_STATS 1 /*#define PROCESS_CONF_FASTPOLL 4*/ -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 @@ -139,9 +143,6 @@ #define UIP_CONF_LLH_LEN 0 #define UIP_CONF_ROUTER 1 -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ #ifndef NBR_TABLE_CONF_MAX_NEIGHBORS @@ -155,7 +156,7 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #ifndef UIP_CONF_IPV6_QUEUE_PKT #define UIP_CONF_IPV6_QUEUE_PKT 0 #endif /* UIP_CONF_IPV6_QUEUE_PKT */ @@ -182,10 +183,10 @@ #ifndef SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS #define SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS 5 #endif /* SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS */ -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 108 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_ICMP_DEST_UNREACH 1 diff --git a/platform/exp5438/contiki-exp5438-main.c b/platform/exp5438/contiki-exp5438-main.c index 3dafe68aa..589a9572d 100644 --- a/platform/exp5438/contiki-exp5438-main.c +++ b/platform/exp5438/contiki-exp5438-main.c @@ -53,9 +53,9 @@ #include "lcd.h" #include "duty-cycle-scroller.h" -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-ds6.h" -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define DEBUG 1 @@ -77,7 +77,7 @@ set_rime_addr(void) int i; memset(&addr, 0, sizeof(linkaddr_t)); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(addr.u8, node_mac, sizeof(addr.u8)); #else if(node_id == 0) { @@ -122,9 +122,9 @@ main(int argc, char **argv) leds_on(LEDS_RED); uart1_init(BAUD2UBR(115200)); /* Must come before first printf */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 slip_arch_init(BAUD2UBR(115200)); -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ leds_on(LEDS_GREEN); /* xmem_init(); */ @@ -203,7 +203,7 @@ main(int argc, char **argv) PRINTF("Node id not set.\n"); } -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, node_mac, sizeof(uip_lladdr.addr)); /* Setup nullmac-like MAC for 802.15.4 */ @@ -248,7 +248,7 @@ main(int argc, char **argv) ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]); } -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ NETSTACK_RDC.init(); NETSTACK_MAC.init(); @@ -259,9 +259,9 @@ main(int argc, char **argv) CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1: NETSTACK_RDC.channel_check_interval()), CC2420_CONF_CHANNEL); -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if !WITH_UIP6 +#if !NETSTACK_CONF_WITH_IPV6 uart1_set_input(serial_line_input_byte); serial_line_init(); #endif diff --git a/platform/exp5438/uart1x.c b/platform/exp5438/uart1x.c index bd212f27d..fe3f17f4f 100644 --- a/platform/exp5438/uart1x.c +++ b/platform/exp5438/uart1x.c @@ -72,8 +72,8 @@ uart1_writeb(unsigned char c) UCA1TXBUF = c; } /*---------------------------------------------------------------------------*/ -#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */ -#endif /* ! WITH_UIP */ +#if ! NETSTACK_CONF_WITH_IPV4 /* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */ +#endif /* ! NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ /** * Initalize the RS232 port. diff --git a/platform/mbxxx/Makefile.mbxxx b/platform/mbxxx/Makefile.mbxxx index d60a6b044..8ce2415dd 100644 --- a/platform/mbxxx/Makefile.mbxxx +++ b/platform/mbxxx/Makefile.mbxxx @@ -6,10 +6,6 @@ ifndef CONTIKI_TARGET_MAIN CONTIKI_TARGET_MAIN = contiki-main.c board.c endif -ifdef UIP_CONF_IPV6 -CFLAGS += -DWITH_UIP6=1 -endif - CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(CONTIKI_TARGET_MAIN) MCU=STM32W108 @@ -21,6 +17,6 @@ ifeq ($(HOST_OS),Windows) SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows endif -MODULES+=core/net/ip core/net/ipv4 core/net core/net/ipv6 \ - core/net/rpl core/net/rime core/net/mac core/net/mac/contikimac \ +MODULES+=core/net \ + core/net/mac core/net/mac/contikimac \ core/net/llsec diff --git a/platform/mbxxx/contiki-conf.h b/platform/mbxxx/contiki-conf.h index e724450ac..5ad8a505e 100644 --- a/platform/mbxxx/contiki-conf.h +++ b/platform/mbxxx/contiki-conf.h @@ -115,7 +115,7 @@ #define RPL_CONF_MAX_DAG_PER_INSTANCE 1 #define PROCESS_CONF_NUMEVENTS 16 -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver @@ -135,10 +135,9 @@ #endif /* WITH_COAP */ #define UIP_CONF_ROUTER 1 -#define UIP_CONF_IPV6_RPL 1 #define UIP_CONF_ND6_SEND_RA 0 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #define UIP_CONF_IPV6_QUEUE_PKT 0 #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_REASSEMBLY 0 @@ -161,12 +160,12 @@ #define SICSLOWPAN_CONF_MAXAGE 2 #endif /* SICSLOWPAN_CONF_MAXAGE */ -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ #define NETSTACK_CONF_NETWORK rime_driver -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #ifdef PROJECT_CONF_H #include PROJECT_CONF_H diff --git a/platform/mbxxx/contiki-init-net.c b/platform/mbxxx/contiki-init-net.c index 0f6eb0a64..381c4f3cf 100644 --- a/platform/mbxxx/contiki-init-net.c +++ b/platform/mbxxx/contiki-init-net.c @@ -46,7 +46,7 @@ #include "contiki-net.h" -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define DEBUG 1 #if DEBUG @@ -136,5 +136,5 @@ void set_net_address(void) #endif /* FIXED_GLOBAL_ADDRESS */ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /** @} */ diff --git a/platform/mbxxx/contiki-main.c b/platform/mbxxx/contiki-main.c index ae16cbf55..020591aff 100644 --- a/platform/mbxxx/contiki-main.c +++ b/platform/mbxxx/contiki-main.c @@ -72,9 +72,9 @@ #include "net/rime/rime.h" #include "net/ip/uip.h" -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-ds6.h" -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define DEBUG 1 #if DEBUG @@ -89,7 +89,7 @@ #endif -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 PROCINIT(&tcpip_process, &sensors_process); #else PROCINIT(&sensors_process); @@ -121,11 +121,11 @@ set_rime_addr(void) } } -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr)); #endif -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 linkaddr_set_node_addr((linkaddr_t *)&eui64); #else linkaddr_set_node_addr((linkaddr_t *)&eui64.u8[8 - LINKADDR_SIZE]); @@ -207,7 +207,7 @@ main(void) ST_RadioSetEdCcaThreshold(DEFAULT_RADIO_CCA_THRESHOLD); autostart_start(autostart_processes); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 printf("Tentative link-local IPv6 address "); { uip_ds6_addr_t *lladdr; @@ -235,7 +235,7 @@ main(void) printf("%02x%02x\n", ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ watchdog_start(); diff --git a/platform/micaz/Makefile.micaz b/platform/micaz/Makefile.micaz index b4fe59da5..f048518b8 100644 --- a/platform/micaz/Makefile.micaz +++ b/platform/micaz/Makefile.micaz @@ -45,6 +45,6 @@ ifneq ($(strip $(HAVE_PRGBOARD_FILE)), ) include $(PRGBOARD_FILE) endif -MODULES += core/net core/net/ip core/net/ipv6 core/net/ipv4 core/net/rime \ - core/net/mac core/net/rpl core/net/mac/cxmac \ +MODULES += core/net \ + core/net/mac core/net/mac/cxmac core/net/mac/sicslowmac \ core/net/llsec dev/cc2420 diff --git a/platform/micaz/contiki-conf.h b/platform/micaz/contiki-conf.h index a94afac86..25d191540 100644 --- a/platform/micaz/contiki-conf.h +++ b/platform/micaz/contiki-conf.h @@ -48,10 +48,10 @@ #include "platform-conf.h" -#if UIP_CONF_IPV6 -#define WITH_UIP6 1 +#if NETSTACK_CONF_WITH_IPV6 +#define NETSTACK_CONF_WITH_IPV6 1 #endif -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver //#define NETSTACK_CONF_MAC csma_driver @@ -65,7 +65,7 @@ #define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 #define CXMAC_CONF_ANNOUNCEMENTS 0 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ @@ -86,7 +86,7 @@ #define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define PACKETBUF_CONF_ATTRS_INLINE 1 @@ -115,7 +115,7 @@ #define PROCESS_CONF_NUMEVENTS 8 #define PROCESS_CONF_STATS 1 -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 @@ -123,20 +123,18 @@ #define UIP_CONF_LLH_LEN 0 #define UIP_CONF_ROUTER 0 -#define UIP_CONF_IPV6_RPL 1 /* configure number of neighbors and routes */ #define NBR_TABLE_CONF_MAX_NEIGHBORS 5 #define UIP_CONF_MAX_ROUTES 5 #define RPL_CONF_MAX_PARENTS 4 -#define NBR_TABLE_CONF_MAX_NEIGHBORS 8 #define UIP_CONF_ND6_SEND_RA 0 #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #define UIP_CONF_IPV6_QUEUE_PKT 0 #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_REASSEMBLY 0 @@ -156,17 +154,17 @@ #endif /* SICSLOWPAN_CONF_FRAG */ #define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 128 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_ICMP_DEST_UNREACH 1 -#if !WITH_UIP && !WITH_UIP6 +#if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6 #define QUEUEBUF_CONF_NUM 8 #else -#define QUEUEBUF_CONF_NUM 4 +#define QUEUEBUF_CONF_NUM 2 #endif #define TIMESYNCH_CONF_ENABLED 1 diff --git a/platform/micaz/contiki-micaz-main.c b/platform/micaz/contiki-micaz-main.c index 488503df4..318cdb8da 100644 --- a/platform/micaz/contiki-micaz-main.c +++ b/platform/micaz/contiki-micaz-main.c @@ -63,12 +63,12 @@ init_usart(void) rs232_init(RS232_PORT_0, USART_BAUD_115200, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); -#if WITH_UIP || WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV4 || NETSTACK_CONF_WITH_IPV6 // slip_arch_init(USART_BAUD_115200); rs232_redirect_stdout(RS232_PORT_0); #else rs232_redirect_stdout(RS232_PORT_0); -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 || NETSTACK_CONF_WITH_IPV6*/ } /*---------------------------------------------------------------------------*/ diff --git a/platform/micaz/init-net.c b/platform/micaz/init-net.c index 1ccf50b57..f4289f567 100644 --- a/platform/micaz/init-net.c +++ b/platform/micaz/init-net.c @@ -54,11 +54,11 @@ #include "dev/ds2401.h" #include "sys/node-id.h" -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-ds6.h" -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 #include "net/ip/uip.h" #include "net/ipv4/uip-fw.h" #include "net/uip-fw-drv.h" @@ -70,7 +70,7 @@ static struct uip_fw_netif meshif = static uint8_t is_gateway; -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ #define UIP_OVER_MESH_CHANNEL 8 @@ -82,7 +82,7 @@ set_rime_addr(void) int i; memset(&addr, 0, sizeof(linkaddr_t)); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(addr.u8, ds2401_id, sizeof(addr.u8)); #else if(node_id == 0) { @@ -103,7 +103,7 @@ set_rime_addr(void) } /*--------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 static void set_gateway(void) { @@ -118,7 +118,7 @@ set_gateway(void) is_gateway = 1; } } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ void init_net(void) @@ -141,7 +141,7 @@ init_net(void) cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr); } -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, ds2401_id, sizeof(uip_lladdr.addr)); /* Setup nullmac-like MAC for 802.15.4 */ /* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */ @@ -188,7 +188,7 @@ init_net(void) ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]); } -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ NETSTACK_RDC.init(); NETSTACK_MAC.init(); @@ -199,10 +199,10 @@ init_net(void) CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1: NETSTACK_RDC.channel_check_interval()), CC2420_CONF_CHANNEL); -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 uip_ipaddr_t hostaddr, netmask; uip_init(); @@ -236,7 +236,7 @@ init_net(void) uip_over_mesh_init(UIP_OVER_MESH_CHANNEL); printf_P(PSTR("uIP started with IP address %d.%d.%d.%d\n"), uip_ipaddr_to_quad(&hostaddr)); -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ diff --git a/platform/minimal-net/Makefile.minimal-net b/platform/minimal-net/Makefile.minimal-net index 9a37adf52..dd7632d92 100644 --- a/platform/minimal-net/Makefile.minimal-net +++ b/platform/minimal-net/Makefile.minimal-net @@ -29,4 +29,4 @@ endif CONTIKI_CPU=$(CONTIKI)/cpu/native include $(CONTIKI)/cpu/native/Makefile.native -MODULES+=core/net/ip core/net/ipv4 core/net core/net/ipv6 core/net/rime +MODULES+=core/net diff --git a/platform/minimal-net/contiki-conf.h b/platform/minimal-net/contiki-conf.h index be000340e..1501b1384 100644 --- a/platform/minimal-net/contiki-conf.h +++ b/platform/minimal-net/contiki-conf.h @@ -57,7 +57,7 @@ typedef int32_t s32_t; typedef unsigned short uip_stats_t; -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* The Windows build uses wpcap to connect to a host interface. It finds the interface by scanning for * an address, which can be specified here and overridden with the command line. * An ip4 or ip6 address can be used; this allows turning off the ip4 protocol on the interface. @@ -89,7 +89,6 @@ typedef unsigned short uip_stats_t; #define WEBSERVER_CONF_STATUSPAGE 1 /* RPL currently works only on Windows. *nix would require converting the tun interface to two pcap tees. */ -//#define UIP_CONF_IPV6_RPL 0 //#define RPL_BORDER_ROUTER 0 #endif @@ -155,7 +154,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_UDP 1 #define UIP_CONF_TCP 1 -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define UIP_CONF_IPV6_QUEUE_PKT 1 #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_REASSEMBLY 1 @@ -169,7 +168,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_DS6_ADDR_NBU 10 #define UIP_CONF_DS6_MADDR_NBU 0 #define UIP_CONF_DS6_AADDR_NBU 0 -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ typedef unsigned long clock_time_t; #define CLOCK_CONF_SECOND 1000 diff --git a/platform/minimal-net/contiki-main.c b/platform/minimal-net/contiki-main.c index d8158605e..35b466a39 100644 --- a/platform/minimal-net/contiki-main.c +++ b/platform/minimal-net/contiki-main.c @@ -54,9 +54,17 @@ #endif /* __CYGWIN__ */ #ifdef __CYGWIN__ +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 PROCINIT(&etimer_process, &tcpip_process, &wpcap_process, &serial_line_process); +#else +PROCINIT(&etimer_process, &wpcap_process, &serial_line_process); +#endif #else /* __CYGWIN__ */ +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 PROCINIT(&etimer_process, &tapdev_process, &tcpip_process, &serial_line_process); +#else +PROCINIT(&etimer_process, &tapdev_process, &serial_line_process); +#endif #endif /* __CYGWIN__ */ #if RPL_BORDER_ROUTER @@ -135,7 +143,7 @@ PROCESS_THREAD(border_router_process, ev, data) } #endif /* RPL_BORDER_ROUTER */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /*---------------------------------------------------------------------------*/ static void sprint_ip6(uip_ip6addr_t addr) @@ -174,7 +182,7 @@ sprint_ip6(uip_ip6addr_t addr) *result=0; printf("%s", thestring); } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ int contiki_argc = 0; char **contiki_argv; @@ -198,7 +206,7 @@ main(int argc, char **argv) #endif clock_init(); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* A hard coded address overrides the stack default MAC address to allow multiple instances. uip6.c defines it as {0x00,0x06,0x98,0x00,0x02,0x32} giving an ipv6 address of @@ -229,7 +237,7 @@ main(int argc, char **argv) } } #endif /* HARD_CODED_ADDRESS */ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ process_init(); /* procinit_init initializes RPL which sets a ctimer for the first DIS */ @@ -248,7 +256,7 @@ main(int argc, char **argv) autostart_start(autostart_processes); /* Set default IP addresses if not specified */ -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 { uip_ipaddr_t addr; @@ -273,7 +281,7 @@ main(int argc, char **argv) } printf("Def. Router: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr)); } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #if !UIP_CONF_IPV6_RPL { @@ -305,7 +313,7 @@ main(int argc, char **argv) } #endif /* !UIP_CONF_IPV6_RPL */ -#endif /* !UIP_CONF_IPV6 */ +#endif /* !NETSTACK_CONF_WITH_IPV6 */ // procinit_init(); // autostart_start(autostart_processes); @@ -315,7 +323,7 @@ main(int argc, char **argv) printf("\n*******%s online*******\n",CONTIKI_VERSION_STRING); -#if UIP_CONF_IPV6 && !RPL_BORDER_ROUTER /* Border router process prints addresses later */ +#if NETSTACK_CONF_WITH_IPV6 && !RPL_BORDER_ROUTER /* Border router process prints addresses later */ { int i = 0; int interface_count = 0; diff --git a/platform/native/Makefile.native b/platform/native/Makefile.native index f84fa6c46..460610a6a 100644 --- a/platform/native/Makefile.native +++ b/platform/native/Makefile.native @@ -6,10 +6,6 @@ ifeq ($(HOST_OS),Darwin) AROPTS = rc endif -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - CONTIKI_TARGET_DIRS = . dev ctk CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o} @@ -23,7 +19,7 @@ TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a else CONTIKI_TARGET_SOURCEFILES += tapdev-drv.c #math -ifneq ($(UIP_CONF_IPV6),1) +ifneq ($(CONTIKI_WITH_IPV6),1) CONTIKI_TARGET_SOURCEFILES += tapdev.c else CONTIKI_TARGET_SOURCEFILES += tapdev6.c @@ -46,5 +42,4 @@ CURSES_LIBS ?= -lncurses TARGET_LIBFILES += $(CURSES_LIBS) -MODULES+=core/net/ip core/net/ipv4 core/net core/net/ipv6 core/net/rime \ - core/net/mac core/net/rpl core/ctk core/net/llsec +MODULES+=core/net core/net/mac core/ctk core/net/llsec diff --git a/platform/native/contiki-conf.h b/platform/native/contiki-conf.h index 54fc8e9e2..48e623266 100644 --- a/platform/native/contiki-conf.h +++ b/platform/native/contiki-conf.h @@ -79,7 +79,7 @@ typedef unsigned short uip_stats_t; #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 #endif /* NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 @@ -102,9 +102,6 @@ typedef unsigned short uip_stats_t; #define NETSTACK_CONF_NETWORK sicslowpan_driver #define UIP_CONF_ROUTER 1 -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif /* UIP_CONF_IPV6_RPL */ #define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 #define SICSLOWPAN_CONF_COMPRESSION_HC1 1 @@ -165,7 +162,7 @@ typedef unsigned short uip_stats_t; -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include #define ctk_arch_isprint isprint diff --git a/platform/native/contiki-main.c b/platform/native/contiki-main.c index b7ae7f901..780dce7c6 100644 --- a/platform/native/contiki-main.c +++ b/platform/native/contiki-main.c @@ -66,9 +66,9 @@ #include "dev/pir-sensor.h" #include "dev/vib-sensor.h" -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-ds6.h" -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include "net/rime/rime.h" @@ -145,7 +145,7 @@ set_rime_addr(void) int i; memset(&addr, 0, sizeof(linkaddr_t)); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(addr.u8, serial_id, sizeof(addr.u8)); #else if(node_id == 0) { @@ -173,7 +173,7 @@ char **contiki_argv; int main(int argc, char **argv) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #if UIP_CONF_IPV6_RPL printf(CONTIKI_VERSION_STRING " started with IPV6, RPL\n"); #else @@ -213,7 +213,7 @@ main(int argc, char **argv) netstack_init(); printf("MAC %s RDC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name); -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 queuebuf_init(); memcpy(&uip_lladdr.addr, serial_id, sizeof(uip_lladdr.addr)); @@ -236,7 +236,7 @@ main(int argc, char **argv) printf("%02x%02x\n", lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]); } -#else +#elif NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); #endif diff --git a/platform/seedeye/Makefile.seedeye b/platform/seedeye/Makefile.seedeye index 8b6a3f732..0d2514d2f 100644 --- a/platform/seedeye/Makefile.seedeye +++ b/platform/seedeye/Makefile.seedeye @@ -6,10 +6,6 @@ ifdef SEEDEYE_ID CFLAGS += -DSEEDEYE_ID=${SEEDEYE_ID} endif -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - CONTIKI_TARGET_DIRS = . dev dev/mrf24j40 apps net CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o} @@ -63,3 +59,6 @@ CONTIKI_TARGET_SOURCEFILES += $(CONTIKI_CORE_SOURCEFILES) CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) include $(CONTIKI)/cpu/pic32/Makefile.pic32 + +MODULES += core/net core/net/mac core/net/rime core/net/llsec + diff --git a/platform/seedeye/contiki-conf.h b/platform/seedeye/contiki-conf.h index f0cce7acb..69c788381 100644 --- a/platform/seedeye/contiki-conf.h +++ b/platform/seedeye/contiki-conf.h @@ -69,7 +69,7 @@ typedef uint32_t rtimer_clock_t; #define ENERGEST_CONF_ON 1 #endif /* ENERGEST_CONF_ON */ -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define NETSTACK_CONF_NETWORK sicslowpan_driver #define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_MAC nullmac_driver @@ -87,14 +87,11 @@ typedef uint32_t rtimer_clock_t; #define RDC_CONF_HARDWARE_CSMA 1 -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define UIP_CONF_ROUTER 1 -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif /* UIP_CONF_IPV6_RPL */ /* IPv6 configuration options */ -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #define NBR_TABLE_CONF_MAX_NEIGHBORS 20 /* number of neighbors */ #define UIP_CONF_DS6_ROUTE_NBU 20 /* number of routes */ #define UIP_CONF_ND6_SEND_RA 0 diff --git a/platform/seedeye/init-net.c b/platform/seedeye/init-net.c index 0f2d2e885..5b871b43c 100644 --- a/platform/seedeye/init-net.c +++ b/platform/seedeye/init-net.c @@ -73,7 +73,7 @@ init_net(uint8_t node_id) uint16_t shortaddr; uint64_t longaddr; linkaddr_t addr; -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 uip_ds6_addr_t *lladdr; uip_ipaddr_t ipaddr; #endif @@ -135,7 +135,7 @@ init_net(uint8_t node_id) CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1 : NETSTACK_RDC.channel_check_interval()), RF_CHANNEL); -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #if LINKADDR_CONF_SIZE == 2 memset(&uip_lladdr.addr, 0, sizeof(uip_lladdr.addr)); @@ -146,7 +146,9 @@ init_net(uint8_t node_id) memcpy(&uip_lladdr.addr, &longaddr, sizeof(uip_lladdr.addr)); #endif +#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); +#endif lladdr = uip_ds6_get_link_local(-1); diff --git a/platform/sensinode/Makefile.sensinode b/platform/sensinode/Makefile.sensinode index 9bb421234..80937391c 100644 --- a/platform/sensinode/Makefile.sensinode +++ b/platform/sensinode/Makefile.sensinode @@ -46,7 +46,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) CLEAN += *.sensinode -ifeq ($(UIP_CONF_IPV6),1) +ifeq ($(CONTIKI_WITH_IPV6),1) ifeq ($(OFFSET_FIRMWARE),1) CFLAGS += -DDISCO_ENABLED=1 CONTIKI_TARGET_SOURCEFILES += disco.c @@ -88,5 +88,5 @@ include $(CONTIKI)/cpu/cc2430/Makefile.cc2430 contiki-$(TARGET).a:# $(addprefix $(OBJECTDIR)/,symbols.rel) -MODULES += core/net/ipv6 core/net/ip core/net/rime core/net core/net/mac core/net/rpl \ +MODULES += core/net core/net/mac \ core/net/llsec diff --git a/platform/sensinode/contiki-conf.h b/platform/sensinode/contiki-conf.h index 08543ad6b..3866bc3b4 100644 --- a/platform/sensinode/contiki-conf.h +++ b/platform/sensinode/contiki-conf.h @@ -146,11 +146,11 @@ /* Sensinode-Specific Tools and APPs */ /* Viztool on by default for IPv6 builds */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #ifndef VIZTOOL_CONF_ON #define VIZTOOL_CONF_ON 1 #endif /* VIZTOOL_CONF_ON */ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* BatMon off by default unless we build with APPS += batmon */ #ifndef BATMON_CONF_ON @@ -159,11 +159,11 @@ /* Network Stack */ #ifndef NETSTACK_CONF_NETWORK -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define NETSTACK_CONF_NETWORK sicslowpan_driver #else #define NETSTACK_CONF_NETWORK rime_driver -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #endif /* NETSTACK_CONF_NETWORK */ #ifndef NETSTACK_CONF_MAC @@ -201,7 +201,7 @@ #define CC2430_RF_CONF_AUTOACK 1 #endif /* CC2430_CONF_AUTOACK */ -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 /* Addresses, Sizes and Interfaces */ /* 8-byte addresses here, 2 otherwise */ #define LINKADDR_CONF_SIZE 8 @@ -270,13 +270,13 @@ #define QUEUEBUF_CONF_NUM 6 #endif -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 108 #define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 #define QUEUEBUF_CONF_NUM 8 -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* Prevent SDCC compile error when UIP_CONF_ROUTER == 0 */ #if !UIP_CONF_ROUTER diff --git a/platform/sensinode/contiki-sensinode-main.c b/platform/sensinode/contiki-sensinode-main.c index 74d6eb46f..9ba3766be 100644 --- a/platform/sensinode/contiki-sensinode-main.c +++ b/platform/sensinode/contiki-sensinode-main.c @@ -245,7 +245,7 @@ main(void) sensinode_sensors_activate(); #endif -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr)); queuebuf_init(); process_start(&tcpip_process, NULL); @@ -267,7 +267,7 @@ main(void) uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE); } #endif /* UIP_CONF_IPV6_RPL */ -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /* * Acknowledge the UART1 RX interrupt diff --git a/platform/sensinode/uip-debug.c b/platform/sensinode/uip-debug.c index ee7942664..5f5b23ca8 100644 --- a/platform/sensinode/uip-debug.c +++ b/platform/sensinode/uip-debug.c @@ -43,7 +43,7 @@ void uip_debug_ipaddr_print(const uip_ipaddr_t *addr) { -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 uint16_t a; unsigned int i; int f; @@ -63,9 +63,9 @@ uip_debug_ipaddr_print(const uip_ipaddr_t *addr) puthex(a & 0xFF); } } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ PRINTA("%u.%u.%u.%u", addr->u8[0], addr->u8[1], addr->u8[2], addr->u8[3]); -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } /*---------------------------------------------------------------------------*/ void diff --git a/platform/sky/Makefile.common b/platform/sky/Makefile.common index 0c121b25a..ef5c7ad57 100644 --- a/platform/sky/Makefile.common +++ b/platform/sky/Makefile.common @@ -10,10 +10,6 @@ ifndef CONTIKI_TARGET_MAIN CONTIKI_TARGET_MAIN = contiki-sky-main.c endif -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - ifdef IAR CFLAGS += -D__MSP430F1611__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32 CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR) diff --git a/platform/sky/Makefile.sky b/platform/sky/Makefile.sky index ebde4c8bd..10101b708 100644 --- a/platform/sky/Makefile.sky +++ b/platform/sky/Makefile.sky @@ -10,8 +10,8 @@ endif include $(CONTIKI)/platform/sky/Makefile.common -MODULES += core/net/ipv6 core/net/ipv4 core/net/rime core/net/mac \ - core/net core/net/ip core/net/rpl \ +MODULES += core/net/mac \ + core/net \ core/net/mac/contikimac core/net/mac/cxmac \ core/net/llsec core/net/llsec/noncoresec \ dev/cc2420 dev/sht11 dev/ds2411 diff --git a/platform/sky/contiki-conf.h b/platform/sky/contiki-conf.h index c99645898..0340a993b 100644 --- a/platform/sky/contiki-conf.h +++ b/platform/sky/contiki-conf.h @@ -26,7 +26,11 @@ #endif /* NETSTACK_CONF_RADIO */ #ifndef NETSTACK_CONF_FRAMER +#if NETSTACK_CONF_WITH_IPV6 #define NETSTACK_CONF_FRAMER framer_802154 +#else /* NETSTACK_CONF_WITH_IPV6 */ +#define NETSTACK_CONF_FRAMER contikimac_framer +#endif /* NETSTACK_CONF_WITH_IPV6 */ #endif /* NETSTACK_CONF_FRAMER */ #ifndef CC2420_CONF_AUTOACK @@ -39,7 +43,7 @@ #define XMAC_CONF_COMPOWER 1 #define CXMAC_CONF_COMPOWER 1 -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver @@ -56,7 +60,7 @@ #define QUEUEBUF_CONF_NUM 8 #endif -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ @@ -85,7 +89,7 @@ #define CC2420_CONF_SFD_TIMESTAMPS 1 #endif /* TIMESYNCH_CONF_ENABLED */ -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define PACKETBUF_CONF_ATTRS_INLINE 1 @@ -131,7 +135,7 @@ #define PROCESS_CONF_STATS 1 /*#define PROCESS_CONF_FASTPOLL 4*/ -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 @@ -139,9 +143,6 @@ #define UIP_CONF_LLH_LEN 0 #define UIP_CONF_ROUTER 1 -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ #ifndef NBR_TABLE_CONF_MAX_NEIGHBORS @@ -156,7 +157,7 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #ifndef UIP_CONF_IPV6_QUEUE_PKT #define UIP_CONF_IPV6_QUEUE_PKT 0 #endif /* UIP_CONF_IPV6_QUEUE_PKT */ @@ -183,10 +184,10 @@ #ifndef SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS #define SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS 5 #endif /* SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS */ -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 108 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_ICMP_DEST_UNREACH 1 diff --git a/platform/sky/contiki-sky-main.c b/platform/sky/contiki-sky-main.c index d589ca037..46f6f99de 100644 --- a/platform/sky/contiki-sky-main.c +++ b/platform/sky/contiki-sky-main.c @@ -43,9 +43,9 @@ #include "net/netstack.h" #include "net/mac/frame802154.h" -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-ds6.h" -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include "net/rime/rime.h" @@ -72,11 +72,11 @@ static struct timer mgt_timer; #endif extern int msp430_dco_required; -#ifndef WITH_UIP -#define WITH_UIP 0 +#ifndef NETSTACK_CONF_WITH_IPV4 +#define NETSTACK_CONF_WITH_IPV4 0 #endif -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 #include "net/ip/uip.h" #include "net/ipv4/uip-fw.h" #include "net/ipv4/uip-fw-drv.h" @@ -86,12 +86,12 @@ static struct uip_fw_netif slipif = static struct uip_fw_netif meshif = {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)}; -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ #define UIP_OVER_MESH_CHANNEL 8 -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 static uint8_t is_gateway; -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ #ifdef EXPERIMENT_SETUP #include "experiment-setup.h" @@ -138,7 +138,7 @@ set_rime_addr(void) int i; memset(&addr, 0, sizeof(linkaddr_t)); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(addr.u8, ds2411_id, sizeof(addr.u8)); #else if(node_id == 0) { @@ -172,7 +172,7 @@ print_processes(struct process * const processes[]) } #endif /* !PROCESS_CONF_NO_PROCESS_NAMES */ /*--------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 static void set_gateway(void) { @@ -187,7 +187,7 @@ set_gateway(void) is_gateway = 1; } } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ static void start_autostart_processes() @@ -198,7 +198,7 @@ start_autostart_processes() autostart_start(autostart_processes); } /*---------------------------------------------------------------------------*/ -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 static void start_uip6() { @@ -235,16 +235,16 @@ start_uip6() ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]); } } -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ static void start_network_layer() { -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 start_uip6(); -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ start_autostart_processes(); - /* To support link layer security in combination with WITH_UIP and + /* To support link layer security in combination with NETSTACK_CONF_WITH_IPV4 and * TIMESYNCH_CONF_ENABLED further things may need to be moved here */ } /*---------------------------------------------------------------------------*/ @@ -315,9 +315,9 @@ main(int argc, char **argv) ctimer_init(); -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 slip_arch_init(BAUD2UBR(115200)); -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ init_platform(); @@ -350,7 +350,7 @@ main(int argc, char **argv) ds2411_id[0], ds2411_id[1], ds2411_id[2], ds2411_id[3], ds2411_id[4], ds2411_id[5], ds2411_id[6], ds2411_id[7]);*/ -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, ds2411_id, sizeof(uip_lladdr.addr)); /* Setup nullmac-like MAC for 802.15.4 */ /* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */ @@ -368,7 +368,7 @@ main(int argc, char **argv) CC2420_CONF_CHANNEL, CC2420_CONF_CCA_THRESH); -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ NETSTACK_RDC.init(); NETSTACK_MAC.init(); @@ -379,9 +379,9 @@ main(int argc, char **argv) CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1: NETSTACK_RDC.channel_check_interval()), CC2420_CONF_CHANNEL); -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if !WITH_UIP && !WITH_UIP6 +#if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6 uart1_set_input(serial_line_input_byte); serial_line_init(); #endif @@ -393,7 +393,7 @@ main(int argc, char **argv) timesynch_set_authority_level((linkaddr_node_addr.u8[0] << 4) + 16); #endif /* TIMESYNCH_CONF_ENABLED */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); process_start(&uip_fw_process, NULL); /* Start IP output */ process_start(&slip_process, NULL); @@ -420,7 +420,7 @@ main(int argc, char **argv) PRINTF("uIP started with IP address %d.%d.%d.%d\n", uip_ipaddr_to_quad(&hostaddr)); } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ watchdog_start(); diff --git a/platform/stm32test/contiki-conf.h b/platform/stm32test/contiki-conf.h index e45f00d69..534f0f441 100644 --- a/platform/stm32test/contiki-conf.h +++ b/platform/stm32test/contiki-conf.h @@ -6,7 +6,7 @@ #define CCIF #define CLIF -#define WITH_UIP 1 +#define NETSTACK_CONF_WITH_IPV4 1 #define WITH_ASCII 1 #define CLOCK_CONF_SECOND 100 diff --git a/platform/win32/Makefile.win32 b/platform/win32/Makefile.win32 index f8bf088ea..5f0b618d4 100644 --- a/platform/win32/Makefile.win32 +++ b/platform/win32/Makefile.win32 @@ -41,7 +41,7 @@ CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c cfs-win32-dir.c ctk-console. CONTIKI_SOURCEFILES += $(CTK) cfs-posix.c ctk-conio.c wpcap.c wpcap-drv.c \ $(CONTIKI_TARGET_SOURCEFILES) -MODULES += core/ctk core/net/ip core/net/ipv4 core/net/ipv6 +MODULES += core/ctk # Define the CPU directory diff --git a/platform/win32/contiki-conf.h b/platform/win32/contiki-conf.h index 41d4b1f08..9c2e81be7 100644 --- a/platform/win32/contiki-conf.h +++ b/platform/win32/contiki-conf.h @@ -64,7 +64,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_TCP_SPLIT 1 #define UIP_CONF_LOGGING 1 #define UIP_CONF_UDP_CHECKSUMS 1 -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 #define UIP_CONF_IP_FORWARD 0 #define NBR_TABLE_CONF_MAX_NEIGHBORS 100 #define UIP_CONF_DS6_DEFRT_NBU 2 diff --git a/platform/win32/contiki-main.c b/platform/win32/contiki-main.c index f1ed10f25..dcadd5385 100644 --- a/platform/win32/contiki-main.c +++ b/platform/win32/contiki-main.c @@ -124,7 +124,7 @@ main(int argc, char **argv) autostart_start(autostart_processes); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 { uip_ipaddr_t addr; uip_ipaddr(&addr, 192,168,0,111); @@ -144,7 +144,7 @@ main(int argc, char **argv) log_message("DNS Server: ", inet_ntoa(*(struct in_addr*)&addr)); } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #if !UIP_CONF_IPV6_RPL #ifdef HARD_CODED_ADDRESS diff --git a/platform/wismote/Makefile.wismote b/platform/wismote/Makefile.wismote index 0a86ea9e6..1cf0b0d9f 100644 --- a/platform/wismote/Makefile.wismote +++ b/platform/wismote/Makefile.wismote @@ -18,10 +18,6 @@ ifndef CONTIKI_TARGET_MAIN CONTIKI_TARGET_MAIN = contiki-wismote-main.c endif -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - ifdef IAR CFLAGS += -D__MSP430F5437__=1 -e --vla -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X --double=32 else @@ -54,7 +50,7 @@ contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} %.upload-clean: %.hex msp430flasher -n msp430x5437 -w $< -v -z [VCC] -MODULES += core/net core/net/ip core/net/ipv6 core/net/ipv4 core/net/mac \ - core/net/rime core/net/mac/contikimac core/net/rpl \ +MODULES += core/net core/net/mac \ + core/net/mac/contikimac \ core/net/llsec \ dev/cc2520 dev/sht11 diff --git a/platform/wismote/contiki-conf.h b/platform/wismote/contiki-conf.h index d37f8f3e6..adcb37c1a 100644 --- a/platform/wismote/contiki-conf.h +++ b/platform/wismote/contiki-conf.h @@ -33,7 +33,7 @@ #define NULLRDC_CONF_802154_AUTOACK 1 -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver @@ -50,7 +50,7 @@ #define QUEUEBUF_CONF_NUM 8 #endif -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ @@ -83,7 +83,7 @@ #define CC2520_CONF_SFD_TIMESTAMPS 1 #endif /* TIMESYNCH_CONF_ENABLED */ -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define PACKETBUF_CONF_ATTRS_INLINE 1 @@ -119,7 +119,7 @@ #define PROCESS_CONF_STATS 1 /*#define PROCESS_CONF_FASTPOLL 4*/ -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 @@ -127,9 +127,6 @@ #define UIP_CONF_LLH_LEN 0 #define UIP_CONF_ROUTER 1 -#ifndef UIP_CONF_IPV6_RPL -#define UIP_CONF_IPV6_RPL 1 -#endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ #ifndef NBR_TABLE_CONF_MAX_NEIGHBORS @@ -143,7 +140,7 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #ifndef UIP_CONF_IPV6_QUEUE_PKT #define UIP_CONF_IPV6_QUEUE_PKT 0 #endif /* UIP_CONF_IPV6_QUEUE_PKT */ @@ -170,10 +167,10 @@ #ifndef SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS #define SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS 5 #endif /* SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS */ -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 108 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_ICMP_DEST_UNREACH 1 diff --git a/platform/wismote/contiki-wismote-main.c b/platform/wismote/contiki-wismote-main.c index ab8522500..5e74a22ee 100644 --- a/platform/wismote/contiki-wismote-main.c +++ b/platform/wismote/contiki-wismote-main.c @@ -44,9 +44,9 @@ #include "net/netstack.h" #include "net/mac/frame802154.h" -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-ds6.h" -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include "net/rime/rime.h" @@ -66,11 +66,11 @@ extern const struct uip_router UIP_ROUTER_MODULE; #endif /* UIP_CONF_ROUTER */ -#ifndef WITH_UIP -#define WITH_UIP 0 +#ifndef NETSTACK_CONF_WITH_IPV4 +#define NETSTACK_CONF_WITH_IPV4 0 #endif -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 #include "net/ip/uip.h" #include "net/ipv4/uip-fw.h" #include "net/uip-fw-drv.h" @@ -80,12 +80,12 @@ static struct uip_fw_netif slipif = static struct uip_fw_netif meshif = {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)}; -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ #define UIP_OVER_MESH_CHANNEL 8 -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 static uint8_t is_gateway; -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ #ifdef EXPERIMENT_SETUP #include "experiment-setup.h" @@ -133,7 +133,7 @@ set_rime_addr(void) memset(&n_addr, 0, sizeof(linkaddr_t)); // Set node address -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 //memcpy(addr.u8, ds2411_id, sizeof(addr.u8)); n_addr.u8[7] = node_id & 0xff; n_addr.u8[6] = node_id >> 8; @@ -172,7 +172,7 @@ print_processes(struct process * const processes[]) } #endif /* !PROCESS_CONF_NO_PROCESS_NAMES */ /*--------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 static void set_gateway(void) { @@ -187,7 +187,7 @@ set_gateway(void) is_gateway = 1; } } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ int main(int argc, char **argv) @@ -206,9 +206,9 @@ main(int argc, char **argv) uart1_init(115200); /* Must come before first printf */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 slip_arch_init(115200); -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ clock_wait(1); @@ -283,7 +283,7 @@ main(int argc, char **argv) printf("Node id is not set.\n"); } -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* memcpy(&uip_lladdr.addr, ds2411_id, sizeof(uip_lladdr.addr)); */ memcpy(&uip_lladdr.addr, linkaddr_node_addr.u8, UIP_LLADDR_LEN > LINKADDR_SIZE ? LINKADDR_SIZE : UIP_LLADDR_LEN); @@ -333,7 +333,7 @@ main(int argc, char **argv) ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]); } -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ NETSTACK_RDC.init(); NETSTACK_MAC.init(); @@ -344,9 +344,9 @@ main(int argc, char **argv) CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1: NETSTACK_RDC.channel_check_interval()), RF_CHANNEL); -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if !WITH_UIP && !WITH_UIP6 +#if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6 uart1_set_input(serial_line_input_byte); serial_line_init(); #endif @@ -358,7 +358,7 @@ main(int argc, char **argv) timesynch_set_authority_level((linkaddr_node_addr.u8[0] << 4) + 16); #endif /* TIMESYNCH_CONF_ENABLED */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); process_start(&uip_fw_process, NULL); /* Start IP output */ process_start(&slip_process, NULL); @@ -385,7 +385,7 @@ main(int argc, char **argv) printf("uIP started with IP address %d.%d.%d.%d\n", uip_ipaddr_to_quad(&hostaddr)); } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ energest_init(); ENERGEST_ON(ENERGEST_TYPE_CPU); diff --git a/platform/z1/Makefile.common b/platform/z1/Makefile.common index 677248ae7..b5bce8a78 100644 --- a/platform/z1/Makefile.common +++ b/platform/z1/Makefile.common @@ -26,10 +26,6 @@ ifndef CONTIKI_TARGET_MAIN CONTIKI_TARGET_MAIN = contiki-z1-main.c endif -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - ifdef nodemac CFLAGS += -DMACID=$(nodemac) endif diff --git a/platform/z1/Makefile.z1 b/platform/z1/Makefile.z1 index 0079373d7..015171af7 100644 --- a/platform/z1/Makefile.z1 +++ b/platform/z1/Makefile.z1 @@ -9,7 +9,7 @@ ifeq ($(ZOLERTIA_Z1SP),1) include $(CONTIKI)/platform/z1/Makefile.z1sp endif -MODULES += core/net core/net/ip core/net/ipv6 core/net/ipv4 core/net/rpl \ - core/net/rime core/net/mac core/net/mac/contikimac \ +MODULES += core/net \ + core/net/mac core/net/mac/contikimac \ core/net/llsec \ dev/cc2420 dev/sht11 diff --git a/platform/z1/contiki-conf.h b/platform/z1/contiki-conf.h index 4445b53f5..34fd48dde 100644 --- a/platform/z1/contiki-conf.h +++ b/platform/z1/contiki-conf.h @@ -37,7 +37,7 @@ #define XMAC_CONF_COMPOWER 1 #define CXMAC_CONF_COMPOWER 1 -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver @@ -61,7 +61,7 @@ #define QUEUEBUF_CONF_NUM 4 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ /* Network setup for non-IPv6 (rime). */ @@ -69,7 +69,7 @@ #define NETSTACK_CONF_MAC csma_driver #define NETSTACK_CONF_RDC contikimac_driver #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 -#define NETSTACK_CONF_FRAMER framer_802154 +#define NETSTACK_CONF_FRAMER contikimac_framer #define CC2420_CONF_AUTOACK 1 @@ -87,7 +87,7 @@ #define QUEUEBUF_CONF_NUM 8 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define PACKETBUF_CONF_ATTRS_INLINE 1 @@ -130,7 +130,7 @@ #define UART0_CONF_TX_WITH_INTERRUPT 0 // So far, printfs without interrupt. -#ifdef WITH_UIP6 +#ifdef NETSTACK_CONF_WITH_IPV6 #define LINKADDR_CONF_SIZE 8 @@ -138,7 +138,6 @@ #define UIP_CONF_LLH_LEN 0 #define UIP_CONF_ROUTER 1 -#define UIP_CONF_IPV6_RPL 1 /* Handle 10 neighbors */ #define NBR_TABLE_CONF_MAX_NEIGHBORS 15 @@ -149,7 +148,7 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #define UIP_CONF_IPV6_QUEUE_PKT 0 #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_REASSEMBLY 0 @@ -169,10 +168,10 @@ #endif /* SICSLOWPAN_CONF_FRAG */ #define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_IP_FORWARD 1 #define UIP_CONF_BUFFER_SIZE 108 -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #define UIP_CONF_ICMP_DEST_UNREACH 1 diff --git a/platform/z1/contiki-z1-main.c b/platform/z1/contiki-z1-main.c index 10444dc75..78e1f4669 100644 --- a/platform/z1/contiki-z1-main.c +++ b/platform/z1/contiki-z1-main.c @@ -47,9 +47,9 @@ #include "dev/adxl345.h" #include "sys/clock.h" -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 #include "net/ipv6/uip-ds6.h" -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ #include "net/rime/rime.h" @@ -70,11 +70,11 @@ extern unsigned char node_mac[8]; static struct timer mgt_timer; #endif -#ifndef WITH_UIP -#define WITH_UIP 0 +#ifndef NETSTACK_CONF_WITH_IPV4 +#define NETSTACK_CONF_WITH_IPV4 0 #endif -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 #include "net/ip/uip.h" #include "net/ipv4/uip-fw.h" #include "net/uip-fw-drv.h" @@ -84,12 +84,12 @@ static struct uip_fw_netif slipif = static struct uip_fw_netif meshif = { UIP_FW_NETIF(172, 16, 0, 0, 255, 255, 0, 0, uip_over_mesh_send) }; -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ #define UIP_OVER_MESH_CHANNEL 8 -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 static uint8_t is_gateway; -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ #ifdef EXPERIMENT_SETUP #include "experiment-setup.h" @@ -140,7 +140,7 @@ set_rime_addr(void) int i; memset(&addr, 0, sizeof(linkaddr_t)); -#if UIP_CONF_IPV6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(addr.u8, node_mac, sizeof(addr.u8)); #else if(node_id == 0) { @@ -172,7 +172,7 @@ print_processes(struct process *const processes[]) putchar('\n'); } /*--------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 static void set_gateway(void) { @@ -187,7 +187,7 @@ set_gateway(void) is_gateway = 1; } } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ int main(int argc, char **argv) @@ -203,9 +203,9 @@ main(int argc, char **argv) clock_wait(100); uart0_init(BAUD2UBR(115200)); /* Must come before first printf */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 slip_arch_init(BAUD2UBR(115200)); -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ xmem_init(); @@ -308,7 +308,7 @@ main(int argc, char **argv) PRINTF("Node id not set\n"); } -#if WITH_UIP6 +#if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, node_mac, sizeof(uip_lladdr.addr)); /* Setup nullmac-like MAC for 802.15.4 */ /* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */ @@ -356,7 +356,7 @@ main(int argc, char **argv) ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]); } -#else /* WITH_UIP6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ NETSTACK_RDC.init(); NETSTACK_MAC.init(); @@ -367,9 +367,9 @@ main(int argc, char **argv) CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1 : NETSTACK_RDC.channel_check_interval()), CC2420_CONF_CHANNEL); -#endif /* WITH_UIP6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if !WITH_UIP && !WITH_UIP6 +#if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6 uart0_set_input(serial_line_input_byte); serial_line_init(); #endif @@ -381,7 +381,7 @@ main(int argc, char **argv) timesynch_set_authority_level(linkaddr_node_addr.u8[0]); #endif /* TIMESYNCH_CONF_ENABLED */ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 process_start(&tcpip_process, NULL); process_start(&uip_fw_process, NULL); /* Start IP output */ process_start(&slip_process, NULL); @@ -408,7 +408,7 @@ main(int argc, char **argv) printf("uIP started with IP address %d.%d.%d.%d\n", uip_ipaddr_to_quad(&hostaddr)); } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ energest_init(); ENERGEST_ON(ENERGEST_TYPE_CPU); diff --git a/regression-tests/04-rime/code/Makefile b/regression-tests/04-rime/code/Makefile index b6db61162..cec13fcf2 100644 --- a/regression-tests/04-rime/code/Makefile +++ b/regression-tests/04-rime/code/Makefile @@ -2,4 +2,5 @@ CONTIKI = ../../.. all: trickle-node +CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/regression-tests/11-ipv6/code/receiver/Makefile b/regression-tests/11-ipv6/code/receiver/Makefile index 0decf131d..7288d10ef 100644 --- a/regression-tests/11-ipv6/code/receiver/Makefile +++ b/regression-tests/11-ipv6/code/receiver/Makefile @@ -1,6 +1,6 @@ CONTIKI=../../../.. -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL -DPROJECT_CONF_H=\"project-conf.h\" +CFLAGS+= -DPROJECT_CONF_H=\"project-conf.h\" +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/regression-tests/11-ipv6/code/sender/Makefile b/regression-tests/11-ipv6/code/sender/Makefile index 0decf131d..7288d10ef 100644 --- a/regression-tests/11-ipv6/code/sender/Makefile +++ b/regression-tests/11-ipv6/code/sender/Makefile @@ -1,6 +1,6 @@ CONTIKI=../../../.. -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL -DPROJECT_CONF_H=\"project-conf.h\" +CFLAGS+= -DPROJECT_CONF_H=\"project-conf.h\" +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/regression-tests/12-rpl/code/Makefile b/regression-tests/12-rpl/code/Makefile index cfe24a53b..616341592 100644 --- a/regression-tests/12-rpl/code/Makefile +++ b/regression-tests/12-rpl/code/Makefile @@ -1,9 +1,7 @@ all: sender-node receiver-node root-node CONTIKI=../../.. -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL - CFLAGS+=-DPROJECT_CONF_H=\"project-conf.h\" +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/regression-tests/17-slip-radio/code/Makefile b/regression-tests/17-slip-radio/code/Makefile index d1db363eb..12e72d165 100644 --- a/regression-tests/17-slip-radio/code/Makefile +++ b/regression-tests/17-slip-radio/code/Makefile @@ -2,8 +2,5 @@ all: wait-dag APPS=servreg-hack CONTIKI=../../.. -WITH_UIP6=1 -UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL - +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/regression-tests/Makefile b/regression-tests/Makefile index f705dcdce..efa9cc54c 100644 --- a/regression-tests/Makefile +++ b/regression-tests/Makefile @@ -47,3 +47,5 @@ cooja: $(CONTIKI)/tools/cooja/dist/cooja.jar $(CONTIKI)/tools/cooja/dist/cooja.jar: (cd $(CONTIKI)/tools/cooja; ant jar) +scan-build: + cd scan_build && scan-build $(MAKE) diff --git a/regression-tests/scan_build/Makefile b/regression-tests/scan_build/Makefile new file mode 100644 index 000000000..9ceec7978 --- /dev/null +++ b/regression-tests/scan_build/Makefile @@ -0,0 +1,16 @@ +EXAMPLESDIR=../../examples +TOOLSDIR=../../tools + +EXAMPLES = \ +hello-world/minimal-net \ +hello-world/native \ +eeprom-test/native \ +example-shell/native \ +tcp-socket/minimal-net \ +telnet-server/minimal-net \ +webserver/minimal-net \ +wget/minimal-net \ + +TOOLS= + +include ../Makefile.compile-test diff --git a/tools/release-tools/compile-platforms/Makefile.platform b/tools/release-tools/compile-platforms/Makefile.platform index ba6cee3d2..aea163ae7 100644 --- a/tools/release-tools/compile-platforms/Makefile.platform +++ b/tools/release-tools/compile-platforms/Makefile.platform @@ -3,7 +3,9 @@ CONTIKI = ../../../.. APPS=serial-shell webserver telnetd ifeq ($(TARGET), avr-raven) - UIP_CONF_IPV6=1 + CONTIKI_WITH_IPV6 = 1 +else + CONTIKI_WITH_RIME = 1 endif include $(CONTIKI)/Makefile.include diff --git a/tools/sky/uip6-bridge/Makefile b/tools/sky/uip6-bridge/Makefile index b537ecce0..492dc9b77 100644 --- a/tools/sky/uip6-bridge/Makefile +++ b/tools/sky/uip6-bridge/Makefile @@ -6,8 +6,7 @@ CONTIKI=../../.. endif endif -DEFINES=WITH_UIP6=1,WITH_SLIP=1,PROJECT_CONF_H=\"bridge-conf.h\" -UIP_CONF_IPV6=1 +DEFINES=WITH_SLIP=1,PROJECT_CONF_H=\"bridge-conf.h\" ifndef TARGET TARGET=sky @@ -22,6 +21,7 @@ upload: uip6-bridge-tap.ihex cp $< $(IHEXFILE) $(MAKE) sky-u.$(subst /,-,$(word $(MOTE), $(MOTES))) +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include ../../tapslip6: ../../tapslip6.c diff --git a/tools/sky/uip6-bridge/dev/slip.c b/tools/sky/uip6-bridge/dev/slip.c index 8c63da078..42d6760b1 100644 --- a/tools/sky/uip6-bridge/dev/slip.c +++ b/tools/sky/uip6-bridge/dev/slip.c @@ -100,7 +100,7 @@ slip_set_tcpip_input_callback(void (*c)(void)) tcpip_input_callback = c; } /*---------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 uint8_t slip_send(void) { @@ -129,7 +129,7 @@ slip_send(void) return UIP_FW_OK; } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ uint8_t slip_write(const void *_ptr, int len) @@ -263,7 +263,7 @@ PROCESS_THREAD(slip_process, ev, data) /* Move packet from rxbuf to buffer provided by uIP. */ uip_len = slip_poll_handler(&uip_buf[UIP_LLH_LEN], UIP_BUFSIZE - UIP_LLH_LEN); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 if(uip_len == 4 && strncmp((char*)&uip_buf[UIP_LLH_LEN], "?IPA", 4) == 0) { char buf[8]; memcpy(&buf[0], "=IPA", 4); @@ -297,7 +297,7 @@ PROCESS_THREAD(slip_process, ev, data) uip_len = 0; SLIP_STATISTICS(slip_ip_drop++); } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ if(uip_len > 0) { if(tcpip_input_callback) { tcpip_input_callback(); @@ -305,7 +305,7 @@ PROCESS_THREAD(slip_process, ev, data) tcpip_input(); } } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } PROCESS_END(); diff --git a/tools/sky/uip6-bridge/sicslow_ethernet.c b/tools/sky/uip6-bridge/sicslow_ethernet.c index 29967d1c0..a74415020 100644 --- a/tools/sky/uip6-bridge/sicslow_ethernet.c +++ b/tools/sky/uip6-bridge/sicslow_ethernet.c @@ -312,7 +312,7 @@ void mac_LowpanToEthernet(void) ETHBUF(uip_buf)->type = uip_htons(UIP_ETHTYPE_IPV6); //Check for broadcast message - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { /* if( ( parsed_frame->fcf->destAddrMode == SHORTADDRMODE) && */ /* ( parsed_frame->dest_addr->addr16 == 0xffff) ) { */ ETHBUF(uip_buf)->dest.addr[0] = 0x33; diff --git a/tools/stm32w/uip6_bridge/Makefile b/tools/stm32w/uip6_bridge/Makefile index a1116deca..f2fd05965 100644 --- a/tools/stm32w/uip6_bridge/Makefile +++ b/tools/stm32w/uip6_bridge/Makefile @@ -7,7 +7,6 @@ endif endif DEFINES=PROJECT_CONF_H=\"bridge-conf.h\" -UIP_CONF_IPV6=1 ifndef TARGET TARGET=mbxxx @@ -18,4 +17,5 @@ PROJECT_SOURCEFILES = fakeuip.c sicslow_ethernet.c slip.c all: uip6-bridge-tap +CONTIKI_WITH_IPV6 = 1 include $(CONTIKI)/Makefile.include diff --git a/tools/stm32w/uip6_bridge/dev/slip.c b/tools/stm32w/uip6_bridge/dev/slip.c index e9983ca6e..1380160d1 100644 --- a/tools/stm32w/uip6_bridge/dev/slip.c +++ b/tools/stm32w/uip6_bridge/dev/slip.c @@ -115,7 +115,7 @@ slip_set_tcpip_input_callback(void (*c)(void)) tcpip_input_callback = c; } /*---------------------------------------------------------------------------*/ -#if WITH_UIP +#if NETSTACK_CONF_WITH_IPV4 uint8_t slip_send(void) { @@ -144,7 +144,7 @@ slip_send(void) return UIP_FW_OK; } -#endif /* WITH_UIP */ +#endif /* NETSTACK_CONF_WITH_IPV4 */ /*---------------------------------------------------------------------------*/ uint8_t slip_write(const void *_ptr, int len) @@ -339,7 +339,7 @@ PROCESS_THREAD(slip_process, ev, data) /* Move packet from rxbuf to buffer provided by uIP. */ uip_len = slip_poll_handler(&uip_buf[UIP_LLH_LEN], UIP_BUFSIZE - UIP_LLH_LEN); -#if !UIP_CONF_IPV6 +#if !NETSTACK_CONF_WITH_IPV6 if(uip_len == 4 && strncmp((char*)&uip_buf[UIP_LLH_LEN], "?IPA", 4) == 0) { char buf[8]; memcpy(&buf[0], "=IPA", 4); @@ -373,7 +373,7 @@ PROCESS_THREAD(slip_process, ev, data) uip_len = 0; SLIP_STATISTICS(slip_ip_drop++); } -#else /* UIP_CONF_IPV6 */ +#else /* NETSTACK_CONF_WITH_IPV6 */ if(uip_len > 0) { if(tcpip_input_callback) { tcpip_input_callback(); @@ -381,7 +381,7 @@ PROCESS_THREAD(slip_process, ev, data) tcpip_input(); } } -#endif /* UIP_CONF_IPV6 */ +#endif /* NETSTACK_CONF_WITH_IPV6 */ } PROCESS_END(); diff --git a/tools/stm32w/uip6_bridge/sicslow_ethernet.c b/tools/stm32w/uip6_bridge/sicslow_ethernet.c index 9bd68d0ad..440ed9504 100644 --- a/tools/stm32w/uip6_bridge/sicslow_ethernet.c +++ b/tools/stm32w/uip6_bridge/sicslow_ethernet.c @@ -339,7 +339,7 @@ void mac_LowpanToEthernet(void) ETHBUF(uip_buf)->type = htons(UIP_ETHTYPE_IPV6); //Check for broadcast message - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { + if(packetbuf_holds_broadcast()) { /* if( ( parsed_frame->fcf->destAddrMode == SHORTADDRMODE) && */ /* ( parsed_frame->dest_addr->addr16 == 0xffff) ) { */ ETHBUF(uip_buf)->dest.addr[0] = 0x33; diff --git a/tools/stm32w/wpcapslip6/fakeuip.c b/tools/stm32w/wpcapslip6/fakeuip.c index 73d103cdf..41fc2064e 100644 --- a/tools/stm32w/wpcapslip6/fakeuip.c +++ b/tools/stm32w/wpcapslip6/fakeuip.c @@ -3,7 +3,7 @@ * compile. Allows you to save needing to compile all of uIP in just * to get a few things */ -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #include "net/ip/uip.h" #include diff --git a/tools/stm32w/wpcapslip6/ip-process.c b/tools/stm32w/wpcapslip6/ip-process.c index ccd73d0e7..f4927e0c8 100644 --- a/tools/stm32w/wpcapslip6/ip-process.c +++ b/tools/stm32w/wpcapslip6/ip-process.c @@ -1,5 +1,5 @@ -#define UIP_CONF_IPV6 1 +#define NETSTACK_CONF_WITH_IPV6 1 #define UIP_CONF_LL_802154 1 #include