mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-09 12:50:13 +00:00
Network layer configuration: replace UIP_CONF_* with NETSTACK_CONF_WITH_*
This commit is contained in:
parent
229c53a2e6
commit
a9cc909794
@ -68,13 +68,13 @@ MODULES += core/sys core/dev core/lib
|
||||
HAS_STACK = 0
|
||||
ifeq ($(CONTIKI_WITH_IPV4),1)
|
||||
HAS_STACK = 1
|
||||
CFLAGS += -DUIP_CONF_IPV4=1
|
||||
CFLAGS += -DNETSTACK_CONF_WITH_IPV4=1
|
||||
MODULES += core/net/ipv4 core/net/ip
|
||||
endif
|
||||
|
||||
ifeq ($(CONTIKI_WITH_RIME),1)
|
||||
HAS_STACK = 1
|
||||
CFLAGS += -DUIP_CONF_RIME=1
|
||||
CFLAGS += -DNETSTACK_CONF_WITH_RIME=1
|
||||
MODULES += core/net/rime
|
||||
endif
|
||||
|
||||
@ -86,7 +86,7 @@ endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONTIKI_WITH_IPV6),1)
|
||||
CFLAGS += -DUIP_CONF_IPV6=1
|
||||
CFLAGS += -DNETSTACK_CONF_WITH_IPV6=1
|
||||
ifneq ($(CONTIKI_WITH_RPL),0)
|
||||
CFLAGS += -DUIP_CONF_IPV6_RPL=1
|
||||
MODULES += core/net/rpl
|
||||
|
@ -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])
|
||||
|
@ -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_IPV6
|
||||
static void
|
||||
sniffprint(char *prefix, int seqno)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -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_ */
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -262,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);
|
||||
@ -296,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();
|
||||
@ -307,7 +307,7 @@ PROCESS_THREAD(slip_process, ev, data)
|
||||
tcpip_input();
|
||||
#endif
|
||||
}
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
|
@ -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 */
|
||||
@ -234,12 +234,12 @@ struct dns_hdr {
|
||||
* <https://developers.google.com/speed/public-dns/docs/using>
|
||||
*/
|
||||
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 +249,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];
|
||||
@ -315,13 +315,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");
|
||||
@ -508,7 +508,7 @@ 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) {
|
||||
@ -545,7 +545,7 @@ mdns_write_announce_records(unsigned char *queryptr, uint8_t *count)
|
||||
++(*count);
|
||||
}
|
||||
}
|
||||
#else /* UIP_CONF_IPV6 */
|
||||
#else /* NETSTACK_CONF_WITH_IPV6 */
|
||||
queryptr = encode_name(queryptr, resolv_hostname);
|
||||
ans = (struct dns_answer *)queryptr;
|
||||
ans->type = UIP_HTONS(NATIVE_DNS_TYPE);
|
||||
@ -556,7 +556,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 +585,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 */
|
||||
}
|
||||
};
|
||||
|
||||
@ -1141,7 +1141,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? */
|
||||
@ -1316,12 +1316,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;
|
||||
}
|
||||
@ -1428,7 +1428,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
|
||||
|
@ -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)
|
||||
{
|
||||
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
|
@ -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) {
|
||||
|
@ -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.
|
||||
|
@ -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. */
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -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 */
|
||||
|
@ -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 <string.h>
|
||||
|
||||
@ -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;
|