summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-06-25 10:34:52 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-06-25 10:34:52 -0600
commit86a37059e98e46294dff804ed9265bfc112d675b (patch)
tree629492c7c7af23a999bda24e9fdcde75e04ea4cb
parentf1994c5a179ba323f3dc29de7bc4cbaadeb4a831 (diff)
downloadnuttx-86a37059e98e46294dff804ed9265bfc112d675b.tar.gz
nuttx-86a37059e98e46294dff804ed9265bfc112d675b.tar.bz2
nuttx-86a37059e98e46294dff804ed9265bfc112d675b.zip
Clean-up packet socket naming
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_eth.c2
-rw-r--r--nuttx/include/nuttx/net/pkt.h16
-rw-r--r--nuttx/include/nuttx/net/uip.h35
-rw-r--r--nuttx/net/bind.c2
-rw-r--r--nuttx/net/net_close.c7
-rw-r--r--nuttx/net/pkt/pkt.h20
-rw-r--r--nuttx/net/pkt/pkt_callback.c7
-rw-r--r--nuttx/net/pkt/pkt_conn.c35
-rw-r--r--nuttx/net/pkt/pkt_input.c13
-rw-r--r--nuttx/net/pkt/pkt_poll.c7
-rw-r--r--nuttx/net/pkt/pkt_send.c7
-rw-r--r--nuttx/net/recvfrom.c11
-rw-r--r--nuttx/net/socket.c3
-rw-r--r--nuttx/net/tcp/Kconfig1
-rw-r--r--nuttx/net/tcp/tcp.h2
-rw-r--r--nuttx/net/tcp/tcp_send_buffered.c2
-rw-r--r--nuttx/net/tcp/tcp_send_unbuffered.c8
-rw-r--r--nuttx/net/uip/uip.h107
-rw-r--r--nuttx/net/uip/uip_initialize.c3
-rw-r--r--nuttx/net/uip/uip_input.c1
-rw-r--r--nuttx/net/uip/uip_poll.c5
21 files changed, 178 insertions, 116 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_eth.c b/nuttx/arch/arm/src/stm32/stm32_eth.c
index b89086309..2197665b3 100644
--- a/nuttx/arch/arm/src/stm32/stm32_eth.c
+++ b/nuttx/arch/arm/src/stm32/stm32_eth.c
@@ -1595,7 +1595,7 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
- uip_pktinput(&priv->dev);
+ pkt_input(&priv->dev);
#endif
/* Check if the packet is a valid size for the uIP buffer configuration
diff --git a/nuttx/include/nuttx/net/pkt.h b/nuttx/include/nuttx/net/pkt.h
index 8db02e923..2dfd85d2d 100644
--- a/nuttx/include/nuttx/net/pkt.h
+++ b/nuttx/include/nuttx/net/pkt.h
@@ -55,7 +55,7 @@
/* Representation of a uIP packet socket connection */
-struct uip_pkt_conn
+struct pkt_conn_s
{
dq_entry_t node; /* Supports a double linked list */
uint8_t lmac[6]; /* The local Ethernet address in network byte order */
@@ -86,21 +86,19 @@ struct uip_pkt_conn
* normally something done by the implementation of the socket() API
*/
-struct uip_pkt_conn *uip_pktalloc(void);
+FAR struct pkt_conn_s *pkt_alloc(void);
/* Allocate a new packet socket data callback */
-#define uip_pktcallbackalloc(conn) uip_callbackalloc(&conn->list)
-#define uip_pktcallbackfree(conn,cb) uip_callbackfree(cb, &conn->list)
+#define pkt_callbackalloc(conn) uip_callbackalloc(&conn->list)
+#define pkt_callbackfree(conn,cb) uip_callbackfree(cb, &conn->list)
/* Free a connection structure that is no longer in use. This should
* be done by the implementation of close()
*/
-void uip_pktfree(struct uip_pkt_conn *conn);
-
-void uip_pktpoll(struct uip_driver_s *dev, struct uip_pkt_conn *conn);
-
-int uip_pktinput(struct uip_driver_s *dev);
+void pkt_free(FAR struct pkt_conn_s *conn);
+void pkt_poll(FAR struct uip_driver_s *dev, FAR struct pkt_conn_s *conn);
+int pkt_input(FAR struct uip_driver_s *dev);
#endif /* __INCLUDE_NUTTX_NET_PKT_H */
diff --git a/nuttx/include/nuttx/net/uip.h b/nuttx/include/nuttx/net/uip.h
index 00dffb159..b9bad39f8 100644
--- a/nuttx/include/nuttx/net/uip.h
+++ b/nuttx/include/nuttx/net/uip.h
@@ -370,41 +370,6 @@ int uip_lockedwait(sem_t *sem);
* data, etc.
*/
-/* Send data on the current connection.
- *
- * This function is used to send out a single segment of TCP
- * data. Only applications that have been invoked by uIP for event
- * processing can send data.
- *
- * The amount of data that actually is sent out after a call to this
- * funcion is determined by the maximum amount of data TCP allows. uIP
- * will automatically crop the data so that only the appropriate
- * amount of data is sent. The function uip_mss() can be used to query
- * uIP for the amount of data that actually will be sent.
- *
- * Note: This function does not guarantee that the sent data will
- * arrive at the destination. If the data is lost in the network, the
- * application will be invoked with the UIP_REXMIT flag set. The
- * application will then have to resend the data using this function.
- *
- * data A pointer to the data which is to be sent.
- *
- * len The maximum amount of data bytes to be sent.
- */
-
-void uip_send(FAR struct uip_driver_s *dev, FAR const void *buf, int len);
-
-#ifdef CONFIG_NET_IOB
-struct iob_s;
-void uip_iobsend(FAR struct uip_driver_s *dev, FAR struct iob_s *buf,
- unsigned int len, unsigned int offset);
-#endif
-
-#ifdef CONFIG_NET_PKT
-void uip_pktsend(FAR struct uip_driver_s *dev, FAR const void *buf,
- unsigned int len);
-#endif
-
/* uIP convenience and converting functions.
*
* These functions can be used for converting between different data
diff --git a/nuttx/net/bind.c b/nuttx/net/bind.c
index 337254e09..a7d7121e5 100644
--- a/nuttx/net/bind.c
+++ b/nuttx/net/bind.c
@@ -73,7 +73,7 @@
****************************************************************************/
#ifdef CONFIG_NET_PKT
-static int pkt_bind(FAR struct uip_pkt_conn *conn,
+static int pkt_bind(FAR struct pkt_conn_s *conn,
FAR const struct sockaddr_ll *addr)
{
int ifindex;
diff --git a/nuttx/net/net_close.c b/nuttx/net/net_close.c
index f8f733a4a..6b5fde4c9 100644
--- a/nuttx/net/net_close.c
+++ b/nuttx/net/net_close.c
@@ -56,6 +56,7 @@
#include "net.h"
#include "uip/uip.h"
+#include "pkt/pkt.h"
/****************************************************************************
* Pre-processor Definitions
@@ -436,7 +437,7 @@ int psock_close(FAR struct socket *psock)
#ifdef CONFIG_NET_PKT
case SOCK_RAW:
{
- struct uip_pkt_conn *conn = psock->s_conn;
+ FAR struct pkt_conn_s *conn = psock->s_conn;
/* Is this the last reference to the connection structure (there
* could be more if the socket was dup'ed).
@@ -446,8 +447,8 @@ int psock_close(FAR struct socket *psock)
{
/* Yes... free the connection structure */
- conn->crefs = 0; /* No more references on the connection */
- uip_pktfree(psock->s_conn); /* Free uIP resources */
+ conn->crefs = 0; /* No more references on the connection */
+ pkt_free(psock->s_conn); /* Free uIP resources */
}
else
{
diff --git a/nuttx/net/pkt/pkt.h b/nuttx/net/pkt/pkt.h
index e2fa88458..bc51fc1b1 100644
--- a/nuttx/net/pkt/pkt.h
+++ b/nuttx/net/pkt/pkt.h
@@ -69,6 +69,26 @@ extern "C"
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
+struct eth_hdr_s; /* Forward reference */
+
+/* Defined in pkt_conn.c ****************************************************/
+
+void pkt_initialize(void);
+struct pkt_conn_s *pkt_alloc(void);
+void pkt_free(FAR struct pkt_conn_s *conn);
+struct pkt_conn_s *pkt_active(FAR struct eth_hdr_s *buf);
+struct pkt_conn_s *uip_nextpktconn(FAR struct pkt_conn_s *conn);
+
+/* Defined in pkt_callback.c ************************************************/
+
+uint16_t pkt_callback(FAR struct uip_driver_s *dev,
+ FAR struct pkt_conn_s *conn, uint16_t flags);
+
+/* Defined in pkt_input.c ***************************************************/
+
+/* Defined in pkt_poll.c ****************************************************/
+
+void pkt_poll(FAR struct uip_driver_s *dev, FAR struct pkt_conn_s *conn);
/****************************************************************************
* Function: psock_pkt_send
diff --git a/nuttx/net/pkt/pkt_callback.c b/nuttx/net/pkt/pkt_callback.c
index a00360f7e..7f91152ca 100644
--- a/nuttx/net/pkt/pkt_callback.c
+++ b/nuttx/net/pkt/pkt_callback.c
@@ -48,6 +48,7 @@
#include <nuttx/net/netdev.h>
#include "uip/uip.h"
+#include "pkt/pkt.h"
/****************************************************************************
* Private Data
@@ -62,7 +63,7 @@
****************************************************************************/
/****************************************************************************
- * Function: uip_pktcallback
+ * Function: pkt_callback
*
* Description:
* Inform the application holding the packet socket of a change in state.
@@ -75,8 +76,8 @@
*
****************************************************************************/
-uint16_t uip_pktcallback(FAR struct uip_driver_s *dev,
- FAR struct uip_pkt_conn *conn, uint16_t flags)
+uint16_t pkt_callback(FAR struct uip_driver_s *dev,
+ FAR struct pkt_conn_s *conn, uint16_t flags)
{
nllvdbg("flags: %04x\n", flags);
diff --git a/nuttx/net/pkt/pkt_conn.c b/nuttx/net/pkt/pkt_conn.c
index 5b8ab87e8..4d0a1420f 100644
--- a/nuttx/net/pkt/pkt_conn.c
+++ b/nuttx/net/pkt/pkt_conn.c
@@ -56,6 +56,7 @@
#include <nuttx/net/arp.h>
#include "uip/uip.h"
+#include "pkt/pkt.h"
/****************************************************************************
* Private Data
@@ -63,7 +64,7 @@
/* The array containing all packet socket connections */
-static struct uip_pkt_conn g_pkt_connections[CONFIG_NET_PKT_CONNS];
+static struct pkt_conn_s g_pkt_connections[CONFIG_NET_PKT_CONNS];
/* A list of all free packet socket connections */
@@ -107,7 +108,7 @@ static inline void _uip_semtake(sem_t *sem)
****************************************************************************/
/****************************************************************************
- * Name: uip_pktinit()
+ * Name: pkt_initialize()
*
* Description:
* Initialize the packet socket connection structures. Called once and
@@ -115,7 +116,7 @@ static inline void _uip_semtake(sem_t *sem)
*
****************************************************************************/
-void uip_pktinit(void)
+void pkt_initialize(void)
{
int i;
@@ -134,23 +135,23 @@ void uip_pktinit(void)
}
/****************************************************************************
- * Name: uip_pktpalloc()
+ * Name: pkt_palloc()
*
* Description:
* Alloc a new, uninitialized packet socket connection structure.
*
****************************************************************************/
-struct uip_pkt_conn *uip_pktalloc(void)
+FAR struct pkt_conn_s *pkt_alloc(void)
{
- struct uip_pkt_conn *conn;
+ FAR struct pkt_conn_s *conn;
/* The free list is only accessed from user, non-interrupt level and
* is protected by a semaphore (that behaves like a mutex).
*/
_uip_semtake(&g_free_sem);
- conn = (struct uip_pkt_conn *)dq_remfirst(&g_free_pkt_connections);
+ conn = (FAR struct pkt_conn_s *)dq_remfirst(&g_free_pkt_connections);
if (conn)
{
/* Make sure that the connection is marked as uninitialized */
@@ -167,7 +168,7 @@ struct uip_pkt_conn *uip_pktalloc(void)
}
/****************************************************************************
- * Name: uip_pktfree()
+ * Name: pkt_free()
*
* Description:
* Free a packet socket connection structure that is no longer in use.
@@ -175,7 +176,7 @@ struct uip_pkt_conn *uip_pktalloc(void)
*
****************************************************************************/
-void uip_pktfree(struct uip_pkt_conn *conn)
+void pkt_free(FAR struct pkt_conn_s *conn)
{
/* The free list is only accessed from user, non-interrupt level and
* is protected by a semaphore (that behaves like a mutex).
@@ -196,7 +197,7 @@ void uip_pktfree(struct uip_pkt_conn *conn)
}
/****************************************************************************
- * Name: uip_pktactive()
+ * Name: pkt_active()
*
* Description:
* Find a connection structure that is the appropriate
@@ -207,15 +208,15 @@ void uip_pktfree(struct uip_pkt_conn *conn)
*
****************************************************************************/
-struct uip_pkt_conn *uip_pktactive(struct eth_hdr_s *buf)
+FAR struct pkt_conn_s *pkt_active(struct eth_hdr_s *buf)
{
#define uip_ethaddr_cmp(addr1, addr2) \
((addr1[0] == addr2[0]) && (addr1[1] == addr2[1]) && \
(addr1[2] == addr2[2]) && (addr1[3] == addr2[3]) && \
(addr1[4] == addr2[4]) && (addr1[5] == addr2[5]))
- FAR struct uip_pkt_conn *conn =
- (struct uip_pkt_conn *)g_active_pkt_connections.head;
+ FAR struct pkt_conn_s *conn =
+ (FAR struct pkt_conn_s *)g_active_pkt_connections.head;
while (conn)
{
@@ -230,7 +231,7 @@ struct uip_pkt_conn *uip_pktactive(struct eth_hdr_s *buf)
/* Look at the next active connection */
- conn = (struct uip_pkt_conn *)conn->node.flink;
+ conn = (FAR struct pkt_conn_s *)conn->node.flink;
}
return conn;
@@ -248,15 +249,15 @@ struct uip_pkt_conn *uip_pktactive(struct eth_hdr_s *buf)
*
****************************************************************************/
-struct uip_pkt_conn *uip_nextpktconn(struct uip_pkt_conn *conn)
+FAR struct pkt_conn_s *uip_nextpktconn(FAR struct pkt_conn_s *conn)
{
if (!conn)
{
- return (struct uip_pkt_conn *)g_active_pkt_connections.head;
+ return (FAR struct pkt_conn_s *)g_active_pkt_connections.head;
}
else
{
- return (struct uip_pkt_conn *)conn->node.flink;
+ return (FAR struct pkt_conn_s *)conn->node.flink;
}
}
diff --git a/nuttx/net/pkt/pkt_input.c b/nuttx/net/pkt/pkt_input.c
index 6b803cb20..dd9bc07fa 100644
--- a/nuttx/net/pkt/pkt_input.c
+++ b/nuttx/net/pkt/pkt_input.c
@@ -53,6 +53,7 @@
#include <nuttx/net/arp.h>
#include "uip/uip.h"
+#include "pkt/pkt.h"
/****************************************************************************
* Pre-processor Definitions
@@ -77,7 +78,7 @@
****************************************************************************/
/****************************************************************************
- * Name: uip_pktinput
+ * Name: pkt_input
*
* Description:
* Handle incoming packet input
@@ -95,13 +96,13 @@
*
****************************************************************************/
-int uip_pktinput(struct uip_driver_s *dev)
+int pkt_input(struct uip_driver_s *dev)
{
- struct uip_pkt_conn *conn;
- struct eth_hdr_s *pbuf = (struct eth_hdr_s *)dev->d_buf;
+ FAR struct pkt_conn_s *conn;
+ FAR struct eth_hdr_s *pbuf = (struct eth_hdr_s *)dev->d_buf;
int ret = OK;
- conn = uip_pktactive(pbuf);
+ conn = pkt_active(pbuf);
if (conn)
{
uint16_t flags;
@@ -114,7 +115,7 @@ int uip_pktinput(struct uip_driver_s *dev)
/* Perform the application callback */
- flags = uip_pktcallback(dev, conn, UIP_NEWDATA);
+ flags = pkt_callback(dev, conn, UIP_NEWDATA);
/* If the operation was successful, the UIP_NEWDATA flag is removed
* and thus the packet can be deleted (OK will be returned).
diff --git a/nuttx/net/pkt/pkt_poll.c b/nuttx/net/pkt/pkt_poll.c
index 36ee03c58..5828261ab 100644
--- a/nuttx/net/pkt/pkt_poll.c
+++ b/nuttx/net/pkt/pkt_poll.c
@@ -53,6 +53,7 @@
#include <nuttx/net/pkt.h>
#include "uip/uip.h"
+#include "pkt/pkt.h"
/****************************************************************************
* Pre-processor Definitions
@@ -75,7 +76,7 @@
****************************************************************************/
/****************************************************************************
- * Name: uip_pktpoll
+ * Name: pkt_poll
*
* Description:
* Poll a packet "connection" structure for availability of TX data
@@ -92,7 +93,7 @@
*
****************************************************************************/
-void uip_pktpoll(struct uip_driver_s *dev, struct uip_pkt_conn *conn)
+void pkt_poll(FAR struct uip_driver_s *dev, FAR struct pkt_conn_s *conn)
{
nlldbg("IN\n");
@@ -110,7 +111,7 @@ void uip_pktpoll(struct uip_driver_s *dev, struct uip_pkt_conn *conn)
/* Perform the application callback */
- (void)uip_pktcallback(dev, conn, UIP_POLL);
+ (void)pkt_callback(dev, conn, UIP_POLL);
/* If the application has data to send, setup the UDP/IP header */
diff --git a/nuttx/net/pkt/pkt_send.c b/nuttx/net/pkt/pkt_send.c
index 6775b3161..768bd403c 100644
--- a/nuttx/net/pkt/pkt_send.c
+++ b/nuttx/net/pkt/pkt_send.c
@@ -57,6 +57,7 @@
#include "net.h"
#include "uip/uip.h"
+#include "pkt/pkt.h"
/****************************************************************************
* Pre-processor Definitions
@@ -237,11 +238,11 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf,
if (len > 0)
{
- struct uip_pkt_conn *conn = (struct uip_pkt_conn*)psock->s_conn;
+ FAR struct pkt_conn_s *conn = (FAR struct pkt_conn_s *)psock->s_conn;
/* Allocate resource to receive a callback */
- state.snd_cb = uip_pktcallbackalloc(conn);
+ state.snd_cb = pkt_callbackalloc(conn);
if (state.snd_cb)
{
FAR struct uip_driver_s *dev;
@@ -279,7 +280,7 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf,
/* Make sure that no further interrupts are processed */
- uip_pktcallbackfree(conn, state.snd_cb);
+ pkt_callbackfree(conn, state.snd_cb);
/* Clear the no-ARP bit in the device flags */
diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c
index c894b2021..a382b383c 100644
--- a/nuttx/net/recvfrom.c
+++ b/nuttx/net/recvfrom.c
@@ -60,6 +60,7 @@
#include "uip/uip.h"
#include "tcp/tcp.h"
#include "udp/udp.h"
+#include "pkt/pkt.h"
/****************************************************************************
* Definitions
@@ -1038,9 +1039,9 @@ static ssize_t recvfrom_result(int result, struct recvfrom_s *pstate)
#ifdef CONFIG_NET_PKT
static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
- FAR struct sockaddr_ll *from)
+ FAR struct sockaddr_ll *from)
{
- struct uip_pkt_conn *conn = (struct uip_pkt_conn *)psock->s_conn;
+ FAR struct pkt_conn_s *conn = (FAR struct pkt_conn_s *)psock->s_conn;
struct recvfrom_s state;
uip_lock_t save;
int ret;
@@ -1060,7 +1061,7 @@ static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
*/
#if 0
- ret = uip_pktconnect(conn, NULL);
+ ret = pkt_connect(conn, NULL);
if (ret < 0)
{
goto errout_with_state;
@@ -1069,7 +1070,7 @@ static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Set up the callback in the connection */
- state.rf_cb = uip_pktcallbackalloc(conn);
+ state.rf_cb = pkt_callbackalloc(conn);
if (state.rf_cb)
{
state.rf_cb->flags = UIP_NEWDATA|UIP_POLL;
@@ -1090,7 +1091,7 @@ static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Make sure that no further interrupts are processed */
- uip_pktcallbackfree(conn, state.rf_cb);
+ pkt_callbackfree(conn, state.rf_cb);
ret = recvfrom_result(ret, &state);
}
else
diff --git a/nuttx/net/socket.c b/nuttx/net/socket.c
index 61224f854..0fbf51ae1 100644
--- a/nuttx/net/socket.c
+++ b/nuttx/net/socket.c
@@ -48,6 +48,7 @@
#include "net.h"
#include "tcp/tcp.h"
#include "udp/udp.h"
+#include "pkt/pkt.h"
/****************************************************************************
* Global Functions
@@ -170,7 +171,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
* in the new socket instance.
*/
- struct uip_pkt_conn *conn = uip_pktalloc();
+ FAR struct pkt_conn_s *conn = pkt_alloc();
if (!conn)
{
/* Failed to reserve a connection structure */
diff --git a/nuttx/net/tcp/Kconfig b/nuttx/net/tcp/Kconfig
index b46b1ab84..da996ce25 100644
--- a/nuttx/net/tcp/Kconfig
+++ b/nuttx/net/tcp/Kconfig
@@ -58,7 +58,6 @@ config NET_TCP_WRITE_BUFFERS
bool "Enable TCP/IP write buffering"
default n
select NET_IOB
- depends on !NET_PKT
---help---
Write buffers allows buffering of ongoing TCP/IP packets, providing
for higher performance, streamed output.
diff --git a/nuttx/net/tcp/tcp.h b/nuttx/net/tcp/tcp.h
index 61089c905..4481774d5 100644
--- a/nuttx/net/tcp/tcp.h
+++ b/nuttx/net/tcp/tcp.h
@@ -70,7 +70,6 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
-#ifdef CONFIG_NET_TCP
/* Defined in tcp_conn.c ****************************************************/
void tcp_initialize(void);
@@ -130,7 +129,6 @@ uint16_t tcp_callback(FAR struct uip_driver_s *dev,
uint16_t tcp_datahandler(FAR struct tcp_conn_s *conn,
FAR uint8_t *buffer, uint16_t nbytes);
#endif
-#endif /* CONFIG_NET_TCP */
/****************************************************************************
* Function: psock_tcp_send
diff --git a/nuttx/net/tcp/tcp_send_buffered.c b/nuttx/net/tcp/tcp_send_buffered.c
index 1a2e53acc..7e0878754 100644
--- a/nuttx/net/tcp/tcp_send_buffered.c
+++ b/nuttx/net/tcp/tcp_send_buffered.c
@@ -662,7 +662,7 @@ static uint16_t psock_send_interrupt(FAR struct uip_driver_s *dev,
* Function: psock_tcp_send
*
* Description:
- * The psock_tcp_send() call may be used only when the TCP socket is in a
+ * psock_tcp_send() call may be used only when the TCP socket is in a
* connected state (so that the intended recipient is known).
*
* Parameters:
diff --git a/nuttx/net/tcp/tcp_send_unbuffered.c b/nuttx/net/tcp/tcp_send_unbuffered.c
index c0c9568e8..9feee3b62 100644
--- a/nuttx/net/tcp/tcp_send_unbuffered.c
+++ b/nuttx/net/tcp/tcp_send_unbuffered.c
@@ -57,6 +57,7 @@
#include "net.h"
#include "uip/uip.h"
+#include "tcp/tcp.h"
/****************************************************************************
* Pre-processor Definitions
@@ -443,10 +444,10 @@ end_wait:
****************************************************************************/
/****************************************************************************
- * Function: tcp_send
+ * Function: psock_tcp_send
*
* Description:
- * The tcp_send() call may be used only when the TCP socket is in a
+ * psock_tcp_send() call may be used only when the TCP socket is in a
* connected state (so that the intended recipient is known).
*
* Parameters:
@@ -499,7 +500,8 @@ end_wait:
*
****************************************************************************/
-ssize_t tcp_send(FAR struct socket *psock, FAR const void *buf, size_t len)
+ssize_t psock_tcp_send(FAR struct socket *psock,
+ FAR const void *buf, size_t len)
{
struct send_s state;
uip_lock_t save;
diff --git a/nuttx/net/uip/uip.h b/nuttx/net/uip/uip.h
index ad612d186..7a11dab26 100644
--- a/nuttx/net/uip/uip.h
+++ b/nuttx/net/uip/uip.h
@@ -96,35 +96,104 @@ extern "C"
#define EXTERN extern
#endif
-/* Defined in uip_callback.c ************************************************/
+/****************************************************************************
+ * Function: uip_callbackinit
+ *
+ * Description:
+ * Configure the pre-allocated callback structures into a free list.
+ * This is called internally as part of uIP initialization and should not
+ * be accessed from the application or socket layer.
+ *
+ * Assumptions:
+ * This function is called with interrupts disabled.
+ *
+ ****************************************************************************/
void uip_callbackinit(void);
-FAR struct uip_callback_s *uip_callbackalloc(struct uip_callback_s **list);
-void uip_callbackfree(FAR struct uip_callback_s *cb, struct uip_callback_s **list);
-uint16_t uip_callbackexecute(FAR struct uip_driver_s *dev, void *pvconn,
- uint16_t flags, FAR struct uip_callback_s *list);
-#ifdef CONFIG_NET_PKT
-/* Defined in uip_pktconn.c *************************************************/
+/****************************************************************************
+ * Function: uip_callbackalloc
+ *
+ * Description:
+ * Allocate a callback container from the free list.
+ * This is called internally as part of uIP initialization and should not
+ * be accessed from the application or socket layer.
+ *
+ * Assumptions:
+ * This function is called with interrupts disabled.
+ *
+ ****************************************************************************/
+
+FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list);
+
+/****************************************************************************
+ * Function: uip_callbackfree
+ *
+ * Description:
+ * Return a callback container to the free list.
+ * This is called internally as part of uIP initialization and should not
+ * be accessed from the application or socket layer.
+ *
+ * Assumptions:
+ * This function is called with interrupts disabled.
+ *
+ ****************************************************************************/
-void uip_pktinit(void);
-struct uip_pkt_conn *uip_pktalloc(void);
-void uip_pktfree(struct uip_pkt_conn *conn);
-struct uip_pkt_conn *uip_pktactive(struct eth_hdr_s *buf);
-struct uip_pkt_conn *uip_nextpktconn(struct uip_pkt_conn *conn);
+void uip_callbackfree(FAR struct uip_callback_s *cb,
+ FAR struct uip_callback_s **list);
-/* Defined in uip_pktcallback.c *********************************************/
+/****************************************************************************
+ * Function: uip_callbackexecute
+ *
+ * Description:
+ * Execute a list of callbacks.
+ * This is called internally as part of uIP initialization and should not
+ * be accessed from the application or socket layer.
+ *
+ * Assumptions:
+ * This function is called with interrupts disabled.
+ *
+ ****************************************************************************/
-uint16_t uip_pktcallback(struct uip_driver_s *dev, struct uip_pkt_conn *conn,
- uint16_t flags);
+uint16_t uip_callbackexecute(FAR struct uip_driver_s *dev, FAR void *pvconn,
+ uint16_t flags, FAR struct uip_callback_s *list);
-/* Defined in uip_pktinput.c ************************************************/
+/****************************************************************************
+ * Send data on the current connection.
+ *
+ * This function is used to send out a single segment of TCP
+ * data. Only applications that have been invoked by uIP for event
+ * processing can send data.
+ *
+ * The amount of data that actually is sent out after a call to this
+ * function is determined by the maximum amount of data TCP allows. uIP
+ * will automatically crop the data so that only the appropriate
+ * amount of data is sent. The function uip_mss() can be used to query
+ * uIP for the amount of data that actually will be sent.
+ *
+ * Note: This function does not guarantee that the sent data will
+ * arrive at the destination. If the data is lost in the network, the
+ * application will be invoked with the UIP_REXMIT flag set. The
+ * application will then have to resend the data using this function.
+ *
+ * data A pointer to the data which is to be sent.
+ *
+ * len The maximum amount of data bytes to be sent.
+ *
+ ****************************************************************************/
-/* Defined in uip_pktpoll.c *************************************************/
+void uip_send(FAR struct uip_driver_s *dev, FAR const void *buf, int len);
-void uip_pktpoll(struct uip_driver_s *dev, struct uip_pkt_conn *conn);
+#ifdef CONFIG_NET_IOB
+struct iob_s;
+void uip_iobsend(FAR struct uip_driver_s *dev, FAR struct iob_s *buf,
+ unsigned int len, unsigned int offset);
+#endif
-#endif /* CONFIG_NET_PKT */
+#ifdef CONFIG_NET_PKT
+void uip_pktsend(FAR struct uip_driver_s *dev, FAR const void *buf,
+ unsigned int len);
+#endif
#undef EXTERN
#ifdef __cplusplus
diff --git a/nuttx/net/uip/uip_initialize.c b/nuttx/net/uip/uip_initialize.c
index f71c3ab58..93e417099 100644
--- a/nuttx/net/uip/uip_initialize.c
+++ b/nuttx/net/uip/uip_initialize.c
@@ -50,6 +50,7 @@
#include "uip/uip.h"
#include "tcp/tcp.h"
#include "udp/udp.h"
+#include "pkt/pkt.h"
#include "igmp/igmp.h"
/****************************************************************************
@@ -129,7 +130,7 @@ void uip_initialize(void)
/* Initialize packet socket suport */
#ifdef CONFIG_NET_PKT
- uip_pktinit();
+ pkt_initialize();
#endif
/* Initialize the listening port structures */
diff --git a/nuttx/net/uip/uip_input.c b/nuttx/net/uip/uip_input.c
index c43a22f8a..cb51cafff 100644
--- a/nuttx/net/uip/uip_input.c
+++ b/nuttx/net/uip/uip_input.c
@@ -96,6 +96,7 @@
#include "uip/uip.h"
#include "tcp/tcp.h"
#include "udp/udp.h"
+#include "pkt/pkt.h"
#include "icmp/icmp.h"
#include "igmp/igmp.h"
diff --git a/nuttx/net/uip/uip_poll.c b/nuttx/net/uip/uip_poll.c
index 614ee1ddc..f7c212f99 100644
--- a/nuttx/net/uip/uip_poll.c
+++ b/nuttx/net/uip/uip_poll.c
@@ -49,6 +49,7 @@
#include "uip/uip.h"
#include "tcp/tcp.h"
#include "udp/udp.h"
+#include "pkt/pkt.h"
#include "icmp/icmp.h"
#include "igmp/igmp.h"
@@ -76,7 +77,7 @@
static int uip_pollpktconnections(struct uip_driver_s *dev,
uip_poll_callback_t callback)
{
- struct uip_pkt_conn *pkt_conn = NULL;
+ FAR struct pkt_conn_s *pkt_conn = NULL;
int bstop = 0;
/* Traverse all of the allocated packet connections and perform the poll action */
@@ -85,7 +86,7 @@ static int uip_pollpktconnections(struct uip_driver_s *dev,
{
/* Perform the packet TX poll */
- uip_pktpoll(dev, pkt_conn);
+ pkt_poll(dev, pkt_conn);
/* Call back into the driver */