NET: in-progress change... don't use

This commit is contained in:
Gregory Nutt 2014-07-04 16:38:51 -06:00
parent cce35ce975
commit a6b39d1879
42 changed files with 227 additions and 194 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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);

View File

@ -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 */

View File

@ -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 */

View File

@ -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

View File

@ -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
****************************************************************************/

View File

@ -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"

View File

@ -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

View File

@ -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;

View File

@ -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>

View File

@ -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"

View File

@ -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>

View File

@ -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"

View File

@ -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 */

View File

@ -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>

View File

@ -54,6 +54,7 @@
#include "pkt/pkt.h"
#include "igmp/igmp.h"
#include "route/route.h"
#include "utils/utils.h"
/****************************************************************************
* Pre-processor Definitions

View File

@ -48,6 +48,8 @@
#include <assert.h>
#include <errno.h>
#include <nuttx/net/net.h>
#include "netdev/netdev.h"
/****************************************************************************

View File

@ -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>

View File

@ -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"
/****************************************************************************

View File

@ -44,6 +44,8 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/net/net.h>
#include <arch/irq.h>
#include "route/route.h"

View File

@ -43,6 +43,7 @@
#include <errno.h>
#include <assert.h>
#include <nuttx/net/net.h>
#include <arch/irq.h>
#include "route/route.h"

View File

@ -42,6 +42,8 @@
#include <stdint.h>
#include <errno.h>
#include <nuttx/net/net.h>
#include <arch/irq.h>
#include "route/route.h"

View File

@ -51,6 +51,7 @@
#include <arch/irq.h>
#include <nuttx/net/net.h>
#include <nuttx/net/tcp.h>
#include "socket/socket.h"

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -57,7 +57,6 @@
#include <nuttx/net/tcp.h>
#include <devif/devif.h>
#include "tcp/tcp.h"
#include "socket/socket.h"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -46,6 +46,8 @@
#include <errno.h>
#include <arch/irq.h>
#include <nuttx/net/net.h>
#include "socket/socket.h"
#include "utils/utils.h"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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 */

View File

@ -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>

View File

@ -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

View File

@ -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 */

View File

@ -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"

View File

@ -71,6 +71,20 @@ struct net_driver_s; /* Forward reference */
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
*