Clean-up packet socket naming
This commit is contained in:
parent
621097b6c8
commit
579ee6f573
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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).
|
||||
@ -447,7 +448,7 @@ 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 */
|
||||
pkt_free(psock->s_conn); /* Free uIP resources */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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).
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -60,6 +60,7 @@
|
||||
#include "uip/uip.h"
|
||||
#include "tcp/tcp.h"
|
||||
#include "udp/udp.h"
|
||||
#include "pkt/pkt.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -1040,7 +1041,7 @@ static ssize_t recvfrom_result(int result, struct recvfrom_s *pstate)
|
||||
static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
|
||||
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
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
117
net/uip/uip.h
117
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,
|
||||
|
||||
/****************************************************************************
|
||||
* 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_callbackfree(FAR struct uip_callback_s *cb,
|
||||
FAR struct uip_callback_s **list);
|
||||
|
||||
/****************************************************************************
|
||||
* 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_callbackexecute(FAR struct uip_driver_s *dev, FAR void *pvconn,
|
||||
uint16_t flags, FAR struct uip_callback_s *list);
|
||||
|
||||
/****************************************************************************
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
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
|
||||
/* Defined in uip_pktconn.c *************************************************/
|
||||
|
||||
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);
|
||||
|
||||
/* Defined in uip_pktcallback.c *********************************************/
|
||||
|
||||
uint16_t uip_pktcallback(struct uip_driver_s *dev, struct uip_pkt_conn *conn,
|
||||
uint16_t flags);
|
||||
|
||||
/* Defined in uip_pktinput.c ************************************************/
|
||||
|
||||
/* Defined in uip_pktpoll.c *************************************************/
|
||||
|
||||
void uip_pktpoll(struct uip_driver_s *dev, struct uip_pkt_conn *conn);
|
||||
|
||||
#endif /* CONFIG_NET_PKT */
|
||||
void uip_pktsend(FAR struct uip_driver_s *dev, FAR const void *buf,
|
||||
unsigned int len);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
@ -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 */
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user