2007-09-03 05:58:35 +08:00
|
|
|
/****************************************************************************
|
2014-06-25 00:14:15 +08:00
|
|
|
* net/uip/uip.h
|
2007-09-03 05:58:35 +08:00
|
|
|
*
|
2014-01-14 03:55:51 +08:00
|
|
|
* Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved.
|
2012-02-23 10:07:38 +08:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
2007-09-03 05:58:35 +08:00
|
|
|
*
|
|
|
|
* This logic was leveraged from uIP which also has a BSD-style license:
|
|
|
|
*
|
|
|
|
* Author Adam Dunkels <adam@dunkels.com>
|
|
|
|
* Copyright (c) 2001-2003, Adam Dunkels.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* 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. The name of the author may not be used to endorse or promote
|
|
|
|
* products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 00:14:15 +08:00
|
|
|
#ifndef _NET_UIP_UIP_H
|
|
|
|
#define _NET_UIP_UIP_H
|
2007-09-03 05:58:35 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2007-11-07 07:38:14 +08:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
#ifdef CONFIG_NET
|
|
|
|
|
2009-12-15 22:53:45 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2007-09-24 04:45:30 +08:00
|
|
|
#include <errno.h>
|
|
|
|
#include <arch/irq.h>
|
2014-06-25 00:14:15 +08:00
|
|
|
#include <nuttx/net/uip.h>
|
2014-06-13 01:52:06 +08:00
|
|
|
#include <nuttx/net/arp.h>
|
2007-09-03 05:58:35 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
2014-04-13 02:13:01 +08:00
|
|
|
* Pre-processor Definitions
|
2007-09-03 05:58:35 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
2007-11-22 22:42:52 +08:00
|
|
|
extern const uip_ipaddr_t g_alloneaddr;
|
|
|
|
extern const uip_ipaddr_t g_allzeroaddr;
|
2007-09-03 07:11:10 +08:00
|
|
|
|
2007-11-07 07:38:14 +08:00
|
|
|
/* Increasing number used for the IP ID field. */
|
|
|
|
|
2009-12-15 22:53:45 +08:00
|
|
|
extern uint16_t g_ipid;
|
2007-11-07 07:38:14 +08:00
|
|
|
|
2007-11-08 06:54:51 +08:00
|
|
|
/* Reassembly timer (units: deci-seconds) */
|
|
|
|
|
2007-11-08 02:54:35 +08:00
|
|
|
#if UIP_REASSEMBLY && !defined(CONFIG_NET_IPv6)
|
2009-12-15 22:53:45 +08:00
|
|
|
extern uint8_t uip_reasstmr;
|
2007-11-08 02:54:35 +08:00
|
|
|
#endif
|
|
|
|
|
2008-09-03 04:38:12 +08:00
|
|
|
/* List of applications waiting for ICMP ECHO REPLY */
|
|
|
|
|
|
|
|
#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING)
|
|
|
|
extern struct uip_callback_s *g_echocallback;
|
|
|
|
#endif
|
|
|
|
|
2007-09-03 05:58:35 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
2014-06-25 23:52:36 +08:00
|
|
|
extern "C"
|
|
|
|
{
|
2007-09-03 05:58:35 +08:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2008-09-01 21:59:54 +08:00
|
|
|
/* Defined in uip_callback.c ************************************************/
|
|
|
|
|
2013-09-06 23:18:07 +08:00
|
|
|
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);
|
2008-09-01 21:59:54 +08:00
|
|
|
|
2014-06-13 01:52:06 +08:00
|
|
|
#ifdef CONFIG_NET_PKT
|
|
|
|
/* Defined in uip_pktconn.c *************************************************/
|
|
|
|
|
|
|
|
void uip_pktinit(void);
|
|
|
|
struct uip_pkt_conn *uip_pktalloc(void);
|
|
|
|
void uip_pktfree(struct uip_pkt_conn *conn);
|
2014-06-25 23:57:52 +08:00
|
|
|
struct uip_pkt_conn *uip_pktactive(struct eth_hdr_s *buf);
|
2014-06-13 01:52:06 +08:00
|
|
|
struct uip_pkt_conn *uip_nextpktconn(struct uip_pkt_conn *conn);
|
|
|
|
|
|
|
|
/* Defined in uip_pktcallback.c *********************************************/
|
|
|
|
|
|
|
|
uint16_t uip_pktcallback(struct uip_driver_s *dev, struct uip_pkt_conn *conn,
|
|
|
|
uint16_t flags);
|
|
|
|
|
|
|
|
/* Defined in uip_pktinput.c ************************************************/
|
|
|
|
|
|
|
|
/* Defined in uip_pktpoll.c *************************************************/
|
|
|
|
|
|
|
|
void uip_pktpoll(struct uip_driver_s *dev, struct uip_pkt_conn *conn);
|
|
|
|
|
|
|
|
#endif /* CONFIG_NET_PKT */
|
|
|
|
|
2007-09-03 05:58:35 +08:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-11-07 07:38:14 +08:00
|
|
|
#endif /* CONFIG_NET */
|
2014-06-25 00:14:15 +08:00
|
|
|
#endif /* _NET_UIP_UIP_H */
|