2016-08-17 11:08:22 -04:00
|
|
|
/*
|
2021-06-04 04:43:32 -04:00
|
|
|
* SPDX-FileCopyrightText: 2001-2003 Swedish Institute of Computer Science
|
2018-11-22 22:53:20 -05:00
|
|
|
*
|
2021-06-04 04:43:32 -04:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2016-08-17 11:08:22 -04:00
|
|
|
*
|
2021-10-11 11:14:03 -04:00
|
|
|
* SPDX-FileContributor: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifndef LWIP_HDR_ESP_LWIPOPTS_H
|
|
|
|
#define LWIP_HDR_ESP_LWIPOPTS_H
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2022-04-28 11:04:07 -04:00
|
|
|
#include "sdkconfig.h"
|
|
|
|
#include <string.h> // For memcpy
|
|
|
|
#include <stdlib.h> // For malloc/free
|
2017-10-03 01:56:55 -04:00
|
|
|
#include <unistd.h>
|
2016-11-07 20:05:05 -05:00
|
|
|
#include <sys/fcntl.h>
|
2017-10-23 06:03:23 -04:00
|
|
|
#include <sys/ioctl.h>
|
2018-05-07 03:01:56 -04:00
|
|
|
#include <sys/types.h>
|
2018-05-24 07:47:00 -04:00
|
|
|
#include <sys/select.h>
|
2022-02-14 07:46:21 -05:00
|
|
|
#include <sys/poll.h>
|
2022-04-28 11:04:07 -04:00
|
|
|
#ifdef __linux__
|
|
|
|
#include "esp32_mock.h"
|
|
|
|
#else
|
|
|
|
#include "esp_task.h"
|
|
|
|
#include "esp_random.h"
|
|
|
|
#endif // __linux__
|
2022-02-14 07:46:21 -05:00
|
|
|
#include "sdkconfig.h"
|
|
|
|
#include "sntp/sntp_get_set_time.h"
|
|
|
|
#include "sockets_ext.h"
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2022-03-31 05:51:56 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
-----------------------------------------------
|
|
|
|
---------- Platform specific locking ----------
|
|
|
|
-----------------------------------------------
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_TCPIP_CORE_LOCKING
|
|
|
|
* Creates a global mutex that is held during TCPIP thread operations.
|
|
|
|
* Can be locked by client code to perform lwIP operations without changing
|
|
|
|
* into TCPIP thread using callbacks. See LOCK_TCPIP_CORE() and
|
|
|
|
* UNLOCK_TCPIP_CORE().
|
|
|
|
* Your system should provide mutexes supporting priority inversion to use this.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
|
|
|
|
#define LWIP_TCPIP_CORE_LOCKING 1
|
|
|
|
#else
|
|
|
|
#define LWIP_TCPIP_CORE_LOCKING 0
|
|
|
|
#endif
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
|
|
|
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
|
|
|
|
* critical regions during buffer allocation, deallocation and memory
|
|
|
|
* allocation and deallocation.
|
|
|
|
*/
|
|
|
|
#define SYS_LIGHTWEIGHT_PROT 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MEMCPY: override this if you have a faster implementation at hand than the
|
|
|
|
* one included in your C library
|
|
|
|
*/
|
|
|
|
#define MEMCPY(dst,src,len) memcpy(dst,src,len)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a
|
|
|
|
* call to memcpy() if the length is known at compile time and is small.
|
|
|
|
*/
|
|
|
|
#define SMEMCPY(dst,src,len) memcpy(dst,src,len)
|
|
|
|
|
2017-07-19 20:04:20 -04:00
|
|
|
#define LWIP_RAND esp_random
|
2016-11-09 22:24:31 -05:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
------------------------------------
|
|
|
|
---------- Memory options ----------
|
|
|
|
------------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library
|
|
|
|
* instead of the lwip internal allocator. Can save code size if you
|
|
|
|
* already use it.
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define MEM_LIBC_MALLOC 1
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator.
|
|
|
|
* Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution
|
|
|
|
* speed and usage from interrupts!
|
|
|
|
*/
|
|
|
|
#define MEMP_MEM_MALLOC 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MEM_ALIGNMENT: should be set to the alignment of the CPU
|
|
|
|
* 4 byte alignment -> #define MEM_ALIGNMENT 4
|
|
|
|
* 2 byte alignment -> #define MEM_ALIGNMENT 2
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define MEM_ALIGNMENT 4
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
------------------------------------------------
|
|
|
|
---------- Internal Memory Pool Sizes ----------
|
|
|
|
------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MEMP_NUM_NETCONN: the number of struct netconns.
|
|
|
|
* (only needed if you use the sequential API, like api_lib.c)
|
|
|
|
*/
|
2016-10-28 00:03:51 -04:00
|
|
|
#define MEMP_NUM_NETCONN CONFIG_LWIP_MAX_SOCKETS
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MEMP_NUM_RAW_PCB: Number of raw connection PCBs
|
|
|
|
* (requires the LWIP_RAW option)
|
|
|
|
*/
|
2017-10-20 02:51:17 -04:00
|
|
|
#define MEMP_NUM_RAW_PCB CONFIG_LWIP_MAX_RAW_PCBS
|
2016-10-28 00:03:51 -04:00
|
|
|
|
|
|
|
/**
|
2017-10-20 02:51:17 -04:00
|
|
|
* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP connections.
|
2016-10-28 00:03:51 -04:00
|
|
|
* (requires the LWIP_TCP option)
|
|
|
|
*/
|
2017-10-20 02:51:17 -04:00
|
|
|
#define MEMP_NUM_TCP_PCB CONFIG_LWIP_MAX_ACTIVE_TCP
|
2016-10-28 00:03:51 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
|
|
|
|
* (requires the LWIP_TCP option)
|
|
|
|
*/
|
2017-10-20 02:51:17 -04:00
|
|
|
#define MEMP_NUM_TCP_PCB_LISTEN CONFIG_LWIP_MAX_LISTENING_TCP
|
2016-10-28 00:03:51 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
|
|
|
* per active UDP "connection".
|
|
|
|
* (requires the LWIP_UDP option)
|
|
|
|
*/
|
2017-10-20 02:51:17 -04:00
|
|
|
#define MEMP_NUM_UDP_PCB CONFIG_LWIP_MAX_UDP_PCBS
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
--------------------------------
|
|
|
|
---------- ARP options -------
|
|
|
|
--------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address
|
|
|
|
* resolution. By default, only the most recent packet is queued per IP address.
|
|
|
|
* This is sufficient for most protocols and mainly reduces TCP connection
|
|
|
|
* startup time. Set this to 1 if you know your application sends more than one
|
|
|
|
* packet in a row to an IP address that is not in the ARP cache.
|
|
|
|
*/
|
|
|
|
#define ARP_QUEUEING 1
|
|
|
|
|
|
|
|
/*
|
|
|
|
--------------------------------
|
|
|
|
---------- IP options ----------
|
|
|
|
--------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* LWIP_IPV4==1: Enable IPv4
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define LWIP_IPV4 1
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* IP_REASSEMBLY==1: Reassemble incoming fragmented IP4 packets. Note that
|
2020-04-30 04:59:17 -04:00
|
|
|
* this option does not affect outgoing packet sizes, which can be controlled
|
2021-09-17 06:36:16 -04:00
|
|
|
* via IP_FRAG.
|
2020-04-30 04:59:17 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_IP4_REASSEMBLY
|
|
|
|
#define IP_REASSEMBLY 1
|
|
|
|
#else
|
|
|
|
#define IP_REASSEMBLY 0
|
|
|
|
#endif
|
2020-04-30 04:59:17 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* IP_FRAG==1: Fragment outgoing IP4 packets if their size exceeds MTU. Note
|
|
|
|
* that this option does not affect incoming packet sizes, which can be
|
|
|
|
* controlled via IP_REASSEMBLY.
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_IP4_FRAG
|
|
|
|
#define IP_FRAG 1
|
|
|
|
#else
|
|
|
|
#define IP_FRAG 0
|
|
|
|
#endif
|
2020-04-30 04:59:17 -04:00
|
|
|
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* IP_FORWARD==1: Enables the ability to forward IP packets across network
|
|
|
|
* interfaces. If you are going to run lwIP on a device with only one network
|
|
|
|
* interface, define this to 0.
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_IP_FORWARD
|
|
|
|
#define IP_FORWARD 1
|
|
|
|
#else
|
|
|
|
#define IP_FORWARD 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* IP_NAPT==1: Enables IPv4 Network Address and Port Translation.
|
|
|
|
* Note that both CONFIG_LWIP_IP_FORWARD and CONFIG_LWIP_L2_TO_L3_COPY options
|
|
|
|
* need to be enabled in system configuration for the NAPT to work on ESP platform
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_IPV4_NAPT
|
|
|
|
#define IP_NAPT 1
|
|
|
|
#else
|
|
|
|
#define IP_NAPT 0
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
|
|
|
|
* a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
|
|
|
|
* in this time, the whole packet is discarded.
|
|
|
|
*/
|
|
|
|
#define IP_REASS_MAXAGE 3
|
|
|
|
|
|
|
|
/**
|
|
|
|
* IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
|
|
|
|
* Since the received pbufs are enqueued, be sure to configure
|
|
|
|
* PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
|
|
|
|
* packets even if the maximum amount of fragments is enqueued for reassembly!
|
|
|
|
*/
|
|
|
|
#define IP_REASS_MAX_PBUFS 10
|
|
|
|
|
|
|
|
/*
|
|
|
|
----------------------------------
|
|
|
|
---------- ICMP options ----------
|
|
|
|
----------------------------------
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_ICMP==1: Enable ICMP module inside the IP stack.
|
|
|
|
* Be careful, disable that make your product non-compliant to RFC1122
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_ICMP
|
|
|
|
#define LWIP_ICMP 1
|
|
|
|
#else
|
|
|
|
#define LWIP_ICMP 0
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only)
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_BROADCAST_PING
|
|
|
|
#define LWIP_BROADCAST_PING 1
|
|
|
|
#else
|
|
|
|
#define LWIP_BROADCAST_PING 0
|
|
|
|
#endif
|
2017-06-07 03:26:05 -04:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only)
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_MULTICAST_PING
|
|
|
|
#define LWIP_MULTICAST_PING 1
|
|
|
|
#else
|
|
|
|
#define LWIP_MULTICAST_PING 0
|
|
|
|
#endif
|
2017-06-07 03:26:05 -04:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
---------------------------------
|
|
|
|
---------- RAW options ----------
|
|
|
|
---------------------------------
|
|
|
|
*/
|
2016-12-07 04:34:26 -05:00
|
|
|
/**
|
|
|
|
* LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
|
|
|
|
*/
|
|
|
|
#define LWIP_RAW 1
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
----------------------------------
|
|
|
|
---------- DHCP options ----------
|
|
|
|
----------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* LWIP_DHCP==1: Enable DHCP module.
|
|
|
|
*/
|
|
|
|
#define LWIP_DHCP 1
|
|
|
|
|
lwip: optimize the dhcp client
1. modify the discover retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s.
2. add DHCP_DOES_ARP_CHECK to menuconfig for users to specify if do a ARP check on the offered address.
If enable, one more second will be taken in obtaining IP address.
3. update wifi libs
2017-01-22 07:32:39 -05:00
|
|
|
/**
|
|
|
|
* DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address.
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_DHCP_DOES_ARP_CHECK
|
|
|
|
#define DHCP_DOES_ARP_CHECK 1
|
|
|
|
#else
|
|
|
|
#define DHCP_DOES_ARP_CHECK 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_DHCP_GETS_NTP==1: Request NTP servers with discover/select. For each
|
|
|
|
* response packet, an callback is called, which has to be provided by the port:
|
|
|
|
* void dhcp_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs);
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_DHCP_GET_NTP_SRV
|
|
|
|
#define LWIP_DHCP_GET_NTP_SRV 1
|
|
|
|
#else
|
|
|
|
#define LWIP_DHCP_GET_NTP_SRV 0
|
|
|
|
#endif
|
lwip: optimize the dhcp client
1. modify the discover retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s.
2. add DHCP_DOES_ARP_CHECK to menuconfig for users to specify if do a ARP check on the offered address.
If enable, one more second will be taken in obtaining IP address.
3. update wifi libs
2017-01-22 07:32:39 -05:00
|
|
|
|
2021-05-05 03:14:34 -04:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* ESP specific option only applicable if ESP_DHCP=1
|
2021-05-05 03:14:34 -04:00
|
|
|
* LWIP_DHCP_DISABLE_CLIENT_ID==1: Do not add option 61 (client-id) to DHCP packets
|
2021-09-17 06:36:16 -04:00
|
|
|
*
|
2021-05-05 03:14:34 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID
|
|
|
|
#define ESP_DHCP_DISABLE_CLIENT_ID 1
|
|
|
|
#else
|
|
|
|
#define ESP_DHCP_DISABLE_CLIENT_ID 0
|
|
|
|
#endif
|
2018-08-29 04:22:54 -04:00
|
|
|
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* ESP specific option only applicable if ESP_DHCP=1
|
2018-08-29 04:22:54 -04:00
|
|
|
* CONFIG_LWIP_DHCP_RESTORE_LAST_IP==1: Last valid IP address obtained from DHCP server
|
|
|
|
* is restored after reset/power-up.
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_DHCP_RESTORE_LAST_IP
|
2022-03-23 14:20:06 -04:00
|
|
|
/*
|
|
|
|
* Make the post-init hook check if we could restore the previously bound address
|
|
|
|
* - if yes reset the state to bound and mark result as ERR_OK (which skips discovery state)
|
|
|
|
* - if no, return false to continue normally to the discovery state
|
|
|
|
*/
|
|
|
|
#define LWIP_HOOK_DHCP_POST_INIT(netif, result) \
|
|
|
|
(dhcp_ip_addr_restore(netif) ? ( dhcp_set_state(dhcp, DHCP_STATE_BOUND), \
|
|
|
|
dhcp_network_changed(netif), \
|
|
|
|
(result) = ERR_OK , \
|
|
|
|
true ) : \
|
|
|
|
false)
|
2021-09-17 06:36:16 -04:00
|
|
|
#else
|
2022-03-23 14:20:06 -04:00
|
|
|
#define LWIP_HOOK_DHCP_PRE_DISCOVERY(netif, result) (false)
|
2021-09-17 06:36:16 -04:00
|
|
|
#endif /* CONFIG_LWIP_DHCP_RESTORE_LAST_IP */
|
2018-08-29 04:22:54 -04:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* The maximum of NTP servers requested
|
|
|
|
*/
|
|
|
|
#define LWIP_DHCP_MAX_NTP_SERVERS CONFIG_LWIP_DHCP_MAX_NTP_SERVERS
|
2018-08-29 04:22:54 -04:00
|
|
|
|
2021-09-06 03:40:58 -04:00
|
|
|
/**
|
|
|
|
* CONFIG_LWIP_DHCP_OPTIONS_LEN: The total length of outgoing DHCP option msg. If you have many options
|
|
|
|
* and options value is too long, you can configure the length according to your requirements
|
|
|
|
*/
|
|
|
|
#define DHCP_OPTIONS_LEN CONFIG_LWIP_DHCP_OPTIONS_LEN
|
|
|
|
|
2021-06-04 04:43:32 -04:00
|
|
|
/**
|
|
|
|
* LWIP_DHCP_DISABLE_VENDOR_CLASS_ID==1: Do not add option 60 (Vendor Class Identifier) to DHCP packets
|
|
|
|
*/
|
|
|
|
#define ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID
|
|
|
|
|
2022-03-23 15:24:50 -04:00
|
|
|
#define DHCP_DEFINE_CUSTOM_TIMEOUTS 1
|
|
|
|
#define DHCP_COARSE_TIMER_SECS (1)
|
|
|
|
#define DHCP_NEXT_TIMEOUT_THRESHOLD (3)
|
|
|
|
/* Since for embedded devices it's not that hard to miss a discover packet, so lower
|
|
|
|
* the discover retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s.
|
|
|
|
*/
|
|
|
|
#define DHCP_REQUEST_TIMEOUT_SEQUENCE(tries) (( (tries) < 6 ? 1 << (tries) : 60) * 250)
|
|
|
|
|
|
|
|
static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
|
|
|
|
{
|
|
|
|
uint32_t timeout = lease;
|
|
|
|
if (timeout == 0) {
|
|
|
|
timeout = min;
|
|
|
|
}
|
|
|
|
return timeout;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DHCP_CALC_TIMEOUT_FROM_OFFERED_T0_LEASE(dhcp) \
|
|
|
|
timeout_from_offered((dhcp)->offered_t0_lease, 120)
|
|
|
|
#define DHCP_CALC_TIMEOUT_FROM_OFFERED_T1_RENEW(dhcp) \
|
|
|
|
timeout_from_offered((dhcp)->offered_t1_renew, (dhcp)->t0_timeout>>1 /* 50% */ )
|
|
|
|
#define DHCP_CALC_TIMEOUT_FROM_OFFERED_T2_REBIND(dhcp) \
|
|
|
|
timeout_from_offered((dhcp)->offered_t2_rebind, ((dhcp)->t0_timeout/8)*7 /* 87.5% */ )
|
|
|
|
|
2022-03-25 15:13:20 -04:00
|
|
|
#define LWIP_HOOK_DHCP_PARSE_OPTION(netif, dhcp, state, msg, msg_type, option, len, pbuf, offset) \
|
|
|
|
do { LWIP_UNUSED_ARG(msg); \
|
|
|
|
dhcp_parse_extra_opts(dhcp, state, option, len, pbuf, offset); \
|
|
|
|
} while(0)
|
|
|
|
|
2022-03-29 12:18:35 -04:00
|
|
|
#define LWIP_HOOK_DHCP_APPEND_OPTIONS(netif, dhcp, state, msg, msg_type, options_len_ptr) \
|
|
|
|
dhcp_append_extra_opts(netif, state, msg, options_len_ptr);
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
------------------------------------
|
|
|
|
---------- AUTOIP options ----------
|
|
|
|
------------------------------------
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_AUTOIP==1: Enable AUTOIP module.
|
|
|
|
*/
|
2017-07-10 05:22:56 -04:00
|
|
|
#ifdef CONFIG_LWIP_AUTOIP
|
2016-11-09 22:24:31 -05:00
|
|
|
#define LWIP_AUTOIP 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on
|
|
|
|
* the same interface at the same time.
|
|
|
|
*/
|
|
|
|
#define LWIP_DHCP_AUTOIP_COOP 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes
|
|
|
|
* that should be sent before falling back on AUTOIP. This can be set
|
|
|
|
* as low as 1 to get an AutoIP address very quickly, but you should
|
|
|
|
* be prepared to handle a changing IP address when DHCP overrides
|
|
|
|
* AutoIP.
|
|
|
|
*/
|
2017-07-10 05:22:56 -04:00
|
|
|
#define LWIP_DHCP_AUTOIP_COOP_TRIES CONFIG_LWIP_AUTOIP_TRIES
|
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* ESP specific option only applicable if ESP_DHCP=1
|
|
|
|
* LWIP_AUTOIP_MAX_CONFLICTS: Defines max conflicts before rate limiting
|
|
|
|
*/
|
2017-07-10 05:22:56 -04:00
|
|
|
#define LWIP_AUTOIP_MAX_CONFLICTS CONFIG_LWIP_AUTOIP_MAX_CONFLICTS
|
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* ESP specific option only applicable if ESP_DHCP=1
|
|
|
|
* LWIP_AUTOIP_RATE_LIMIT_INTERVAL: Delay in seconds between successive attempts
|
|
|
|
*/
|
2017-07-10 05:22:56 -04:00
|
|
|
#define LWIP_AUTOIP_RATE_LIMIT_INTERVAL CONFIG_LWIP_AUTOIP_RATE_LIMIT_INTERVAL
|
|
|
|
|
|
|
|
#endif /* CONFIG_LWIP_AUTOIP */
|
2016-11-09 22:24:31 -05:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
----------------------------------
|
|
|
|
---------- IGMP options ----------
|
|
|
|
----------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* LWIP_IGMP==1: Turn on IGMP module.
|
|
|
|
*/
|
|
|
|
#define LWIP_IGMP 1
|
|
|
|
|
|
|
|
/*
|
|
|
|
----------------------------------
|
|
|
|
---------- DNS options -----------
|
|
|
|
----------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
|
|
|
|
* transport.
|
|
|
|
*/
|
|
|
|
#define LWIP_DNS 1
|
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/** The maximum of DNS servers
|
|
|
|
*/
|
2017-06-07 09:22:53 -04:00
|
|
|
#define DNS_MAX_SERVERS 3
|
2021-09-17 06:36:16 -04:00
|
|
|
|
|
|
|
/** ESP specific option only applicable if ESP_DNS=1
|
|
|
|
*
|
|
|
|
* The last server can be initialized automatically by defining
|
|
|
|
* FALLBACK_DNS_SERVER_ADDRESS(ipaddr), where 'ipaddr' is an 'ip_addr_t*'
|
|
|
|
*/
|
|
|
|
#define DNS_FALLBACK_SERVER_INDEX (DNS_MAX_SERVERS - 1)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_DNS_SUPPORT_MDNS_QUERIES==1: Enable mDNS queries in hostname resolution.
|
|
|
|
* This option is set via menuconfig.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES
|
|
|
|
#define LWIP_DNS_SUPPORT_MDNS_QUERIES 1
|
|
|
|
#else
|
|
|
|
#define LWIP_DNS_SUPPORT_MDNS_QUERIES 0
|
|
|
|
#endif
|
2017-06-07 09:22:53 -04:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
---------------------------------
|
|
|
|
---------- UDP options ----------
|
|
|
|
---------------------------------
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_UDP==1: Turn on UDP.
|
|
|
|
*/
|
|
|
|
#define LWIP_UDP 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_NETBUF_RECVINFO==1: Enable IP_PKTINFO option.
|
|
|
|
* This option is set via menuconfig.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_NETBUF_RECVINFO
|
|
|
|
#define LWIP_NETBUF_RECVINFO 1
|
|
|
|
#else
|
|
|
|
#define LWIP_NETBUF_RECVINFO 0
|
|
|
|
#endif
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
---------------------------------
|
|
|
|
---------- TCP options ----------
|
|
|
|
---------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* LWIP_TCP==1: Turn on TCP.
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define LWIP_TCP 1
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2020-01-08 04:05:57 -05:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* TCP_WND: The size of a TCP window. This must be at least
|
|
|
|
* (2 * TCP_MSS) for things to work well.
|
|
|
|
* ATTENTION: when using TCP_RCV_SCALE, TCP_WND is the total size
|
|
|
|
* with scaling applied. Maximum window value in the TCP header
|
|
|
|
* will be TCP_WND >> TCP_RCV_SCALE
|
2020-01-08 04:05:57 -05:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define TCP_WND CONFIG_LWIP_TCP_WND_DEFAULT
|
2020-01-08 04:05:57 -05:00
|
|
|
|
2018-06-06 23:24:03 -04:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* TCP_MAXRTX: Maximum number of retransmissions of data segments.
|
2018-06-06 23:24:03 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define TCP_MAXRTX CONFIG_LWIP_TCP_MAXRTX
|
2018-06-06 23:24:03 -04:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments.
|
|
|
|
*/
|
|
|
|
#define TCP_SYNMAXRTX CONFIG_LWIP_TCP_SYNMAXRTX
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2019-10-18 08:37:38 -04:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order.
|
|
|
|
* Define to 0 if your device is low on memory.
|
2019-10-18 08:37:38 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_TCP_QUEUE_OOSEQ
|
|
|
|
#define TCP_QUEUE_OOSEQ 1
|
|
|
|
#else
|
|
|
|
#define TCP_QUEUE_OOSEQ 0
|
|
|
|
#endif
|
2019-10-18 08:37:38 -04:00
|
|
|
|
2017-07-09 06:42:37 -04:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* LWIP_TCP_SACK_OUT==1: TCP will support sending selective acknowledgements (SACKs).
|
2017-07-09 06:42:37 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_TCP_SACK_OUT
|
|
|
|
#define LWIP_TCP_SACK_OUT 1
|
|
|
|
#else
|
|
|
|
#define LWIP_TCP_SACK_OUT 0
|
|
|
|
#endif
|
2017-07-09 06:42:37 -04:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default,
|
|
|
|
* you might want to increase this.)
|
|
|
|
* For the receive side, this MSS is advertised to the remote side
|
|
|
|
* when opening a connection. For the transmit size, this MSS sets
|
|
|
|
* an upper limit on the MSS advertised by the remote host.
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define TCP_MSS CONFIG_LWIP_TCP_MSS
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* TCP_SND_BUF: TCP sender buffer space (bytes).
|
|
|
|
* To achieve good performance, this should be at least 2 * TCP_MSS.
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define TCP_SND_BUF CONFIG_LWIP_TCP_SND_BUF_DEFAULT
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
|
|
|
|
*/
|
|
|
|
#define TCP_LISTEN_BACKLOG 1
|
|
|
|
|
2017-06-22 03:14:21 -04:00
|
|
|
/**
|
|
|
|
* TCP_OVERSIZE: The maximum number of bytes that tcp_write may
|
|
|
|
* allocate ahead of time
|
|
|
|
*/
|
2019-04-29 08:30:13 -04:00
|
|
|
#ifdef CONFIG_LWIP_TCP_OVERSIZE_MSS
|
2017-06-22 03:14:21 -04:00
|
|
|
#define TCP_OVERSIZE TCP_MSS
|
|
|
|
#endif
|
2019-04-29 08:30:13 -04:00
|
|
|
#ifdef CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS
|
2017-06-22 03:14:21 -04:00
|
|
|
#define TCP_OVERSIZE (TCP_MSS/4)
|
|
|
|
#endif
|
2019-04-29 08:30:13 -04:00
|
|
|
#ifdef CONFIG_LWIP_TCP_OVERSIZE_DISABLE
|
2017-06-22 03:14:21 -04:00
|
|
|
#define TCP_OVERSIZE 0
|
|
|
|
#endif
|
|
|
|
#ifndef TCP_OVERSIZE
|
|
|
|
#error "One of CONFIG_TCP_OVERSIZE_xxx options should be set by sdkconfig"
|
|
|
|
#endif
|
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1.
|
|
|
|
* LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all
|
|
|
|
* events (accept, sent, etc) that happen in the system.
|
|
|
|
* LWIP_CALLBACK_API==1: The PCB callback function is called directly
|
|
|
|
* for the event. This is the default.
|
|
|
|
*/
|
|
|
|
#define LWIP_EVENT_API 0
|
|
|
|
#define LWIP_CALLBACK_API 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TCP_TMR_INTERVAL: TCP timer interval
|
|
|
|
*/
|
|
|
|
#define TCP_TMR_INTERVAL CONFIG_LWIP_TCP_TMR_INTERVAL
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TCP_MSL: The maximum segment lifetime in milliseconds
|
|
|
|
*/
|
|
|
|
#define TCP_MSL CONFIG_LWIP_TCP_MSL
|
|
|
|
|
2019-05-29 21:41:05 -04:00
|
|
|
/**
|
|
|
|
* LWIP_WND_SCALE and TCP_RCV_SCALE:
|
|
|
|
* Set LWIP_WND_SCALE to 1 to enable window scaling.
|
|
|
|
* Set TCP_RCV_SCALE to the desired scaling factor (shift count in the
|
|
|
|
* range of [0..14]).
|
|
|
|
* When LWIP_WND_SCALE is enabled but TCP_RCV_SCALE is 0, we can use a large
|
|
|
|
* send window while having a small receive window only.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_WND_SCALE
|
|
|
|
#define LWIP_WND_SCALE 1
|
|
|
|
#define TCP_RCV_SCALE CONFIG_LWIP_TCP_RCV_SCALE
|
2021-09-17 06:36:16 -04:00
|
|
|
#else
|
|
|
|
#define LWIP_WND_SCALE 0
|
|
|
|
#define TCP_RCV_SCALE 0
|
|
|
|
#endif /* CONFIG_LWIP_WND_SCALE */
|
2019-05-29 21:41:05 -04:00
|
|
|
|
2020-06-08 02:26:46 -04:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* ESP specific option only applicable if ESP_LWIP=1
|
2020-06-08 02:26:46 -04:00
|
|
|
* LWIP_TCP_RTO_TIME: TCP rto time.
|
|
|
|
* Default is 3 second.
|
|
|
|
*/
|
|
|
|
#define LWIP_TCP_RTO_TIME CONFIG_LWIP_TCP_RTO_TIME
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
------------------------------------------------
|
|
|
|
---------- Network Interfaces options ----------
|
|
|
|
------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname
|
|
|
|
* field.
|
|
|
|
*/
|
|
|
|
#define LWIP_NETIF_HOSTNAME 1
|
|
|
|
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* LWIP_NETIF_API==1: Support netif api (in netifapi.c)
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_NETIF_API
|
|
|
|
#define LWIP_NETIF_API 1
|
|
|
|
#else
|
|
|
|
#define LWIP_NETIF_API 0
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2021-02-01 02:47:42 -05:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
|
|
|
|
* changes its up/down status (i.e., due to DHCP IP acquisition)
|
2021-02-01 02:47:42 -05:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_NETIF_STATUS_CALLBACK
|
|
|
|
#define LWIP_NETIF_STATUS_CALLBACK 1
|
|
|
|
#else
|
|
|
|
#define LWIP_NETIF_STATUS_CALLBACK 0
|
|
|
|
#endif
|
2021-02-01 02:47:42 -05:00
|
|
|
|
2022-02-14 07:46:21 -05:00
|
|
|
/**
|
|
|
|
* LWIP_NETIF_EXT_STATUS_CALLBACK==1: Support an extended callback function
|
|
|
|
* for several netif related event that supports multiple subscribers.
|
|
|
|
*
|
|
|
|
* This ext-callback is used by ESP-NETIF with lwip-orig (upstream version)
|
|
|
|
* to provide netif related events on IP4/IP6 address/status changes
|
|
|
|
*/
|
|
|
|
#define LWIP_NETIF_EXT_STATUS_CALLBACK 1
|
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP *tries* to put all data
|
|
|
|
* to be sent into one single pbuf. This is for compatibility with DMA-enabled
|
|
|
|
* MACs that do not support scatter-gather.
|
|
|
|
* Beware that this might involve CPU-memcpy before transmitting that would not
|
|
|
|
* be needed without this flag! Use this only if you need to!
|
|
|
|
*
|
|
|
|
* ATTENTION: a driver should *NOT* rely on getting single pbufs but check TX
|
|
|
|
* pbufs for being in one piece. If not, @ref pbuf_clone can be used to get
|
|
|
|
* a single pbuf:
|
|
|
|
* if (p->next != NULL) {
|
|
|
|
* struct pbuf *q = pbuf_clone(PBUF_RAW, PBUF_RAM, p);
|
|
|
|
* if (q == NULL) {
|
|
|
|
* return ERR_MEM;
|
|
|
|
* }
|
|
|
|
* p = q; ATTENTION: do NOT free the old 'p' as the ref belongs to the caller!
|
|
|
|
* }
|
|
|
|
*/
|
|
|
|
#define LWIP_NETIF_TX_SINGLE_PBUF 1
|
2021-04-08 05:58:50 -04:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
------------------------------------
|
|
|
|
---------- LOOPIF options ----------
|
|
|
|
------------------------------------
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1).
|
|
|
|
* This is only needed when no real netifs are available. If at least one other
|
|
|
|
*/
|
2017-07-10 05:22:56 -04:00
|
|
|
#ifdef CONFIG_LWIP_NETIF_LOOPBACK
|
2021-09-17 06:36:16 -04:00
|
|
|
#define LWIP_HAVE_LOOPIF 1
|
|
|
|
|
2016-11-09 22:24:31 -05:00
|
|
|
/**
|
|
|
|
* LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP
|
|
|
|
* address equal to the netif IP address, looping them back up the stack.
|
|
|
|
*/
|
|
|
|
#define LWIP_NETIF_LOOPBACK 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback
|
|
|
|
* sending for each netif (0 = disabled)
|
|
|
|
*/
|
2017-07-10 05:22:56 -04:00
|
|
|
#define LWIP_LOOPBACK_MAX_PBUFS CONFIG_LWIP_LOOPBACK_MAX_PBUFS
|
2021-09-17 06:36:16 -04:00
|
|
|
#else
|
|
|
|
#define LWIP_HAVE_LOOPIF 0
|
2016-11-09 22:24:31 -05:00
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
------------------------------------
|
|
|
|
---------- SLIPIF options ----------
|
|
|
|
------------------------------------
|
|
|
|
*/
|
|
|
|
|
2020-05-21 01:55:56 -04:00
|
|
|
#ifdef CONFIG_LWIP_SLIP_SUPPORT
|
|
|
|
/**
|
2020-06-12 10:43:34 -04:00
|
|
|
* Enable SLIP receive from ISR functions and disable Rx thread
|
|
|
|
*
|
|
|
|
* This is the only supported mode of lwIP SLIP interface, so that
|
|
|
|
* - incoming packets are queued into pbufs
|
|
|
|
* - no thread is created from lwIP
|
|
|
|
* meaning it is the application responsibility to read data
|
|
|
|
* from IO driver and feed them to the slip interface
|
|
|
|
*/
|
|
|
|
#define SLIP_RX_FROM_ISR 1
|
|
|
|
#define SLIP_USE_RX_THREAD 0
|
2020-05-21 01:55:56 -04:00
|
|
|
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* SLIP_DEBUG: Enable debugging for SLIP.
|
2020-05-21 01:55:56 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_SLIP_DEBUG_ON
|
2020-05-21 01:55:56 -04:00
|
|
|
#define SLIP_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define SLIP_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
2021-09-17 06:36:16 -04:00
|
|
|
#endif /* CONFIG_LWIP_SLIP_SUPPORT */
|
2020-05-21 01:55:56 -04:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
------------------------------------
|
|
|
|
---------- Thread options ----------
|
|
|
|
------------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* TCPIP_THREAD_NAME: The name assigned to the main tcpip thread.
|
|
|
|
*/
|
|
|
|
#define TCPIP_THREAD_NAME "tiT"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
|
|
|
|
* The stack size value itself is platform-dependent, but is passed to
|
|
|
|
* sys_thread_new() when the thread is created.
|
|
|
|
*/
|
2016-09-13 21:36:54 -04:00
|
|
|
#define TCPIP_THREAD_STACKSIZE ESP_TASK_TCPIP_STACK
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
|
|
|
|
* The priority value itself is platform-dependent, but is passed to
|
|
|
|
* sys_thread_new() when the thread is created.
|
|
|
|
*/
|
2016-09-13 21:36:54 -04:00
|
|
|
#define TCPIP_THREAD_PRIO ESP_TASK_TCPIP_PRIO
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
|
|
|
|
* The queue size value itself is platform-dependent, but is passed to
|
|
|
|
* sys_mbox_new() when tcpip_init is called.
|
|
|
|
*/
|
2019-04-29 08:30:13 -04:00
|
|
|
#define TCPIP_MBOX_SIZE CONFIG_LWIP_TCPIP_RECVMBOX_SIZE
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
|
|
|
|
* NETCONN_UDP. The queue size value itself is platform-dependent, but is passed
|
|
|
|
* to sys_mbox_new() when the recvmbox is created.
|
|
|
|
*/
|
2019-04-29 08:30:13 -04:00
|
|
|
#define DEFAULT_UDP_RECVMBOX_SIZE CONFIG_LWIP_UDP_RECVMBOX_SIZE
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
|
|
|
|
* NETCONN_TCP. The queue size value itself is platform-dependent, but is passed
|
|
|
|
* to sys_mbox_new() when the recvmbox is created.
|
|
|
|
*/
|
2019-04-29 08:30:13 -04:00
|
|
|
#define DEFAULT_TCP_RECVMBOX_SIZE CONFIG_LWIP_TCP_RECVMBOX_SIZE
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections.
|
|
|
|
* The queue size value itself is platform-dependent, but is passed to
|
|
|
|
* sys_mbox_new() when the acceptmbox is created.
|
|
|
|
*/
|
|
|
|
#define DEFAULT_ACCEPTMBOX_SIZE 6
|
|
|
|
|
2016-12-07 04:34:26 -05:00
|
|
|
/**
|
|
|
|
* DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
|
|
|
|
* The stack size value itself is platform-dependent, but is passed to
|
|
|
|
* sys_thread_new() when the thread is created.
|
|
|
|
*/
|
|
|
|
#define DEFAULT_THREAD_STACKSIZE TCPIP_THREAD_STACKSIZE
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread.
|
|
|
|
* The priority value itself is platform-dependent, but is passed to
|
|
|
|
* sys_thread_new() when the thread is created.
|
|
|
|
*/
|
|
|
|
#define DEFAULT_THREAD_PRIO TCPIP_THREAD_PRIO
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
|
|
|
|
* NETCONN_RAW. The queue size value itself is platform-dependent, but is passed
|
|
|
|
* to sys_mbox_new() when the recvmbox is created.
|
|
|
|
*/
|
|
|
|
#define DEFAULT_RAW_RECVMBOX_SIZE 6
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
----------------------------------------------
|
|
|
|
---------- Sequential layer options ----------
|
|
|
|
----------------------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
|
|
|
|
*/
|
|
|
|
#define LWIP_NETCONN 1
|
|
|
|
|
|
|
|
/** LWIP_NETCONN_SEM_PER_THREAD==1: Use one (thread-local) semaphore per
|
|
|
|
* thread calling socket/netconn functions instead of allocating one
|
|
|
|
* semaphore per netconn (and per select etc.)
|
|
|
|
* ATTENTION: a thread-local semaphore for API calls is needed:
|
|
|
|
* - LWIP_NETCONN_THREAD_SEM_GET() returning a sys_sem_t*
|
|
|
|
* - LWIP_NETCONN_THREAD_SEM_ALLOC() creating the semaphore
|
|
|
|
* - LWIP_NETCONN_THREAD_SEM_FREE() freeing the semaphore
|
|
|
|
* The latter 2 can be invoked up by calling netconn_thread_init()/netconn_thread_cleanup().
|
|
|
|
* Ports may call these for threads created with sys_thread_new().
|
|
|
|
*/
|
|
|
|
#if LWIP_TCPIP_CORE_LOCKING
|
|
|
|
#define LWIP_NETCONN_SEM_PER_THREAD 0
|
|
|
|
#else
|
|
|
|
#define LWIP_NETCONN_SEM_PER_THREAD 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** LWIP_NETCONN_FULLDUPLEX==1: Enable code that allows reading from one thread,
|
|
|
|
* writing from a 2nd thread and closing from a 3rd thread at the same time.
|
|
|
|
* ATTENTION: This is currently really alpha! Some requirements:
|
|
|
|
* - LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from
|
|
|
|
* multiple threads at once
|
|
|
|
* - sys_mbox_free() has to unblock receive tasks waiting on recvmbox/acceptmbox
|
|
|
|
* and prevent a task pending on this during/after deletion
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define LWIP_NETCONN_FULLDUPLEX 1
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
------------------------------------
|
|
|
|
---------- Socket options ----------
|
|
|
|
------------------------------------
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
|
|
|
|
*/
|
|
|
|
#define LWIP_SOCKET 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names through defines.
|
|
|
|
* LWIP_COMPAT_SOCKETS==2: Same as ==1 but correctly named functions are created.
|
|
|
|
* While this helps code completion, it might conflict with existing libraries.
|
|
|
|
* (only used if you use sockets.c)
|
|
|
|
*/
|
2022-03-17 08:07:05 -04:00
|
|
|
#define LWIP_COMPAT_SOCKETS 0
|
2021-09-17 06:36:16 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names.
|
|
|
|
* Disable this option if you use a POSIX operating system that uses the same
|
|
|
|
* names (read, write & close). (only used if you use sockets.c)
|
|
|
|
*
|
|
|
|
* POSIX I/O functions are mapped to LWIP via the VFS layer
|
|
|
|
* (see port/vfs_lwip.c)
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
#define LWIP_POSIX_SOCKETS_IO_NAMES 0
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_SOCKET_OFFSET==n: Increases the file descriptor number created by LwIP with n.
|
|
|
|
*
|
|
|
|
* FD_SETSIZE from sys/types.h is the maximum number of supported file
|
|
|
|
* descriptors and CONFIG_LWIP_MAX_SOCKETS defines the number of sockets;
|
|
|
|
* LWIP_SOCKET_OFFSET is configured to use the largest numbers of file
|
|
|
|
* descriptors for sockets. File descriptors from 0 to LWIP_SOCKET_OFFSET-1
|
|
|
|
* are non-socket descriptors and from LWIP_SOCKET_OFFSET to FD_SETSIZE are
|
|
|
|
* socket descriptors.
|
|
|
|
*/
|
|
|
|
#define LWIP_SOCKET_OFFSET (FD_SETSIZE - CONFIG_LWIP_MAX_SOCKETS)
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
|
|
|
* LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and
|
|
|
|
* SO_SNDTIMEO processing.
|
|
|
|
*/
|
|
|
|
#define LWIP_SO_SNDTIMEO 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and
|
|
|
|
* SO_RCVTIMEO processing.
|
|
|
|
*/
|
|
|
|
#define LWIP_SO_RCVTIMEO 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT
|
|
|
|
* options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set
|
|
|
|
* in seconds. (does not require sockets.c, and will affect tcp.c)
|
|
|
|
*/
|
|
|
|
#define LWIP_TCP_KEEPALIVE 1
|
|
|
|
|
2020-05-14 03:18:39 -04:00
|
|
|
/**
|
|
|
|
* LWIP_SO_LINGER==1: Enable SO_LINGER processing.
|
2021-09-17 06:36:16 -04:00
|
|
|
* This option is set via menuconfig.
|
2020-05-14 03:18:39 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_SO_LINGER
|
|
|
|
#define LWIP_SO_LINGER 1
|
|
|
|
#else
|
|
|
|
#define LWIP_SO_LINGER 0
|
|
|
|
#endif
|
2020-05-14 03:18:39 -04:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
|
|
|
* LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
|
2021-09-17 06:36:16 -04:00
|
|
|
* This option is set via menuconfig.
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_SO_RCVBUF
|
|
|
|
#define LWIP_SO_RCVBUF 1
|
|
|
|
#else
|
|
|
|
#define LWIP_SO_RCVBUF 0
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SO_REUSE==1: Enable SO_REUSEADDR option.
|
2016-09-20 03:36:55 -04:00
|
|
|
* This option is set via menuconfig.
|
2016-08-17 11:08:22 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_SO_REUSE
|
|
|
|
#define SO_REUSE 1
|
|
|
|
#else
|
|
|
|
#define SO_REUSE 0
|
|
|
|
#endif
|
2019-06-12 15:27:03 -04:00
|
|
|
|
2016-11-09 22:24:31 -05:00
|
|
|
/**
|
|
|
|
* SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets
|
|
|
|
* to all local matches if SO_REUSEADDR is turned on.
|
|
|
|
* WARNING: Adds a memcpy for every packet if passing to more than one pcb!
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_SO_REUSE_RXTOALL
|
|
|
|
#define SO_REUSE_RXTOALL 1
|
|
|
|
#else
|
|
|
|
#define SO_REUSE_RXTOALL 0
|
|
|
|
#endif
|
2016-11-09 22:24:31 -05:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
|
|
|
|
* by your system, set this to 0 and include <sys/time.h> in cc.h */
|
|
|
|
#define LWIP_TIMEVAL_PRIVATE 0
|
2019-08-28 17:08:58 -04:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
----------------------------------------
|
|
|
|
---------- Statistics options ----------
|
|
|
|
----------------------------------------
|
|
|
|
*/
|
2017-03-30 11:12:25 -04:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
|
|
|
* LWIP_STATS==1: Enable statistics collection in lwip_stats.
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_STATS
|
|
|
|
#define LWIP_STATS 1
|
|
|
|
#define ESP_STATS_MEM 1
|
2017-03-30 11:12:25 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_STATS_DISPLAY==1: Compile in the statistics output functions.
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define LWIP_STATS_DISPLAY 1
|
|
|
|
#else
|
|
|
|
#define LWIP_STATS 0
|
|
|
|
#define ESP_STATS_MEM 0
|
|
|
|
#endif /* CONFIG_LWIP_STATS */
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
---------------------------------
|
|
|
|
---------- PPP options ----------
|
|
|
|
---------------------------------
|
|
|
|
*/
|
|
|
|
|
2017-01-20 06:05:38 -05:00
|
|
|
/**
|
|
|
|
* PPP_SUPPORT==1: Enable PPP.
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_PPP_SUPPORT
|
|
|
|
#define PPP_SUPPORT 1
|
2017-01-20 06:05:38 -05:00
|
|
|
|
2020-02-17 06:33:37 -05:00
|
|
|
/**
|
|
|
|
* PPP_IPV6_SUPPORT == 1: Enable IPV6 support for local link
|
|
|
|
* between modem and lwIP stack.
|
|
|
|
* Some modems do not support IPV6 addressing in local link and
|
|
|
|
* the only option available is to disable IPV6 address negotiation.
|
|
|
|
*/
|
2021-04-08 05:58:50 -04:00
|
|
|
#define PPP_IPV6_SUPPORT CONFIG_LWIP_PPP_ENABLE_IPV6
|
2020-02-17 06:33:37 -05:00
|
|
|
|
2018-11-22 22:53:20 -05:00
|
|
|
/**
|
|
|
|
* PPP_NOTIFY_PHASE==1: Support PPP notify phase.
|
|
|
|
*/
|
2019-04-29 08:30:13 -04:00
|
|
|
#define PPP_NOTIFY_PHASE CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT
|
2018-11-22 22:53:20 -05:00
|
|
|
|
2017-01-20 06:05:38 -05:00
|
|
|
/**
|
|
|
|
* PAP_SUPPORT==1: Support PAP.
|
|
|
|
*/
|
2019-04-29 08:30:13 -04:00
|
|
|
#define PAP_SUPPORT CONFIG_LWIP_PPP_PAP_SUPPORT
|
2017-01-20 06:05:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CHAP_SUPPORT==1: Support CHAP.
|
|
|
|
*/
|
2019-04-29 08:30:13 -04:00
|
|
|
#define CHAP_SUPPORT CONFIG_LWIP_PPP_CHAP_SUPPORT
|
2017-01-20 06:05:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MSCHAP_SUPPORT==1: Support MSCHAP.
|
|
|
|
*/
|
2019-04-29 08:30:13 -04:00
|
|
|
#define MSCHAP_SUPPORT CONFIG_LWIP_PPP_MSCHAP_SUPPORT
|
2017-01-20 06:05:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CCP_SUPPORT==1: Support CCP.
|
|
|
|
*/
|
2019-04-29 08:30:13 -04:00
|
|
|
#define MPPE_SUPPORT CONFIG_LWIP_PPP_MPPE_SUPPORT
|
2017-01-20 06:05:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* PPP_MAXIDLEFLAG: Max Xmit idle time (in ms) before resend flag char.
|
|
|
|
* TODO: If PPP_MAXIDLEFLAG > 0 and next package is send during PPP_MAXIDLEFLAG time,
|
|
|
|
* then 0x7E is not added at the begining of PPP package but 0x7E termination
|
|
|
|
* is always at the end. This behaviour brokes PPP dial with GSM (PPPoS).
|
|
|
|
* The PPP package should always start and end with 0x7E.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define PPP_MAXIDLEFLAG 0
|
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_ENABLE_LCP_ECHO
|
2017-01-20 06:05:38 -05:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* LCP_ECHOINTERVAL: Interval in seconds between keepalive LCP echo requests, 0 to disable.
|
2017-01-20 06:05:38 -05:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define LCP_ECHOINTERVAL CONFIG_LWIP_LCP_ECHOINTERVAL
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LCP_MAXECHOFAILS: Number of consecutive unanswered echo requests before failure is indicated.
|
|
|
|
*/
|
|
|
|
#define LCP_MAXECHOFAILS CONFIG_LWIP_LCP_MAXECHOFAILS
|
|
|
|
#endif /* CONFIG_LWIP_ENABLE_LCP_ECHO */
|
2017-01-20 06:05:38 -05:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* PPP_DEBUG: Enable debugging for PPP.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_PPP_DEBUG_ON
|
2017-01-20 06:05:38 -05:00
|
|
|
#define PPP_DEBUG LWIP_DBG_ON
|
2020-03-31 07:10:42 -04:00
|
|
|
#define PRINTPKT_SUPPORT 1
|
|
|
|
#define PPP_PROTOCOLNAME 1
|
2017-01-20 06:05:38 -05:00
|
|
|
#else
|
|
|
|
#define PPP_DEBUG LWIP_DBG_OFF
|
2021-09-17 06:36:16 -04:00
|
|
|
#endif /* CONFIG_LWIP_PPP_DEBUG_ON */
|
|
|
|
#else
|
|
|
|
#define PPP_SUPPORT 0
|
|
|
|
#endif /* CONFIG_LWIP_PPP_SUPPORT */
|
2021-02-15 04:23:32 -05:00
|
|
|
|
|
|
|
/*
|
2021-09-17 06:36:16 -04:00
|
|
|
--------------------------------------
|
|
|
|
---------- Checksum options ----------
|
|
|
|
--------------------------------------
|
2021-02-15 04:23:32 -05:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
|
2021-02-15 04:23:32 -05:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
|
2021-02-15 04:23:32 -05:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_CHECKSUM_CHECK_IP
|
|
|
|
#define CHECKSUM_CHECK_IP 1
|
|
|
|
#else
|
|
|
|
#define CHECKSUM_CHECK_IP 0
|
|
|
|
#endif
|
2021-02-15 04:23:32 -05:00
|
|
|
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
|
2021-02-15 04:23:32 -05:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_CHECKSUM_CHECK_UDP
|
|
|
|
#define CHECKSUM_CHECK_UDP 1
|
|
|
|
#else
|
|
|
|
#define CHECKSUM_CHECK_UDP 0
|
|
|
|
#endif
|
2017-01-20 06:05:38 -05:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* CHECKSUM_CHECK_ICMP==1: Check checksums in software for incoming ICMP packets.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_CHECKSUM_CHECK_ICMP
|
|
|
|
#define CHECKSUM_CHECK_ICMP 1
|
|
|
|
#else
|
|
|
|
#define CHECKSUM_CHECK_ICMP 0
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
---------------------------------------
|
|
|
|
---------- IPv6 options ---------------
|
|
|
|
---------------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* LWIP_IPV6==1: Enable IPv6
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_IPV6
|
|
|
|
#define LWIP_IPV6 1
|
|
|
|
#else
|
|
|
|
#define LWIP_IPV6 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_IPV6_NUM_ADDRESSES: Number of IPv6 addresses per netif.
|
|
|
|
*/
|
|
|
|
#define LWIP_IPV6_NUM_ADDRESSES CONFIG_LWIP_IPV6_NUM_ADDRESSES
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_IPV6_FORWARD==1: Forward IPv6 packets across netifs
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_IPV6_FORWARD
|
|
|
|
#define LWIP_IPV6_FORWARD 1
|
|
|
|
#else
|
|
|
|
#define LWIP_IPV6_FORWARD 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_IPV6_FRAG==1: Fragment outgoing IP6 packets if their size exceeds MTU. Note
|
|
|
|
* that this option does not affect incoming packet sizes, which can be
|
|
|
|
* controlled via IP6_REASSEMBLY.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_IP6_FRAG
|
|
|
|
#define LWIP_IPV6_FRAG 1
|
|
|
|
#else
|
|
|
|
#define LWIP_IPV6_FRAG 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_IPV6_REASS==1: reassemble incoming IP6 packets that fragmented. Note that
|
|
|
|
* this option does not affect outgoing packet sizes, which can be controlled
|
|
|
|
* via LWIP_IP6_FRAG.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_IP6_REASSEMBLY
|
|
|
|
#define LWIP_IPV6_REASS 1
|
|
|
|
#else
|
|
|
|
#define LWIP_IPV6_REASS 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_IPV6_AUTOCONFIG==1: Enable stateless address autoconfiguration as per RFC 4862.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_IPV6_AUTOCONFIG
|
|
|
|
#define ESP_IPV6_AUTOCONFIG 1
|
|
|
|
#else
|
|
|
|
#define ESP_IPV6_AUTOCONFIG 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_ND6_RDNSS_MAX_DNS_SERVERS > 0: Use IPv6 Router Advertisement Recursive
|
|
|
|
* DNS Server Option (as per RFC 6106) to copy a defined maximum number of DNS
|
|
|
|
* servers to the DNS module.
|
|
|
|
*/
|
|
|
|
#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_IPV6_DHCP6==1: enable DHCPv6 stateful/stateless address autoconfiguration.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_IPV6_DHCP6
|
|
|
|
#define LWIP_IPV6_DHCP6 1
|
|
|
|
#else
|
|
|
|
#define LWIP_IPV6_DHCP6 0
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2020-07-20 09:04:45 -04:00
|
|
|
/**
|
|
|
|
* MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution.
|
|
|
|
*/
|
|
|
|
#define MEMP_NUM_ND6_QUEUE CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LWIP_ND6_NUM_NEIGHBORS: Number of entries in IPv6 neighbor cache
|
|
|
|
*/
|
|
|
|
#define LWIP_ND6_NUM_NEIGHBORS CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
---------------------------------------
|
|
|
|
---------- Hook options ---------------
|
|
|
|
---------------------------------------
|
|
|
|
*/
|
2020-12-17 08:28:50 -05:00
|
|
|
#ifdef LWIP_HOOK_FILENAME
|
|
|
|
#warning LWIP_HOOK_FILENAME is used for IDF default hooks. Please use ESP_IDF_LWIP_HOOK_FILENAME to insert additional hook
|
|
|
|
#endif
|
2020-10-22 13:41:15 -04:00
|
|
|
#define LWIP_HOOK_FILENAME "lwip_default_hooks.h"
|
2017-06-30 04:18:29 -04:00
|
|
|
#define LWIP_HOOK_IP4_ROUTE_SRC ip4_route_src_hook
|
2022-02-14 07:46:21 -05:00
|
|
|
#define LWIP_HOOK_SOCKETS_GETSOCKOPT(s, sock, level, optname, optval, optlen, err) \
|
|
|
|
lwip_getsockopt_impl_ext(sock, level, optname, optval, optlen, err)?(done_socket(sock), true): false
|
|
|
|
|
|
|
|
#define LWIP_HOOK_SOCKETS_SETSOCKOPT(s, sock, level, optname, optval, optlen, err) \
|
|
|
|
lwip_setsockopt_impl_ext(sock, level, optname, optval, optlen, err)?(done_socket(sock), true): false
|
2020-10-22 13:41:15 -04:00
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/*
|
|
|
|
---------------------------------------
|
|
|
|
---------- Debugging options ----------
|
|
|
|
---------------------------------------
|
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* LWIP_DEBUG: Enable lwip debugging in other modules.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_DEBUG
|
|
|
|
#define LWIP_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#undef LWIP_DEBUG
|
|
|
|
#endif
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
|
|
|
* ETHARP_DEBUG: Enable debugging in etharp.c.
|
|
|
|
*/
|
2020-07-15 09:35:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_ETHARP_DEBUG
|
|
|
|
#define ETHARP_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define ETHARP_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
|
|
|
* NETIF_DEBUG: Enable debugging in netif.c.
|
|
|
|
*/
|
2020-07-15 09:35:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_NETIF_DEBUG
|
|
|
|
#define NETIF_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
2016-08-17 11:08:22 -04:00
|
|
|
#define NETIF_DEBUG LWIP_DBG_OFF
|
2020-07-15 09:35:16 -04:00
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* PBUF_DEBUG: Enable debugging in pbuf.c.
|
|
|
|
*/
|
2020-07-15 09:35:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_PBUF_DEBUG
|
|
|
|
#define PBUF_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define PBUF_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* API_LIB_DEBUG: Enable debugging in api_lib.c.
|
|
|
|
*/
|
2020-07-15 09:35:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_API_LIB_DEBUG
|
|
|
|
#define API_LIB_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define API_LIB_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
|
|
|
* SOCKETS_DEBUG: Enable debugging in sockets.c.
|
|
|
|
*/
|
2020-07-15 09:35:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_SOCKETS_DEBUG
|
|
|
|
#define SOCKETS_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
2016-08-29 02:32:38 -04:00
|
|
|
#define SOCKETS_DEBUG LWIP_DBG_OFF
|
2020-07-15 09:35:16 -04:00
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ICMP_DEBUG: Enable debugging in icmp.c.
|
|
|
|
*/
|
2020-07-15 09:35:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_ICMP_DEBUG
|
|
|
|
#define ICMP_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
2016-08-17 11:08:22 -04:00
|
|
|
#define ICMP_DEBUG LWIP_DBG_OFF
|
2020-07-15 09:35:16 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_LWIP_ICMP6_DEBUG
|
|
|
|
#define ICMP6_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define ICMP6_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2020-11-30 21:33:01 -05:00
|
|
|
/**
|
|
|
|
* DHCP_DEBUG: Enable debugging in dhcp.c.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_DHCP_DEBUG
|
|
|
|
#define DHCP_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define DHCP_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
|
|
|
|
2020-12-21 22:20:09 -05:00
|
|
|
#ifdef CONFIG_LWIP_DHCP_STATE_DEBUG
|
|
|
|
#define ESP_DHCP_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define ESP_DHCP_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
|
|
|
* IP_DEBUG: Enable debugging for IP.
|
|
|
|
*/
|
2020-07-15 09:35:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_IP_DEBUG
|
|
|
|
#define IP_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
2016-08-17 11:08:22 -04:00
|
|
|
#define IP_DEBUG LWIP_DBG_OFF
|
2020-07-15 09:35:16 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2020-11-30 21:33:01 -05:00
|
|
|
* IP6_DEBUG: Enable debugging for IP6.
|
2020-07-15 09:35:16 -04:00
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_IP6_DEBUG
|
|
|
|
#define IP6_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define IP6_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2020-11-30 21:33:01 -05:00
|
|
|
/**
|
|
|
|
* TCP_DEBUG: Enable debugging for TCP.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_TCP_DEBUG
|
|
|
|
#define TCP_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define TCP_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
|
|
|
|
2021-07-28 12:45:45 -04:00
|
|
|
/**
|
|
|
|
* SNTP_DEBUG: Enable debugging for SNTP.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_SNTP_DEBUG
|
|
|
|
#define SNTP_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define SNTP_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
|
|
|
|
2022-03-30 09:45:56 -04:00
|
|
|
/**
|
|
|
|
* DNS_DEBUG: Enable debugging for DNS.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_DNS_DEBUG
|
|
|
|
#define DNS_DEBUG LWIP_DBG_ON
|
|
|
|
#else
|
|
|
|
#define DNS_DEBUG LWIP_DBG_OFF
|
|
|
|
#endif
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
/**
|
|
|
|
* MEMP_DEBUG: Enable debugging in memp.c.
|
|
|
|
*/
|
|
|
|
#define MEMP_DEBUG LWIP_DBG_OFF
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug.
|
|
|
|
*/
|
|
|
|
#define TCP_INPUT_DEBUG LWIP_DBG_OFF
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions.
|
|
|
|
*/
|
|
|
|
#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TCPIP_DEBUG: Enable debugging in tcpip.c.
|
|
|
|
*/
|
|
|
|
#define TCPIP_DEBUG LWIP_DBG_OFF
|
|
|
|
|
2020-11-18 23:10:47 -05:00
|
|
|
/**
|
|
|
|
* TCP_OOSEQ_DEBUG: Enable debugging in tcpin.c for OOSEQ.
|
|
|
|
*/
|
|
|
|
#define TCP_OOSEQ_DEBUG LWIP_DBG_OFF
|
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/*
|
|
|
|
--------------------------------------
|
|
|
|
------------ SNTP options ------------
|
|
|
|
--------------------------------------
|
|
|
|
*/
|
2017-04-19 04:18:07 -04:00
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* Max number of SNTP servers handled (default equal to LWIP_DHCP_MAX_NTP_SERVERS)
|
2017-04-19 04:18:07 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_SNTP_MAX_SERVERS
|
|
|
|
#define SNTP_MAX_SERVERS CONFIG_LWIP_SNTP_MAX_SERVERS
|
|
|
|
#endif /* CONFIG_LWIP_SNTP_MAX_SERVERS */
|
2016-11-28 05:36:14 -05:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/** Set this to 1 to support DNS names (or IP address strings) to set sntp servers
|
|
|
|
* One server address/name can be defined as default if SNTP_SERVER_DNS == 1:
|
|
|
|
* \#define SNTP_SERVER_ADDRESS "pool.ntp.org"
|
2017-10-03 01:56:55 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define SNTP_SERVER_DNS 1
|
2017-10-03 01:56:55 -04:00
|
|
|
|
|
|
|
/**
|
2021-09-17 06:36:16 -04:00
|
|
|
* It disables a check of SNTP_UPDATE_DELAY it is done in sntp_set_sync_interval
|
2017-10-03 01:56:55 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#define SNTP_SUPPRESS_DELAY_CHECK
|
2021-04-08 05:58:50 -04:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
#define SNTP_UPDATE_DELAY (sntp_get_sync_interval())
|
|
|
|
#define SNTP_SET_SYSTEM_TIME_US(sec, us) (sntp_set_system_time(sec, us))
|
|
|
|
#define SNTP_GET_SYSTEM_TIME(sec, us) (sntp_get_system_time(&(sec), &(us)))
|
2021-06-22 02:33:58 -04:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/*
|
|
|
|
---------------------------------------
|
|
|
|
--------- ESP specific options --------
|
|
|
|
---------------------------------------
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* ESP_LWIP_IGMP_TIMERS_ONDEMAND==1: Start IGMP timers only if used
|
|
|
|
* ESP_LWIP_MLD6_TIMERS_ONDEMAND==1: Start MLD6 timers only if used
|
|
|
|
* Timers will only be activated when joining groups/receiving queries
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_TIMERS_ONDEMAND
|
|
|
|
#define ESP_LWIP_IGMP_TIMERS_ONDEMAND 1
|
|
|
|
#define ESP_LWIP_MLD6_TIMERS_ONDEMAND 1
|
2022-03-29 12:19:31 -04:00
|
|
|
#define LWIP_NUM_SYS_TIMEOUT_INTERNAL_WOUT_IGMP_MLD6 (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_DNS + PPP_NUM_TIMEOUTS + (LWIP_IPV6 * (1 + LWIP_IPV6_REASS)))
|
|
|
|
#define MEMP_NUM_SYS_TIMEOUT LWIP_NUM_SYS_TIMEOUT_INTERNAL_WOUT_IGMP_MLD6
|
2021-09-17 06:36:16 -04:00
|
|
|
#else
|
|
|
|
#define ESP_LWIP_IGMP_TIMERS_ONDEMAND 0
|
|
|
|
#define ESP_LWIP_MLD6_TIMERS_ONDEMAND 0
|
|
|
|
#endif
|
2021-08-19 13:49:52 -04:00
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* ESP_GRATUITOUS_ARP==1: This option allows to send gratuitous ARP periodically.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LWIP_ESP_GRATUITOUS_ARP
|
|
|
|
#define ESP_GRATUITOUS_ARP 1
|
|
|
|
#define ESP_GRATUITOUS_ARP_INTERVAL (CONFIG_LWIP_GARP_TMR_INTERVAL*1000UL)
|
|
|
|
#else
|
|
|
|
#define ESP_GRATUITOUS_ARP 0
|
|
|
|
#endif
|
2016-10-27 02:11:01 -04:00
|
|
|
|
|
|
|
#define ESP_LWIP 1
|
2016-11-21 01:09:52 -05:00
|
|
|
#define ESP_LWIP_ARP 1
|
2018-09-06 07:43:08 -04:00
|
|
|
#define ESP_PER_SOC_TCP_WND 0
|
2016-10-27 02:11:01 -04:00
|
|
|
#define ESP_THREAD_SAFE 1
|
|
|
|
#define ESP_THREAD_SAFE_DEBUG LWIP_DBG_OFF
|
|
|
|
#define ESP_DHCP 1
|
|
|
|
#define ESP_DNS 1
|
2017-04-05 03:21:55 -04:00
|
|
|
#define ESP_STATS_TCP 0
|
|
|
|
#define ESP_LWIP_LOGI(...) ESP_LOGI("lwip", __VA_ARGS__)
|
2017-06-14 23:37:23 -04:00
|
|
|
#define ESP_PING 1
|
2018-05-24 07:47:00 -04:00
|
|
|
#define ESP_HAS_SELECT 1
|
2019-06-27 05:13:44 -04:00
|
|
|
#define ESP_IP4_ROUTE 1
|
|
|
|
#define ESP_AUTO_IP 1
|
|
|
|
#define ESP_PBUF 1
|
|
|
|
#define ESP_PPP 1
|
2021-01-18 06:13:22 -05:00
|
|
|
#define ESP_IPV6 LWIP_IPV6
|
2019-06-27 05:13:44 -04:00
|
|
|
#define ESP_SOCKET 1
|
2019-08-14 23:17:15 -04:00
|
|
|
#define ESP_LWIP_SELECT 1
|
2019-11-29 01:26:50 -05:00
|
|
|
#define ESP_LWIP_LOCK 1
|
2021-03-16 03:03:09 -04:00
|
|
|
#define ESP_THREAD_PROTECTION 1
|
2022-03-17 07:51:00 -04:00
|
|
|
#define LWIP_SUPPORT_CUSTOM_PBUF 1
|
2016-10-27 02:11:01 -04:00
|
|
|
|
2019-06-17 03:44:25 -04:00
|
|
|
/*
|
2021-09-17 06:36:16 -04:00
|
|
|
-----------------------------------------
|
|
|
|
---------- DHCP Server options ----------
|
|
|
|
-----------------------------------------
|
2019-06-17 03:44:25 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
/**
|
|
|
|
* ESP_DHCPS==1: Enable the DHCP server
|
2019-06-27 05:13:44 -04:00
|
|
|
*/
|
2021-09-17 06:36:16 -04:00
|
|
|
#ifdef CONFIG_LWIP_DHCPS
|
|
|
|
#define ESP_DHCPS 1
|
2022-01-19 13:50:49 -05:00
|
|
|
#define ESP_DHCPS_TIMER 0
|
2021-09-17 06:36:16 -04:00
|
|
|
#else
|
|
|
|
#define ESP_DHCPS 0
|
|
|
|
#define ESP_DHCPS_TIMER 0
|
|
|
|
#endif /* CONFIG_LWIP_DHCPS */
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
|
2022-03-17 07:20:28 -04:00
|
|
|
#if LWIP_NETCONN_SEM_PER_THREAD
|
|
|
|
#if ESP_THREAD_SAFE
|
|
|
|
#define LWIP_NETCONN_THREAD_SEM_GET() sys_thread_sem_get()
|
|
|
|
#define LWIP_NETCONN_THREAD_SEM_ALLOC() sys_thread_sem_init()
|
|
|
|
#define LWIP_NETCONN_THREAD_SEM_FREE() sys_thread_sem_deinit()
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2022-03-17 07:46:35 -04:00
|
|
|
/**
|
|
|
|
* If CONFIG_ALLOC_MEMORY_IN_SPIRAM_FIRST is enabled, Try to
|
|
|
|
* allocate memory for lwip in SPIRAM firstly. If failed, try to allocate
|
|
|
|
* internal memory then.
|
|
|
|
*/
|
2022-06-02 10:25:20 -04:00
|
|
|
#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
|
2022-03-17 07:46:35 -04:00
|
|
|
#define mem_clib_malloc(size) heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
|
|
|
|
#define mem_clib_calloc(n, size) heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
|
2022-06-02 10:25:20 -04:00
|
|
|
#else /* !CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP */
|
2022-03-17 07:46:35 -04:00
|
|
|
#define mem_clib_malloc malloc
|
|
|
|
#define mem_clib_calloc calloc
|
2022-06-02 10:25:20 -04:00
|
|
|
#endif /* CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP */
|
2022-03-17 07:46:35 -04:00
|
|
|
|
2022-03-31 05:51:56 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-09-17 06:36:16 -04:00
|
|
|
#endif /* LWIP_HDR_ESP_LWIPOPTS_H */
|