Partial implementation of driver-based UDP backlog still missing some logic. From Max Holtzberg.
This commit is contained in:
parent
abc006453f
commit
deaa35987e
@ -2,7 +2,7 @@
|
||||
* include/nuttx/net/uip/uip-arch.h
|
||||
* Defines architecture-specific device driver interfaces to uIP
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Derived largely from portions of uIP with has a similar BSD-styple license:
|
||||
@ -180,6 +180,9 @@ struct uip_driver_s
|
||||
int (*d_ifup)(struct uip_driver_s *dev);
|
||||
int (*d_ifdown)(struct uip_driver_s *dev);
|
||||
int (*d_txavail)(struct uip_driver_s *dev);
|
||||
#ifdef CONFIG_NET_RXAVAIL
|
||||
int (*d_rxavail)(struct uip_driver_s *dev);
|
||||
#endif
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
int (*d_addmac)(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||
int (*d_rmmac)(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||
@ -249,7 +252,7 @@ struct uip_driver_s
|
||||
* }
|
||||
*/
|
||||
|
||||
extern void uip_input(struct uip_driver_s *dev);
|
||||
extern int uip_input(struct uip_driver_s *dev);
|
||||
|
||||
/* Polling of connections
|
||||
*
|
||||
|
32
net/Kconfig
32
net/Kconfig
@ -40,7 +40,7 @@ config NET_NOINTS
|
||||
bool "Not interrupt driven"
|
||||
default n
|
||||
---help---
|
||||
NET_NOINT indicates that uIP is not called from the interrupt level.
|
||||
NET_NOINT indicates that uIP is not called from the interrupt level.
|
||||
If NET_NOINTS is defined, critical sections will be managed with semaphores;
|
||||
Otherwise, it assumed that uIP will be called from interrupt level handling
|
||||
and critical sections will be managed by enabling and disabling interrupts.
|
||||
@ -228,6 +228,22 @@ config NET_BROADCAST
|
||||
---help---
|
||||
Incoming UDP broadcast support
|
||||
|
||||
config NET_RXAVAIL
|
||||
bool "Driver-based UDP backlog"
|
||||
default n
|
||||
---help---
|
||||
One problem with UDP communications is that, unlike TCP/IP, there is
|
||||
no backlog of UDP packets. So if you are listening at the precise
|
||||
moment that the UDP packet is sent, it will not be received. This
|
||||
is not incompatible with the properties of UDP, but can result in
|
||||
bad performance if packets are missed, time out, and are resent.
|
||||
|
||||
Some Ethernet controllers have built-in RAM and the drivers can
|
||||
support retention of UDP packets in that RAM. If the drivers
|
||||
supports such a capability, this option may be enabled to use it.
|
||||
NOTE: If this option is enabled, the driver must support the
|
||||
rxavail() method in the uip_driver_s structure.
|
||||
|
||||
endif
|
||||
endmenu
|
||||
|
||||
@ -317,32 +333,32 @@ config NET_SLIP
|
||||
network settings: NET_NOINTS and NET_MULTIBUFFER.
|
||||
|
||||
NET_BUFSIZE *must* be set to 296. Other optional configuration
|
||||
settings that affect the SLIP driver: NET_STATISTICS.
|
||||
settings that affect the SLIP driver: NET_STATISTICS.
|
||||
Default: Ethernet
|
||||
|
||||
SLIP supports point-to-point IP communications over a serial port.
|
||||
The default data link layer for uIP is Ethernet. If NET_SLIP is
|
||||
defined in the NuttX configuration file, then SLIP will be supported.
|
||||
The basic differences between the SLIP and Ethernet configurations is
|
||||
that when SLIP is selected:
|
||||
that when SLIP is selected:
|
||||
|
||||
* The link level header (that comes before the IP header) is omitted.
|
||||
* All MAC address processing is suppressed.
|
||||
* The link level header (that comes before the IP header) is omitted.
|
||||
* All MAC address processing is suppressed.
|
||||
* ARP is disabled.
|
||||
|
||||
If NET_SLIP is not selected, then Ethernet will be used (there is
|
||||
no need to define anything special in the configuration file to use
|
||||
Ethernet -- it is the default).
|
||||
Ethernet -- it is the default).
|
||||
|
||||
endif
|
||||
if NET_SLIP
|
||||
|
||||
config SLIP_NINTERFACES
|
||||
config SLIP_NINTERFACES
|
||||
int "Number of SLIP interfaces"
|
||||
default 1
|
||||
---help---
|
||||
Selects the number of physical SLIP
|
||||
interfaces to support.
|
||||
interfaces to support.
|
||||
Default: 1
|
||||
|
||||
config SLIP_STACKSIZE
|
||||
|
10
net/Makefile
10
net/Makefile
@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# net/Makefile
|
||||
#
|
||||
# Copyright (C) 2007, 2008, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2007, 2008, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -53,7 +53,7 @@ endif
|
||||
# Socket options
|
||||
|
||||
ifeq ($(CONFIG_NET_SOCKOPTS),y)
|
||||
SOCK_CSRCS += setsockopt.c getsockopt.c
|
||||
SOCK_CSRCS += setsockopt.c getsockopt.c
|
||||
ifneq ($(CONFIG_DISABLE_CLOCK),y)
|
||||
SOCK_CSRCS += net_timeo.c net_dsec2timeval.c net_timeval2dsec.c
|
||||
ifneq ($(CONFIG_NET_SLIP),y)
|
||||
@ -65,7 +65,7 @@ endif
|
||||
# Support for network access using streams
|
||||
|
||||
ifneq ($(CONFIG_NFILE_STREAMS),0)
|
||||
SOCK_CSRCS += net_checksd.c
|
||||
SOCK_CSRCS += net_checksd.c
|
||||
endif
|
||||
|
||||
# Support for operations on network devices
|
||||
@ -75,6 +75,10 @@ NETDEV_CSRCS = netdev_register.c netdev_ioctl.c net_poll.c netdev_txnotify.c \
|
||||
netdev_findbyname.c netdev_findbyaddr.c netdev_count.c \
|
||||
netdev_foreach.c netdev_unregister.c netdev_sem.c
|
||||
|
||||
ifeq ($(CONFIG_NET_RXAVAIL),y)
|
||||
NETDEV_CSRCS +=netdev_rxnotify.c
|
||||
endif
|
||||
|
||||
include uip/Make.defs
|
||||
endif
|
||||
|
||||
|
@ -211,6 +211,14 @@ FAR struct uip_driver_s *netdev_findbyaddr(FAR const uip_ipaddr_t *raddr);
|
||||
void netdev_txnotify(const uip_ipaddr_t *raddr);
|
||||
#endif
|
||||
|
||||
/* net_rxnotify.c ************************************************************/
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET_RXAVAIL)
|
||||
void netdev_rxnotify(const uip_ipaddr_t *raddr);
|
||||
#else
|
||||
# define netdev_rxnotify(raddr)
|
||||
#endif
|
||||
|
||||
/* net_count.c ***************************************************************/
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
|
109
net/netdev_rxnotify.c
Normal file
109
net/netdev_rxnotify.c
Normal file
@ -0,0 +1,109 @@
|
||||
/****************************************************************************
|
||||
* net/netdev_rxnotify.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET_RXAVAIL)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/net/uip/uip-arch.h>
|
||||
|
||||
#include "net_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Priviate Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: netdev_rxnotify
|
||||
*
|
||||
* Description:
|
||||
* Notify the device driver that the application waits for RX data.
|
||||
*
|
||||
* Parameters:
|
||||
* raddr - Pointer to the remote address to send the data
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Called from normal user mode
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void netdev_rxnotify(const uip_ipaddr_t *raddr)
|
||||
{
|
||||
/* Find the device driver that serves the subnet of the remote address */
|
||||
|
||||
/* @HACK how to get the interface with INADDR_ANY? */
|
||||
|
||||
struct uip_driver_s *dev = netdev_findbyname("eth0");
|
||||
|
||||
if (dev && dev->d_rxavail)
|
||||
{
|
||||
/* Notify the device driver that new RX data is available. */
|
||||
|
||||
(void)dev->d_rxavail(dev);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS && CONFIG_NET_RXAVAIL */
|
@ -2,7 +2,7 @@
|
||||
* netuip/uip_input.c
|
||||
* The uIP TCP/IP stack code.
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Adapted for NuttX from logic in uIP which also has a BSD-like license:
|
||||
@ -170,7 +170,7 @@ static uint8_t uip_reass(void)
|
||||
* fragment into the buffer.
|
||||
*/
|
||||
|
||||
if (uiphdr_addr_cmp(pbuf->srcipaddr, pfbuf->srcipaddr) &&
|
||||
if (uiphdr_addr_cmp(pbuf->srcipaddr, pfbuf->srcipaddr) &&
|
||||
uiphdr_addr_cmp(pbuf->destipaddr == pfbuf->destipaddr) &&
|
||||
pbuf->g_ipid[0] == pfbuf->g_ipid[0] && pbuf->g_ipid[1] == pfbuf->g_ipid[1])
|
||||
{
|
||||
@ -291,11 +291,14 @@ nullreturn:
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Returned Value:
|
||||
* OK if packet could be processed, otherwise ERROR.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void uip_input(struct uip_driver_s *dev)
|
||||
int uip_input(struct uip_driver_s *dev)
|
||||
{
|
||||
struct uip_ip_hdr *pbuf = BUF;
|
||||
uint16_t iplen;
|
||||
@ -311,7 +314,7 @@ void uip_input(struct uip_driver_s *dev)
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
/* Check validity of the IP header. */
|
||||
|
||||
if ((pbuf->vtc & 0xf0) != 0x60)
|
||||
if ((pbuf->vtc & 0xf0) != 0x60)
|
||||
{
|
||||
/* IP version and header length. */
|
||||
|
||||
@ -405,8 +408,7 @@ void uip_input(struct uip_driver_s *dev)
|
||||
uip_ipaddr_cmp(pbuf->destipaddr, g_alloneaddr))
|
||||
#endif
|
||||
{
|
||||
uip_udpinput(dev);
|
||||
return;
|
||||
return uip_udpinput(dev);
|
||||
}
|
||||
|
||||
/* In most other cases, the device must be assigned a non-zero IP
|
||||
@ -537,9 +539,11 @@ void uip_input(struct uip_driver_s *dev)
|
||||
|
||||
/* Return and let the caller do any actual transmission. */
|
||||
|
||||
return;
|
||||
return OK;
|
||||
|
||||
drop:
|
||||
dev->d_len = 0;
|
||||
|
||||
return ERROR;
|
||||
}
|
||||
#endif /* CONFIG_NET */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* net/uip/uip_internal.h
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* This logic was leveraged from uIP which also has a BSD-style license:
|
||||
@ -36,8 +36,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UIP_INTERNAL_H
|
||||
#define __UIP_INTERNAL_H
|
||||
#ifndef _NET_UIP_UIP_INTERNAL_H
|
||||
#define _NET_UIP_UIP_INTERNAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@ -96,77 +96,77 @@ extern "C" {
|
||||
|
||||
/* Defined in uip_callback.c ************************************************/
|
||||
|
||||
EXTERN void uip_callbackinit(void);
|
||||
EXTERN FAR struct uip_callback_s *uip_callbackalloc(struct uip_callback_s **list);
|
||||
EXTERN void uip_callbackfree(FAR struct uip_callback_s *cb, struct uip_callback_s **list);
|
||||
EXTERN uint16_t uip_callbackexecute(FAR struct uip_driver_s *dev, void *pvconn,
|
||||
uint16_t flags, FAR struct uip_callback_s *list);
|
||||
void uip_callbackinit(void);
|
||||
FAR struct uip_callback_s *uip_callbackalloc(struct uip_callback_s **list);
|
||||
void uip_callbackfree(FAR struct uip_callback_s *cb, struct uip_callback_s **list);
|
||||
uint16_t uip_callbackexecute(FAR struct uip_driver_s *dev, void *pvconn,
|
||||
uint16_t flags, FAR struct uip_callback_s *list);
|
||||
|
||||
#ifdef CONFIG_NET_TCP
|
||||
/* Defined in uip_tcpconn.c *************************************************/
|
||||
|
||||
EXTERN void uip_tcpinit(void);
|
||||
EXTERN struct uip_conn *uip_tcpactive(struct uip_tcpip_hdr *buf);
|
||||
EXTERN struct uip_conn *uip_nexttcpconn(struct uip_conn *conn);
|
||||
EXTERN struct uip_conn *uip_tcplistener(uint16_t portno);
|
||||
EXTERN struct uip_conn *uip_tcpaccept(struct uip_tcpip_hdr *buf);
|
||||
void uip_tcpinit(void);
|
||||
struct uip_conn *uip_tcpactive(struct uip_tcpip_hdr *buf);
|
||||
struct uip_conn *uip_nexttcpconn(struct uip_conn *conn);
|
||||
struct uip_conn *uip_tcplistener(uint16_t portno);
|
||||
struct uip_conn *uip_tcpaccept(struct uip_tcpip_hdr *buf);
|
||||
|
||||
/* Defined in uip_tcpseqno.c ************************************************/
|
||||
|
||||
EXTERN void uip_tcpsetsequence(FAR uint8_t *seqno, uint32_t value);
|
||||
EXTERN uint32_t uip_tcpgetsequence(FAR uint8_t *seqno);
|
||||
EXTERN uint32_t uip_tcpaddsequence(FAR uint8_t *seqno, uint16_t len);
|
||||
EXTERN void uip_tcpinitsequence(FAR uint8_t *seqno);
|
||||
EXTERN void uip_tcpnextsequence(void);
|
||||
void uip_tcpsetsequence(FAR uint8_t *seqno, uint32_t value);
|
||||
uint32_t uip_tcpgetsequence(FAR uint8_t *seqno);
|
||||
uint32_t uip_tcpaddsequence(FAR uint8_t *seqno, uint16_t len);
|
||||
void uip_tcpinitsequence(FAR uint8_t *seqno);
|
||||
void uip_tcpnextsequence(void);
|
||||
|
||||
/* Defined in uip_tcppoll.c *************************************************/
|
||||
|
||||
EXTERN void uip_tcppoll(struct uip_driver_s *dev, struct uip_conn *conn);
|
||||
void uip_tcppoll(struct uip_driver_s *dev, struct uip_conn *conn);
|
||||
|
||||
/* Defined in uip_udptimer.c ************************************************/
|
||||
|
||||
EXTERN void uip_tcptimer(struct uip_driver_s *dev, struct uip_conn *conn, int hsec);
|
||||
void uip_tcptimer(struct uip_driver_s *dev, struct uip_conn *conn, int hsec);
|
||||
|
||||
/* Defined in uip_listen.c **************************************************/
|
||||
|
||||
EXTERN void uip_listeninit(void);
|
||||
EXTERN bool uip_islistener(uint16_t port);
|
||||
EXTERN int uip_accept(struct uip_driver_s *dev, struct uip_conn *conn, uint16_t portno);
|
||||
void uip_listeninit(void);
|
||||
bool uip_islistener(uint16_t port);
|
||||
int uip_accept(struct uip_driver_s *dev, struct uip_conn *conn, uint16_t portno);
|
||||
|
||||
/* Defined in uip_tcpsend.c *************************************************/
|
||||
|
||||
EXTERN void uip_tcpsend(struct uip_driver_s *dev, struct uip_conn *conn,
|
||||
uint16_t flags, uint16_t len);
|
||||
EXTERN void uip_tcpreset(struct uip_driver_s *dev);
|
||||
EXTERN void uip_tcpack(struct uip_driver_s *dev, struct uip_conn *conn,
|
||||
uint8_t ack);
|
||||
void uip_tcpsend(struct uip_driver_s *dev, struct uip_conn *conn,
|
||||
uint16_t flags, uint16_t len);
|
||||
void uip_tcpreset(struct uip_driver_s *dev);
|
||||
void uip_tcpack(struct uip_driver_s *dev, struct uip_conn *conn,
|
||||
uint8_t ack);
|
||||
|
||||
/* Defined in uip_tcpappsend.c **********************************************/
|
||||
|
||||
EXTERN void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
|
||||
uint16_t result);
|
||||
EXTERN void uip_tcprexmit(struct uip_driver_s *dev, struct uip_conn *conn,
|
||||
uint16_t result);
|
||||
void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
|
||||
uint16_t result);
|
||||
void uip_tcprexmit(struct uip_driver_s *dev, struct uip_conn *conn,
|
||||
uint16_t result);
|
||||
|
||||
/* Defined in uip_tcpinput.c ************************************************/
|
||||
|
||||
EXTERN void uip_tcpinput(struct uip_driver_s *dev);
|
||||
void uip_tcpinput(struct uip_driver_s *dev);
|
||||
|
||||
/* Defined in uip_tcpcallback.c *********************************************/
|
||||
|
||||
EXTERN uint16_t uip_tcpcallback(FAR struct uip_driver_s *dev,
|
||||
FAR struct uip_conn *conn, uint16_t flags);
|
||||
uint16_t uip_tcpcallback(FAR struct uip_driver_s *dev,
|
||||
FAR struct uip_conn *conn, uint16_t flags);
|
||||
#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0
|
||||
EXTERN uint16_t uip_datahandler(FAR struct uip_conn *conn,
|
||||
FAR uint8_t *buffer, uint16_t nbytes);
|
||||
uint16_t uip_datahandler(FAR struct uip_conn *conn,
|
||||
FAR uint8_t *buffer, uint16_t nbytes);
|
||||
#endif
|
||||
|
||||
/* Defined in uip_tcpreadahead.c ********************************************/
|
||||
|
||||
#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0
|
||||
EXTERN void uip_tcpreadaheadinit(void);
|
||||
EXTERN struct uip_readahead_s *uip_tcpreadaheadalloc(void);
|
||||
EXTERN void uip_tcpreadaheadrelease(struct uip_readahead_s *buf);
|
||||
void uip_tcpreadaheadinit(void);
|
||||
struct uip_readahead_s *uip_tcpreadaheadalloc(void);
|
||||
void uip_tcpreadaheadrelease(struct uip_readahead_s *buf);
|
||||
#endif /* CONFIG_NET_NTCP_READAHEAD_BUFFERS */
|
||||
|
||||
#endif /* CONFIG_NET_TCP */
|
||||
@ -174,41 +174,41 @@ EXTERN void uip_tcpreadaheadrelease(struct uip_readahead_s *buf);
|
||||
#ifdef CONFIG_NET_UDP
|
||||
/* Defined in uip_udpconn.c *************************************************/
|
||||
|
||||
EXTERN void uip_udpinit(void);
|
||||
EXTERN struct uip_udp_conn *uip_udpactive(struct uip_udpip_hdr *buf);
|
||||
EXTERN struct uip_udp_conn *uip_nextudpconn(struct uip_udp_conn *conn);
|
||||
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 uip_udppoll.c *************************************************/
|
||||
|
||||
EXTERN void uip_udppoll(struct uip_driver_s *dev, struct uip_udp_conn *conn);
|
||||
void uip_udppoll(struct uip_driver_s *dev, struct uip_udp_conn *conn);
|
||||
|
||||
/* Defined in uip_udpsend.c *************************************************/
|
||||
|
||||
EXTERN void uip_udpsend(struct uip_driver_s *dev, struct uip_udp_conn *conn);
|
||||
void uip_udpsend(struct uip_driver_s *dev, struct uip_udp_conn *conn);
|
||||
|
||||
/* Defined in uip_udpinput.c ************************************************/
|
||||
|
||||
EXTERN void uip_udpinput(struct uip_driver_s *dev);
|
||||
int uip_udpinput(struct uip_driver_s *dev);
|
||||
|
||||
/* Defined in uip_udpcallback.c *********************************************/
|
||||
|
||||
EXTERN void uip_udpcallback(struct uip_driver_s *dev,
|
||||
struct uip_udp_conn *conn, uint16_t flags);
|
||||
int uip_udpcallback(struct uip_driver_s *dev,
|
||||
struct uip_udp_conn *conn, uint16_t flags);
|
||||
#endif /* CONFIG_NET_UDP */
|
||||
|
||||
#ifdef CONFIG_NET_ICMP
|
||||
/* Defined in uip_icmpinput.c ***********************************************/
|
||||
|
||||
EXTERN void uip_icmpinput(struct uip_driver_s *dev);
|
||||
void uip_icmpinput(struct uip_driver_s *dev);
|
||||
|
||||
#ifdef CONFIG_NET_ICMP_PING
|
||||
/* Defined in uip_icmpoll.c *************************************************/
|
||||
|
||||
EXTERN void uip_icmppoll(struct uip_driver_s *dev);
|
||||
void uip_icmppoll(struct uip_driver_s *dev);
|
||||
|
||||
/* Defined in uip_icmsend.c *************************************************/
|
||||
|
||||
EXTERN void uip_icmpsend(struct uip_driver_s *dev, uip_ipaddr_t *destaddr);
|
||||
void uip_icmpsend(struct uip_driver_s *dev, uip_ipaddr_t *destaddr);
|
||||
|
||||
#endif /* CONFIG_NET_ICMP_PING */
|
||||
#endif /* CONFIG_NET_ICMP */
|
||||
@ -216,50 +216,49 @@ EXTERN void uip_icmpsend(struct uip_driver_s *dev, uip_ipaddr_t *destaddr);
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
/* Defined in uip_igmpinit.c ************************************************/
|
||||
|
||||
EXTERN void uip_igmpinit(void);
|
||||
void uip_igmpinit(void);
|
||||
|
||||
/* Defined in uip_igmpinput.c ***********************************************/
|
||||
|
||||
EXTERN void uip_igmpinput(struct uip_driver_s *dev);
|
||||
void uip_igmpinput(struct uip_driver_s *dev);
|
||||
|
||||
/* Defined in uip_igmpgroup.c ***********************************************/
|
||||
|
||||
EXTERN void uip_grpinit(void);
|
||||
EXTERN FAR struct igmp_group_s *uip_grpalloc(FAR struct uip_driver_s *dev,
|
||||
FAR const uip_ipaddr_t *addr);
|
||||
EXTERN FAR struct igmp_group_s *uip_grpfind(FAR struct uip_driver_s *dev,
|
||||
FAR const uip_ipaddr_t *addr);
|
||||
EXTERN FAR struct igmp_group_s *uip_grpallocfind(FAR struct uip_driver_s *dev,
|
||||
FAR const uip_ipaddr_t *addr);
|
||||
EXTERN void uip_grpfree(FAR struct uip_driver_s *dev,
|
||||
FAR struct igmp_group_s *group);
|
||||
void uip_grpinit(void);
|
||||
FAR struct igmp_group_s *uip_grpalloc(FAR struct uip_driver_s *dev,
|
||||
FAR const uip_ipaddr_t *addr);
|
||||
FAR struct igmp_group_s *uip_grpfind(FAR struct uip_driver_s *dev,
|
||||
FAR const uip_ipaddr_t *addr);
|
||||
FAR struct igmp_group_s *uip_grpallocfind(FAR struct uip_driver_s *dev,
|
||||
FAR const uip_ipaddr_t *addr);
|
||||
void uip_grpfree(FAR struct uip_driver_s *dev,
|
||||
FAR struct igmp_group_s *group);
|
||||
|
||||
/* Defined in uip_igmpmsg.c **************************************************/
|
||||
|
||||
EXTERN void uip_igmpschedmsg(FAR struct igmp_group_s *group, uint8_t msgid);
|
||||
EXTERN void uip_igmpwaitmsg(FAR struct igmp_group_s *group, uint8_t msgid);
|
||||
void uip_igmpschedmsg(FAR struct igmp_group_s *group, uint8_t msgid);
|
||||
void uip_igmpwaitmsg(FAR struct igmp_group_s *group, uint8_t msgid);
|
||||
|
||||
/* Defined in uip_igmppoll.c *************************************************/
|
||||
|
||||
EXTERN void uip_igmppoll(FAR struct uip_driver_s *dev);
|
||||
void uip_igmppoll(FAR struct uip_driver_s *dev);
|
||||
|
||||
/* Defined in up_igmpsend.c **************************************************/
|
||||
|
||||
EXTERN void uip_igmpsend(FAR struct uip_driver_s *dev,
|
||||
FAR struct igmp_group_s *group,
|
||||
FAR uip_ipaddr_t *dest);
|
||||
void uip_igmpsend(FAR struct uip_driver_s *dev, FAR struct igmp_group_s *group,
|
||||
FAR uip_ipaddr_t *dest);
|
||||
|
||||
/* Defined in uip_igmptimer.c ************************************************/
|
||||
|
||||
EXTERN int uip_decisec2tick(int decisecs);
|
||||
EXTERN void uip_igmpstartticks(FAR struct igmp_group_s *group, int ticks);
|
||||
EXTERN void uip_igmpstarttimer(FAR struct igmp_group_s *group, uint8_t decisecs);
|
||||
EXTERN bool uip_igmpcmptimer(FAR struct igmp_group_s *group, int maxticks);
|
||||
int uip_decisec2tick(int decisecs);
|
||||
void uip_igmpstartticks(FAR struct igmp_group_s *group, int ticks);
|
||||
void uip_igmpstarttimer(FAR struct igmp_group_s *group, uint8_t decisecs);
|
||||
bool uip_igmpcmptimer(FAR struct igmp_group_s *group, int maxticks);
|
||||
|
||||
/* Defined in uip_mcastmac ***************************************************/
|
||||
|
||||
EXTERN void uip_addmcastmac(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *ip);
|
||||
EXTERN void uip_removemcastmac(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *ip);
|
||||
void uip_addmcastmac(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *ip);
|
||||
void uip_removemcastmac(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *ip);
|
||||
|
||||
#endif /* CONFIG_NET_IGMP */
|
||||
|
||||
@ -269,4 +268,4 @@ EXTERN void uip_removemcastmac(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *i
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NET */
|
||||
#endif /* __UIP_INTERNAL_H */
|
||||
#endif /* _NET_UIP_UIP_INTERNAL_H */
|
||||
|
@ -67,24 +67,35 @@
|
||||
* Description:
|
||||
* Inform the application holding the UDP socket of a change in state.
|
||||
*
|
||||
* Returned Value:
|
||||
* OK if packet has been processed, otherwise ERROR.
|
||||
*
|
||||
* Assumptions:
|
||||
* This function is called at the interrupt level with interrupts disabled.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void uip_udpcallback(struct uip_driver_s *dev, struct uip_udp_conn *conn,
|
||||
uint16_t flags)
|
||||
int uip_udpcallback(struct uip_driver_s *dev, struct uip_udp_conn *conn,
|
||||
uint16_t flags)
|
||||
{
|
||||
int ret = ERROR;
|
||||
|
||||
nllvdbg("flags: %04x\n", flags);
|
||||
|
||||
/* Some sanity checking */
|
||||
|
||||
if (conn)
|
||||
{
|
||||
/* HACK to check if the packet could be processed */
|
||||
|
||||
ret = (conn->list->event && (flags & conn->list->flags) != 0) ? OK : ERROR;
|
||||
|
||||
/* Perform the callback */
|
||||
|
||||
flags = uip_callbackexecute(dev, conn, flags, conn->list);
|
||||
uip_callbackexecute(dev, conn, flags, conn->list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NET_UDP */
|
||||
|
@ -85,17 +85,19 @@
|
||||
* dev - The device driver structure containing the received UDP packet
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* OK if packet has been processed, otherwise ERROR.
|
||||
*
|
||||
* Assumptions:
|
||||
* Called from the interrupt level or with interrupts disabled.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void uip_udpinput(struct uip_driver_s *dev)
|
||||
int uip_udpinput(struct uip_driver_s *dev)
|
||||
{
|
||||
struct uip_udp_conn *conn;
|
||||
struct uip_udpip_hdr *pbuf = UDPBUF;
|
||||
int ret = ERROR;
|
||||
|
||||
|
||||
#ifdef CONFIG_NET_STATISTICS
|
||||
uip_stat.udp.recv++;
|
||||
@ -134,7 +136,7 @@ void uip_udpinput(struct uip_driver_s *dev)
|
||||
|
||||
/* Perform the application callback */
|
||||
|
||||
uip_udpcallback(dev, conn, UIP_NEWDATA);
|
||||
ret = uip_udpcallback(dev, conn, UIP_NEWDATA);
|
||||
|
||||
/* If the application has data to send, setup the UDP/IP header */
|
||||
|
||||
@ -150,7 +152,7 @@ void uip_udpinput(struct uip_driver_s *dev)
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NET_UDP */
|
||||
|
Loading…
Reference in New Issue
Block a user