diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-07-04 16:38:51 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-07-04 16:38:51 -0600 |
commit | 2a65a652708030d24e530925ccb0f6be8817c2d2 (patch) | |
tree | 04d8f90f4d717da9c10ab22d9c52c2890575b8a7 | |
parent | eb46f67f7957f8a27d7c09836ada9cf8264d0ad5 (diff) | |
download | px4-nuttx-2a65a652708030d24e530925ccb0f6be8817c2d2.tar.gz px4-nuttx-2a65a652708030d24e530925ccb0f6be8817c2d2.tar.bz2 px4-nuttx-2a65a652708030d24e530925ccb0f6be8817c2d2.zip |
NET: in-progress change... don't use
44 files changed, 229 insertions, 195 deletions
diff --git a/apps/netutils/dhcpd/dhcpd.c b/apps/netutils/dhcpd/dhcpd.c index d13d7cee5..b0f171384 100644 --- a/apps/netutils/dhcpd/dhcpd.c +++ b/apps/netutils/dhcpd/dhcpd.c @@ -56,6 +56,7 @@ # include <debug.h> /* For ndbg, vdbg */ # include <nuttx/compiler.h> /* For CONFIG_CPP_HAVE_WARNING */ # include <arch/irq.h> /* For irqstore() and friends -- REVISIT */ +# include <nuttx/net/net.h> /* For net_lock() and friends */ # include <nuttx/net/arp.h> /* For low-level ARP interfaces -- REVISIT */ # include <apps/netutils/dhcpd.h> /* Advertised DHCPD APIs */ #endif diff --git a/misc/drivers/rtl8187x/rtl8187x.c b/misc/drivers/rtl8187x/rtl8187x.c index b131ba2d3..8b09483dd 100644 --- a/misc/drivers/rtl8187x/rtl8187x.c +++ b/misc/drivers/rtl8187x/rtl8187x.c @@ -72,7 +72,7 @@ #include <nuttx/usb/usb.h> #include <nuttx/usb/usbhost.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/arp.h> #include <nuttx/net/devif.h> diff --git a/nuttx/drivers/net/enc28j60.c b/nuttx/drivers/net/enc28j60.c index 36ee9966b..3303f4006 100644 --- a/nuttx/drivers/net/enc28j60.c +++ b/nuttx/drivers/net/enc28j60.c @@ -61,7 +61,7 @@ #include <nuttx/clock.h> #include <nuttx/net/enc28j60.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/arp.h> #include <nuttx/net/netdev.h> diff --git a/nuttx/drivers/net/encx24j600.c b/nuttx/drivers/net/encx24j600.c index a6c4f8ce2..c995a75fb 100644 --- a/nuttx/drivers/net/encx24j600.c +++ b/nuttx/drivers/net/encx24j600.c @@ -67,7 +67,7 @@ #include <nuttx/clock.h> #include <nuttx/net/encx24j600.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/arp.h> #include <nuttx/net/netdev.h> diff --git a/nuttx/include/nuttx/net/net.h b/nuttx/include/nuttx/net/net.h index 0cfbdbe40..14a4216ed 100644 --- a/nuttx/include/nuttx/net/net.h +++ b/nuttx/include/nuttx/net/net.h @@ -55,7 +55,7 @@ ****************************************************************************/ /* Socket descriptors are the index into the TCB sockets list, offset by the - * following amount. This offset is used to distinquish file descriptors from + * following amount. This offset is used to distinguish file descriptors from * socket descriptors */ @@ -85,6 +85,8 @@ typedef uint16_t socktimeo_t; * descriptor. */ +struct devif_callback_s; /* Forward reference */ + struct socket { int s_crefs; /* Reference count on the socket */ @@ -128,6 +130,24 @@ struct socketlist struct net_driver_s; /* Forward reference. Defined in nuttx/net/netdev.h */ typedef int (*netdev_callback_t)(FAR struct net_driver_s *dev, void *arg); +#ifdef CONFIG_NET_NOINTS +/* Semaphore based locking for non-interrupt based logic. + * + * net_lock_t -- Not used. Only for compatibility + */ + +typedef uint8_t net_lock_t; /* Not really used */ + +#else + +/* Enable/disable locking for interrupt based logic: + * + * net_lock_t -- The processor specific representation of interrupt state. + */ + +# define net_lock_t irqstate_t +#endif + /**************************************************************************** * Public Data ****************************************************************************/ @@ -144,6 +164,42 @@ extern "C" * Public Function Prototypes ****************************************************************************/ +/* net_lock.c ****************************************************************/ +/* Critical section management. The NuttX configuration setting + * CONFIG_NET_NOINT indicates that uIP not called from the interrupt level. + * If CONFIG_NET_NOINTS is defined, then these will map to semaphore + * controls. Otherwise, it assumed that uIP will be called from interrupt + * level handling and these will map to interrupt enable/disable controls. + */ + +#ifdef CONFIG_NET_NOINTS +/* Semaphore based locking for non-interrupt based logic. + * + * net_lock() -- Takes the semaphore(). Implements a re-entrant mutex. + * net_unlock() -- Gives the semaphore(). + * net_lockedwait() -- Like pthread_cond_wait(); releases the semaphore + * momentarily to wait on another semaphore() + */ + +net_lock_t net_lock(void); +void net_unlock(net_lock_t flags); +int net_lockedwait(sem_t *sem); + +#else + +/* Enable/disable locking for interrupt based logic: + * + * net_lock() -- Disables interrupts. + * net_unlock() -- Conditionally restores interrupts. + * net_lockedwait() -- Just wait for the semaphore. + */ + +# define net_lock() irqsave() +# define net_unlock(f) irqrestore(f) +# define net_lockedwait(s) sem_wait(s) + +#endif + /* This function may be used at boot time to set the initial ip_id.*/ void net_setipid(uint16_t id); diff --git a/nuttx/include/nuttx/net/pkt.h b/nuttx/include/nuttx/net/pkt.h index 05df97180..1b38e02c4 100644 --- a/nuttx/include/nuttx/net/pkt.h +++ b/nuttx/include/nuttx/net/pkt.h @@ -55,6 +55,8 @@ /* Representation of a uIP packet socket connection */ +struct devif_callback_s; /* Forward reference */ + struct pkt_conn_s { dq_entry_t node; /* Supports a double linked list */ diff --git a/nuttx/include/nuttx/net/udp.h b/nuttx/include/nuttx/net/udp.h index ec145a20e..4fac3ab76 100644 --- a/nuttx/include/nuttx/net/udp.h +++ b/nuttx/include/nuttx/net/udp.h @@ -70,7 +70,8 @@ /* Representation of a uIP UDP connection */ struct net_driver_s; /* Forward reference */ -struct devif_callback_s; /* Forward reference */ +struct devif_callback_s; /* Forward reference */ + struct udp_conn_s { dq_entry_t node; /* Supports a doubly linked list */ diff --git a/nuttx/include/nuttx/net/uip.h b/nuttx/include/nuttx/net/uip.h index 1e3ad46f3..b3052f365 100644 --- a/nuttx/include/nuttx/net/uip.h +++ b/nuttx/include/nuttx/net/uip.h @@ -54,10 +54,6 @@ #include <stdbool.h> #include <queue.h> -#ifdef CONFIG_NET_NOINTS -# include <semaphore.h> -#endif - #include <arpa/inet.h> #include <nuttx/net/netconfig.h> @@ -65,94 +61,20 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Values for the IP protocol field */ -/* The following flags may be set in the set of flags before calling the - * application callback. The UIP_ACKDATA, UIP_NEWDATA, and UIP_CLOSE flags - * may be set at the same time, whereas the others are mutually exclusive. - * - * UIP_ACKDATA IN: Signifies that the outstanding data was ACKed and - * the application should send out new data instead - * of retransmitting the last data (TCP only) - * OUT: Input state must be preserved on output. - * UIP_NEWDATA IN: Set to indicate that the peer has sent us new data. - * OUT: Cleared (only) by the application logic to indicate - * that the new data was consumed, suppressing further - * attempts to process the new data. - * UIP_SNDACK IN: Not used; always zero - * OUT: Set by the application if the new data was consumed - * and an ACK should be sent in the response. (TCP only) - * UIP_REXMIT IN: Tells the application to retransmit the data that - * was last sent. (TCP only) - * OUT: Not used - * UIP_POLL IN: Used for polling the application. This is provided - * periodically from the drivers to support (1) timed - * operations, and (2) to check if the application has - * data that it wants to send - * OUT: Not used - * UIP_BACKLOG IN: There is a new connection in the backlog list set - * up by the listen() command. (TCP only) - * OUT: Not used - * UIP_CLOSE IN: The remote host has closed the connection, thus the - * connection has gone away. (TCP only) - * OUT: The application signals that it wants to close the - * connection. (TCP only) - * UIP_ABORT IN: The remote host has aborted the connection, thus the - * connection has gone away. (TCP only) - * OUT: The application signals that it wants to abort the - * connection. (TCP only) - * UIP_CONNECTED IN: We have got a connection from a remote host and have - * set up a new connection for it, or an active connection - * has been successfully established. (TCP only) - * OUT: Not used - * UIP_TIMEDOUT IN: The connection has been aborted due to too many - * retransmissions. (TCP only) - * OUT: Not used - * UIP_ECHOREPLY IN: An ICMP Echo Reply has been received. Used to support - * ICMP ping from applications. (ICMP only) - * OUT: Cleared (only) by the application logic to indicate - * that the reply was processed, suppressing further - * attempts to process the reply. - */ - -#define UIP_ACKDATA (1 << 0) -#define UIP_NEWDATA (1 << 1) -#define UIP_SNDACK (1 << 2) -#define UIP_REXMIT (1 << 3) -#define UIP_POLL (1 << 4) -#define UIP_BACKLOG (1 << 5) -#define UIP_CLOSE (1 << 6) -#define UIP_ABORT (1 << 7) -#define UIP_CONNECTED (1 << 8) -#define UIP_TIMEDOUT (1 << 9) -#define UIP_ECHOREPLY (1 << 10) - -#define UIP_CONN_EVENTS (UIP_CLOSE|UIP_ABORT|UIP_CONNECTED|UIP_TIMEDOUT) - -/* The buffer size available for user data in the d_buf buffer. - * - * This macro holds the available size for user data in the - * d_buf buffer. The macro is intended to be used for checking - * bounds of available user data. - * - * Example: - * - * snprintf(dev->d_appdata, UIP_APPDATA_SIZE, "%u\n", i); - */ - -#define UIP_APPDATA_SIZE (CONFIG_NET_BUFSIZE - NET_LLH_LEN - UIP_TCPIP_HLEN) - -#define UIP_PROTO_ICMP 1 -#define UIP_PROTO_IGMP 2 -#define UIP_PROTO_TCP 6 -#define UIP_PROTO_UDP 17 -#define UIP_PROTO_ICMP6 58 +#define IP_PROTO_ICMP 1 +#define IP_PROTO_IGMP 2 +#define IP_PROTO_TCP 6 +#define IP_PROTO_UDP 17 +#define IP_PROTO_ICMP6 58 /* Header sizes */ #ifdef CONFIG_NET_IPv6 -# define UIP_IPH_LEN 40 /* Size of IP header */ +# define IPHDR_LEN 40 /* Size of IP header */ #else -# define UIP_IPH_LEN 20 /* Size of IP header */ +# define IPHDR_LEN 20 /* Size of IP header */ #endif /**************************************************************************** @@ -205,28 +127,6 @@ struct net_iphdr_s #endif /* CONFIG_NET_IPv6 */ }; -/* Describes a device interface callback - * - * flink - Supports a singly linked list - * event - Provides the address of the callback function entry point. - * pvconn is a pointer to one of struct tcp_conn_s or struct - * udp_conn_s. - * priv - Holds a reference to application specific data that will - * provided - * flags - Set by the application to inform the lower layer which flags - * were and were not handled by the callback. - */ - -struct net_driver_s; /* Forward reference */ -struct devif_callback_s -{ - FAR struct devif_callback_s *flink; - uint16_t (*event)(FAR struct net_driver_s *dev, FAR void *pvconn, - FAR void *pvpriv, uint16_t flags); - FAR void *priv; - uint16_t flags; -}; - /**************************************************************************** * Public Data ****************************************************************************/ @@ -235,51 +135,6 @@ struct devif_callback_s * Public Function Prototypes ****************************************************************************/ -/* Critical section management. The NuttX configuration setting - * CONFIG_NET_NOINT indicates that uIP not called from the interrupt level. - * If CONFIG_NET_NOINTS is defined, then these will map to semaphore - * controls. Otherwise, it assumed that uIP will be called from interrupt - * level handling and these will map to interrupt enable/disable controls. - */ - -#ifdef CONFIG_NET_NOINTS - -/* Semaphore based locking for non-interrupt based logic. - * - * net_lock_t -- Not used. Only for compatibility - * net_lockinitialize() -- Initializes an underlying semaphore/mutex - * net_lock() -- Takes the semaphore(). Implements a re-entrant mutex. - * net_unlock() -- Gives the semaphore(). - * net_lockedwait() -- Like pthread_cond_wait(); releases the semaphore - * momemtarily to wait on another semaphore() - */ - -typedef uint8_t net_lock_t; /* Not really used */ - -void net_lockinitialize(void); -net_lock_t net_lock(void); -void net_unlock(net_lock_t flags); -int net_lockedwait(sem_t *sem); - -#else - -/* Enable/disable locking for interrupt based logic: - * - * net_lock_t -- The processor specific representation of interrupt state. - * net_lockinitialize() -- (Does not exist). - * net_lock() -- Disables interrupts. - * net_unlock() -- Conditionally restores interrupts. - * net_lockedwait() -- Just wait for the semaphore. - */ - -# define net_lock_t irqstate_t -# define net_lockinitialize() -# define net_lock() irqsave() -# define net_unlock(f) irqrestore(f) -# define net_lockedwait(s) sem_wait(s) - -#endif - /* uIP application functions * * Functions used by an application running of top of uIP. This includes diff --git a/nuttx/net/devif/devif.h b/nuttx/net/devif/devif.h index 1c47b43c3..c3f18cd81 100644 --- a/nuttx/net/devif/devif.h +++ b/nuttx/net/devif/devif.h @@ -57,11 +57,94 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* The following flags may be set in the set of flags before calling the + * application callback. The UIP_ACKDATA, UIP_NEWDATA, and UIP_CLOSE flags + * may be set at the same time, whereas the others are mutually exclusive. + * + * UIP_ACKDATA IN: Signifies that the outstanding data was ACKed and + * the application should send out new data instead + * of retransmitting the last data (TCP only) + * OUT: Input state must be preserved on output. + * UIP_NEWDATA IN: Set to indicate that the peer has sent us new data. + * OUT: Cleared (only) by the application logic to indicate + * that the new data was consumed, suppressing further + * attempts to process the new data. + * UIP_SNDACK IN: Not used; always zero + * OUT: Set by the application if the new data was consumed + * and an ACK should be sent in the response. (TCP only) + * UIP_REXMIT IN: Tells the application to retransmit the data that + * was last sent. (TCP only) + * OUT: Not used + * UIP_POLL IN: Used for polling the application. This is provided + * periodically from the drivers to support (1) timed + * operations, and (2) to check if the application has + * data that it wants to send + * OUT: Not used + * UIP_BACKLOG IN: There is a new connection in the backlog list set + * up by the listen() command. (TCP only) + * OUT: Not used + * UIP_CLOSE IN: The remote host has closed the connection, thus the + * connection has gone away. (TCP only) + * OUT: The application signals that it wants to close the + * connection. (TCP only) + * UIP_ABORT IN: The remote host has aborted the connection, thus the + * connection has gone away. (TCP only) + * OUT: The application signals that it wants to abort the + * connection. (TCP only) + * UIP_CONNECTED IN: We have got a connection from a remote host and have + * set up a new connection for it, or an active connection + * has been successfully established. (TCP only) + * OUT: Not used + * UIP_TIMEDOUT IN: The connection has been aborted due to too many + * retransmissions. (TCP only) + * OUT: Not used + * UIP_ECHOREPLY IN: An ICMP Echo Reply has been received. Used to support + * ICMP ping from applications. (ICMP only) + * OUT: Cleared (only) by the application logic to indicate + * that the reply was processed, suppressing further + * attempts to process the reply. + */ + +#define UIP_ACKDATA (1 << 0) +#define UIP_NEWDATA (1 << 1) +#define UIP_SNDACK (1 << 2) +#define UIP_REXMIT (1 << 3) +#define UIP_POLL (1 << 4) +#define UIP_BACKLOG (1 << 5) +#define UIP_CLOSE (1 << 6) +#define UIP_ABORT (1 << 7) +#define UIP_CONNECTED (1 << 8) +#define UIP_TIMEDOUT (1 << 9) +#define UIP_ECHOREPLY (1 << 10) + +#define UIP_CONN_EVENTS (UIP_CLOSE|UIP_ABORT|UIP_CONNECTED|UIP_TIMEDOUT) /**************************************************************************** * Public Type Definitions ****************************************************************************/ +/* Describes a device interface callback + * + * flink - Supports a singly linked list + * event - Provides the address of the callback function entry point. + * pvconn is a pointer to one of struct tcp_conn_s or struct + * udp_conn_s. + * priv - Holds a reference to application specific data that will + * provided + * flags - Set by the application to inform the lower layer which flags + * were and were not handled by the callback. + */ + +struct net_driver_s; /* Forward reference */ +struct devif_callback_s +{ + FAR struct devif_callback_s *flink; + uint16_t (*event)(FAR struct net_driver_s *dev, FAR void *pvconn, + FAR void *pvpriv, uint16_t flags); + FAR void *priv; + uint16_t flags; +}; + /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/nuttx/net/devif/devif_callback.c b/nuttx/net/devif/devif_callback.c index 5a66a33b7..cbee5a2e6 100644 --- a/nuttx/net/devif/devif_callback.c +++ b/nuttx/net/devif/devif_callback.c @@ -45,7 +45,7 @@ #include <debug.h> #include <nuttx/net/netconfig.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/netdev.h> #include "devif/devif.h" diff --git a/nuttx/net/devif/devif_input.c b/nuttx/net/devif/devif_input.c index 55555cb55..e2da0defd 100644 --- a/nuttx/net/devif/devif_input.c +++ b/nuttx/net/devif/devif_input.c @@ -162,7 +162,7 @@ static uint8_t devif_reassembly(void) if (!g_reassembly_timer) { - memcpy(g_reassembly_buffer, &pbuf->vhl, UIP_IPH_LEN); + memcpy(g_reassembly_buffer, &pbuf->vhl, IPHDR_LEN); g_reassembly_timer = UIP_REASS_MAXAGE; g_reassembly_flags = 0; @@ -195,7 +195,7 @@ static uint8_t devif_reassembly(void) /* Copy the fragment into the reassembly buffer, at the right offset. */ - memcpy(&g_reassembly_buffer[UIP_IPH_LEN + offset], (char *)pbuf + (int)((pbuf->vhl & 0x0f) * 4), len); + memcpy(&g_reassembly_buffer[IPHDR_LEN + offset], (char *)pbuf + (int)((pbuf->vhl & 0x0f) * 4), len); /* Update the bitmap. */ @@ -367,7 +367,7 @@ int devif_input(FAR struct net_driver_s *dev) * the size of the IPv6 header (40 bytes). */ - iplen = (pbuf->len[0] << 8) + pbuf->len[1] + UIP_IPH_LEN; + iplen = (pbuf->len[0] << 8) + pbuf->len[1] + IPHDR_LEN; #else iplen = (pbuf->len[0] << 8) + pbuf->len[1]; #endif /* CONFIG_NET_IPv6 */ @@ -411,7 +411,7 @@ int devif_input(FAR struct net_driver_s *dev) */ #if defined(CONFIG_NET_BROADCAST) && defined(CONFIG_NET_UDP) - if (pbuf->proto == UIP_PROTO_UDP && + if (pbuf->proto == IP_PROTO_UDP && #ifndef CONFIG_NET_IPv6 net_ipaddr_cmp(net_ip4addr_conv32(pbuf->destipaddr), g_alloneaddr)) #else @@ -437,7 +437,7 @@ int devif_input(FAR struct net_driver_s *dev) */ #if defined(CONFIG_NET_PINGADDRCONF) && !defined(CONFIG_NET_IPv6) - if (pbuf->proto == UIP_PROTO_ICMP) + if (pbuf->proto == IP_PROTO_ICMP) { nlldbg("Possible ping config packet received\n"); icmp_input(dev); @@ -511,13 +511,13 @@ int devif_input(FAR struct net_driver_s *dev) switch (pbuf->proto) { #ifdef CONFIG_NET_TCP - case UIP_PROTO_TCP: /* TCP input */ + case IP_PROTO_TCP: /* TCP input */ tcp_input(dev); break; #endif #ifdef CONFIG_NET_UDP - case UIP_PROTO_UDP: /* UDP input */ + case IP_PROTO_UDP: /* UDP input */ udp_input(dev); break; #endif @@ -526,9 +526,9 @@ int devif_input(FAR struct net_driver_s *dev) #ifdef CONFIG_NET_ICMP #ifndef CONFIG_NET_IPv6 - case UIP_PROTO_ICMP: /* ICMP input */ + case IP_PROTO_ICMP: /* ICMP input */ #else - case UIP_PROTO_ICMP6: /* ICMP6 input */ + case IP_PROTO_ICMP6: /* ICMP6 input */ #endif icmp_input(dev); break; @@ -538,7 +538,7 @@ int devif_input(FAR struct net_driver_s *dev) #ifdef CONFIG_NET_IGMP #ifndef CONFIG_NET_IPv6 - case UIP_PROTO_IGMP: /* IGMP input */ + case IP_PROTO_IGMP: /* IGMP input */ igmp_input(dev); break; #endif diff --git a/nuttx/net/icmp/icmp_input.c b/nuttx/net/icmp/icmp_input.c index 63c94c979..ab250e7bf 100644 --- a/nuttx/net/icmp/icmp_input.c +++ b/nuttx/net/icmp/icmp_input.c @@ -149,7 +149,7 @@ void icmp_input(FAR struct net_driver_s *dev) /* The slow way... sum over the ICMP message */ picmp->icmpchksum = 0; - picmp->icmpchksum = ~icmp_chksum(dev, (((uint16_t)picmp->len[0] << 8) | (uint16_t)picmp->len[1]) - UIP_IPH_LEN); + picmp->icmpchksum = ~icmp_chksum(dev, (((uint16_t)picmp->len[0] << 8) | (uint16_t)picmp->len[1]) - IPHDR_LEN); if (picmp->icmpchksum == 0) { picmp->icmpchksum = 0xffff; diff --git a/nuttx/net/icmp/icmp_ping.c b/nuttx/net/icmp/icmp_ping.c index 11763503a..9a9a57179 100644 --- a/nuttx/net/icmp/icmp_ping.c +++ b/nuttx/net/icmp/icmp_ping.c @@ -50,7 +50,7 @@ #include <net/if.h> #include <nuttx/clock.h> #include <nuttx/net/netconfig.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/netdev.h> #include <nuttx/net/icmp.h> diff --git a/nuttx/net/igmp/igmp_group.c b/nuttx/net/igmp/igmp_group.c index a12af82a3..865462afd 100644 --- a/nuttx/net/igmp/igmp_group.c +++ b/nuttx/net/igmp/igmp_group.c @@ -55,7 +55,7 @@ #include <nuttx/arch.h> #include <nuttx/kmalloc.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/igmp.h> #include "devif/devif.h" diff --git a/nuttx/net/igmp/igmp_leave.c b/nuttx/net/igmp/igmp_leave.c index 3021fcb8e..0f64d24dc 100644 --- a/nuttx/net/igmp/igmp_leave.c +++ b/nuttx/net/igmp/igmp_leave.c @@ -48,7 +48,7 @@ #include <debug.h> #include <nuttx/net/netconfig.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/netstats.h> #include <nuttx/net/igmp.h> diff --git a/nuttx/net/igmp/igmp_msg.c b/nuttx/net/igmp/igmp_msg.c index 9616fd4a0..aef5965fd 100644 --- a/nuttx/net/igmp/igmp_msg.c +++ b/nuttx/net/igmp/igmp_msg.c @@ -47,7 +47,7 @@ #include <debug.h> #include <nuttx/net/netconfig.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/igmp.h> #include "devif/devif.h" diff --git a/nuttx/net/igmp/igmp_send.c b/nuttx/net/igmp/igmp_send.c index ec7b02189..75908b076 100644 --- a/nuttx/net/igmp/igmp_send.c +++ b/nuttx/net/igmp/igmp_send.c @@ -160,7 +160,7 @@ void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group, /* Calculate IP checksum. */ IGMPBUF->ipchksum = 0; - IGMPBUF->ipchksum = ~igmp_chksum((FAR uint8_t *)IGMPBUF, UIP_IPH_LEN + RASIZE); + IGMPBUF->ipchksum = ~igmp_chksum((FAR uint8_t *)IGMPBUF, IPHDR_LEN + RASIZE); /* Set up the IGMP message */ diff --git a/nuttx/net/igmp/igmp_timer.c b/nuttx/net/igmp/igmp_timer.c index 71ba9ce76..59b5f9f95 100644 --- a/nuttx/net/igmp/igmp_timer.c +++ b/nuttx/net/igmp/igmp_timer.c @@ -49,7 +49,7 @@ #include <debug.h> #include <nuttx/net/netconfig.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/netstats.h> #include <nuttx/net/igmp.h> diff --git a/nuttx/net/net_initialize.c b/nuttx/net/net_initialize.c index f5431bd60..c57b7b623 100644 --- a/nuttx/net/net_initialize.c +++ b/nuttx/net/net_initialize.c @@ -54,6 +54,7 @@ #include "pkt/pkt.h" #include "igmp/igmp.h" #include "route/route.h" +#include "utils/utils.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/net/netdev/netdev_sem.c b/nuttx/net/netdev/netdev_sem.c index 2a7fa07ca..387ffd136 100644 --- a/nuttx/net/netdev/netdev_sem.c +++ b/nuttx/net/netdev/netdev_sem.c @@ -48,6 +48,8 @@ #include <assert.h> #include <errno.h> +#include <nuttx/net/net.h> + #include "netdev/netdev.h" /**************************************************************************** diff --git a/nuttx/net/pkt/pkt_conn.c b/nuttx/net/pkt/pkt_conn.c index 047303f27..471de1d3b 100644 --- a/nuttx/net/pkt/pkt_conn.c +++ b/nuttx/net/pkt/pkt_conn.c @@ -51,7 +51,7 @@ #include <arch/irq.h> #include <nuttx/net/netconfig.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/netdev.h> #include <nuttx/net/arp.h> #include <nuttx/net/pkt.h> diff --git a/nuttx/net/pkt/pkt_send.c b/nuttx/net/pkt/pkt_send.c index ffd0119e0..daee8c445 100644 --- a/nuttx/net/pkt/pkt_send.c +++ b/nuttx/net/pkt/pkt_send.c @@ -51,13 +51,14 @@ #include <arch/irq.h> #include <nuttx/clock.h> +#include <nuttx/net/net.h> #include <nuttx/net/arp.h> #include <nuttx/net/netdev.h> #include <nuttx/net/pkt.h> -#include "socket/socket.h" #include "netdev/netdev.h" #include "devif/devif.h" +#include "socket/socket.h" #include "pkt/pkt.h" /**************************************************************************** diff --git a/nuttx/net/route/net_addroute.c b/nuttx/net/route/net_addroute.c index acadcbb43..32d5c2063 100644 --- a/nuttx/net/route/net_addroute.c +++ b/nuttx/net/route/net_addroute.c @@ -44,6 +44,8 @@ #include <errno.h> #include <debug.h> +#include <nuttx/net/net.h> + #include <arch/irq.h> #include "route/route.h" diff --git a/nuttx/net/route/net_allocroute.c b/nuttx/net/route/net_allocroute.c index a8074b20c..bf078bae0 100644 --- a/nuttx/net/route/net_allocroute.c +++ b/nuttx/net/route/net_allocroute.c @@ -43,6 +43,7 @@ #include <errno.h> #include <assert.h> +#include <nuttx/net/net.h> #include <arch/irq.h> #include "route/route.h" diff --git a/nuttx/net/route/net_foreachroute.c b/nuttx/net/route/net_foreachroute.c index 0c0de44f1..27c199702 100644 --- a/nuttx/net/route/net_foreachroute.c +++ b/nuttx/net/route/net_foreachroute.c @@ -42,6 +42,8 @@ #include <stdint.h> #include <errno.h> +#include <nuttx/net/net.h> + #include <arch/irq.h> #include "route/route.h" diff --git a/nuttx/net/socket/accept.c b/nuttx/net/socket/accept.c index ba86f0f95..b30f61373 100644 --- a/nuttx/net/socket/accept.c +++ b/nuttx/net/socket/accept.c @@ -51,6 +51,7 @@ #include <arch/irq.h> +#include <nuttx/net/net.h> #include <nuttx/net/tcp.h> #include "socket/socket.h" diff --git a/nuttx/net/socket/connect.c b/nuttx/net/socket/connect.c index e93838f93..d851b7b22 100644 --- a/nuttx/net/socket/connect.c +++ b/nuttx/net/socket/connect.c @@ -48,14 +48,15 @@ #include <debug.h> #include <arch/irq.h> +#include <nuttx/net/net.h> #include <nuttx/net/netdev.h> #include <nuttx/net/tcp.h> #include <nuttx/net/udp.h> -#include "socket/socket.h" #include "devif/devif.h" #include "tcp/tcp.h" #include "udp/udp.h" +#include "socket/socket.h /**************************************************************************** * Private Types diff --git a/nuttx/net/socket/net_clone.c b/nuttx/net/socket/net_clone.c index 0866d88f4..e8bcba5ae 100644 --- a/nuttx/net/socket/net_clone.c +++ b/nuttx/net/socket/net_clone.c @@ -45,6 +45,7 @@ #include <debug.h> #include <nuttx/arch.h> +#include <nuttx/net/net.h> #include <nuttx/net/tcp.h> #include <nuttx/net/udp.h> diff --git a/nuttx/net/socket/net_close.c b/nuttx/net/socket/net_close.c index 515109b46..503dbab15 100644 --- a/nuttx/net/socket/net_close.c +++ b/nuttx/net/socket/net_close.c @@ -48,6 +48,7 @@ #include <debug.h> #include <arch/irq.h> +#include <nuttx/net/net.h> #include <nuttx/net/netdev.h> #include <nuttx/net/tcp.h> #include <nuttx/net/udp.h> @@ -57,11 +58,11 @@ # include <nuttx/clock.h> #endif -#include "socket/socket.h" #include "netdev/netdev.h" #include "devif/devif.h" #include "tcp/tcp.h" #include "pkt/pkt.h" +#include "socket/socket.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/net/socket/net_poll.c b/nuttx/net/socket/net_poll.c index 5ce00931b..3bfed4dd5 100644 --- a/nuttx/net/socket/net_poll.c +++ b/nuttx/net/socket/net_poll.c @@ -57,7 +57,6 @@ #include <nuttx/net/tcp.h> #include <devif/devif.h> - #include "tcp/tcp.h" #include "socket/socket.h" diff --git a/nuttx/net/socket/net_sendfile.c b/nuttx/net/socket/net_sendfile.c index ab392e01a..5ff8c6fe0 100644 --- a/nuttx/net/socket/net_sendfile.c +++ b/nuttx/net/socket/net_sendfile.c @@ -58,14 +58,16 @@ #include <arch/irq.h> #include <nuttx/clock.h> #include <nuttx/fs/fs.h> +#include <nuttx/net/net.h> #include <nuttx/net/arp.h> #include <nuttx/net/netdev.h> #include <nuttx/net/tcp.h> -#include "socket/socket.h" #include "netdev/netdev.h" #include "devif/devif.h" #include "tcp/tcp.h" +#include "socket/socket.h" + /**************************************************************************** * Definitions diff --git a/nuttx/net/socket/recvfrom.c b/nuttx/net/socket/recvfrom.c index c6ccee67b..6c6360928 100644 --- a/nuttx/net/socket/recvfrom.c +++ b/nuttx/net/socket/recvfrom.c @@ -54,18 +54,20 @@ #include <arch/irq.h> #include <nuttx/clock.h> +#include <nuttx/net/net.h> #include <nuttx/net/iob.h> #include <nuttx/net/netdev.h> #include <nuttx/net/tcp.h> #include <nuttx/net/udp.h> #include <nuttx/net/pkt.h> -#include "socket/socket.h" #include "netdev/netdev.h" #include "devif/devif.h" #include "tcp/tcp.h" #include "udp/udp.h" #include "pkt/pkt.h" +#include "socket/socket.h" + /**************************************************************************** * Definitions diff --git a/nuttx/net/socket/sendto.c b/nuttx/net/socket/sendto.c index e8f46afe8..3f06bf1ee 100644 --- a/nuttx/net/socket/sendto.c +++ b/nuttx/net/socket/sendto.c @@ -49,13 +49,14 @@ #include <arch/irq.h> #include <nuttx/clock.h> +#include <nuttx/net/net.h> #include <nuttx/net/netdev.h> #include <nuttx/net/udp.h> -#include "socket/socket.h" #include "netdev/netdev.h" #include "devif/devif.h" #include "udp/udp.h" +#include "socket/socket.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/net/socket/setsockopt.c b/nuttx/net/socket/setsockopt.c index fdd9e2e3a..2c89ea3c4 100644 --- a/nuttx/net/socket/setsockopt.c +++ b/nuttx/net/socket/setsockopt.c @@ -46,6 +46,8 @@ #include <errno.h> #include <arch/irq.h> +#include <nuttx/net/net.h> + #include "socket/socket.h" #include "utils/utils.h" diff --git a/nuttx/net/tcp/tcp_backlog.c b/nuttx/net/tcp/tcp_backlog.c index a88d0bdf9..4d1223e56 100644 --- a/nuttx/net/tcp/tcp_backlog.c +++ b/nuttx/net/tcp/tcp_backlog.c @@ -47,7 +47,7 @@ #include <debug.h> #include <nuttx/kmalloc.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/tcp.h> #include "devif/devif.h" diff --git a/nuttx/net/tcp/tcp_conn.c b/nuttx/net/tcp/tcp_conn.c index e81542b45..2d87f8d4f 100644 --- a/nuttx/net/tcp/tcp_conn.c +++ b/nuttx/net/tcp/tcp_conn.c @@ -52,12 +52,12 @@ #include <arch/irq.h> #include <nuttx/net/netconfig.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include <nuttx/net/netdev.h> #include <nuttx/net/tcp.h> -#include "tcp/tcp.h" #include "devif/devif.h" +#include "tcp/tcp.h" /**************************************************************************** * Public Data diff --git a/nuttx/net/tcp/tcp_input.c b/nuttx/net/tcp/tcp_input.c index 62b0aff7b..ecda48c51 100644 --- a/nuttx/net/tcp/tcp_input.c +++ b/nuttx/net/tcp/tcp_input.c @@ -324,7 +324,7 @@ found: * len) and the length of the IP header (20 bytes). */ - dev->d_len -= (len + UIP_IPH_LEN); + dev->d_len -= (len + IPHDR_LEN); /* First, check if the sequence number of the incoming packet is * what we're expecting next. If not, we send out an ACK with the diff --git a/nuttx/net/tcp/tcp_listen.c b/nuttx/net/tcp/tcp_listen.c index 36af75556..0e7ea1e2f 100644 --- a/nuttx/net/tcp/tcp_listen.c +++ b/nuttx/net/tcp/tcp_listen.c @@ -49,6 +49,7 @@ #include <debug.h> #include <nuttx/net/netconfig.h> +#include <nuttx/net/net.h> #include <nuttx/net/tcp.h> #include "devif/devif.h" diff --git a/nuttx/net/tcp/tcp_send.c b/nuttx/net/tcp/tcp_send.c index 7d792c827..713371e11 100644 --- a/nuttx/net/tcp/tcp_send.c +++ b/nuttx/net/tcp/tcp_send.c @@ -104,8 +104,8 @@ static void tcp_sendcomplete(FAR struct net_driver_s *dev) * length. */ - pbuf->len[0] = ((dev->d_len - UIP_IPH_LEN) >> 8); - pbuf->len[1] = ((dev->d_len - UIP_IPH_LEN) & 0xff); + pbuf->len[0] = ((dev->d_len - IPHDR_LEN) >> 8); + pbuf->len[1] = ((dev->d_len - IPHDR_LEN) & 0xff); #else /* CONFIG_NET_IPv6 */ diff --git a/nuttx/net/tcp/tcp_send_buffered.c b/nuttx/net/tcp/tcp_send_buffered.c index fd8fbd2c9..7c3af9a15 100644 --- a/nuttx/net/tcp/tcp_send_buffered.c +++ b/nuttx/net/tcp/tcp_send_buffered.c @@ -63,6 +63,7 @@ #include <arch/irq.h> #include <nuttx/clock.h> +#include <nuttx/net/net.h> #include <nuttx/net/arp.h> #include <nuttx/net/iob.h> #include <nuttx/net/netdev.h> diff --git a/nuttx/net/tcp/tcp_send_unbuffered.c b/nuttx/net/tcp/tcp_send_unbuffered.c index ad7f5d237..05e05f9a2 100644 --- a/nuttx/net/tcp/tcp_send_unbuffered.c +++ b/nuttx/net/tcp/tcp_send_unbuffered.c @@ -52,14 +52,15 @@ #include <arch/irq.h> #include <nuttx/clock.h> +#include <nuttx/net/net.h> #include <nuttx/net/arp.h> #include <nuttx/net/netdev.h> #include <nuttx/net/tcp.h> -#include "socket/socket.h" #include "netdev/netdev.h" #include "devif/devif.h" #include "tcp/tcp.h" +#include "socket/socket.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/net/utils/net_chksum.c b/nuttx/net/utils/net_chksum.c index 55aa75339..a772ea89c 100644 --- a/nuttx/net/utils/net_chksum.c +++ b/nuttx/net/utils/net_chksum.c @@ -123,7 +123,7 @@ static uint16_t upper_layer_chksum(FAR struct net_driver_s *dev, uint8_t proto) #ifdef CONFIG_NET_IPv6 upper_layer_len = (((uint16_t)(pbuf->len[0]) << 8) + pbuf->len[1]); #else /* CONFIG_NET_IPv6 */ - upper_layer_len = (((uint16_t)(pbuf->len[0]) << 8) + pbuf->len[1]) - UIP_IPH_LEN; + upper_layer_len = (((uint16_t)(pbuf->len[0]) << 8) + pbuf->len[1]) - IPHDR_LEN; #endif /* CONFIG_NET_IPv6 */ /* Verify some minimal assumptions */ @@ -145,7 +145,7 @@ static uint16_t upper_layer_chksum(FAR struct net_driver_s *dev, uint8_t proto) /* Sum TCP header and data. */ - sum = chksum(sum, &dev->d_buf[UIP_IPH_LEN + NET_LLH_LEN], upper_layer_len); + sum = chksum(sum, &dev->d_buf[IPHDR_LEN + NET_LLH_LEN], upper_layer_len); return (sum == 0) ? 0xffff : htons(sum); } @@ -285,7 +285,7 @@ uint16_t ip_chksum(FAR struct net_driver_s *dev) { uint16_t sum; - sum = chksum(0, &dev->d_buf[NET_LLH_LEN], UIP_IPH_LEN); + sum = chksum(0, &dev->d_buf[NET_LLH_LEN], IPHDR_LEN); return (sum == 0) ? 0xffff : htons(sum); } #endif /* CONFIG_NET_ARCH_CHKSUM */ diff --git a/nuttx/net/utils/net_lock.c b/nuttx/net/utils/net_lock.c index ce5eea036..e0446690a 100644 --- a/nuttx/net/utils/net_lock.c +++ b/nuttx/net/utils/net_lock.c @@ -46,7 +46,7 @@ #include <debug.h> #include <nuttx/arch.h> -#include <nuttx/net/uip.h> +#include <nuttx/net/net.h> #include "utils/utils.h" diff --git a/nuttx/net/utils/utils.h b/nuttx/net/utils/utils.h index 152cd4a24..094a0a837 100644 --- a/nuttx/net/utils/utils.h +++ b/nuttx/net/utils/utils.h @@ -72,6 +72,20 @@ struct timeval; /* Forward reference */ #endif /**************************************************************************** + * Function: net_lockinitialize + * + * Description: + * Initialize the locking facility + * + ****************************************************************************/ + +#ifdef CONFIG_NET_NOINTS +void net_lockinitialize(void); +#else +# define net_lockinitialize() +#endif + +/**************************************************************************** * Function: net_dsec2timeval * * Description: |