Rename many functions in net/devif from uip_* to devif_*

This commit is contained in:
Gregory Nutt 2014-06-28 18:36:09 -06:00
parent 5790c94ba3
commit 8e706eb4ff
29 changed files with 94 additions and 92 deletions

View File

@ -88,11 +88,6 @@ struct pkt_conn_s
FAR struct pkt_conn_s *pkt_alloc(void); FAR struct pkt_conn_s *pkt_alloc(void);
/* Allocate a new packet socket data callback */
#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 /* Free a connection structure that is no longer in use. This should
* be done by the implementation of close() * be done by the implementation of close()
*/ */

View File

@ -397,11 +397,6 @@ struct tcp_iphdr_s
struct tcp_conn_s *tcp_alloc(void); struct tcp_conn_s *tcp_alloc(void);
/* Allocate a new TCP data callback */
#define tcp_callbackalloc(conn) uip_callbackalloc(&conn->list)
#define tcp_callbackfree(conn,cb) uip_callbackfree(cb, &conn->list)
/* Free a connection structure that is no longer in use. This should /* Free a connection structure that is no longer in use. This should
* be done by the implementation of close() * be done by the implementation of close()
*/ */

View File

@ -161,11 +161,6 @@ struct udp_stats_s
FAR struct udp_conn_s *udp_alloc(void); FAR struct udp_conn_s *udp_alloc(void);
/* Allocate a new TCP data callback */
#define udp_callbackalloc(conn) uip_callbackalloc(&conn->list)
#define udp_callbackfree(conn,cb) uip_callbackfree(cb, &conn->list)
/* Free a connection structure that is no longer in use. This should /* Free a connection structure that is no longer in use. This should
* be done by the implementation of close() * be done by the implementation of close()
*/ */

View File

@ -114,7 +114,7 @@ extern "C"
void devif_initialize(void); void devif_initialize(void);
/**************************************************************************** /****************************************************************************
* Function: uip_callbackinit * Function: devif_callback_init
* *
* Description: * Description:
* Configure the pre-allocated callback structures into a free list. * Configure the pre-allocated callback structures into a free list.
@ -126,10 +126,10 @@ void devif_initialize(void);
* *
****************************************************************************/ ****************************************************************************/
void uip_callbackinit(void); void devif_callback_init(void);
/**************************************************************************** /****************************************************************************
* Function: uip_callbackalloc * Function: devif_callback_alloc
* *
* Description: * Description:
* Allocate a callback container from the free list. * Allocate a callback container from the free list.
@ -141,10 +141,10 @@ void uip_callbackinit(void);
* *
****************************************************************************/ ****************************************************************************/
FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list); FAR struct uip_callback_s *devif_callback_alloc(FAR struct uip_callback_s **list);
/**************************************************************************** /****************************************************************************
* Function: uip_callbackfree * Function: devif_callback_free
* *
* Description: * Description:
* Return a callback container to the free list. * Return a callback container to the free list.
@ -156,11 +156,11 @@ FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list);
* *
****************************************************************************/ ****************************************************************************/
void uip_callbackfree(FAR struct uip_callback_s *cb, void devif_callback_free(FAR struct uip_callback_s *cb,
FAR struct uip_callback_s **list); FAR struct uip_callback_s **list);
/**************************************************************************** /****************************************************************************
* Function: uip_callbackexecute * Function: devif_callback_execute
* *
* Description: * Description:
* Execute a list of callbacks. * Execute a list of callbacks.
@ -172,8 +172,8 @@ void uip_callbackfree(FAR struct uip_callback_s *cb,
* *
****************************************************************************/ ****************************************************************************/
uint16_t uip_callbackexecute(FAR struct net_driver_s *dev, FAR void *pvconn, uint16_t devif_callback_execute(FAR struct net_driver_s *dev, FAR void *pvconn,
uint16_t flags, FAR struct uip_callback_s *list); uint16_t flags, FAR struct uip_callback_s *list);
/**************************************************************************** /****************************************************************************
* Send data on the current connection. * Send data on the current connection.
@ -199,17 +199,17 @@ uint16_t uip_callbackexecute(FAR struct net_driver_s *dev, FAR void *pvconn,
* *
****************************************************************************/ ****************************************************************************/
void uip_send(FAR struct net_driver_s *dev, FAR const void *buf, int len); void devif_send(FAR struct net_driver_s *dev, FAR const void *buf, int len);
#ifdef CONFIG_NET_IOB #ifdef CONFIG_NET_IOB
struct iob_s; struct iob_s;
void uip_iobsend(FAR struct net_driver_s *dev, FAR struct iob_s *buf, void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *buf,
unsigned int len, unsigned int offset); unsigned int len, unsigned int offset);
#endif #endif
#ifdef CONFIG_NET_PKT #ifdef CONFIG_NET_PKT
void uip_pktsend(FAR struct net_driver_s *dev, FAR const void *buf, void devif_pkt_send(FAR struct net_driver_s *dev, FAR const void *buf,
unsigned int len); unsigned int len);
#endif #endif
#undef EXTERN #undef EXTERN

