mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-02 16:11:41 +01:00
lwip: Support for linux target
Implement linux port layer and reuse the original FreeRTOS layer that's compiled and used on linux target as well, by means of FreeRTOS simulator.
This commit is contained in:
12
components/lwip/port/include/arpa/inet.h
Normal file
12
components/lwip/port/include/arpa/inet.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef INET_H_
|
||||
#define INET_H_
|
||||
|
||||
#include "lwip/inet.h"
|
||||
|
||||
#endif /* INET_H_ */
|
||||
25
components/lwip/port/include/debug/lwip_debug.h
Normal file
25
components/lwip/port/include/debug/lwip_debug.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _LWIP_DEBUG_H
|
||||
#define _LWIP_DEBUG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void dbg_lwip_tcp_pcb_show(void);
|
||||
void dbg_lwip_udp_pcb_show(void);
|
||||
void dbg_lwip_tcp_rxtx_show(void);
|
||||
void dbg_lwip_udp_rxtx_show(void);
|
||||
void dbg_lwip_mem_cnt_show(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _LWIP_DEBUG_H
|
||||
76
components/lwip/port/include/lwip_default_hooks.h
Normal file
76
components/lwip/port/include/lwip_default_hooks.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef LWIP_ESP_DEFAULT_HOOKS_H_
|
||||
#define LWIP_ESP_DEFAULT_HOOKS_H_
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "netif/dhcp_state.h"
|
||||
|
||||
|
||||
#ifdef ESP_IDF_LWIP_HOOK_FILENAME
|
||||
#include ESP_IDF_LWIP_HOOK_FILENAME
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT
|
||||
void lwip_init_tcp_isn(u32_t boot_time, const u8_t *secret_16_bytes);
|
||||
#endif
|
||||
#if defined(CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM) || defined(CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT)
|
||||
u32_t lwip_hook_tcp_isn(const ip_addr_t *local_ip, u16_t local_port,
|
||||
const ip_addr_t *remote_ip, u16_t remote_port);
|
||||
#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn
|
||||
#endif /* CONFIG_LWIP_HOOK_TCP_ISN... */
|
||||
|
||||
#if defined(CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM) || defined(CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT)
|
||||
struct netif *
|
||||
lwip_hook_ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest);
|
||||
|
||||
#define LWIP_HOOK_IP6_ROUTE lwip_hook_ip6_route
|
||||
#endif /* CONFIG_LWIP_HOOK_IP6_ROUTE... */
|
||||
|
||||
#if defined(CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM) || defined(CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT)
|
||||
const ip6_addr_t *lwip_hook_nd6_get_gw(struct netif *netif, const ip6_addr_t *dest);
|
||||
|
||||
#define LWIP_HOOK_ND6_GET_GW lwip_hook_nd6_get_gw
|
||||
#endif /* CONFIG_LWIP_HOOK_ND6_GET_GATEWAY... */
|
||||
|
||||
#if defined(CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM) || defined(CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT)
|
||||
int lwip_hook_netconn_external_resolve(const char *name, ip_addr_t *addr, u8_t addrtype, err_t *err);
|
||||
|
||||
#define LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE lwip_hook_netconn_external_resolve
|
||||
#endif /* CONFIG_LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE... */
|
||||
|
||||
#if defined(CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM) || defined(CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT)
|
||||
int lwip_hook_ip6_input(struct pbuf *p, struct netif *inp);
|
||||
|
||||
#define LWIP_HOOK_IP6_INPUT lwip_hook_ip6_input
|
||||
#endif /* CONFIG_LWIP_HOOK_IP6_INPUT_CUSTIOM... */
|
||||
|
||||
struct netif *
|
||||
ip4_route_src_hook(const ip4_addr_t *src,const ip4_addr_t *dest);
|
||||
|
||||
struct dhcp;
|
||||
struct netif;
|
||||
struct dhcp_msg;
|
||||
void dhcp_parse_extra_opts(struct dhcp *dhcp, uint8_t state, uint8_t option, uint8_t len, struct pbuf* p, uint16_t offset);
|
||||
|
||||
void dhcp_append_extra_opts(struct netif *netif, uint8_t state, struct dhcp_msg *msg_out, uint16_t *options_out_len);
|
||||
|
||||
int dhcp_set_vendor_class_identifier(uint8_t len, const char * str);
|
||||
int dhcp_get_vendor_specific_information(uint8_t len, char * str);
|
||||
void dhcp_free_vendor_class_identifier(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_ESP_DEFAULT_HOOKS_H_ */
|
||||
1550
components/lwip/port/include/lwipopts.h
Normal file
1550
components/lwip/port/include/lwipopts.h
Normal file
File diff suppressed because it is too large
Load Diff
29
components/lwip/port/include/netdb.h
Normal file
29
components/lwip/port/include/netdb.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @file
|
||||
* This file is a posix wrapper for lwip/netdb.h.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2001-2004 Swedish Institute of Computer Science
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* SPDX-FileContributor: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
|
||||
#include "lwip/netdb.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
int getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
|
||||
char *host, socklen_t hostlen,
|
||||
char *serv, socklen_t servlen, int flags);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
27
components/lwip/port/include/netif/dhcp_state.h
Normal file
27
components/lwip/port/include/netif/dhcp_state.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef LWIP_ESP_DHCP_STATE_H
|
||||
#define LWIP_ESP_DHCP_STATE_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "lwip/netif.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool dhcp_ip_addr_restore(struct netif *netif);
|
||||
|
||||
void dhcp_ip_addr_store(struct netif *netif);
|
||||
|
||||
void dhcp_ip_addr_erase(struct netif *netif);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_ESP_DHCP_STATE_H */
|
||||
14
components/lwip/port/include/netinet/in.h
Normal file
14
components/lwip/port/include/netinet/in.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef IN_H_
|
||||
#define IN_H_
|
||||
|
||||
#include "lwip/inet.h"
|
||||
|
||||
#define IN6_IS_ADDR_MULTICAST(a) IN_MULTICAST(a)
|
||||
|
||||
#endif /* IN_H_ */
|
||||
13
components/lwip/port/include/netinet/tcp.h
Normal file
13
components/lwip/port/include/netinet/tcp.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2016 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020 Francesco Giancane <francesco.giancane@accenture.com>
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_TCP_H
|
||||
#define _NETINET_TCP_H
|
||||
|
||||
#include "lwip/tcp.h"
|
||||
|
||||
#endif /* _NETINET_TCP_H */
|
||||
47
components/lwip/port/include/sntp/sntp_get_set_time.h
Normal file
47
components/lwip/port/include/sntp/sntp_get_set_time.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __SNTP_GET_SET_TIME_H__
|
||||
#define __SNTP_GET_SET_TIME_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Declarations of functions used in lwipopts.h to redefine
|
||||
* default sntp macros, such as:
|
||||
* - SNTP_UPDATE_DELAY()
|
||||
* - SNTP_SET_SYSTEM_TIME_US()
|
||||
* - SNTP_GET_SYSTEM_TIME()
|
||||
*/
|
||||
|
||||
/*
|
||||
* @brief Get the sync interval of SNTP operation
|
||||
* Full definition is provided in IDF's layer in esp_sntp.c
|
||||
*/
|
||||
uint32_t sntp_get_sync_interval(void);
|
||||
|
||||
/**
|
||||
* @brief system time setter used in the sntp module
|
||||
* @note The lwip sntp uses u32_t types for sec and us arguments
|
||||
*/
|
||||
void sntp_set_system_time(uint32_t sec, uint32_t us);
|
||||
|
||||
/**
|
||||
* @brief system time getter used in the sntp module
|
||||
* @note The lwip sntp uses u32_t types for sec and us arguments
|
||||
*/
|
||||
void sntp_get_system_time(uint32_t* sec, uint32_t* us);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //__SNTP_GET_SET_TIME_H__
|
||||
24
components/lwip/port/include/sockets_ext.h
Normal file
24
components/lwip/port/include/sockets_ext.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IPV6_MULTICAST_IF 0x300
|
||||
#define IPV6_MULTICAST_HOPS 0x301
|
||||
#define IPV6_MULTICAST_LOOP 0x302
|
||||
|
||||
struct lwip_sock;
|
||||
|
||||
bool lwip_setsockopt_impl_ext(struct lwip_sock* sock, int level, int optname, const void *optval, uint32_t optlen, int *err);
|
||||
bool lwip_getsockopt_impl_ext(struct lwip_sock* sock, int level, int optname, void *optval, uint32_t *optlen, int *err);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user