Disable TCP by default, homogenize UDP and TCP connections config
This commit is contained in:
parent
f64ec24c9b
commit
bf5bea583e
@ -53,7 +53,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef WEBSERVER_CONF_CFS_CONNS
|
||||
#define CONNS UIP_CONNS
|
||||
#define CONNS UIP_TCP_CONNS
|
||||
#else /* WEBSERVER_CONF_CFS_CONNS */
|
||||
#define CONNS WEBSERVER_CONF_CFS_CONNS
|
||||
#endif /* WEBSERVER_CONF_CFS_CONNS */
|
||||
|
@ -171,9 +171,8 @@ typedef uint64_t rtimer_clock_t;
|
||||
|
||||
#define UIP_CONF_DHCP_LIGHT
|
||||
#define UIP_CONF_LLH_LEN 0
|
||||
#define UIP_CONF_MAX_CONNECTIONS 4
|
||||
#define UIP_CONF_TCP_CONNS 4
|
||||
#define UIP_CONF_MAX_LISTENPORTS 8
|
||||
#define UIP_CONF_UDP_CONNS 12
|
||||
#define UIP_CONF_FWCACHE_SIZE 30
|
||||
#define UIP_CONF_BROADCAST 1
|
||||
#define UIP_ARCH_IPCHKSUM 1
|
||||
|
@ -144,9 +144,8 @@
|
||||
#ifndef UIP_CONF_TCP_MSS
|
||||
#define UIP_CONF_TCP_MSS 48
|
||||
#endif
|
||||
#define UIP_CONF_MAX_CONNECTIONS 4
|
||||
#define UIP_CONF_TCP_CONNS 4
|
||||
#define UIP_CONF_MAX_LISTENPORTS 8
|
||||
#define UIP_CONF_UDP_CONNS 12
|
||||
#define UIP_CONF_FWCACHE_SIZE 30
|
||||
#define UIP_CONF_BROADCAST 1
|
||||
#define UIP_ARCH_CHKSUM 0
|
||||
|
@ -65,7 +65,7 @@ typedef int32_t s32_t;
|
||||
typedef unsigned short uip_stats_t;
|
||||
|
||||
#define UIP_CONF_UDP 1
|
||||
#define UIP_CONF_MAX_CONNECTIONS 40
|
||||
#define UIP_CONF_TCP_CONNS 40
|
||||
#define UIP_CONF_MAX_LISTENPORTS 40
|
||||
#define UIP_CONF_BUFFER_SIZE 420
|
||||
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
|
||||
@ -123,7 +123,6 @@ typedef unsigned short uip_stats_t;
|
||||
#define UIP_CONF_RECEIVE_WINDOW 48
|
||||
#endif
|
||||
#define UIP_CONF_TCP_MSS 48
|
||||
#define UIP_CONF_UDP_CONNS 12
|
||||
#define UIP_CONF_FWCACHE_SIZE 30
|
||||
#define UIP_CONF_BROADCAST 1
|
||||
#define UIP_ARCH_IPCHKSUM 1
|
||||
|
@ -111,9 +111,8 @@
|
||||
#ifndef UIP_CONF_TCP_MSS
|
||||
#define UIP_CONF_TCP_MSS 48
|
||||
#endif
|
||||
#define UIP_CONF_MAX_CONNECTIONS 4
|
||||
#define UIP_CONF_TCP_CONNS 4
|
||||
#define UIP_CONF_MAX_LISTENPORTS 8
|
||||
#define UIP_CONF_UDP_CONNS 12
|
||||
#define UIP_CONF_FWCACHE_SIZE 30
|
||||
#define UIP_CONF_BROADCAST 1
|
||||
#define UIP_ARCH_IPCHKSUM 1
|
||||
|
@ -141,23 +141,23 @@
|
||||
#define UIP_CONF_UDP 1
|
||||
#endif /* UIP_CONF_UDP */
|
||||
|
||||
/* UIP_CONF_MAX_CONNECTIONS specifies the maximum number of
|
||||
simultaneous TCP connections. */
|
||||
#ifndef UIP_CONF_MAX_CONNECTIONS
|
||||
#define UIP_CONF_MAX_CONNECTIONS 8
|
||||
#endif /* UIP_CONF_MAX_CONNECTIONS */
|
||||
/* UIP_CONF_UDP_CONNS specifies the maximum number of
|
||||
simultaneous UDP connections. */
|
||||
#ifndef UIP_CONF_UDP_CONNS
|
||||
#define UIP_CONF_UDP_CONNS 8
|
||||
#endif /* UIP_CONF_UDP_CONNS */
|
||||
|
||||
/* UIP_CONF_TCP specifies if TCP support should be included or
|
||||
not. Disabling TCP saves memory. */
|
||||
#ifndef UIP_CONF_TCP
|
||||
#define UIP_CONF_TCP 1
|
||||
#define UIP_CONF_TCP 0
|
||||
#endif /* UIP_CONF_TCP */
|
||||
|
||||
/* UIP_CONF_MAX_CONNECTIONS specifies the maximum number of
|
||||
/* UIP_CONF_TCP_CONNS specifies the maximum number of
|
||||
simultaneous TCP connections. */
|
||||
#ifndef UIP_CONF_MAX_CONNECTIONS
|
||||
#define UIP_CONF_MAX_CONNECTIONS 8
|
||||
#endif /* UIP_CONF_MAX_CONNECTIONS */
|
||||
#ifndef UIP_CONF_TCP_CONNS
|
||||
#define UIP_CONF_TCP_CONNS 8
|
||||
#endif /* UIP_CONF_TCP_CONNS */
|
||||
|
||||
/* UIP_CONF_ND6_SEND_RA enables standard IPv6 Router Advertisement.
|
||||
* We enable it by default when IPv6 is used without RPL. */
|
||||
|
@ -331,7 +331,7 @@ eventhandler(process_event_t ev, process_data_t data)
|
||||
{
|
||||
struct uip_conn *cptr;
|
||||
|
||||
for(cptr = &uip_conns[0]; cptr < &uip_conns[UIP_CONNS]; ++cptr) {
|
||||
for(cptr = &uip_conns[0]; cptr < &uip_conns[UIP_TCP_CONNS]; ++cptr) {
|
||||
if(cptr->appstate.p == p) {
|
||||
cptr->appstate.p = PROCESS_NONE;
|
||||
cptr->tcpstateflags = UIP_CLOSED;
|
||||
@ -361,7 +361,7 @@ eventhandler(process_event_t ev, process_data_t data)
|
||||
if(data == &periodic &&
|
||||
etimer_expired(&periodic)) {
|
||||
#if UIP_TCP
|
||||
for(i = 0; i < UIP_CONNS; ++i) {
|
||||
for(i = 0; i < UIP_TCP_CONNS; ++i) {
|
||||
if(uip_conn_active(i)) {
|
||||
/* Only restart the timer if there are active
|
||||
connections. */
|
||||
|
@ -355,7 +355,7 @@ void uip_setipid(uint16_t id);
|
||||
* The usual way of calling the function is through a for() loop like
|
||||
* this:
|
||||
\code
|
||||
for(i = 0; i < UIP_CONNS; ++i) {
|
||||
for(i = 0; i < UIP_TCP_CONNS; ++i) {
|
||||
uip_periodic(i);
|
||||
if(uip_len > 0) {
|
||||
devicedriver_send();
|
||||
@ -368,7 +368,7 @@ void uip_setipid(uint16_t id);
|
||||
* Ethernet, you will need to call the uip_arp_out() function before
|
||||
* calling the device driver:
|
||||
\code
|
||||
for(i = 0; i < UIP_CONNS; ++i) {
|
||||
for(i = 0; i < UIP_TCP_CONNS; ++i) {
|
||||
uip_periodic(i);
|
||||
if(uip_len > 0) {
|
||||
uip_arp_out();
|
||||
@ -1363,7 +1363,7 @@ struct uip_conn {
|
||||
CCIF extern struct uip_conn *uip_conn;
|
||||
#if UIP_TCP
|
||||
/* The array containing all uIP connections. */
|
||||
CCIF extern struct uip_conn uip_conns[UIP_CONNS];
|
||||
CCIF extern struct uip_conn uip_conns[UIP_TCP_CONNS];
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -415,11 +415,11 @@ void uip_log(char *msg);
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#ifndef UIP_CONF_MAX_CONNECTIONS
|
||||
#define UIP_CONNS 10
|
||||
#else /* UIP_CONF_MAX_CONNECTIONS */
|
||||
#define UIP_CONNS (UIP_CONF_MAX_CONNECTIONS)
|
||||
#endif /* UIP_CONF_MAX_CONNECTIONS */
|
||||
#ifndef UIP_CONF_TCP_CONNS
|
||||
#define UIP_TCP_CONNS 10
|
||||
#else /* UIP_CONF_TCP_CONNS */
|
||||
#define UIP_TCP_CONNS (UIP_CONF_TCP_CONNS)
|
||||
#endif /* UIP_CONF_TCP_CONNS */
|
||||
|
||||
|
||||
/**
|
||||
|
@ -140,6 +140,7 @@ extract_lladdr_from_llao_aligned(uip_lladdr_t *dest) {
|
||||
}
|
||||
#endif /* UIP_ND6_SEND_NA || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER */
|
||||
/*------------------------------------------------------------------*/
|
||||
#if UIP_ND6_SEND_NA /* UIP_ND6_SEND_NA */
|
||||
/* create a llao */
|
||||
static void
|
||||
create_llao(uint8_t *llao, uint8_t type) {
|
||||
@ -150,7 +151,7 @@ create_llao(uint8_t *llao, uint8_t type) {
|
||||
memset(&llao[UIP_ND6_OPT_DATA_OFFSET + UIP_LLADDR_LEN], 0,
|
||||
UIP_ND6_OPT_LLAO_LEN - 2 - UIP_LLADDR_LEN);
|
||||
}
|
||||
|
||||
#endif /* UIP_ND6_SEND_NA */
|
||||
/*------------------------------------------------------------------*/
|
||||
/**
|
||||
* Neighbor Solicitation Processing
|
||||
|
@ -234,7 +234,7 @@ static uint16_t lastport;
|
||||
*/
|
||||
#if UIP_TCP
|
||||
/* The uip_conns array holds all TCP connections. */
|
||||
struct uip_conn uip_conns[UIP_CONNS];
|
||||
struct uip_conn uip_conns[UIP_TCP_CONNS];
|
||||
|
||||
/* The uip_listenports list all currently listning ports. */
|
||||
uint16_t uip_listenports[UIP_LISTENPORTS];
|
||||
@ -428,7 +428,7 @@ uip_init(void)
|
||||
for(c = 0; c < UIP_LISTENPORTS; ++c) {
|
||||
uip_listenports[c] = 0;
|
||||
}
|
||||
for(c = 0; c < UIP_CONNS; ++c) {
|
||||
for(c = 0; c < UIP_TCP_CONNS; ++c) {
|
||||
uip_conns[c].tcpstateflags = UIP_CLOSED;
|
||||
}
|
||||
#endif /* UIP_TCP */
|
||||
@ -465,7 +465,7 @@ uip_connect(const uip_ipaddr_t *ripaddr, uint16_t rport)
|
||||
|
||||
/* Check if this port is already in use, and if so try to find
|
||||
another one. */
|
||||
for(c = 0; c < UIP_CONNS; ++c) {
|
||||
for(c = 0; c < UIP_TCP_CONNS; ++c) {
|
||||
conn = &uip_conns[c];
|
||||
if(conn->tcpstateflags != UIP_CLOSED &&
|
||||
conn->lport == uip_htons(lastport)) {
|
||||
@ -474,7 +474,7 @@ uip_connect(const uip_ipaddr_t *ripaddr, uint16_t rport)
|
||||
}
|
||||
|
||||
conn = 0;
|
||||
for(c = 0; c < UIP_CONNS; ++c) {
|
||||
for(c = 0; c < UIP_TCP_CONNS; ++c) {
|
||||
cconn = &uip_conns[c];
|
||||
if(cconn->tcpstateflags == UIP_CLOSED) {
|
||||
conn = cconn;
|
||||
@ -1603,7 +1603,7 @@ uip_process(uint8_t flag)
|
||||
|
||||
/* Demultiplex this segment. */
|
||||
/* First check any active connections. */
|
||||
for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_CONNS - 1];
|
||||
for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_TCP_CONNS - 1];
|
||||
++uip_connr) {
|
||||
if(uip_connr->tcpstateflags != UIP_CLOSED &&
|
||||
UIP_TCP_BUF->destport == uip_connr->lport &&
|
||||
@ -1696,7 +1696,7 @@ uip_process(uint8_t flag)
|
||||
CLOSED connections are found. Thanks to Eddie C. Dost for a very
|
||||
nice algorithm for the TIME_WAIT search. */
|
||||
uip_connr = 0;
|
||||
for(c = 0; c < UIP_CONNS; ++c) {
|
||||
for(c = 0; c < UIP_TCP_CONNS; ++c) {
|
||||
if(uip_conns[c].tcpstateflags == UIP_CLOSED) {
|
||||
uip_connr = &uip_conns[c];
|
||||
break;
|
||||
|
@ -4,6 +4,5 @@ APPS += http-socket
|
||||
|
||||
CONTIKI_WITH_IPV6 = 1
|
||||
CONTIKI_WITH_RPL_LITE = 0
|
||||
CFLAGS += -DUIP_CONF_TCP=1
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
||||
|
||||
|
@ -3,5 +3,5 @@ CONTIKI=../..
|
||||
|
||||
CONTIKI_WITH_IPV6 = 1
|
||||
CONTIKI_WITH_RPL_LITE = 0
|
||||
CFLAGS += -DUIP_CONF_TCP=1
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
#define webserver_log(...)
|
||||
|
||||
#ifndef WEBSERVER_CONF_CFS_CONNS
|
||||
#define CONNS UIP_CONNS
|
||||
#define CONNS UIP_TCP_CONNS
|
||||
#else /* WEBSERVER_CONF_CFS_CONNS */
|
||||
#define CONNS WEBSERVER_CONF_CFS_CONNS
|
||||
#endif /* WEBSERVER_CONF_CFS_CONNS */
|
||||
|
@ -49,7 +49,7 @@
|
||||
#define webserver_log(...)
|
||||
|
||||
#ifndef WEBSERVER_CONF_CFS_CONNS
|
||||
#define CONNS UIP_CONNS
|
||||
#define CONNS UIP_TCP_CONNS
|
||||
#else /* WEBSERVER_CONF_CFS_CONNS */
|
||||
#define CONNS WEBSERVER_CONF_CFS_CONNS
|
||||
#endif /* WEBSERVER_CONF_CFS_CONNS */
|
||||
|
@ -53,8 +53,6 @@
|
||||
//#define UIP_CONF_BUFFER_SIZE (REST_MAX_CHUNK_SIZE + UIP_LLH_LEN + UIP_IPUDPH_LEN + COAP_MAX_HEADER_SIZE)
|
||||
//#define UIP_CONF_BUFFER_SIZE (REST_MAX_CHUNK_SIZE + 0 + 48 + 70)
|
||||
#define UIP_CONF_BUFFER_SIZE 1280 /* ipv6 required minimum */
|
||||
#undef UIP_CONF_UDP_CONNS
|
||||
#define UIP_CONF_UDP_CONNS 8
|
||||
|
||||
/* No IPv6 reassembly */
|
||||
#undef UIP_CONF_IPV6_REASSEMBLY
|
||||
|
@ -45,7 +45,7 @@
|
||||
#define webserver_log(...)
|
||||
|
||||
#ifndef WEBSERVER_CONF_CFS_CONNS
|
||||
#define CONNS UIP_CONNS
|
||||
#define CONNS UIP_TCP_CONNS
|
||||
#else /* WEBSERVER_CONF_CFS_CONNS */
|
||||
#define CONNS WEBSERVER_CONF_CFS_CONNS
|
||||
#endif /* WEBSERVER_CONF_CFS_CONNS */
|
||||
|
Loading…
Reference in New Issue
Block a user