View File

@ -66,7 +66,7 @@ static FAR struct uip_callback_s *g_cbfreelist = NULL;
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Function: uip_callbackinit * Function: devif_callback_init
* *
* Description: * Description:
* Configure the pre-allocated callback structures into a free list. * Configure the pre-allocated callback structures into a free list.
@ -78,7 +78,7 @@ static FAR struct uip_callback_s *g_cbfreelist = NULL;
* *
****************************************************************************/ ****************************************************************************/
void uip_callbackinit(void) void devif_callback_init(void)
{ {
int i; int i;
for (i = 0; i < CONFIG_NET_NACTIVESOCKETS; i++) for (i = 0; i < CONFIG_NET_NACTIVESOCKETS; i++)
@ -89,7 +89,7 @@ void uip_callbackinit(void)
} }
/**************************************************************************** /****************************************************************************
* Function: uip_callbackalloc * Function: devif_callback_alloc
* *
* Description: * Description:
* Allocate a callback container from the free list. * Allocate a callback container from the free list.
@ -101,7 +101,7 @@ void uip_callbackinit(void)
* *
****************************************************************************/ ****************************************************************************/
FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list) FAR struct uip_callback_s *devif_callback_alloc(FAR struct uip_callback_s **list)
{ {
struct uip_callback_s *ret; struct uip_callback_s *ret;
net_lock_t save; net_lock_t save;
@ -141,7 +141,7 @@ FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list)
} }
/**************************************************************************** /****************************************************************************
* Function: uip_callbackfree * Function: devif_callback_free
* *
* Description: * Description:
* Return a callback container to the free list. * Return a callback container to the free list.
@ -153,8 +153,8 @@ FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list)
* *
****************************************************************************/ ****************************************************************************/
void uip_callbackfree(FAR struct uip_callback_s *cb, void devif_callback_free(FAR struct uip_callback_s *cb,
FAR struct uip_callback_s **list) FAR struct uip_callback_s **list)
{ {
FAR struct uip_callback_s *prev; FAR struct uip_callback_s *prev;
FAR struct uip_callback_s *curr; FAR struct uip_callback_s *curr;
@ -208,7 +208,7 @@ void uip_callbackfree(FAR struct uip_callback_s *cb,
} }
/**************************************************************************** /****************************************************************************
* Function: uip_callbackexecute * Function: devif_callback_execute
* *
* Description: * Description:
* Execute a list of callbacks. * Execute a list of callbacks.
@ -220,8 +220,8 @@ void uip_callbackfree(FAR struct uip_callback_s *cb,
* *
****************************************************************************/ ****************************************************************************/
uint16_t uip_callbackexecute(FAR struct net_driver_s *dev, void *pvconn, uint16_t devif_callback_execute(FAR struct net_driver_s *dev, void *pvconn,
uint16_t flags, FAR struct uip_callback_s *list) uint16_t flags, FAR struct uip_callback_s *list)
{ {
FAR struct uip_callback_s *next; FAR struct uip_callback_s *next;
net_lock_t save; net_lock_t save;

View File

@ -118,6 +118,6 @@ void devif_initialize(void)
{ {
/* Initialize callback support */ /* Initialize callback support */
uip_callbackinit(); devif_callback_init();
} }
#endif /* CONFIG_NET */ #endif /* CONFIG_NET */

View File

@ -82,13 +82,13 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: uip_iobsend * Name: devif_iob_send
* *
* Description: * Description:
* Called from socket logic in response to a xmit or poll request from the * Called from socket logic in response to a xmit or poll request from the
* the network interface driver. * the network interface driver.
* *
* This is identical to calling uip_send() except that the data is * This is identical to calling devif_send() except that the data is
* in an I/O buffer chain, rather than a flat buffer. * in an I/O buffer chain, rather than a flat buffer.
* *
* Assumptions: * Assumptions:
@ -97,8 +97,8 @@
* *
****************************************************************************/ ****************************************************************************/
void uip_iobsend(FAR struct net_driver_s *dev, FAR struct iob_s *iob, void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *iob,
unsigned int len, unsigned int offset) unsigned int len, unsigned int offset)
{ {
DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE); DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE);
@ -110,7 +110,7 @@ void uip_iobsend(FAR struct net_driver_s *dev, FAR struct iob_s *iob,
#ifdef CONFIG_NET_TCP_WRBUFFER_DUMP #ifdef CONFIG_NET_TCP_WRBUFFER_DUMP
/* Dump the outgoing device buffer */ /* Dump the outgoing device buffer */
lib_dumpbuffer("uip_iobsend", dev->d_snddata, len); lib_dumpbuffer("devif_iob_send", dev->d_snddata, len);
#endif #endif
} }

View File

@ -81,13 +81,13 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: uip_pktsend * Name: devif_pkt_send
* *
* Description: * Description:
* Called from socket logic in order to send a raw packet in response to * Called from socket logic in order to send a raw packet in response to
* an xmit or poll request from the the network interface driver. * an xmit or poll request from the the network interface driver.
* *
* This is almost identical to calling uip_send() except that the data to * This is almost identical to calling devif_send() except that the data to
* be sent is copied into dev->d_buf (vs. dev->d_snddata), since there is * be sent is copied into dev->d_buf (vs. dev->d_snddata), since there is
* no header on the data. * no header on the data.
* *
@ -97,8 +97,8 @@
* *
****************************************************************************/ ****************************************************************************/
void uip_pktsend(FAR struct net_driver_s *dev, FAR const void *buf, void devif_pkt_send(FAR struct net_driver_s *dev, FAR const void *buf,
unsigned int len) unsigned int len)
{ {
DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE); DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE);

View File

@ -81,7 +81,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: uip_send * Name: devif_send
* *
* Description: * Description:
* Called from socket logic in response to a xmit or poll request from the * Called from socket logic in response to a xmit or poll request from the
@ -93,7 +93,7 @@
* *
****************************************************************************/ ****************************************************************************/
void uip_send(struct net_driver_s *dev, const void *buf, int len) void devif_send(struct net_driver_s *dev, const void *buf, int len)
{ {
DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE); DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE);

View File

@ -185,7 +185,7 @@ void icmp_input(FAR struct net_driver_s *dev)
#ifdef CONFIG_NET_ICMP_PING #ifdef CONFIG_NET_ICMP_PING
else if (picmp->type == ICMP_ECHO_REPLY && g_echocallback) else if (picmp->type == ICMP_ECHO_REPLY && g_echocallback)
{ {
(void)uip_callbackexecute(dev, picmp, UIP_ECHOREPLY, g_echocallback); (void)devif_callback_execute(dev, picmp, UIP_ECHOREPLY, g_echocallback);
} }
#endif #endif
@ -273,7 +273,7 @@ typeerr:
{ {
/* Dispatch the ECHO reply to the waiting thread */ /* Dispatch the ECHO reply to the waiting thread */
flags = uip_callbackexecute(dev, picmp, flags, g_echocallback); flags = devif_callback_execute(dev, picmp, flags, g_echocallback);
} }
/* If the ECHO reply was not handled, then drop the packet */ /* If the ECHO reply was not handled, then drop the packet */

View File

@ -67,8 +67,8 @@
/* Allocate a new ICMP data callback */ /* Allocate a new ICMP data callback */
#define icmp_callbackalloc() uip_callbackalloc(&g_echocallback) #define icmp_callback_alloc() devif_callback_alloc(&g_echocallback)
#define icmp_callbackfree(cb) uip_callbackfree(cb, &g_echocallback) #define icmp_callback_free(cb) devif_callback_free(cb, &g_echocallback)
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
@ -345,7 +345,7 @@ int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno,
/* Set up the callback */ /* Set up the callback */
state.png_cb = icmp_callbackalloc(); state.png_cb = icmp_callback_alloc();
if (state.png_cb) if (state.png_cb)
{ {
state.png_cb->flags = UIP_POLL|UIP_ECHOREPLY; state.png_cb->flags = UIP_POLL|UIP_ECHOREPLY;
@ -367,7 +367,7 @@ int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno,
nlldbg("Start time: 0x%08x seqno: %d\n", state.png_time, seqno); nlldbg("Start time: 0x%08x seqno: %d\n", state.png_time, seqno);
net_lockedwait(&state.png_sem); net_lockedwait(&state.png_sem);
icmp_callbackfree(state.png_cb); icmp_callback_free(state.png_cb);
} }
net_unlock(save); net_unlock(save);

View File

@ -98,7 +98,7 @@ void icmp_poll(FAR struct net_driver_s *dev)
/* Perform the application callback */ /* Perform the application callback */
(void)uip_callbackexecute(dev, NULL, UIP_POLL, g_echocallback); (void)devif_callback_execute(dev, NULL, UIP_POLL, g_echocallback);
} }
#endif /* CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING */ #endif /* CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING */

