Clean up all UDP-related naming
This commit is contained in:
parent
04985d6d1e
commit
abf04708ce
@ -104,7 +104,7 @@ struct socket
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FAR void *s_conn; /* Connection: struct tcp_conn_s or uip_udp_conn */
|
FAR void *s_conn; /* Connection: struct tcp_conn_s or udp_conn_s */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
||||||
/* Callback instance for TCP send */
|
/* Callback instance for TCP send */
|
||||||
|
@ -388,8 +388,7 @@ uint16_t uip_ipchksum(struct uip_driver_s *dev);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
uint16_t tcp_chksum(struct uip_driver_s *dev);
|
uint16_t tcp_chksum(struct uip_driver_s *dev);
|
||||||
|
uint16_t udp_chksum(struct uip_driver_s *dev);
|
||||||
uint16_t uip_udpchksum(struct uip_driver_s *dev);
|
|
||||||
uint16_t uip_icmpchksum(struct uip_driver_s *dev, int len);
|
uint16_t uip_icmpchksum(struct uip_driver_s *dev, int len);
|
||||||
|
|
||||||
#endif /* __INCLUDE_NUTTX_NET_NETDEV_H */
|
#endif /* __INCLUDE_NUTTX_NET_NETDEV_H */
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
struct uip_driver_s; /* Forward reference */
|
struct uip_driver_s; /* Forward reference */
|
||||||
struct uip_callback_s; /* Forward reference */
|
struct uip_callback_s; /* Forward reference */
|
||||||
struct uip_udp_conn
|
struct udp_conn_s
|
||||||
{
|
{
|
||||||
dq_entry_t node; /* Supports a doubly linked list */
|
dq_entry_t node; /* Supports a doubly linked list */
|
||||||
uip_ipaddr_t ripaddr; /* The IP address of the remote peer */
|
uip_ipaddr_t ripaddr; /* The IP address of the remote peer */
|
||||||
@ -87,7 +87,7 @@ struct uip_udp_conn
|
|||||||
|
|
||||||
/* The UDP and IP headers */
|
/* The UDP and IP headers */
|
||||||
|
|
||||||
struct uip_udpip_hdr
|
struct udp_iphdr_s
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ struct uip_udpip_hdr
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_STATISTICS
|
#ifdef CONFIG_NET_STATISTICS
|
||||||
struct uip_udp_stats_s
|
struct udp_stats_s
|
||||||
{
|
{
|
||||||
uip_stats_t drop; /* Number of dropped UDP segments */
|
uip_stats_t drop; /* Number of dropped UDP segments */
|
||||||
uip_stats_t recv; /* Number of recived UDP segments */
|
uip_stats_t recv; /* Number of recived UDP segments */
|
||||||
@ -159,31 +159,33 @@ struct uip_udp_stats_s
|
|||||||
* normally something done by the implementation of the socket() API
|
* normally something done by the implementation of the socket() API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern struct uip_udp_conn *uip_udpalloc(void);
|
FAR struct udp_conn_s *udp_alloc(void);
|
||||||
|
|
||||||
/* Allocate a new TCP data callback */
|
/* Allocate a new TCP data callback */
|
||||||
|
|
||||||
#define uip_udpcallbackalloc(conn) uip_callbackalloc(&conn->list)
|
#define udp_callbackalloc(conn) uip_callbackalloc(&conn->list)
|
||||||
#define uip_udpcallbackfree(conn,cb) uip_callbackfree(cb, &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()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern void uip_udpfree(struct uip_udp_conn *conn);
|
void udp_free(FAR struct udp_conn_s *conn);
|
||||||
|
|
||||||
/* Bind a UDP connection to a local address */
|
/* Bind a UDP connection to a local address */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
extern int uip_udpbind(struct uip_udp_conn *conn, const struct sockaddr_in6 *addr);
|
int udp_bind(FAR struct udp_conn_s *conn,
|
||||||
|
FAR const struct sockaddr_in6 *addr);
|
||||||
#else
|
#else
|
||||||
extern int uip_udpbind(struct uip_udp_conn *conn, const struct sockaddr_in *addr);
|
int udp_bind(FAR struct udp_conn_s *conn,
|
||||||
|
FAR const struct sockaddr_in *addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function sets up a new UDP connection. The function will
|
/* This function sets up a new UDP connection. The function will
|
||||||
* automatically allocate an unused local port for the new
|
* automatically allocate an unused local port for the new
|
||||||
* connection. However, another port can be chosen by using the
|
* connection. However, another port can be chosen by using the
|
||||||
* uip_udpbind() call, after the uip_udpconnect() function has been
|
* udp_bind() call, after the udp_connect() function has been
|
||||||
* called.
|
* called.
|
||||||
*
|
*
|
||||||
* This function is called as part of the implementation of sendto
|
* This function is called as part of the implementation of sendto
|
||||||
@ -193,14 +195,16 @@ extern int uip_udpbind(struct uip_udp_conn *conn, const struct sockaddr_in *addr
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
extern int uip_udpconnect(struct uip_udp_conn *conn, const struct sockaddr_in6 *addr);
|
int udp_connect(FAR struct udp_conn_s *conn,
|
||||||
|
FAR const struct sockaddr_in6 *addr);
|
||||||
#else
|
#else
|
||||||
extern int uip_udpconnect(struct uip_udp_conn *conn, const struct sockaddr_in *addr);
|
int udp_connect(FAR struct udp_conn_s *conn,
|
||||||
|
FAR const struct sockaddr_in *addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable/disable UDP callbacks on a connection */
|
/* Enable/disable UDP callbacks on a connection */
|
||||||
|
|
||||||
extern void uip_udpenable(struct uip_udp_conn *conn);
|
void udp_enable(FAR struct udp_conn_s *conn);
|
||||||
extern void uip_udpdisable(struct uip_udp_conn *conn);
|
void udp_disable(FAR struct udp_conn_s *conn);
|
||||||
|
|
||||||
#endif /* __INCLUDE_NUTTX_NET_UDP_H */
|
#endif /* __INCLUDE_NUTTX_NET_UDP_H */
|
||||||
|
@ -210,7 +210,7 @@ struct uip_ip_hdr
|
|||||||
* flink - Supports a singly linked list
|
* flink - Supports a singly linked list
|
||||||
* event - Provides the address of the callback function entry point.
|
* event - Provides the address of the callback function entry point.
|
||||||
* pvconn is a pointer to one of struct tcp_conn_s or struct
|
* pvconn is a pointer to one of struct tcp_conn_s or struct
|
||||||
* uip_udp_conn.
|
* udp_conn_s.
|
||||||
* priv - Holds a reference to application specific data that will
|
* priv - Holds a reference to application specific data that will
|
||||||
* provided
|
* provided
|
||||||
* flags - Set by the application to inform the uIP layer which flags
|
* flags - Set by the application to inform the uIP layer which flags
|
||||||
@ -285,7 +285,7 @@ struct uip_stats
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_UDP
|
#ifdef CONFIG_NET_UDP
|
||||||
struct uip_udp_stats_s udp; /* UDP statistics */
|
struct udp_stats_s udp; /* UDP statistics */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#endif /* CONFIG_NET_STATISTICS */
|
#endif /* CONFIG_NET_STATISTICS */
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
#include "tcp/tcp.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@ -204,7 +206,7 @@ int psock_bind(FAR struct socket *psock, const struct sockaddr *addr,
|
|||||||
|
|
||||||
#ifdef CONFIG_NET_UDP
|
#ifdef CONFIG_NET_UDP
|
||||||
case SOCK_DGRAM:
|
case SOCK_DGRAM:
|
||||||
ret = uip_udpbind(psock->s_conn, inaddr);
|
ret = udp_bind(psock->s_conn, inaddr);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -52,6 +52,8 @@
|
|||||||
|
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "tcp/tcp.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
@ -494,7 +496,7 @@ int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
|
|||||||
#ifdef CONFIG_NET_UDP
|
#ifdef CONFIG_NET_UDP
|
||||||
case SOCK_DGRAM:
|
case SOCK_DGRAM:
|
||||||
{
|
{
|
||||||
ret = uip_udpconnect(psock->s_conn, inaddr);
|
ret = udp_connect(psock->s_conn, inaddr);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
err = -ret;
|
err = -ret;
|
||||||
|
@ -162,7 +162,7 @@ int getsockname(int sockfd, FAR struct sockaddr *addr, FAR socklen_t *addrlen)
|
|||||||
#ifdef CONFIG_NET_UDP
|
#ifdef CONFIG_NET_UDP
|
||||||
case SOCK_DGRAM:
|
case SOCK_DGRAM:
|
||||||
{
|
{
|
||||||
struct uip_udp_conn *udp_conn = (struct uip_udp_conn *)psock->s_conn;
|
FAR struct udp_conn_s *udp_conn = (FAR struct udp_conn_s *)psock->s_conn;
|
||||||
outaddr->sin_port = udp_conn->lport; /* Already in network byte order */
|
outaddr->sin_port = udp_conn->lport; /* Already in network byte order */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -106,7 +106,7 @@ int net_clone(FAR struct socket *psock1, FAR struct socket *psock2)
|
|||||||
#ifdef CONFIG_NET_UDP
|
#ifdef CONFIG_NET_UDP
|
||||||
if (psock2->s_type == SOCK_DGRAM)
|
if (psock2->s_type == SOCK_DGRAM)
|
||||||
{
|
{
|
||||||
FAR struct uip_udp_conn *conn = psock2->s_conn;
|
FAR struct udp_conn_s *conn = psock2->s_conn;
|
||||||
DEBUGASSERT(conn->crefs > 0 && conn->crefs < 255);
|
DEBUGASSERT(conn->crefs > 0 && conn->crefs < 255);
|
||||||
conn->crefs++;
|
conn->crefs++;
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ int psock_close(FAR struct socket *psock)
|
|||||||
#ifdef CONFIG_NET_UDP
|
#ifdef CONFIG_NET_UDP
|
||||||
case SOCK_DGRAM:
|
case SOCK_DGRAM:
|
||||||
{
|
{
|
||||||
struct uip_udp_conn *conn = psock->s_conn;
|
FAR struct udp_conn_s *conn = psock->s_conn;
|
||||||
|
|
||||||
/* Is this the last reference to the connection structure (there
|
/* Is this the last reference to the connection structure (there
|
||||||
* could be more if the socket was dup'ed).
|
* could be more if the socket was dup'ed).
|
||||||
@ -507,8 +507,8 @@ int psock_close(FAR struct socket *psock)
|
|||||||
{
|
{
|
||||||
/* Yes... free the connection structure */
|
/* Yes... free the connection structure */
|
||||||
|
|
||||||
conn->crefs = 0; /* No more references on the connection */
|
conn->crefs = 0; /* No more references on the connection */
|
||||||
uip_udpfree(psock->s_conn); /* Free uIP resources */
|
udp_free(psock->s_conn); /* Free uIP resources */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -59,12 +59,13 @@
|
|||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
#include "tcp/tcp.h"
|
#include "tcp/tcp.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define UDPBUF ((struct uip_udpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[UIP_LLH_LEN])
|
||||||
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[UIP_LLH_LEN])
|
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[UIP_LLH_LEN])
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -1135,10 +1136,10 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
|
|||||||
FAR struct sockaddr_in *infrom )
|
FAR struct sockaddr_in *infrom )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
struct uip_udp_conn *conn = (struct uip_udp_conn *)psock->s_conn;
|
FAR struct udp_conn_s *conn = (FAR struct udp_conn_s *)psock->s_conn;
|
||||||
struct recvfrom_s state;
|
struct recvfrom_s state;
|
||||||
uip_lock_t save;
|
uip_lock_t save;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Perform the UDP recvfrom() operation */
|
/* Perform the UDP recvfrom() operation */
|
||||||
|
|
||||||
@ -1152,7 +1153,7 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
|
|||||||
|
|
||||||
/* Setup the UDP remote connection */
|
/* Setup the UDP remote connection */
|
||||||
|
|
||||||
ret = uip_udpconnect(conn, NULL);
|
ret = udp_connect(conn, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
goto errout_with_state;
|
goto errout_with_state;
|
||||||
@ -1160,7 +1161,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 = uip_udpcallbackalloc(conn);
|
state.rf_cb = udp_callbackalloc(conn);
|
||||||
if (state.rf_cb)
|
if (state.rf_cb)
|
||||||
{
|
{
|
||||||
/* Set up the callback in the connection */
|
/* Set up the callback in the connection */
|
||||||
@ -1183,7 +1184,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 */
|
||||||
|
|
||||||
uip_udpcallbackfree(conn, state.rf_cb);
|
udp_callbackfree(conn, state.rf_cb);
|
||||||
ret = recvfrom_result(ret, &state);
|
ret = recvfrom_result(ret, &state);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
11
net/sendto.c
11
net/sendto.c
@ -53,6 +53,7 @@
|
|||||||
|
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@ -297,7 +298,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||||||
socklen_t tolen)
|
socklen_t tolen)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_UDP
|
#ifdef CONFIG_NET_UDP
|
||||||
FAR struct uip_udp_conn *conn;
|
FAR struct udp_conn_s *conn;
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
FAR const struct sockaddr_in6 *into = (const struct sockaddr_in6 *)to;
|
FAR const struct sockaddr_in6 *into = (const struct sockaddr_in6 *)to;
|
||||||
#else
|
#else
|
||||||
@ -378,8 +379,8 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||||||
|
|
||||||
/* Setup the UDP socket */
|
/* Setup the UDP socket */
|
||||||
|
|
||||||
conn = (struct uip_udp_conn *)psock->s_conn;
|
conn = (FAR struct udp_conn_s *)psock->s_conn;
|
||||||
ret = uip_udpconnect(conn, into);
|
ret = udp_connect(conn, into);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
uip_unlock(save);
|
uip_unlock(save);
|
||||||
@ -389,7 +390,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 = uip_udpcallbackalloc(conn);
|
state.st_cb = udp_callbackalloc(conn);
|
||||||
if (state.st_cb)
|
if (state.st_cb)
|
||||||
{
|
{
|
||||||
state.st_cb->flags = UIP_POLL;
|
state.st_cb->flags = UIP_POLL;
|
||||||
@ -410,7 +411,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 */
|
||||||
|
|
||||||
uip_udpcallbackfree(conn, state.st_cb);
|
udp_callbackfree(conn, state.st_cb);
|
||||||
}
|
}
|
||||||
uip_unlock(save);
|
uip_unlock(save);
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
#include "tcp/tcp.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Global Functions
|
* Global Functions
|
||||||
@ -222,7 +224,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
|
|||||||
* socket instance.
|
* socket instance.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct uip_udp_conn *conn = uip_udpalloc();
|
FAR struct udp_conn_s *conn = udp_alloc();
|
||||||
if (!conn)
|
if (!conn)
|
||||||
{
|
{
|
||||||
/* Failed to reserve a connection structure */
|
/* Failed to reserve a connection structure */
|
||||||
|
@ -70,6 +70,29 @@ extern "C"
|
|||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Defined in udp_conn.c ****************************************************/
|
||||||
|
|
||||||
|
void udp_initialize(void);
|
||||||
|
FAR struct udp_conn_s *udp_active(FAR struct udp_iphdr_s *buf);
|
||||||
|
FAR struct udp_conn_s *uip_nextudpconn(FAR struct udp_conn_s *conn);
|
||||||
|
|
||||||
|
/* Defined in udp_poll.c ****************************************************/
|
||||||
|
|
||||||
|
void udp_poll(FAR struct uip_driver_s *dev, FAR struct udp_conn_s *conn);
|
||||||
|
|
||||||
|
/* Defined in udp_send.c ****************************************************/
|
||||||
|
|
||||||
|
void udp_send(FAR struct uip_driver_s *dev, FAR struct udp_conn_s *conn);
|
||||||
|
|
||||||
|
/* Defined in udp_input.c ***************************************************/
|
||||||
|
|
||||||
|
int udp_input(FAR struct uip_driver_s *dev);
|
||||||
|
|
||||||
|
/* Defined in udp_callback.c ************************************************/
|
||||||
|
|
||||||
|
uint16_t udp_callback(FAR struct uip_driver_s *dev,
|
||||||
|
FAR struct udp_conn_s *conn, uint16_t flags);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@ -62,7 +63,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: uip_udpcallback
|
* Function: udp_callback
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Inform the application holding the UDP socket of a change in state.
|
* Inform the application holding the UDP socket of a change in state.
|
||||||
@ -75,8 +76,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint16_t uip_udpcallback(struct uip_driver_s *dev, struct uip_udp_conn *conn,
|
uint16_t udp_callback(FAR struct uip_driver_s *dev,
|
||||||
uint16_t flags)
|
FAR struct udp_conn_s *conn, uint16_t flags)
|
||||||
{
|
{
|
||||||
nllvdbg("flags: %04x\n", flags);
|
nllvdbg("flags: %04x\n", flags);
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@ -68,7 +69,7 @@
|
|||||||
|
|
||||||
/* The array containing all uIP UDP connections. */
|
/* The array containing all uIP UDP connections. */
|
||||||
|
|
||||||
struct uip_udp_conn g_udp_connections[CONFIG_NET_UDP_CONNS];
|
struct udp_conn_s g_udp_connections[CONFIG_NET_UDP_CONNS];
|
||||||
|
|
||||||
/* A list of all free UDP connections */
|
/* A list of all free UDP connections */
|
||||||
|
|
||||||
@ -120,7 +121,7 @@ static inline void _uip_semtake(FAR sem_t *sem)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static FAR struct uip_udp_conn *uip_find_conn(uint16_t portno)
|
static FAR struct udp_conn_s *uip_find_conn(uint16_t portno)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -198,7 +199,7 @@ static uint16_t uip_selectport(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_udpinit()
|
* Name: udp_initialize()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Initialize the UDP connection structures. Called once and only from
|
* Initialize the UDP connection structures. Called once and only from
|
||||||
@ -206,7 +207,7 @@ static uint16_t uip_selectport(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void uip_udpinit(void)
|
void udp_initialize(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -228,23 +229,23 @@ void uip_udpinit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_udpalloc()
|
* Name: udp_alloc()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Allocate a new, uninitialized UDP connection structure.
|
* Allocate a new, uninitialized UDP connection structure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct uip_udp_conn *uip_udpalloc(void)
|
FAR struct udp_conn_s *udp_alloc(void)
|
||||||
{
|
{
|
||||||
struct uip_udp_conn *conn;
|
FAR struct udp_conn_s *conn;
|
||||||
|
|
||||||
/* The free list is only accessed from user, non-interrupt level and
|
/* The free list is only accessed from user, non-interrupt level and
|
||||||
* is protected by a semaphore (that behaves like a mutex).
|
* is protected by a semaphore (that behaves like a mutex).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_uip_semtake(&g_free_sem);
|
_uip_semtake(&g_free_sem);
|
||||||
conn = (struct uip_udp_conn *)dq_remfirst(&g_free_udp_connections);
|
conn = (FAR struct udp_conn_s *)dq_remfirst(&g_free_udp_connections);
|
||||||
if (conn)
|
if (conn)
|
||||||
{
|
{
|
||||||
/* Make sure that the connection is marked as uninitialized */
|
/* Make sure that the connection is marked as uninitialized */
|
||||||
@ -261,16 +262,16 @@ struct uip_udp_conn *uip_udpalloc(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_udpfree()
|
* Name: udp_free()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Free a UDP connection structure that is no longer in use. This should be
|
* Free a UDP connection structure that is no longer in use. This should be
|
||||||
* done by the implementation of close(). uip_udpdisable must have been
|
* done by the implementation of close(). udp_disable must have been
|
||||||
* previously called.
|
* previously called.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void uip_udpfree(struct uip_udp_conn *conn)
|
void udp_free(FAR struct udp_conn_s *conn)
|
||||||
{
|
{
|
||||||
/* The free list is only accessed from user, non-interrupt level and
|
/* The free list is only accessed from user, non-interrupt level and
|
||||||
* is protected by a semaphore (that behaves like a mutex).
|
* is protected by a semaphore (that behaves like a mutex).
|
||||||
@ -292,7 +293,7 @@ void uip_udpfree(struct uip_udp_conn *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_udpactive()
|
* Name: udp_active()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Find a connection structure that is the appropriate
|
* Find a connection structure that is the appropriate
|
||||||
@ -303,10 +304,10 @@ void uip_udpfree(struct uip_udp_conn *conn)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct uip_udp_conn *uip_udpactive(FAR struct uip_udpip_hdr *buf)
|
FAR struct udp_conn_s *udp_active(FAR struct udp_iphdr_s *buf)
|
||||||
{
|
{
|
||||||
FAR struct uip_udp_conn *conn =
|
FAR struct udp_conn_s *conn =
|
||||||
(FAR struct uip_udp_conn *)g_active_udp_connections.head;
|
(FAR struct udp_conn_s *)g_active_udp_connections.head;
|
||||||
|
|
||||||
while (conn)
|
while (conn)
|
||||||
{
|
{
|
||||||
@ -332,7 +333,7 @@ struct uip_udp_conn *uip_udpactive(FAR struct uip_udpip_hdr *buf)
|
|||||||
|
|
||||||
/* Look at the next active connection */
|
/* Look at the next active connection */
|
||||||
|
|
||||||
conn = (struct uip_udp_conn *)conn->node.flink;
|
conn = (FAR struct udp_conn_s *)conn->node.flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conn;
|
return conn;
|
||||||
@ -350,20 +351,20 @@ struct uip_udp_conn *uip_udpactive(FAR struct uip_udpip_hdr *buf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct uip_udp_conn *uip_nextudpconn(FAR struct uip_udp_conn *conn)
|
FAR struct udp_conn_s *uip_nextudpconn(FAR struct udp_conn_s *conn)
|
||||||
{
|
{
|
||||||
if (!conn)
|
if (!conn)
|
||||||
{
|
{
|
||||||
return (struct uip_udp_conn *)g_active_udp_connections.head;
|
return (FAR struct udp_conn_s *)g_active_udp_connections.head;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (struct uip_udp_conn *)conn->node.flink;
|
return (FAR struct udp_conn_s *)conn->node.flink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_udpbind()
|
* Name: udp_bind()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function implements the UIP specific parts of the standard UDP
|
* This function implements the UIP specific parts of the standard UDP
|
||||||
@ -375,11 +376,9 @@ FAR struct uip_udp_conn *uip_nextudpconn(FAR struct uip_udp_conn *conn)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
int uip_udpbind(FAR struct uip_udp_conn *conn,
|
int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr_in6 *addr)
|
||||||
FAR const struct sockaddr_in6 *addr)
|
|
||||||
#else
|
#else
|
||||||
int uip_udpbind(FAR struct uip_udp_conn *conn,
|
int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr_in *addr)
|
||||||
FAR const struct sockaddr_in *addr)
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int ret = -EADDRINUSE;
|
int ret = -EADDRINUSE;
|
||||||
@ -417,16 +416,16 @@ int uip_udpbind(FAR struct uip_udp_conn *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_udpconnect()
|
* Name: udp_connect()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function sets up a new UDP connection. The function will
|
* This function sets up a new UDP connection. The function will
|
||||||
* automatically allocate an unused local port for the new
|
* automatically allocate an unused local port for the new
|
||||||
* connection. However, another port can be chosen by using the
|
* connection. However, another port can be chosen by using the
|
||||||
* uip_udpbind() call, after the uip_udpconnect() function has been
|
* udp_bind() call, after the udp_connect() function has been
|
||||||
* called.
|
* called.
|
||||||
*
|
*
|
||||||
* uip_udpenable() must be called before the connection is made active (i.e.,
|
* udp_enable() must be called before the connection is made active (i.e.,
|
||||||
* is eligible for callbacks.
|
* is eligible for callbacks.
|
||||||
*
|
*
|
||||||
* addr The address of the remote host.
|
* addr The address of the remote host.
|
||||||
@ -437,11 +436,11 @@ int uip_udpbind(FAR struct uip_udp_conn *conn,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
int uip_udpconnect(FAR struct uip_udp_conn *conn,
|
int udp_connect(FAR struct udp_conn_s *conn,
|
||||||
FAR const struct sockaddr_in6 *addr)
|
FAR const struct sockaddr_in6 *addr)
|
||||||
#else
|
#else
|
||||||
int uip_udpconnect(FAR struct uip_udp_conn *conn,
|
int udp_connect(FAR struct udp_conn_s *conn,
|
||||||
FAR const struct sockaddr_in *addr)
|
FAR const struct sockaddr_in *addr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* Has this address already been bound to a local port (lport)? */
|
/* Has this address already been bound to a local port (lport)? */
|
||||||
|
@ -52,12 +52,13 @@
|
|||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define UDPBUF ((struct uip_udpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[UIP_LLH_LEN])
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Variables
|
* Public Variables
|
||||||
@ -76,7 +77,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_udpinput
|
* Name: udp_input
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Handle incoming UDP input
|
* Handle incoming UDP input
|
||||||
@ -94,10 +95,10 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int uip_udpinput(FAR struct uip_driver_s *dev)
|
int udp_input(FAR struct uip_driver_s *dev)
|
||||||
{
|
{
|
||||||
struct uip_udp_conn *conn;
|
FAR struct udp_conn_s *conn;
|
||||||
struct uip_udpip_hdr *pbuf = UDPBUF;
|
FAR struct udp_iphdr_s *pbuf = UDPBUF;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
#ifdef CONFIG_NET_STATISTICS
|
#ifdef CONFIG_NET_STATISTICS
|
||||||
@ -112,7 +113,7 @@ int uip_udpinput(FAR struct uip_driver_s *dev)
|
|||||||
dev->d_len -= UIP_IPUDPH_LEN;
|
dev->d_len -= UIP_IPUDPH_LEN;
|
||||||
#ifdef CONFIG_NET_UDP_CHECKSUMS
|
#ifdef CONFIG_NET_UDP_CHECKSUMS
|
||||||
dev->d_appdata = &dev->d_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];
|
dev->d_appdata = &dev->d_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];
|
||||||
if (pbuf->udpchksum != 0 && uip_udpchksum(dev) != 0xffff)
|
if (pbuf->udpchksum != 0 && udp_chksum(dev) != 0xffff)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_STATISTICS
|
#ifdef CONFIG_NET_STATISTICS
|
||||||
uip_stat.udp.drop++;
|
uip_stat.udp.drop++;
|
||||||
@ -126,7 +127,7 @@ int uip_udpinput(FAR struct uip_driver_s *dev)
|
|||||||
{
|
{
|
||||||
/* Demultiplex this UDP packet between the UDP "connections". */
|
/* Demultiplex this UDP packet between the UDP "connections". */
|
||||||
|
|
||||||
conn = uip_udpactive(pbuf);
|
conn = udp_active(pbuf);
|
||||||
if (conn)
|
if (conn)
|
||||||
{
|
{
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
@ -139,7 +140,7 @@ int uip_udpinput(FAR struct uip_driver_s *dev)
|
|||||||
|
|
||||||
/* Perform the application callback */
|
/* Perform the application callback */
|
||||||
|
|
||||||
flags = uip_udpcallback(dev, conn, UIP_NEWDATA);
|
flags = udp_callback(dev, conn, UIP_NEWDATA);
|
||||||
|
|
||||||
/* If the operation was successful, the UIP_NEWDATA flag is removed
|
/* If the operation was successful, the UIP_NEWDATA flag is removed
|
||||||
* and thus the packet can be deleted (OK will be returned).
|
* and thus the packet can be deleted (OK will be returned).
|
||||||
@ -158,7 +159,7 @@ int uip_udpinput(FAR struct uip_driver_s *dev)
|
|||||||
|
|
||||||
if (dev->d_sndlen > 0)
|
if (dev->d_sndlen > 0)
|
||||||
{
|
{
|
||||||
uip_udpsend(dev, conn);
|
udp_send(dev, conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@ -74,7 +75,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_udppoll
|
* Name: udp_poll
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Poll a UDP "connection" structure for availability of TX data
|
* Poll a UDP "connection" structure for availability of TX data
|
||||||
@ -91,7 +92,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void uip_udppoll(FAR struct uip_driver_s *dev, FAR struct uip_udp_conn *conn)
|
void udp_poll(FAR struct uip_driver_s *dev, FAR struct udp_conn_s *conn)
|
||||||
{
|
{
|
||||||
/* Verify that the UDP connection is valid */
|
/* Verify that the UDP connection is valid */
|
||||||
|
|
||||||
@ -107,13 +108,13 @@ void uip_udppoll(FAR struct uip_driver_s *dev, FAR struct uip_udp_conn *conn)
|
|||||||
|
|
||||||
/* Perform the application callback */
|
/* Perform the application callback */
|
||||||
|
|
||||||
(void)uip_udpcallback(dev, conn, UIP_POLL);
|
(void)udp_callback(dev, conn, UIP_POLL);
|
||||||
|
|
||||||
/* If the application has data to send, setup the UDP/IP header */
|
/* If the application has data to send, setup the UDP/IP header */
|
||||||
|
|
||||||
if (dev->d_sndlen > 0)
|
if (dev->d_sndlen > 0)
|
||||||
{
|
{
|
||||||
uip_udpsend(dev, conn);
|
udp_send(dev, conn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,13 @@
|
|||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define UDPBUF ((struct uip_udpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[UIP_LLH_LEN])
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Variables
|
* Public Variables
|
||||||
@ -75,7 +76,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_udpsend
|
* Name: udp_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set-up to send a UDP packet
|
* Set-up to send a UDP packet
|
||||||
@ -92,9 +93,9 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void uip_udpsend(struct uip_driver_s *dev, struct uip_udp_conn *conn)
|
void udp_send(struct uip_driver_s *dev, struct udp_conn_s *conn)
|
||||||
{
|
{
|
||||||
struct uip_udpip_hdr *pudpbuf = UDPBUF;
|
FAR struct udp_iphdr_s *pudpbuf = UDPBUF;
|
||||||
|
|
||||||
if (dev->d_sndlen > 0)
|
if (dev->d_sndlen > 0)
|
||||||
{
|
{
|
||||||
@ -155,7 +156,7 @@ void uip_udpsend(struct uip_driver_s *dev, struct uip_udp_conn *conn)
|
|||||||
/* Calculate UDP checksum. */
|
/* Calculate UDP checksum. */
|
||||||
|
|
||||||
pudpbuf->udpchksum = 0;
|
pudpbuf->udpchksum = 0;
|
||||||
pudpbuf->udpchksum = ~(uip_udpchksum(dev));
|
pudpbuf->udpchksum = ~(udp_chksum(dev));
|
||||||
if (pudpbuf->udpchksum == 0)
|
if (pudpbuf->udpchksum == 0)
|
||||||
{
|
{
|
||||||
pudpbuf->udpchksum = 0xffff;
|
pudpbuf->udpchksum = 0xffff;
|
||||||
|
@ -125,31 +125,6 @@ void uip_pktpoll(struct uip_driver_s *dev, struct uip_pkt_conn *conn);
|
|||||||
|
|
||||||
#endif /* CONFIG_NET_PKT */
|
#endif /* CONFIG_NET_PKT */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_UDP
|
|
||||||
/* Defined in udp_conn.c ****************************************************/
|
|
||||||
|
|
||||||
void uip_udpinit(void);
|
|
||||||
struct uip_udp_conn *uip_udpactive(struct uip_udpip_hdr *buf);
|
|
||||||
struct uip_udp_conn *uip_nextudpconn(struct uip_udp_conn *conn);
|
|
||||||
|
|
||||||
/* Defined in udp_poll.c ****************************************************/
|
|
||||||
|
|
||||||
void uip_udppoll(struct uip_driver_s *dev, struct uip_udp_conn *conn);
|
|
||||||
|
|
||||||
/* Defined in udp_send.c ****************************************************/
|
|
||||||
|
|
||||||
void uip_udpsend(struct uip_driver_s *dev, struct uip_udp_conn *conn);
|
|
||||||
|
|
||||||
/* Defined in udp_input.c ***************************************************/
|
|
||||||
|
|
||||||
int uip_udpinput(struct uip_driver_s *dev);
|
|
||||||
|
|
||||||
/* Defined in udp_callback.c ************************************************/
|
|
||||||
|
|
||||||
uint16_t uip_udpcallback(struct uip_driver_s *dev,
|
|
||||||
struct uip_udp_conn *conn, uint16_t flags);
|
|
||||||
#endif /* CONFIG_NET_UDP */
|
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ICMP
|
#ifdef CONFIG_NET_ICMP
|
||||||
/* Defined in icmp_input.c **************************************************/
|
/* Defined in icmp_input.c **************************************************/
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ uint16_t tcp_chksum(struct uip_driver_s *dev)
|
|||||||
/* Calculate the UDP checksum of the packet in d_buf and d_appdata. */
|
/* Calculate the UDP checksum of the packet in d_buf and d_appdata. */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_UDP_CHECKSUMS
|
#ifdef CONFIG_NET_UDP_CHECKSUMS
|
||||||
uint16_t uip_udpchksum(struct uip_driver_s *dev)
|
uint16_t udp_chksum(struct uip_driver_s *dev)
|
||||||
{
|
{
|
||||||
return upper_layer_chksum(dev, UIP_PROTO_UDP);
|
return upper_layer_chksum(dev, UIP_PROTO_UDP);
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <nuttx/net/uip.h>
|
#include <nuttx/net/uip.h>
|
||||||
|
|
||||||
|
#include "uip/uip.h"
|
||||||
#include "tcp/tcp.h"
|
#include "tcp/tcp.h"
|
||||||
#include "uip.h"
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@ -149,7 +150,7 @@ void uip_initialize(void)
|
|||||||
/* Initialize the UDP connection structures */
|
/* Initialize the UDP connection structures */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_UDP
|
#ifdef CONFIG_NET_UDP
|
||||||
uip_udpinit();
|
udp_initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize IGMP support */
|
/* Initialize IGMP support */
|
||||||
|
@ -93,9 +93,9 @@
|
|||||||
# include "uip_neighbor.h"
|
# include "uip_neighbor.h"
|
||||||
#endif /* CONFIG_NET_IPv6 */
|
#endif /* CONFIG_NET_IPv6 */
|
||||||
|
|
||||||
|
#include "uip/uip.h"
|
||||||
#include "tcp/tcp.h"
|
#include "tcp/tcp.h"
|
||||||
#include "udp/udp.h"
|
#include "udp/udp.h"
|
||||||
#include "uip.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@ -414,7 +414,7 @@ int uip_input(struct uip_driver_s *dev)
|
|||||||
uip_ipaddr_cmp(pbuf->destipaddr, g_alloneaddr))
|
uip_ipaddr_cmp(pbuf->destipaddr, g_alloneaddr))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return uip_udpinput(dev);
|
return udp_input(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In most other cases, the device must be assigned a non-zero IP
|
/* In most other cases, the device must be assigned a non-zero IP
|
||||||
@ -514,7 +514,7 @@ int uip_input(struct uip_driver_s *dev)
|
|||||||
|
|
||||||
#ifdef CONFIG_NET_UDP
|
#ifdef CONFIG_NET_UDP
|
||||||
case UIP_PROTO_UDP: /* UDP input */
|
case UIP_PROTO_UDP: /* UDP input */
|
||||||
uip_udpinput(dev);
|
udp_input(dev);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -46,8 +46,9 @@
|
|||||||
#include <nuttx/net/uip.h>
|
#include <nuttx/net/uip.h>
|
||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
|
#include "uip/uip.h"
|
||||||
#include "tcp/tcp.h"
|
#include "tcp/tcp.h"
|
||||||
#include "uip.h"
|
#include "udp/udp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@ -161,16 +162,16 @@ static inline int uip_polligmp(FAR struct uip_driver_s *dev,
|
|||||||
static int uip_polludpconnections(FAR struct uip_driver_s *dev,
|
static int uip_polludpconnections(FAR struct uip_driver_s *dev,
|
||||||
uip_poll_callback_t callback)
|
uip_poll_callback_t callback)
|
||||||
{
|
{
|
||||||
FAR struct uip_udp_conn *udp_conn = NULL;
|
FAR struct udp_conn_s *conn = NULL;
|
||||||
int bstop = 0;
|
int bstop = 0;
|
||||||
|
|
||||||
/* Traverse all of the allocated UDP connections and perform the poll action */
|
/* Traverse all of the allocated UDP connections and perform the poll action */
|
||||||
|
|
||||||
while (!bstop && (udp_conn = uip_nextudpconn(udp_conn)))
|
while (!bstop && (conn = uip_nextudpconn(conn)))
|
||||||
{
|
{
|
||||||
/* Perform the UDP TX poll */
|
/* Perform the UDP TX poll */
|
||||||
|
|
||||||
uip_udppoll(dev, udp_conn);
|
udp_poll(dev, conn);
|
||||||
|
|
||||||
/* Call back into the driver */
|
/* Call back into the driver */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user