summaryrefslogtreecommitdiff
path: root/nuttx/net/uip
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-22 18:36:46 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-22 18:36:46 +0000
commitc5148ad9e5d0c44c891f843bc7927bdcce0aee1a (patch)
tree6f54ddc25051c52d0ce5226bfac63c0054137b7c /nuttx/net/uip
parent7d4b2f6253d8ac898def6839b2ccc2ae61e24135 (diff)
downloadpx4-nuttx-c5148ad9e5d0c44c891f843bc7927bdcce0aee1a.tar.gz
px4-nuttx-c5148ad9e5d0c44c891f843bc7927bdcce0aee1a.tar.bz2
px4-nuttx-c5148ad9e5d0c44c891f843bc7927bdcce0aee1a.zip
TCP and ICMP protocols may now be disabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@398 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/uip')
-rw-r--r--nuttx/net/uip/Make.defs16
-rw-r--r--nuttx/net/uip/uip-arp.c6
-rw-r--r--nuttx/net/uip/uip-chksum.c2
-rw-r--r--nuttx/net/uip/uip-initialize.c4
-rw-r--r--nuttx/net/uip/uip-input.c11
-rw-r--r--nuttx/net/uip/uip-internal.h21
-rw-r--r--nuttx/net/uip/uip-poll.c8
-rw-r--r--nuttx/net/uip/uip-tcpappsend.c4
-rw-r--r--nuttx/net/uip/uip-tcpcallback.c4
-rw-r--r--nuttx/net/uip/uip-tcpconn.c4
-rw-r--r--nuttx/net/uip/uip-tcpinput.c7
-rw-r--r--nuttx/net/uip/uip-tcppoll.c4
-rw-r--r--nuttx/net/uip/uip-tcpreadahead.c4
-rw-r--r--nuttx/net/uip/uip-tcpsend.c4
-rw-r--r--nuttx/net/uip/uip-tcptimer.c4
15 files changed, 65 insertions, 38 deletions
diff --git a/nuttx/net/uip/Make.defs b/nuttx/net/uip/Make.defs
index 4256e72e9..c6a7f4d74 100644
--- a/nuttx/net/uip/Make.defs
+++ b/nuttx/net/uip/Make.defs
@@ -38,10 +38,10 @@ UIP_CSRCS =
ifeq ($(CONFIG_NET),y)
-# Common network source files
+# Common IP source files
UIP_CSRCS += uip-initialize.c uip-setipid.c uip-arp.c uip-input.c uip-send.c \
- uip-fw.c uip-split.c uip-poll.c uip-chksum.c
+ uip-poll.c uip-chksum.c
ifeq ($(CONFIG_NET_IPv6),y)
UIP_CSRCS += uip-neighbor.c
@@ -49,10 +49,19 @@ endif
# TCP source files
+ifeq ($(CONFIG_NET_TCP),y)
+
UIP_CSRCS += uip-tcpconn.c uip-tcppoll.c uip-tcptimer.c uip-tcpsend.c \
uip-tcpinput.c uip-tcpappsend.c uip-listen.c uip-tcpcallback.c \
uip-tcpreadahead.c
+# Follow can be used to add support for the "uipsplit uIP TCP throughput booster hack"
+# but are not currently used
+
+UIP_CSRCS += uip-fw.c uip-split.c
+
+endif
+
# UDP source files
ifeq ($(CONFIG_NET_UDP),y)
@@ -64,8 +73,11 @@ endif
#ICMP source files
+ifeq ($(CONFIG_NET_ICMP),y)
+
UIP_CSRCS += uip-icmpinput.c
endif
+endif
diff --git a/nuttx/net/uip/uip-arp.c b/nuttx/net/uip/uip-arp.c
index 4d95d16d3..9b74d0507 100644
--- a/nuttx/net/uip/uip-arp.c
+++ b/nuttx/net/uip/uip-arp.c
@@ -364,8 +364,8 @@ void uip_arp_arpin(struct uip_driver_s *dev)
uiphdr_ipaddr_copy(ARPBUF->ah_sipaddr, &dev->d_ipaddr);
uip_arp_dump(ARPBUF);
- ETHBUF->type = HTONS(UIP_ETHTYPE_ARP);
- dev->d_len = sizeof(struct arp_hdr) + UIP_LLH_LEN;
+ ETHBUF->type = HTONS(UIP_ETHTYPE_ARP);
+ dev->d_len = sizeof(struct arp_hdr) + UIP_LLH_LEN;
}
break;
@@ -482,8 +482,6 @@ void uip_arp_out(struct uip_driver_s *dev)
uip_arp_dump(ARPBUF);
ETHBUF->type = HTONS(UIP_ETHTYPE_ARP);
-
- dev->d_appdata = &dev->d_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
dev->d_len = sizeof(struct arp_hdr) + UIP_LLH_LEN;
return;
}
diff --git a/nuttx/net/uip/uip-chksum.c b/nuttx/net/uip/uip-chksum.c
index 6faaf9817..50602f481 100644
--- a/nuttx/net/uip/uip-chksum.c
+++ b/nuttx/net/uip/uip-chksum.c
@@ -54,7 +54,7 @@
* Definitions
****************************************************************************/
-#define BUF ((struct uip_tcpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
+#define BUF ((struct uip_ip_hdr *)&dev->d_buf[UIP_LLH_LEN])
/****************************************************************************
* Private Data
diff --git a/nuttx/net/uip/uip-initialize.c b/nuttx/net/uip/uip-initialize.c
index a3338d082..decc60ff8 100644
--- a/nuttx/net/uip/uip-initialize.c
+++ b/nuttx/net/uip/uip-initialize.c
@@ -116,6 +116,7 @@ void uip_initialize(void)
{
/* Initialize the listening port structures */
+#ifdef CONFIG_NET_TCP
uip_listeninit();
/* Initialize the TCP/IP connection structures */
@@ -127,14 +128,13 @@ void uip_initialize(void)
#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0
uip_tcpreadaheadinit();
#endif
+#endif /* CONFIG_NET_TCP */
/* Initialize the UDP connection structures */
#ifdef CONFIG_NET_UDP
uip_udpinit();
#endif
-
- /* IPv4 initialization. */
}
#endif /* CONFIG_NET */
diff --git a/nuttx/net/uip/uip-input.c b/nuttx/net/uip/uip-input.c
index b8d8ebb7e..6ee748c89 100644
--- a/nuttx/net/uip/uip-input.c
+++ b/nuttx/net/uip/uip-input.c
@@ -102,8 +102,8 @@
/* Macros. */
-#define BUF ((struct uip_tcpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
-#define FBUF ((struct uip_tcpip_hdr *)&uip_reassbuf[0])
+#define BUF ((struct uip_ip_hdr *)&dev->d_buf[UIP_LLH_LEN])
+#define FBUF ((struct uip_ip_hdr *)&uip_reassbuf[0])
/* IP fragment re-assembly */
@@ -294,9 +294,6 @@ nullreturn:
void uip_input(struct uip_driver_s *dev)
{
- dev->d_snddata = &dev->d_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];
- dev->d_appdata = &dev->d_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];
-
/* This is where the input processing starts. */
#ifdef CONFIG_NET_STATISTICS
@@ -468,9 +465,11 @@ void uip_input(struct uip_driver_s *dev)
switch (BUF->proto)
{
+#ifdef CONFIG_NET_TCP
case UIP_PROTO_TCP: /* TCP input */
uip_tcpinput(dev);
break;
+#endif
#ifdef CONFIG_NET_UDP
case UIP_PROTO_UDP: /* UDP input */
@@ -480,6 +479,7 @@ void uip_input(struct uip_driver_s *dev)
/* Check for ICMP input */
+#ifdef CONFIG_NET_ICMP
#ifndef CONFIG_NET_IPv6
case UIP_PROTO_ICMP: /* ICMP input */
#else
@@ -487,6 +487,7 @@ void uip_input(struct uip_driver_s *dev)
#endif
uip_icmpinput(dev);
break;
+#endif
default: /* Unrecognized/unsupported protocol */
#ifdef CONFIG_NET_STATISTICS
diff --git a/nuttx/net/uip/uip-internal.h b/nuttx/net/uip/uip-internal.h
index ccc1c86bd..2aab6fbe3 100644
--- a/nuttx/net/uip/uip-internal.h
+++ b/nuttx/net/uip/uip-internal.h
@@ -118,6 +118,7 @@ extern "C" {
#define EXTERN extern
#endif
+#ifdef CONFIG_NET_TCP
/* Defined in uip_tcpconn.c *************************************************/
EXTERN void uip_tcpinit(void);
@@ -165,6 +166,16 @@ EXTERN void uip_tcpinput(struct uip_driver_s *dev);
EXTERN uint8 uip_tcpcallback(struct uip_driver_s *dev,
struct uip_conn *conn, uint8 flags);
+/* Defined in uip-tcpreadahead.c ********************************************/
+
+#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0
+EXTERN void uip_tcpreadaheadinit(void);
+EXTERN struct uip_readahead_s *uip_tcpreadaheadalloc(void);
+EXTERN void uip_tcpreadaheadrelease(struct uip_readahead_s *buf);
+#endif /* CONFIG_NET_NTCP_READAHEAD_BUFFERS */
+
+#endif /* CONFIG_NET_TCP */
+
#ifdef CONFIG_NET_UDP
/* Defined in uip_udpconn.c *************************************************/
@@ -190,17 +201,11 @@ EXTERN void uip_udpcallback(struct uip_driver_s *dev,
struct uip_udp_conn *conn, uint8 flags);
#endif /* CONFIG_NET_UDP */
+#ifdef CONFIG_NET_ICMP
/* Defined in uip-icmpinput.c ***********************************************/
EXTERN void uip_icmpinput(struct uip_driver_s *dev);
-
-/* Defined in uip-tcpreadahead.c ********************************************/
-
-#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0
-EXTERN void uip_tcpreadaheadinit(void);
-EXTERN struct uip_readahead_s *uip_tcpreadaheadalloc(void);
-EXTERN void uip_tcpreadaheadrelease(struct uip_readahead_s *buf);
-#endif /* CONFIG_NET_NTCP_READAHEAD_BUFFERS */
+#endif /* CONFIG_NET_ICMP */
#undef EXTERN
#ifdef __cplusplus
diff --git a/nuttx/net/uip/uip-poll.c b/nuttx/net/uip/uip-poll.c
index f17f42e75..1e8483ea6 100644
--- a/nuttx/net/uip/uip-poll.c
+++ b/nuttx/net/uip/uip-poll.c
@@ -108,6 +108,7 @@ static int uip_polludpconnections(struct uip_driver_s *dev,
*
****************************************************************************/
+#ifdef CONFIG_NET_TCP
static inline int uip_polltcpconnections(struct uip_driver_s *dev,
uip_poll_callback_t callback)
{
@@ -129,6 +130,9 @@ static inline int uip_polltcpconnections(struct uip_driver_s *dev,
return bstop;
}
+#else
+# define uip_polltcpconnections(dev, callback) (0)
+#endif
/****************************************************************************
* Function: uip_polltcptimer
@@ -143,6 +147,7 @@ static inline int uip_polltcpconnections(struct uip_driver_s *dev,
*
****************************************************************************/
+#ifdef CONFIG_NET_TCP
static inline int uip_polltcptimer(struct uip_driver_s *dev,
uip_poll_callback_t callback, int hsec)
{
@@ -164,6 +169,9 @@ static inline int uip_polltcptimer(struct uip_driver_s *dev,
return bstop;
}
+#else
+# define uip_polltcptimer(dev, callback, hsec) (0)
+#endif
/****************************************************************************
* Public Functions
diff --git a/nuttx/net/uip/uip-tcpappsend.c b/nuttx/net/uip/uip-tcpappsend.c
index fa19c23f0..f26f897bb 100644
--- a/nuttx/net/uip/uip-tcpappsend.c
+++ b/nuttx/net/uip/uip-tcpappsend.c
@@ -42,7 +42,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#ifdef CONFIG_NET
+#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP)
#include <sys/types.h>
#include <debug.h>
@@ -235,4 +235,4 @@ void uip_tcprexmit(struct uip_driver_s *dev, struct uip_conn *conn, uint8 result
dev->d_len = 0;
}
}
-#endif /* CONFIG_NET */
+#endif /* CONFIG_NET && CONFIG_NET_TCP */
diff --git a/nuttx/net/uip/uip-tcpcallback.c b/nuttx/net/uip/uip-tcpcallback.c
index 311323059..1694a9ab4 100644
--- a/nuttx/net/uip/uip-tcpcallback.c
+++ b/nuttx/net/uip/uip-tcpcallback.c
@@ -39,7 +39,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#ifdef CONFIG_NET
+#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP)
#include <sys/types.h>
#include <string.h>
@@ -210,4 +210,4 @@ uint8 uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, uint8 fla
return ret;
}
-#endif /* CONFIG_NET */
+#endif /* CONFIG_NET && CONFIG_NET_TCP */
diff --git a/nuttx/net/uip/uip-tcpconn.c b/nuttx/net/uip/uip-tcpconn.c
index eb84d8f31..d2e211232 100644
--- a/nuttx/net/uip/uip-tcpconn.c
+++ b/nuttx/net/uip/uip-tcpconn.c
@@ -45,7 +45,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#ifdef CONFIG_NET
+#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP)
#include <sys/types.h>
#include <string.h>
@@ -655,4 +655,4 @@ int uip_tcpconnect(struct uip_conn *conn, const struct sockaddr_in *addr)
return OK;
}
-#endif /* CONFIG_NET */
+#endif /* CONFIG_NET && CONFIG_NET_TCP */
diff --git a/nuttx/net/uip/uip-tcpinput.c b/nuttx/net/uip/uip-tcpinput.c
index ba11fcb81..e3271263a 100644
--- a/nuttx/net/uip/uip-tcpinput.c
+++ b/nuttx/net/uip/uip-tcpinput.c
@@ -43,7 +43,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#ifdef CONFIG_NET
+#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP)
#include <sys/types.h>
#include <debug.h>
@@ -103,6 +103,9 @@ void uip_tcpinput(struct uip_driver_s *dev)
int len;
int i;
+ dev->d_snddata = &dev->d_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];
+ dev->d_appdata = &dev->d_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];
+
#ifdef CONFIG_NET_STATISTICS
uip_stat.tcp.recv++;
#endif
@@ -741,4 +744,4 @@ drop:
dev->d_len = 0;
}
-#endif /* CONFIG_NET */
+#endif /* CONFIG_NET && CONFIG_NET_TCP */
diff --git a/nuttx/net/uip/uip-tcppoll.c b/nuttx/net/uip/uip-tcppoll.c
index 9b66ef707..18aa9541d 100644
--- a/nuttx/net/uip/uip-tcppoll.c
+++ b/nuttx/net/uip/uip-tcppoll.c
@@ -43,7 +43,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#ifdef CONFIG_NET
+#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP)
#include <sys/types.h>
#include <debug.h>
@@ -127,4 +127,4 @@ void uip_tcppoll(struct uip_driver_s *dev, struct uip_conn *conn)
}
}
-#endif /* CONFIG_NET */
+#endif /* CONFIG_NET && CONFIG_NET_TCP */
diff --git a/nuttx/net/uip/uip-tcpreadahead.c b/nuttx/net/uip/uip-tcpreadahead.c
index 6c4c78f1e..abadb4f50 100644
--- a/nuttx/net/uip/uip-tcpreadahead.c
+++ b/nuttx/net/uip/uip-tcpreadahead.c
@@ -39,7 +39,7 @@
****************************************************************************/
#include <net/uip/uipopt.h>
-#if defined(CONFIG_NET) && (CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0)
+#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP) && (CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0)
#include <sys/types.h>
#include <queue.h>
@@ -129,4 +129,4 @@ void uip_tcpreadaheadrelease(struct uip_readahead_s *buf)
sq_addfirst(&buf->rh_node, &g_freebuffers);
}
-#endif /* CONFIG_NET && CONFIG_NET_NTCP_READAHEAD_BUFFERS*/
+#endif /* CONFIG_NET && CONFIG_NET_TCP && CONFIG_NET_NTCP_READAHEAD_BUFFERS*/
diff --git a/nuttx/net/uip/uip-tcpsend.c b/nuttx/net/uip/uip-tcpsend.c
index ef4a1b7af..1729dd75b 100644
--- a/nuttx/net/uip/uip-tcpsend.c
+++ b/nuttx/net/uip/uip-tcpsend.c
@@ -42,7 +42,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#ifdef CONFIG_NET
+#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP)
#include <sys/types.h>
#include <debug.h>
@@ -362,4 +362,4 @@ void uip_tcpack(struct uip_driver_s *dev, struct uip_conn *conn, uint8 ack)
uip_tcpsendcommon(dev, conn);
}
-#endif /* CONFIG_NET */
+#endif /* CONFIG_NET && CONFIG_NET_TCP */
diff --git a/nuttx/net/uip/uip-tcptimer.c b/nuttx/net/uip/uip-tcptimer.c
index beb16bc0f..3679808d3 100644
--- a/nuttx/net/uip/uip-tcptimer.c
+++ b/nuttx/net/uip/uip-tcptimer.c
@@ -43,7 +43,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#ifdef CONFIG_NET
+#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP)
#include <sys/types.h>
#include <debug.h>
@@ -247,4 +247,4 @@ done:
return;
}
-#endif /* CONFIG_NET */
+#endif /* CONFIG_NET && CONFIG_NET_TCP */