View File

@ -50,6 +50,11 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Allocate a new packet socket data callback */
#define pkt_callback_alloc(conn) devif_callback_alloc(&conn->list)
#define pkt_callback_free(conn,cb) devif_callback_free(cb, &conn->list)
/**************************************************************************** /****************************************************************************
* Public Type Definitions * Public Type Definitions
****************************************************************************/ ****************************************************************************/

View File

@ -88,7 +88,7 @@ uint16_t pkt_callback(FAR struct net_driver_s *dev,
{ {
/* Perform the callback */ /* Perform the callback */
flags = uip_callbackexecute(dev, conn, flags, conn->list); flags = devif_callback_execute(dev, conn, flags, conn->list);
} }
return flags; return flags;

View File

@ -118,7 +118,7 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn)
if (dev->d_sndlen > 0) if (dev->d_sndlen > 0)
{ {
// uip_pktsend(dev, conn); // devif_pkt_send(dev, conn);
return; return;
} }
} }

View File

@ -124,7 +124,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
{ {
/* Copy the packet data into the device packet buffer and send it */ /* Copy the packet data into the device packet buffer and send it */
uip_pktsend(dev, pstate->snd_buffer, pstate->snd_buflen); devif_pkt_send(dev, pstate->snd_buffer, pstate->snd_buflen);
pstate->snd_sent = pstate->snd_buflen; pstate->snd_sent = pstate->snd_buflen;
} }
@ -243,7 +243,7 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf,
/* Allocate resource to receive a callback */ /* Allocate resource to receive a callback */
state.snd_cb = pkt_callbackalloc(conn); state.snd_cb = pkt_callback_alloc(conn);
if (state.snd_cb) if (state.snd_cb)
{ {
FAR struct net_driver_s *dev; FAR struct net_driver_s *dev;
@ -281,7 +281,7 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf,
/* Make sure that no further interrupts are processed */ /* Make sure that no further interrupts are processed */
pkt_callbackfree(conn, state.snd_cb); pkt_callback_free(conn, state.snd_cb);
/* Clear the no-ARP bit in the device flags */ /* Clear the no-ARP bit in the device flags */

View File

@ -113,7 +113,7 @@ static inline int psock_setup_callbacks(FAR struct socket *psock,
/* Set up the callbacks in the connection */ /* Set up the callbacks in the connection */
pstate->tc_cb = tcp_callbackalloc(conn); pstate->tc_cb = tcp_callback_alloc(conn);
if (pstate->tc_cb) if (pstate->tc_cb)
{ {
/* Set up the connection "interrupt" handler */ /* Set up the connection "interrupt" handler */
@ -143,7 +143,7 @@ static inline void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate,
/* Make sure that no further interrupts are processed */ /* Make sure that no further interrupts are processed */
tcp_callbackfree(conn, pstate->tc_cb); tcp_callback_free(conn, pstate->tc_cb);
pstate->tc_cb = NULL; pstate->tc_cb = NULL;

View File

@ -60,6 +60,7 @@
#include "socket/socket.h" #include "socket/socket.h"
#include "netdev/netdev.h" #include "netdev/netdev.h"
#include "devif/devif.h" #include "devif/devif.h"
#include "tcp/tcp.h"
#include "pkt/pkt.h" #include "pkt/pkt.h"
/**************************************************************************** /****************************************************************************
@ -297,7 +298,7 @@ static inline int netclose_disconnect(FAR struct socket *psock)
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS #ifdef CONFIG_NET_TCP_WRITE_BUFFERS
if (psock->s_sndcb) if (psock->s_sndcb)
{ {
tcp_callbackfree(conn, psock->s_sndcb); tcp_callback_free(conn, psock->s_sndcb);
psock->s_sndcb = NULL; psock->s_sndcb = NULL;
} }
#endif #endif
@ -309,7 +310,7 @@ static inline int netclose_disconnect(FAR struct socket *psock)
/* Check for the case where the host beat us and disconnected first */ /* Check for the case where the host beat us and disconnected first */
if (conn->tcpstateflags == UIP_ESTABLISHED && if (conn->tcpstateflags == UIP_ESTABLISHED &&
(state.cl_cb = tcp_callbackalloc(conn)) != NULL) (state.cl_cb = tcp_callback_alloc(conn)) != NULL)
{ {
/* Set up to receive TCP data event callbacks */ /* Set up to receive TCP data event callbacks */
@ -373,7 +374,7 @@ static inline int netclose_disconnect(FAR struct socket *psock)
/* We are now disconnected */ /* We are now disconnected */
sem_destroy(&state.cl_sem); sem_destroy(&state.cl_sem);
tcp_callbackfree(conn, state.cl_cb); tcp_callback_free(conn, state.cl_cb);
/* Free the connection */ /* Free the connection */

View File

@ -58,6 +58,7 @@
#include <devif/devif.h> #include <devif/devif.h>
#include "tcp/tcp.h"
#include "socket/socket.h" #include "socket/socket.h"
/**************************************************************************** /****************************************************************************
@ -214,7 +215,7 @@ static inline int net_pollsetup(FAR struct socket *psock,
/* Allocate a TCP/IP callback structure */ /* Allocate a TCP/IP callback structure */
cb = tcp_callbackalloc(conn); cb = tcp_callback_alloc(conn);
if (!cb) if (!cb)
{ {
ret = -EBUSY; ret = -EBUSY;
@ -366,7 +367,7 @@ static inline int net_pollteardown(FAR struct socket *psock,
/* Release the callback */ /* Release the callback */
flags = net_lock(); flags = net_lock();
tcp_callbackfree(conn, info->cb); tcp_callback_free(conn, info->cb);
net_unlock(flags); net_unlock(flags);
/* Release the poll/select data slot */ /* Release the poll/select data slot */

View File

@ -491,7 +491,7 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset,
/* Allocate resources to receive a callback */ /* Allocate resources to receive a callback */
state.snd_datacb = tcp_callbackalloc(conn); state.snd_datacb = tcp_callback_alloc(conn);
if (state.snd_datacb == NULL) if (state.snd_datacb == NULL)
{ {
@ -500,7 +500,7 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset,
goto errout_locked; goto errout_locked;
} }
state.snd_ackcb = tcp_callbackalloc(conn); state.snd_ackcb = tcp_callback_alloc(conn);
if (state.snd_ackcb == NULL) if (state.snd_ackcb == NULL)
{ {
@ -551,10 +551,10 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset,
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE); psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE);
tcp_callbackfree(conn, state.snd_ackcb); tcp_callback_free(conn, state.snd_ackcb);
errout_datacb: errout_datacb:
tcp_callbackfree(conn, state.snd_datacb); tcp_callback_free(conn, state.snd_datacb);
errout_locked: errout_locked:

View File

@ -1075,7 +1075,7 @@ static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Set up the callback in the connection */ /* Set up the callback in the connection */
state.rf_cb = pkt_callbackalloc(conn); state.rf_cb = pkt_callback_alloc(conn);
if (state.rf_cb) if (state.rf_cb)
{ {
state.rf_cb->flags = UIP_NEWDATA|UIP_POLL; state.rf_cb->flags = UIP_NEWDATA|UIP_POLL;
@ -1096,7 +1096,7 @@ static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Make sure that no further interrupts are processed */ /* Make sure that no further interrupts are processed */
pkt_callbackfree(conn, state.rf_cb); pkt_callback_free(conn, state.rf_cb);
ret = recvfrom_result(ret, &state); ret = recvfrom_result(ret, &state);
} }
else else
@ -1167,7 +1167,7 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Set up the callback in the connection */ /* Set up the callback in the connection */
state.rf_cb = udp_callbackalloc(conn); state.rf_cb = udp_callback_alloc(conn);
if (state.rf_cb) if (state.rf_cb)
{ {
/* Set up the callback in the connection */ /* Set up the callback in the connection */
@ -1190,7 +1190,7 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Make sure that no further interrupts are processed */ /* Make sure that no further interrupts are processed */
udp_callbackfree(conn, state.rf_cb); udp_callback_free(conn, state.rf_cb);
ret = recvfrom_result(ret, &state); ret = recvfrom_result(ret, &state);
} }
else else
@ -1354,7 +1354,7 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Set up the callback in the connection */ /* Set up the callback in the connection */
state.rf_cb = tcp_callbackalloc(conn); state.rf_cb = tcp_callback_alloc(conn);
if (state.rf_cb) if (state.rf_cb)
{ {
state.rf_cb->flags = UIP_NEWDATA|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT; state.rf_cb->flags = UIP_NEWDATA|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT;
@ -1371,7 +1371,7 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Make sure that no further interrupts are processed */ /* Make sure that no further interrupts are processed */
tcp_callbackfree(conn, state.rf_cb); tcp_callback_free(conn, state.rf_cb);
ret = recvfrom_result(ret, &state); ret = recvfrom_result(ret, &state);
} }
else else

View File

@ -207,7 +207,7 @@ static uint16_t sendto_interrupt(struct net_driver_s *dev, void *conn,
{ {
/* Copy the user data into d_snddata and send it */ /* Copy the user data into d_snddata and send it */
uip_send(dev, pstate->st_buffer, pstate->st_buflen); devif_send(dev, pstate->st_buffer, pstate->st_buflen);
pstate->st_sndlen = pstate->st_buflen; pstate->st_sndlen = pstate->st_buflen;
} }
@ -392,7 +392,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
/* Set up the callback in the connection */ /* Set up the callback in the connection */
state.st_cb = udp_callbackalloc(conn); state.st_cb = udp_callback_alloc(conn);
if (state.st_cb) if (state.st_cb)
{ {
state.st_cb->flags = UIP_POLL; state.st_cb->flags = UIP_POLL;
@ -413,7 +413,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
/* Make sure that no further interrupts are processed */ /* Make sure that no further interrupts are processed */
udp_callbackfree(conn, state.st_cb); udp_callback_free(conn, state.st_cb);
} }
net_unlock(save); net_unlock(save);

View File

@ -50,6 +50,11 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Allocate a new TCP data callback */
#define tcp_callback_alloc(conn) devif_callback_alloc(&conn->list)
#define tcp_callback_free(conn,cb) devif_callback_free(cb, &conn->list)
/**************************************************************************** /****************************************************************************
* Public Type Definitions * Public Type Definitions
****************************************************************************/ ****************************************************************************/

View File

@ -178,7 +178,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
* dev->d_len should also be cleared). * dev->d_len should also be cleared).
*/ */
flags = uip_callbackexecute(dev, conn, flags, conn->list); flags = devif_callback_execute(dev, conn, flags, conn->list);
/* There may be no new data handler in place at them moment that the new /* There may be no new data handler in place at them moment that the new
* incoming data is received. If the new incoming data was not handled, then * incoming data is received. If the new incoming data was not handled, then

View File

@ -338,7 +338,7 @@ void tcp_free(FAR struct tcp_conn_s *conn)
for (cb = conn->list; cb; cb = next) for (cb = conn->list; cb; cb = next)
{ {
next = cb->flink; next = cb->flink;
tcp_callbackfree(conn, cb); tcp_callback_free(conn, cb);
} }
/* UIP_ALLOCATED means that that the connection is not in the active list /* UIP_ALLOCATED means that that the connection is not in the active list

View File

@ -600,7 +600,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
* won't actually happen until the polling cycle completes). * won't actually happen until the polling cycle completes).
*/ */
uip_iobsend(dev, WRB_IOB(wrb), sndlen, WRB_SENT(wrb)); devif_iob_send(dev, WRB_IOB(wrb), sndlen, WRB_SENT(wrb));
/* Remember how much data we send out now so that we know /* Remember how much data we send out now so that we know
* when everything has been acknowledged. Just increment * when everything has been acknowledged. Just increment
@ -755,7 +755,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
if (!psock->s_sndcb) if (!psock->s_sndcb)
{ {
psock->s_sndcb = tcp_callbackalloc(conn); psock->s_sndcb = tcp_callback_alloc(conn);
} }
/* Test if the callback has been allocated */ /* Test if the callback has been allocated */

View File

@ -376,7 +376,7 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev,
* happen until the polling cycle completes). * happen until the polling cycle completes).
*/ */
uip_send(dev, &pstate->snd_buffer[pstate->snd_sent], sndlen); devif_send(dev, &pstate->snd_buffer[pstate->snd_sent], sndlen);
/* Check if the destination IP address is in the ARP table. If not, /* Check if the destination IP address is in the ARP table. If not,
* then the send won't actually make it out... it will be replaced with * then the send won't actually make it out... it will be replaced with
@ -550,7 +550,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
/* Allocate resources to receive a callback */ /* Allocate resources to receive a callback */
state.snd_cb = tcp_callbackalloc(conn); state.snd_cb = tcp_callback_alloc(conn);
if (state.snd_cb) if (state.snd_cb)
{ {
/* Get the initial sequence number that will be used */ /* Get the initial sequence number that will be used */
@ -588,7 +588,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
/* Make sure that no further interrupts are processed */ /* Make sure that no further interrupts are processed */
tcp_callbackfree(conn, state.snd_cb); tcp_callback_free(conn, state.snd_cb);
} }
} }

View File

@ -50,6 +50,11 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Allocate a new TCP data callback */
#define udp_callback_alloc(conn) devif_callback_alloc(&conn->list)
#define udp_callback_free(conn,cb) devif_callback_free(cb, &conn->list)
/**************************************************************************** /****************************************************************************
* Public Type Definitions * Public Type Definitions
****************************************************************************/ ****************************************************************************/

View File

@ -88,7 +88,7 @@ uint16_t udp_callback(FAR struct net_driver_s *dev,
{ {
/* Perform the callback */ /* Perform the callback */
flags = uip_callbackexecute(dev, conn, flags, conn->list); flags = devif_callback_execute(dev, conn, flags, conn->list);
} }
return flags; return flags;