mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-29 05:21:37 +03:00
update to lwIP-2.1.0: partial SACK support by default (de-selectable in menu) (#5126)
* update to lwIP-2.1.0rc1: partial SACK support fix #4176 * hash fix * get some flash back due to mistake in conf (fragmentation & reassembly was incorrectly enabled) (ahah I scared you) * add missing include files * update to lwip-2.1.0(release) + remove unused lwIP's include files * lwIP release 2.1.0, SACK is now default, bigger, no-SACK is selectable * fix ldscript * pio * rename 'sack' option to 'feat'ure option, + IP fragmentation/reassembly * merge, fix pio * change internal/hidden string * pio: more lwip2 configuration: + without sack for no change in flash footprint
This commit is contained in:
146
tools/sdk/lwip2/include/lwip/priv/altcp_priv.h
Normal file
146
tools/sdk/lwip2/include/lwip/priv/altcp_priv.h
Normal file
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* @file
|
||||
* Application layered TCP connection API (to be used from TCPIP thread)\n
|
||||
* This interface mimics the tcp callback API to the application while preventing
|
||||
* direct linking (much like virtual functions).
|
||||
* This way, an application can make use of other application layer protocols
|
||||
* on top of TCP without knowing the details (e.g. TLS, proxy connection).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2017 Simon Goldschmidt
|
||||
* 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.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Simon Goldschmidt <goldsimon@gmx.de>
|
||||
*
|
||||
*/
|
||||
#ifndef LWIP_HDR_ALTCP_PRIV_H
|
||||
#define LWIP_HDR_ALTCP_PRIV_H
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#include "lwip/altcp.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct altcp_pcb *altcp_alloc(void);
|
||||
void altcp_free(struct altcp_pcb *conn);
|
||||
|
||||
/* Function prototypes for application layers */
|
||||
typedef void (*altcp_set_poll_fn)(struct altcp_pcb *conn, u8_t interval);
|
||||
typedef void (*altcp_recved_fn)(struct altcp_pcb *conn, u16_t len);
|
||||
typedef err_t (*altcp_bind_fn)(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port);
|
||||
typedef err_t (*altcp_connect_fn)(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port, altcp_connected_fn connected);
|
||||
|
||||
typedef struct altcp_pcb *(*altcp_listen_fn)(struct altcp_pcb *conn, u8_t backlog, err_t *err);
|
||||
|
||||
typedef void (*altcp_abort_fn)(struct altcp_pcb *conn);
|
||||
typedef err_t (*altcp_close_fn)(struct altcp_pcb *conn);
|
||||
typedef err_t (*altcp_shutdown_fn)(struct altcp_pcb *conn, int shut_rx, int shut_tx);
|
||||
|
||||
typedef err_t (*altcp_write_fn)(struct altcp_pcb *conn, const void *dataptr, u16_t len, u8_t apiflags);
|
||||
typedef err_t (*altcp_output_fn)(struct altcp_pcb *conn);
|
||||
|
||||
typedef u16_t (*altcp_mss_fn)(struct altcp_pcb *conn);
|
||||
typedef u16_t (*altcp_sndbuf_fn)(struct altcp_pcb *conn);
|
||||
typedef u16_t (*altcp_sndqueuelen_fn)(struct altcp_pcb *conn);
|
||||
typedef void (*altcp_nagle_disable_fn)(struct altcp_pcb *conn);
|
||||
typedef void (*altcp_nagle_enable_fn)(struct altcp_pcb *conn);
|
||||
typedef int (*altcp_nagle_disabled_fn)(struct altcp_pcb *conn);
|
||||
|
||||
typedef void (*altcp_setprio_fn)(struct altcp_pcb *conn, u8_t prio);
|
||||
|
||||
typedef void (*altcp_dealloc_fn)(struct altcp_pcb *conn);
|
||||
|
||||
typedef err_t (*altcp_get_tcp_addrinfo_fn)(struct altcp_pcb *conn, int local, ip_addr_t *addr, u16_t *port);
|
||||
typedef ip_addr_t *(*altcp_get_ip_fn)(struct altcp_pcb *conn, int local);
|
||||
typedef u16_t (*altcp_get_port_fn)(struct altcp_pcb *conn, int local);
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
typedef enum tcp_state (*altcp_dbg_get_tcp_state_fn)(struct altcp_pcb *conn);
|
||||
#endif
|
||||
|
||||
struct altcp_functions {
|
||||
altcp_set_poll_fn set_poll;
|
||||
altcp_recved_fn recved;
|
||||
altcp_bind_fn bind;
|
||||
altcp_connect_fn connect;
|
||||
altcp_listen_fn listen;
|
||||
altcp_abort_fn abort;
|
||||
altcp_close_fn close;
|
||||
altcp_shutdown_fn shutdown;
|
||||
altcp_write_fn write;
|
||||
altcp_output_fn output;
|
||||
altcp_mss_fn mss;
|
||||
altcp_sndbuf_fn sndbuf;
|
||||
altcp_sndqueuelen_fn sndqueuelen;
|
||||
altcp_nagle_disable_fn nagle_disable;
|
||||
altcp_nagle_enable_fn nagle_enable;
|
||||
altcp_nagle_disabled_fn nagle_disabled;
|
||||
altcp_setprio_fn setprio;
|
||||
altcp_dealloc_fn dealloc;
|
||||
altcp_get_tcp_addrinfo_fn addrinfo;
|
||||
altcp_get_ip_fn getip;
|
||||
altcp_get_port_fn getport;
|
||||
#ifdef LWIP_DEBUG
|
||||
altcp_dbg_get_tcp_state_fn dbg_get_tcp_state;
|
||||
#endif
|
||||
};
|
||||
|
||||
void altcp_default_set_poll(struct altcp_pcb *conn, u8_t interval);
|
||||
void altcp_default_recved(struct altcp_pcb *conn, u16_t len);
|
||||
err_t altcp_default_bind(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port);
|
||||
err_t altcp_default_shutdown(struct altcp_pcb *conn, int shut_rx, int shut_tx);
|
||||
err_t altcp_default_write(struct altcp_pcb *conn, const void *dataptr, u16_t len, u8_t apiflags);
|
||||
err_t altcp_default_output(struct altcp_pcb *conn);
|
||||
u16_t altcp_default_mss(struct altcp_pcb *conn);
|
||||
u16_t altcp_default_sndbuf(struct altcp_pcb *conn);
|
||||
u16_t altcp_default_sndqueuelen(struct altcp_pcb *conn);
|
||||
void altcp_default_nagle_disable(struct altcp_pcb *conn);
|
||||
void altcp_default_nagle_enable(struct altcp_pcb *conn);
|
||||
int altcp_default_nagle_disabled(struct altcp_pcb *conn);
|
||||
void altcp_default_setprio(struct altcp_pcb *conn, u8_t prio);
|
||||
void altcp_default_dealloc(struct altcp_pcb *conn);
|
||||
err_t altcp_default_get_tcp_addrinfo(struct altcp_pcb *conn, int local, ip_addr_t *addr, u16_t *port);
|
||||
ip_addr_t *altcp_default_get_ip(struct altcp_pcb *conn, int local);
|
||||
u16_t altcp_default_get_port(struct altcp_pcb *conn, int local);
|
||||
#ifdef LWIP_DEBUG
|
||||
enum tcp_state altcp_default_dbg_get_tcp_state(struct altcp_pcb *conn);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_ALTCP */
|
||||
|
||||
#endif /* LWIP_HDR_ALTCP_PRIV_H */
|
@ -39,10 +39,6 @@
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_NETCONN || LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
|
||||
/* Note: Netconn API is always available when sockets are enabled -
|
||||
* sockets are implemented on top of them */
|
||||
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/err.h"
|
||||
@ -55,6 +51,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if LWIP_NETCONN || LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
|
||||
/* Note: Netconn API is always available when sockets are enabled -
|
||||
* sockets are implemented on top of them */
|
||||
|
||||
#if LWIP_MPU_COMPATIBLE
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
#define API_MSG_M_DEF_SEM(m) *m
|
||||
@ -94,6 +94,7 @@ struct api_msg {
|
||||
struct {
|
||||
API_MSG_M_DEF_C(ip_addr_t, ipaddr);
|
||||
u16_t port;
|
||||
u8_t if_idx;
|
||||
} bc;
|
||||
/** used for lwip_netconn_do_getaddr */
|
||||
struct {
|
||||
@ -103,8 +104,16 @@ struct api_msg {
|
||||
} ad;
|
||||
/** used for lwip_netconn_do_write */
|
||||
struct {
|
||||
const void *dataptr;
|
||||
/** current vector to write */
|
||||
const struct netvector *vector;
|
||||
/** number of unwritten vectors */
|
||||
u16_t vector_cnt;
|
||||
/** offset into current vector */
|
||||
size_t vector_off;
|
||||
/** total length across vectors */
|
||||
size_t len;
|
||||
/** offset into total length/output of bytes written when err == ERR_OK */
|
||||
size_t offset;
|
||||
u8_t apiflags;
|
||||
#if LWIP_SO_SNDTIMEO
|
||||
u32_t time_started;
|
||||
@ -112,7 +121,7 @@ struct api_msg {
|
||||
} w;
|
||||
/** used for lwip_netconn_do_recv */
|
||||
struct {
|
||||
u32_t len;
|
||||
size_t len;
|
||||
} r;
|
||||
#if LWIP_TCP
|
||||
/** used for lwip_netconn_do_close (/shutdown) */
|
||||
@ -130,6 +139,7 @@ struct api_msg {
|
||||
struct {
|
||||
API_MSG_M_DEF_C(ip_addr_t, multiaddr);
|
||||
API_MSG_M_DEF_C(ip_addr_t, netif_addr);
|
||||
u8_t if_idx;
|
||||
enum netconn_igmp join_or_leave;
|
||||
} jl;
|
||||
#endif /* LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD) */
|
||||
@ -177,13 +187,14 @@ struct dns_api_msg {
|
||||
};
|
||||
#endif /* LWIP_DNS */
|
||||
|
||||
#if LWIP_TCP
|
||||
extern u8_t netconn_aborted;
|
||||
#endif /* LWIP_TCP */
|
||||
|
||||
#if LWIP_NETCONN_FULLDUPLEX
|
||||
int lwip_netconn_is_deallocated_msg(void *msg);
|
||||
#endif
|
||||
int lwip_netconn_is_err_msg(void *msg, err_t *err);
|
||||
void lwip_netconn_do_newconn (void *m);
|
||||
void lwip_netconn_do_delconn (void *m);
|
||||
void lwip_netconn_do_bind (void *m);
|
||||
void lwip_netconn_do_bind_if (void *m);
|
||||
void lwip_netconn_do_connect (void *m);
|
||||
void lwip_netconn_do_disconnect (void *m);
|
||||
void lwip_netconn_do_listen (void *m);
|
||||
@ -198,6 +209,7 @@ void lwip_netconn_do_close (void *m);
|
||||
void lwip_netconn_do_shutdown (void *m);
|
||||
#if LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD)
|
||||
void lwip_netconn_do_join_leave_group(void *m);
|
||||
void lwip_netconn_do_join_leave_group_netif(void *m);
|
||||
#endif /* LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD) */
|
||||
|
||||
#if LWIP_DNS
|
||||
@ -207,10 +219,54 @@ void lwip_netconn_do_gethostbyname(void *arg);
|
||||
struct netconn* netconn_alloc(enum netconn_type t, netconn_callback callback);
|
||||
void netconn_free(struct netconn *conn);
|
||||
|
||||
#endif /* LWIP_NETCONN || LWIP_SOCKET */
|
||||
|
||||
#if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
/* netifapi related lwIP internal definitions */
|
||||
|
||||
#if LWIP_MPU_COMPATIBLE
|
||||
#define NETIFAPI_IPADDR_DEF(type, m) type m
|
||||
#else /* LWIP_MPU_COMPATIBLE */
|
||||
#define NETIFAPI_IPADDR_DEF(type, m) const type * m
|
||||
#endif /* LWIP_MPU_COMPATIBLE */
|
||||
|
||||
typedef void (*netifapi_void_fn)(struct netif *netif);
|
||||
typedef err_t (*netifapi_errt_fn)(struct netif *netif);
|
||||
|
||||
struct netifapi_msg {
|
||||
struct tcpip_api_call_data call;
|
||||
struct netif *netif;
|
||||
union {
|
||||
struct {
|
||||
#if LWIP_IPV4
|
||||
NETIFAPI_IPADDR_DEF(ip4_addr_t, ipaddr);
|
||||
NETIFAPI_IPADDR_DEF(ip4_addr_t, netmask);
|
||||
NETIFAPI_IPADDR_DEF(ip4_addr_t, gw);
|
||||
#endif /* LWIP_IPV4 */
|
||||
void *state;
|
||||
netif_init_fn init;
|
||||
netif_input_fn input;
|
||||
} add;
|
||||
struct {
|
||||
netifapi_void_fn voidfunc;
|
||||
netifapi_errt_fn errtfunc;
|
||||
} common;
|
||||
struct {
|
||||
#if LWIP_MPU_COMPATIBLE
|
||||
char name[NETIF_NAMESIZE];
|
||||
#else /* LWIP_MPU_COMPATIBLE */
|
||||
char *name;
|
||||
#endif /* LWIP_MPU_COMPATIBLE */
|
||||
u8_t index;
|
||||
} ifs;
|
||||
} msg;
|
||||
};
|
||||
|
||||
#endif /* LWIP_NETIF_API */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_NETCONN || LWIP_SOCKET */
|
||||
|
||||
#endif /* LWIP_HDR_API_MSG_H */
|
||||
|
84
tools/sdk/lwip2/include/lwip/priv/mem_priv.h
Normal file
84
tools/sdk/lwip2/include/lwip/priv/mem_priv.h
Normal file
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @file
|
||||
* lwIP internal memory implementations (do not use in application code)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018 Swedish Institute of Computer Science.
|
||||
* 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.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Simon Goldschmidt <goldsimon@gmx.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LWIP_HDR_MEM_PRIV_H
|
||||
#define LWIP_HDR_MEM_PRIV_H
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "lwip/mem.h"
|
||||
|
||||
#if MEM_OVERFLOW_CHECK || MEMP_OVERFLOW_CHECK
|
||||
/* if MEM_OVERFLOW_CHECK or MEMP_OVERFLOW_CHECK is turned on, we reserve some
|
||||
* bytes at the beginning and at the end of each element, initialize them as
|
||||
* 0xcd and check them later.
|
||||
* If MEM(P)_OVERFLOW_CHECK is >= 2, on every call to mem(p)_malloc or mem(p)_free,
|
||||
* every single element in each pool/heap is checked!
|
||||
* This is VERY SLOW but also very helpful.
|
||||
* MEM_SANITY_REGION_BEFORE and MEM_SANITY_REGION_AFTER can be overridden in
|
||||
* lwipopts.h to change the amount reserved for checking. */
|
||||
#ifndef MEM_SANITY_REGION_BEFORE
|
||||
#define MEM_SANITY_REGION_BEFORE 16
|
||||
#endif /* MEM_SANITY_REGION_BEFORE*/
|
||||
#if MEM_SANITY_REGION_BEFORE > 0
|
||||
#define MEM_SANITY_REGION_BEFORE_ALIGNED LWIP_MEM_ALIGN_SIZE(MEM_SANITY_REGION_BEFORE)
|
||||
#else
|
||||
#define MEM_SANITY_REGION_BEFORE_ALIGNED 0
|
||||
#endif /* MEM_SANITY_REGION_BEFORE*/
|
||||
#ifndef MEM_SANITY_REGION_AFTER
|
||||
#define MEM_SANITY_REGION_AFTER 16
|
||||
#endif /* MEM_SANITY_REGION_AFTER*/
|
||||
#if MEM_SANITY_REGION_AFTER > 0
|
||||
#define MEM_SANITY_REGION_AFTER_ALIGNED LWIP_MEM_ALIGN_SIZE(MEM_SANITY_REGION_AFTER)
|
||||
#else
|
||||
#define MEM_SANITY_REGION_AFTER_ALIGNED 0
|
||||
#endif /* MEM_SANITY_REGION_AFTER*/
|
||||
|
||||
void mem_overflow_init_raw(void *p, size_t size);
|
||||
void mem_overflow_check_raw(void *p, size_t size, const char *descr1, const char *descr2);
|
||||
|
||||
#endif /* MEM_OVERFLOW_CHECK || MEMP_OVERFLOW_CHECK */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_HDR_MEMP_PRIV_H */
|
@ -45,36 +45,14 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/priv/mem_priv.h"
|
||||
|
||||
#if MEMP_OVERFLOW_CHECK
|
||||
/* if MEMP_OVERFLOW_CHECK is turned on, we reserve some bytes at the beginning
|
||||
* and at the end of each element, initialize them as 0xcd and check
|
||||
* them later. */
|
||||
/* If MEMP_OVERFLOW_CHECK is >= 2, on every call to memp_malloc or memp_free,
|
||||
* every single element in each pool is checked!
|
||||
* This is VERY SLOW but also very helpful. */
|
||||
/* MEMP_SANITY_REGION_BEFORE and MEMP_SANITY_REGION_AFTER can be overridden in
|
||||
* lwipopts.h to change the amount reserved for checking. */
|
||||
#ifndef MEMP_SANITY_REGION_BEFORE
|
||||
#define MEMP_SANITY_REGION_BEFORE 16
|
||||
#endif /* MEMP_SANITY_REGION_BEFORE*/
|
||||
#if MEMP_SANITY_REGION_BEFORE > 0
|
||||
#define MEMP_SANITY_REGION_BEFORE_ALIGNED LWIP_MEM_ALIGN_SIZE(MEMP_SANITY_REGION_BEFORE)
|
||||
#else
|
||||
#define MEMP_SANITY_REGION_BEFORE_ALIGNED 0
|
||||
#endif /* MEMP_SANITY_REGION_BEFORE*/
|
||||
#ifndef MEMP_SANITY_REGION_AFTER
|
||||
#define MEMP_SANITY_REGION_AFTER 16
|
||||
#endif /* MEMP_SANITY_REGION_AFTER*/
|
||||
#if MEMP_SANITY_REGION_AFTER > 0
|
||||
#define MEMP_SANITY_REGION_AFTER_ALIGNED LWIP_MEM_ALIGN_SIZE(MEMP_SANITY_REGION_AFTER)
|
||||
#else
|
||||
#define MEMP_SANITY_REGION_AFTER_ALIGNED 0
|
||||
#endif /* MEMP_SANITY_REGION_AFTER*/
|
||||
|
||||
|
||||
/* MEMP_SIZE: save space for struct memp and for sanity check */
|
||||
#define MEMP_SIZE (LWIP_MEM_ALIGN_SIZE(sizeof(struct memp)) + MEMP_SANITY_REGION_BEFORE_ALIGNED)
|
||||
#define MEMP_ALIGN_SIZE(x) (LWIP_MEM_ALIGN_SIZE(x) + MEMP_SANITY_REGION_AFTER_ALIGNED)
|
||||
#define MEMP_SIZE (LWIP_MEM_ALIGN_SIZE(sizeof(struct memp)) + MEM_SANITY_REGION_BEFORE_ALIGNED)
|
||||
#define MEMP_ALIGN_SIZE(x) (LWIP_MEM_ALIGN_SIZE(x) + MEM_SANITY_REGION_AFTER_ALIGNED)
|
||||
|
||||
#else /* MEMP_OVERFLOW_CHECK */
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#ifndef LWIP_PBUF_MEMPOOL
|
||||
/* This treats "pbuf pools" just like any other pool.
|
||||
* Allocates buffers for a pbuf struct AND a payload size */
|
||||
#define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc)
|
||||
#define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf)) + LWIP_MEM_ALIGN_SIZE(payload)), desc)
|
||||
#endif /* LWIP_PBUF_MEMPOOL */
|
||||
|
||||
|
||||
@ -52,6 +52,10 @@ LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_lis
|
||||
LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG")
|
||||
#endif /* LWIP_TCP */
|
||||
|
||||
#if LWIP_ALTCP && LWIP_TCP
|
||||
LWIP_MEMPOOL(ALTCP_PCB, MEMP_NUM_ALTCP_PCB, sizeof(struct altcp_pcb), "ALTCP_PCB")
|
||||
#endif /* LWIP_ALTCP && LWIP_TCP */
|
||||
|
||||
#if LWIP_IPV4 && IP_REASSEMBLY
|
||||
LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA")
|
||||
#endif /* LWIP_IPV4 && IP_REASSEMBLY */
|
||||
@ -74,6 +78,9 @@ LWIP_MEMPOOL(DNS_API_MSG, MEMP_NUM_DNS_API_MSG, sizeof(struct dns_api_msg
|
||||
#if LWIP_SOCKET && !LWIP_TCPIP_CORE_LOCKING
|
||||
LWIP_MEMPOOL(SOCKET_SETGETSOCKOPT_DATA, MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA, sizeof(struct lwip_setgetsockopt_data), "SOCKET_SETGETSOCKOPT_DATA")
|
||||
#endif
|
||||
#if LWIP_SOCKET && (LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL)
|
||||
LWIP_MEMPOOL(SELECT_CB, MEMP_NUM_SELECT_CB, sizeof(struct lwip_select_cb), "SELECT_CB")
|
||||
#endif /* LWIP_SOCKET && (LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL) */
|
||||
#if LWIP_NETIF_API
|
||||
LWIP_MEMPOOL(NETIFAPI_MSG, MEMP_NUM_NETIFAPI_MSG, sizeof(struct netifapi_msg), "NETIFAPI_MSG")
|
||||
#endif
|
||||
@ -103,15 +110,15 @@ LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE,
|
||||
#endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
|
||||
|
||||
#if LWIP_IPV6 && LWIP_ND6_QUEUEING
|
||||
LWIP_MEMPOOL(ND6_QUEUE, MEMP_NUM_ND6_QUEUE, sizeof(struct nd6_q_entry), "ND6_QUEUE")
|
||||
LWIP_MEMPOOL(ND6_QUEUE, MEMP_NUM_ND6_QUEUE, sizeof(struct nd6_q_entry), "ND6_QUEUE")
|
||||
#endif /* LWIP_IPV6 && LWIP_ND6_QUEUEING */
|
||||
|
||||
#if LWIP_IPV6 && LWIP_IPV6_REASS
|
||||
LWIP_MEMPOOL(IP6_REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip6_reassdata), "IP6_REASSDATA")
|
||||
LWIP_MEMPOOL(IP6_REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip6_reassdata), "IP6_REASSDATA")
|
||||
#endif /* LWIP_IPV6 && LWIP_IPV6_REASS */
|
||||
|
||||
#if LWIP_IPV6 && LWIP_IPV6_MLD
|
||||
LWIP_MEMPOOL(MLD6_GROUP, MEMP_NUM_MLD6_GROUP, sizeof(struct mld_group), "MLD6_GROUP")
|
||||
LWIP_MEMPOOL(MLD6_GROUP, MEMP_NUM_MLD6_GROUP, sizeof(struct mld_group), "MLD6_GROUP")
|
||||
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
|
||||
|
||||
|
||||
@ -123,7 +130,7 @@ LWIP_MEMPOOL(MLD6_GROUP, MEMP_NUM_MLD6_GROUP, sizeof(struct mld_group),
|
||||
* This allocates enough space for the pbuf struct and a payload.
|
||||
* (Example: pbuf_payload_size=0 allocates only size for the struct)
|
||||
*/
|
||||
LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM")
|
||||
LWIP_MEMPOOL(PBUF, MEMP_NUM_PBUF, sizeof(struct pbuf), "PBUF_REF/ROM")
|
||||
LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL")
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ struct nd6_neighbor_cache_entry {
|
||||
u8_t state;
|
||||
u8_t isrouter;
|
||||
union {
|
||||
u32_t reachable_time; /* in ms since value may originate from network packet */
|
||||
u32_t reachable_time; /* in seconds */
|
||||
u32_t delay_time; /* ticks (ND6_TMR_INTERVAL) */
|
||||
u32_t probes_sent;
|
||||
u32_t stale_time; /* ticks (ND6_TMR_INTERVAL) */
|
||||
@ -100,18 +100,12 @@ struct nd6_destination_cache_entry {
|
||||
struct nd6_prefix_list_entry {
|
||||
ip6_addr_t prefix;
|
||||
struct netif *netif;
|
||||
u32_t invalidation_timer; /* in ms since value may originate from network packet */
|
||||
#if LWIP_IPV6_AUTOCONFIG
|
||||
u8_t flags;
|
||||
#define ND6_PREFIX_AUTOCONFIG_AUTONOMOUS 0x01
|
||||
#define ND6_PREFIX_AUTOCONFIG_ADDRESS_GENERATED 0x02
|
||||
#define ND6_PREFIX_AUTOCONFIG_ADDRESS_DUPLICATE 0x04
|
||||
#endif /* LWIP_IPV6_AUTOCONFIG */
|
||||
u32_t invalidation_timer; /* in seconds */
|
||||
};
|
||||
|
||||
struct nd6_router_list_entry {
|
||||
struct nd6_neighbor_cache_entry *neighbor_entry;
|
||||
u32_t invalidation_timer; /* in ms since value may originate from network packet */
|
||||
u32_t invalidation_timer; /* in seconds */
|
||||
u8_t flags;
|
||||
};
|
||||
|
||||
@ -124,6 +118,10 @@ enum nd6_neighbor_cache_entry_state {
|
||||
ND6_PROBE
|
||||
};
|
||||
|
||||
#define ND6_HOPLIM 255 /* maximum hop limit, required in all ND packets */
|
||||
|
||||
#define ND6_2HRS 7200 /* two hours, expressed in number of seconds */
|
||||
|
||||
/* Router tables. */
|
||||
/* @todo make these static? and entries accessible through API? */
|
||||
extern struct nd6_neighbor_cache_entry neighbor_cache[];
|
||||
|
69
tools/sdk/lwip2/include/lwip/priv/raw_priv.h
Normal file
69
tools/sdk/lwip2/include/lwip/priv/raw_priv.h
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @file
|
||||
* raw API internal implementations (do not use in application code)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* 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.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef LWIP_HDR_RAW_PRIV_H
|
||||
#define LWIP_HDR_RAW_PRIV_H
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#include "lwip/raw.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** return codes for raw_input */
|
||||
typedef enum raw_input_state
|
||||
{
|
||||
RAW_INPUT_NONE = 0, /* pbuf did not match any pcbs */
|
||||
RAW_INPUT_EATEN, /* pbuf handed off and delivered to pcb */
|
||||
RAW_INPUT_DELIVERED /* pbuf only delivered to pcb (pbuf can still be referenced) */
|
||||
} raw_input_state_t;
|
||||
|
||||
/* The following functions are the lower layer interface to RAW. */
|
||||
raw_input_state_t raw_input(struct pbuf *p, struct netif *inp);
|
||||
|
||||
void raw_netif_ip_addr_changed(const ip_addr_t* old_addr, const ip_addr_t* new_addr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_RAW */
|
||||
|
||||
#endif /* LWIP_HDR_RAW_PRIV_H */
|
175
tools/sdk/lwip2/include/lwip/priv/sockets_priv.h
Normal file
175
tools/sdk/lwip2/include/lwip/priv/sockets_priv.h
Normal file
@ -0,0 +1,175 @@
|
||||
/**
|
||||
* @file
|
||||
* Sockets API internal implementations (do not use in application code)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. <joel.cunningham@garmin.com>
|
||||
* 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.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Joel Cunningham <joel.cunningham@me.com>
|
||||
*
|
||||
*/
|
||||
#ifndef LWIP_HDR_SOCKETS_PRIV_H
|
||||
#define LWIP_HDR_SOCKETS_PRIV_H
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/sockets.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NUM_SOCKETS MEMP_NUM_NETCONN
|
||||
|
||||
/** This is overridable for the rare case where more than 255 threads
|
||||
* select on the same socket...
|
||||
*/
|
||||
#ifndef SELWAIT_T
|
||||
#define SELWAIT_T u8_t
|
||||
#endif
|
||||
|
||||
union lwip_sock_lastdata {
|
||||
struct netbuf *netbuf;
|
||||
struct pbuf *pbuf;
|
||||
};
|
||||
|
||||
/** Contains all internal pointers and states used for a socket */
|
||||
struct lwip_sock {
|
||||
/** sockets currently are built on netconns, each socket has one netconn */
|
||||
struct netconn *conn;
|
||||
/** data that was left from the previous read */
|
||||
union lwip_sock_lastdata lastdata;
|
||||
#if LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL
|
||||
/** number of times data was received, set by event_callback(),
|
||||
tested by the receive and select functions */
|
||||
s16_t rcvevent;
|
||||
/** number of times data was ACKed (free send buffer), set by event_callback(),
|
||||
tested by select */
|
||||
u16_t sendevent;
|
||||
/** error happened for this socket, set by event_callback(), tested by select */
|
||||
u16_t errevent;
|
||||
/** counter of how many threads are waiting for this socket using select */
|
||||
SELWAIT_T select_waiting;
|
||||
#endif /* LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL */
|
||||
#if LWIP_NETCONN_FULLDUPLEX
|
||||
/* counter of how many threads are using a struct lwip_sock (not the 'int') */
|
||||
u8_t fd_used;
|
||||
/* status of pending close/delete actions */
|
||||
u8_t fd_free_pending;
|
||||
#define LWIP_SOCK_FD_FREE_TCP 1
|
||||
#define LWIP_SOCK_FD_FREE_FREE 2
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef set_errno
|
||||
#define set_errno(err) do { if (err) { errno = (err); } } while(0)
|
||||
#endif
|
||||
|
||||
#if !LWIP_TCPIP_CORE_LOCKING
|
||||
/** Maximum optlen used by setsockopt/getsockopt */
|
||||
#define LWIP_SETGETSOCKOPT_MAXOPTLEN LWIP_MAX(16, sizeof(struct ifreq))
|
||||
|
||||
/** This struct is used to pass data to the set/getsockopt_internal
|
||||
* functions running in tcpip_thread context (only a void* is allowed) */
|
||||
struct lwip_setgetsockopt_data {
|
||||
/** socket index for which to change options */
|
||||
int s;
|
||||
/** level of the option to process */
|
||||
int level;
|
||||
/** name of the option to process */
|
||||
int optname;
|
||||
/** set: value to set the option to
|
||||
* get: value of the option is stored here */
|
||||
#if LWIP_MPU_COMPATIBLE
|
||||
u8_t optval[LWIP_SETGETSOCKOPT_MAXOPTLEN];
|
||||
#else
|
||||
union {
|
||||
void *p;
|
||||
const void *pc;
|
||||
} optval;
|
||||
#endif
|
||||
/** size of *optval */
|
||||
socklen_t optlen;
|
||||
/** if an error occurs, it is temporarily stored here */
|
||||
int err;
|
||||
/** semaphore to wake up the calling task */
|
||||
void* completed_sem;
|
||||
};
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
struct lwip_sock* lwip_socket_dbg_get_socket(int fd);
|
||||
|
||||
#if LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL
|
||||
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
#define SELECT_SEM_T sys_sem_t*
|
||||
#define SELECT_SEM_PTR(sem) (sem)
|
||||
#else /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
#define SELECT_SEM_T sys_sem_t
|
||||
#define SELECT_SEM_PTR(sem) (&(sem))
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
/** Description for a task waiting in select */
|
||||
struct lwip_select_cb {
|
||||
/** Pointer to the next waiting task */
|
||||
struct lwip_select_cb *next;
|
||||
/** Pointer to the previous waiting task */
|
||||
struct lwip_select_cb *prev;
|
||||
#if LWIP_SOCKET_SELECT
|
||||
/** readset passed to select */
|
||||
fd_set *readset;
|
||||
/** writeset passed to select */
|
||||
fd_set *writeset;
|
||||
/** unimplemented: exceptset passed to select */
|
||||
fd_set *exceptset;
|
||||
#endif /* LWIP_SOCKET_SELECT */
|
||||
#if LWIP_SOCKET_POLL
|
||||
/** fds passed to poll; NULL if select */
|
||||
struct pollfd *poll_fds;
|
||||
/** nfds passed to poll; 0 if select */
|
||||
nfds_t poll_nfds;
|
||||
#endif /* LWIP_SOCKET_POLL */
|
||||
/** don't signal the same semaphore twice: set to 1 when signalled */
|
||||
int sem_signalled;
|
||||
/** semaphore to wake up a task waiting for select */
|
||||
SELECT_SEM_T sem;
|
||||
};
|
||||
#endif /* LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL */
|
||||
|
||||
#endif /* LWIP_SOCKET */
|
||||
|
||||
#endif /* LWIP_HDR_SOCKETS_PRIV_H */
|
@ -77,9 +77,12 @@ void tcp_txnow (void);
|
||||
void tcp_input (struct pbuf *p, struct netif *inp);
|
||||
/* Used within the TCP code only: */
|
||||
struct tcp_pcb * tcp_alloc (u8_t prio);
|
||||
void tcp_free (struct tcp_pcb *pcb);
|
||||
void tcp_abandon (struct tcp_pcb *pcb, int reset);
|
||||
err_t tcp_send_empty_ack(struct tcp_pcb *pcb);
|
||||
void tcp_rexmit (struct tcp_pcb *pcb);
|
||||
err_t tcp_rexmit (struct tcp_pcb *pcb);
|
||||
err_t tcp_rexmit_rto_prepare(struct tcp_pcb *pcb);
|
||||
void tcp_rexmit_rto_commit(struct tcp_pcb *pcb);
|
||||
void tcp_rexmit_rto (struct tcp_pcb *pcb);
|
||||
void tcp_rexmit_fast (struct tcp_pcb *pcb);
|
||||
u32_t tcp_update_rcv_ann_wnd(struct tcp_pcb *pcb);
|
||||
@ -174,6 +177,8 @@ err_t tcp_process_refused_data(struct tcp_pcb *pcb);
|
||||
ret = lwip_tcp_event((pcb)->callback_arg, (pcb), LWIP_EVENT_POLL, NULL, 0, ERR_OK); \
|
||||
} else { \
|
||||
ret = ERR_ARG; } } while(0)
|
||||
/* For event API, last state SYN_RCVD must be excluded here: the application
|
||||
has not seen this pcb, yet! */
|
||||
#define TCP_EVENT_ERR(last_state,errf,arg,err) do { if (last_state != SYN_RCVD) { \
|
||||
lwip_tcp_event((arg), NULL, LWIP_EVENT_ERR, NULL, 0, (err)); } } while(0)
|
||||
|
||||
@ -259,11 +264,12 @@ struct tcp_seg {
|
||||
u8_t chksum_swapped;
|
||||
#endif /* TCP_CHECKSUM_ON_COPY */
|
||||
u8_t flags;
|
||||
#define TF_SEG_OPTS_MSS (u8_t)0x01U /* Include MSS option. */
|
||||
#define TF_SEG_OPTS_MSS (u8_t)0x01U /* Include MSS option (only used in SYN segments) */
|
||||
#define TF_SEG_OPTS_TS (u8_t)0x02U /* Include timestamp option. */
|
||||
#define TF_SEG_DATA_CHECKSUMMED (u8_t)0x04U /* ALL data (not the header) is
|
||||
checksummed into 'chksum' */
|
||||
#define TF_SEG_OPTS_WND_SCALE (u8_t)0x08U /* Include WND SCALE option */
|
||||
#define TF_SEG_OPTS_WND_SCALE (u8_t)0x08U /* Include WND SCALE option (only used in SYN segments) */
|
||||
#define TF_SEG_OPTS_SACK_PERM (u8_t)0x10U /* Include SACK Permitted option (only used in SYN segments) */
|
||||
struct tcp_hdr *tcphdr; /* the TCP header */
|
||||
};
|
||||
|
||||
@ -271,6 +277,7 @@ struct tcp_seg {
|
||||
#define LWIP_TCP_OPT_NOP 1
|
||||
#define LWIP_TCP_OPT_MSS 2
|
||||
#define LWIP_TCP_OPT_WS 3
|
||||
#define LWIP_TCP_OPT_SACK_PERM 4
|
||||
#define LWIP_TCP_OPT_TS 8
|
||||
|
||||
#define LWIP_TCP_OPT_LEN_MSS 4
|
||||
@ -287,10 +294,18 @@ struct tcp_seg {
|
||||
#define LWIP_TCP_OPT_LEN_WS_OUT 0
|
||||
#endif
|
||||
|
||||
#if LWIP_TCP_SACK_OUT
|
||||
#define LWIP_TCP_OPT_LEN_SACK_PERM 2
|
||||
#define LWIP_TCP_OPT_LEN_SACK_PERM_OUT 4 /* aligned for output (includes NOP padding) */
|
||||
#else
|
||||
#define LWIP_TCP_OPT_LEN_SACK_PERM_OUT 0
|
||||
#endif
|
||||
|
||||
#define LWIP_TCP_OPT_LENGTH(flags) \
|
||||
(flags & TF_SEG_OPTS_MSS ? LWIP_TCP_OPT_LEN_MSS : 0) + \
|
||||
(flags & TF_SEG_OPTS_TS ? LWIP_TCP_OPT_LEN_TS_OUT : 0) + \
|
||||
(flags & TF_SEG_OPTS_WND_SCALE ? LWIP_TCP_OPT_LEN_WS_OUT : 0)
|
||||
((flags) & TF_SEG_OPTS_MSS ? LWIP_TCP_OPT_LEN_MSS : 0) + \
|
||||
((flags) & TF_SEG_OPTS_TS ? LWIP_TCP_OPT_LEN_TS_OUT : 0) + \
|
||||
((flags) & TF_SEG_OPTS_WND_SCALE ? LWIP_TCP_OPT_LEN_WS_OUT : 0) + \
|
||||
((flags) & TF_SEG_OPTS_SACK_PERM ? LWIP_TCP_OPT_LEN_SACK_PERM_OUT : 0)
|
||||
|
||||
/** This returns a TCP header option for MSS in an u32_t */
|
||||
#define TCP_BUILD_MSS_OPTION(mss) lwip_htonl(0x02040000 | ((mss) & 0xFFFF))
|
||||
@ -342,7 +357,7 @@ extern struct tcp_pcb ** const tcp_pcb_lists[NUM_TCP_PCB_LISTS];
|
||||
#if TCP_DEBUG_PCB_LISTS
|
||||
#define TCP_REG(pcbs, npcb) do {\
|
||||
struct tcp_pcb *tcp_tmp_pcb; \
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %"U16_F"\n", (void *)(npcb), (npcb)->local_port)); \
|
||||
for (tcp_tmp_pcb = *(pcbs); \
|
||||
tcp_tmp_pcb != NULL; \
|
||||
tcp_tmp_pcb = tcp_tmp_pcb->next) { \
|
||||
@ -352,13 +367,13 @@ extern struct tcp_pcb ** const tcp_pcb_lists[NUM_TCP_PCB_LISTS];
|
||||
(npcb)->next = *(pcbs); \
|
||||
LWIP_ASSERT("TCP_REG: npcb->next != npcb", (npcb)->next != (npcb)); \
|
||||
*(pcbs) = (npcb); \
|
||||
LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
|
||||
LWIP_ASSERT("TCP_REG: tcp_pcbs sane", tcp_pcbs_sane()); \
|
||||
tcp_timer_needed(); \
|
||||
} while(0)
|
||||
#define TCP_RMV(pcbs, npcb) do { \
|
||||
struct tcp_pcb *tcp_tmp_pcb; \
|
||||
LWIP_ASSERT("TCP_RMV: pcbs != NULL", *(pcbs) != NULL); \
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (npcb), *(pcbs))); \
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (void *)(npcb), (void *)(*(pcbs)))); \
|
||||
if(*(pcbs) == (npcb)) { \
|
||||
*(pcbs) = (*pcbs)->next; \
|
||||
} else for (tcp_tmp_pcb = *(pcbs); tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
|
||||
@ -369,7 +384,7 @@ extern struct tcp_pcb ** const tcp_pcb_lists[NUM_TCP_PCB_LISTS];
|
||||
} \
|
||||
(npcb)->next = NULL; \
|
||||
LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", (npcb), *(pcbs))); \
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", (void *)(npcb), (void *)(*(pcbs)))); \
|
||||
} while(0)
|
||||
|
||||
#else /* LWIP_DEBUG */
|
||||
@ -433,45 +448,38 @@ struct tcp_seg *tcp_seg_copy(struct tcp_seg *seg);
|
||||
#define tcp_ack(pcb) \
|
||||
do { \
|
||||
if((pcb)->flags & TF_ACK_DELAY) { \
|
||||
(pcb)->flags &= ~TF_ACK_DELAY; \
|
||||
(pcb)->flags |= TF_ACK_NOW; \
|
||||
tcp_clear_flags(pcb, TF_ACK_DELAY); \
|
||||
tcp_ack_now(pcb); \
|
||||
} \
|
||||
else { \
|
||||
(pcb)->flags |= TF_ACK_DELAY; \
|
||||
tcp_set_flags(pcb, TF_ACK_DELAY); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define tcp_ack_now(pcb) \
|
||||
do { \
|
||||
(pcb)->flags |= TF_ACK_NOW; \
|
||||
} while (0)
|
||||
tcp_set_flags(pcb, TF_ACK_NOW)
|
||||
|
||||
err_t tcp_send_fin(struct tcp_pcb *pcb);
|
||||
err_t tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags);
|
||||
|
||||
void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg);
|
||||
|
||||
void tcp_rst(u32_t seqno, u32_t ackno,
|
||||
void tcp_rst(const struct tcp_pcb* pcb, u32_t seqno, u32_t ackno,
|
||||
const ip_addr_t *local_ip, const ip_addr_t *remote_ip,
|
||||
u16_t local_port, u16_t remote_port);
|
||||
|
||||
u32_t tcp_next_iss(struct tcp_pcb *pcb);
|
||||
|
||||
err_t tcp_keepalive(struct tcp_pcb *pcb);
|
||||
err_t tcp_split_unsent_seg(struct tcp_pcb *pcb, u16_t split);
|
||||
err_t tcp_zero_window_probe(struct tcp_pcb *pcb);
|
||||
void tcp_trigger_input_pcb_close(void);
|
||||
|
||||
#if TCP_CALCULATE_EFF_SEND_MSS
|
||||
u16_t tcp_eff_send_mss_impl(u16_t sendmss, const ip_addr_t *dest
|
||||
#if LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING
|
||||
, const ip_addr_t *src
|
||||
#endif /* LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING */
|
||||
);
|
||||
#if LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING
|
||||
#define tcp_eff_send_mss(sendmss, src, dest) tcp_eff_send_mss_impl(sendmss, dest, src)
|
||||
#else /* LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING */
|
||||
#define tcp_eff_send_mss(sendmss, src, dest) tcp_eff_send_mss_impl(sendmss, dest)
|
||||
#endif /* LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING */
|
||||
u16_t tcp_eff_send_mss_netif(u16_t sendmss, struct netif *outif,
|
||||
const ip_addr_t *dest);
|
||||
#define tcp_eff_send_mss(sendmss, src, dest) \
|
||||
tcp_eff_send_mss_netif(sendmss, ip_route(src, dest), dest)
|
||||
#endif /* TCP_CALCULATE_EFF_SEND_MSS */
|
||||
|
||||
#if LWIP_CALLBACK_API
|
||||
@ -498,6 +506,14 @@ void tcp_timer_needed(void);
|
||||
|
||||
void tcp_netif_ip_addr_changed(const ip_addr_t* old_addr, const ip_addr_t* new_addr);
|
||||
|
||||
#if TCP_QUEUE_OOSEQ
|
||||
void tcp_free_ooseq(struct tcp_pcb *pcb);
|
||||
#endif
|
||||
|
||||
#if LWIP_TCP_PCB_NUM_EXT_ARGS
|
||||
err_t tcp_ext_arg_invoke_callbacks_passive_open(struct tcp_pcb_listen *lpcb, struct tcp_pcb *cpcb);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -55,12 +55,13 @@ struct netif;
|
||||
#if LWIP_MPU_COMPATIBLE
|
||||
#define API_VAR_REF(name) (*(name))
|
||||
#define API_VAR_DECLARE(type, name) type * name
|
||||
#define API_VAR_ALLOC(type, pool, name, errorval) do { \
|
||||
#define API_VAR_ALLOC_EXT(type, pool, name, errorblock) do { \
|
||||
name = (type *)memp_malloc(pool); \
|
||||
if (name == NULL) { \
|
||||
return errorval; \
|
||||
errorblock; \
|
||||
} \
|
||||
} while(0)
|
||||
#define API_VAR_ALLOC(type, pool, name, errorval) API_VAR_ALLOC_EXT(type, pool, name, return errorval)
|
||||
#define API_VAR_ALLOC_POOL(type, pool, name, errorval) do { \
|
||||
name = (type *)LWIP_MEMPOOL_ALLOC(pool); \
|
||||
if (name == NULL) { \
|
||||
@ -81,6 +82,7 @@ struct netif;
|
||||
#else /* LWIP_MPU_COMPATIBLE */
|
||||
#define API_VAR_REF(name) name
|
||||
#define API_VAR_DECLARE(type, name) type name
|
||||
#define API_VAR_ALLOC_EXT(type, pool, name, errorblock)
|
||||
#define API_VAR_ALLOC(type, pool, name, errorval)
|
||||
#define API_VAR_ALLOC_POOL(type, pool, name, errorval)
|
||||
#define API_VAR_FREE(pool, name)
|
||||
@ -109,9 +111,13 @@ typedef err_t (*tcpip_api_call_fn)(struct tcpip_api_call_data* call);
|
||||
err_t tcpip_api_call(tcpip_api_call_fn fn, struct tcpip_api_call_data *call);
|
||||
|
||||
enum tcpip_msg_type {
|
||||
#if !LWIP_TCPIP_CORE_LOCKING
|
||||
TCPIP_MSG_API,
|
||||
TCPIP_MSG_API_CALL,
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
||||
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
|
||||
TCPIP_MSG_INPKT,
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
|
||||
#if LWIP_TCPIP_TIMEOUT && LWIP_TIMERS
|
||||
TCPIP_MSG_TIMEOUT,
|
||||
TCPIP_MSG_UNTIMEOUT,
|
||||
@ -123,6 +129,7 @@ enum tcpip_msg_type {
|
||||
struct tcpip_msg {
|
||||
enum tcpip_msg_type type;
|
||||
union {
|
||||
#if !LWIP_TCPIP_CORE_LOCKING
|
||||
struct {
|
||||
tcpip_callback_fn function;
|
||||
void* msg;
|
||||
@ -132,11 +139,14 @@ struct tcpip_msg {
|
||||
struct tcpip_api_call_data *arg;
|
||||
sys_sem_t *sem;
|
||||
} api_call;
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
|
||||
struct {
|
||||
struct pbuf *p;
|
||||
struct netif *netif;
|
||||
netif_input_fn input_fn;
|
||||
} inp;
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
|
||||
struct {
|
||||
tcpip_callback_fn function;
|
||||
void *ctx;
|
||||
|
Reference in New Issue
Block a user