mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
IPv6 on esp8266-nonos-sdk and arduino (#5136)
This commit is contained in:
@ -951,19 +951,27 @@ macros = {
|
||||
( '.menu.ip.lm2f', 'v2 Lower Memory' ),
|
||||
( '.menu.ip.lm2f.build.lwip_include', 'lwip2/include' ),
|
||||
( '.menu.ip.lm2f.build.lwip_lib', '-llwip2-536-feat' ),
|
||||
( '.menu.ip.lm2f.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1' ),
|
||||
( '.menu.ip.lm2f.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0' ),
|
||||
( '.menu.ip.hb2f', 'v2 Higher Bandwidth' ),
|
||||
( '.menu.ip.hb2f.build.lwip_include', 'lwip2/include' ),
|
||||
( '.menu.ip.hb2f.build.lwip_lib', '-llwip2-1460-feat' ),
|
||||
( '.menu.ip.hb2f.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1' ),
|
||||
( '.menu.ip.hb2f.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0' ),
|
||||
( '.menu.ip.lm2n', 'v2 Lower Memory (no features)' ),
|
||||
( '.menu.ip.lm2n.build.lwip_include', 'lwip2/include' ),
|
||||
( '.menu.ip.lm2n.build.lwip_lib', '-llwip2-536' ),
|
||||
( '.menu.ip.lm2n.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0' ),
|
||||
( '.menu.ip.lm2n.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0' ),
|
||||
( '.menu.ip.hb2n', 'v2 Higher Bandwidth (no features)' ),
|
||||
( '.menu.ip.hb2n.build.lwip_include', 'lwip2/include' ),
|
||||
( '.menu.ip.hb2n.build.lwip_lib', '-llwip2-1460' ),
|
||||
( '.menu.ip.hb2n.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0' ),
|
||||
( '.menu.ip.hb2n.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0' ),
|
||||
( '.menu.ip.lm6f', 'v2 IPv6 Lower Memory' ),
|
||||
( '.menu.ip.lm6f.build.lwip_include', 'lwip2/include' ),
|
||||
( '.menu.ip.lm6f.build.lwip_lib', '-llwip6-536-feat' ),
|
||||
( '.menu.ip.lm6f.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1' ),
|
||||
( '.menu.ip.hb6f', 'v2 IPv6 Higher Bandwidth' ),
|
||||
( '.menu.ip.hb6f.build.lwip_include', 'lwip2/include' ),
|
||||
( '.menu.ip.hb6f.build.lwip_lib', '-llwip6-1460-feat' ),
|
||||
( '.menu.ip.hb6f.build.lwip_flags', '-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1' ),
|
||||
]),
|
||||
|
||||
'lwip': collections.OrderedDict([
|
||||
|
@ -140,28 +140,40 @@ if "PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH" in flatten_cppdefines:
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip", "include")],
|
||||
LIBS=["lwip_gcc"]
|
||||
)
|
||||
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 536), ("LWIP_FEATURES", 1), ("LWIP_IPV6", 1)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip6-536-feat"]
|
||||
)
|
||||
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 1460), ("LWIP_FEATURES", 1), ("LWIP_IPV6", 1)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip6-1460-feat"]
|
||||
)
|
||||
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 1460), ("LWIP_FEATURES", 1)],
|
||||
CPPDEFINES=[("TCP_MSS", 1460), ("LWIP_FEATURES", 1), ("LWIP_IPV6", 0)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip2-1460-feat"]
|
||||
)
|
||||
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 536), ("LWIP_FEATURES", 0)],
|
||||
CPPDEFINES=[("TCP_MSS", 536), ("LWIP_FEATURES", 0), ("LWIP_IPV6", 0)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip2-536"]
|
||||
)
|
||||
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 1460), ("LWIP_FEATURES", 0)],
|
||||
CPPDEFINES=[("TCP_MSS", 1460), ("LWIP_FEATURES", 0), ("LWIP_IPV6", 0)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip2-1460"]
|
||||
)
|
||||
# PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY (default)
|
||||
else:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 536), ("LWIP_FEATURES", 1)],
|
||||
CPPDEFINES=[("TCP_MSS", 536), ("LWIP_FEATURES", 1), ("LWIP_IPV6", 0)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip2-536-feat"]
|
||||
)
|
||||
|
@ -432,21 +432,21 @@ sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *optarg);
|
||||
* TypedefName : dns_found_callback
|
||||
* Description : Callback which is invoked when a hostname is found.
|
||||
* Parameters : name -- pointer to the name that was looked up.
|
||||
* ipaddr -- pointer to an ip_addr_t containing the IP address of
|
||||
* ipaddr -- pointer to an ipv4_addr_t containing the IP address of
|
||||
* the hostname, or NULL if the name could not be found (or on any
|
||||
* other error).
|
||||
* callback_arg -- a user-specified callback argument passed to
|
||||
* dns_gethostbyname
|
||||
*******************************************************************************/
|
||||
|
||||
typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg);
|
||||
typedef void (*dns_found_callback)(const char *name, ipv4_addr_t *ipaddr, void *callback_arg);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_gethostbyname
|
||||
* Description : Resolve a hostname (string) into an IP address.
|
||||
* Parameters : pespconn -- espconn to resolve a hostname
|
||||
* hostname -- the hostname that is to be queried
|
||||
* addr -- pointer to a ip_addr_t where to store the address if
|
||||
* addr -- pointer to a ipv4_addr_t where to store the address if
|
||||
* it is already cached in the dns_table (only valid if ESPCONN_OK
|
||||
* is returned!)
|
||||
* found -- a callback function to be called on success, failure
|
||||
@ -459,7 +459,7 @@ typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *ca
|
||||
* - ESPCONN_ARG: dns client not initialized or invalid hostname
|
||||
*******************************************************************************/
|
||||
|
||||
err_t espconn_gethostbyname(struct espconn *pespconn, const char *hostname, ip_addr_t *addr, dns_found_callback found);
|
||||
err_t espconn_gethostbyname(struct espconn *pespconn, const char *hostname, ipv4_addr_t *addr, dns_found_callback found);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_abort
|
||||
@ -623,7 +623,7 @@ sint8 espconn_secure_delete(struct espconn *espconn);
|
||||
* multicast_ip -- multicast ip given by user
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
|
||||
sint8 espconn_igmp_join(ipv4_addr_t *host_ip, ipv4_addr_t *multicast_ip);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_igmp_leave
|
||||
@ -632,7 +632,7 @@ sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
|
||||
* multicast_ip -- multicast ip given by user
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
|
||||
sint8 espconn_igmp_leave(ipv4_addr_t *host_ip, ipv4_addr_t *multicast_ip);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_recv_hold
|
||||
@ -738,7 +738,7 @@ void espconn_mdns_enable(void);
|
||||
* dnsserver -- IP address of the DNS server to set
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_dns_setserver(uint8 numdns, ip_addr_t *dnsserver);
|
||||
void espconn_dns_setserver(uint8 numdns, ipv4_addr_t *dnsserver);
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_dns_getserver
|
||||
* Description : get dns server.
|
||||
@ -746,7 +746,7 @@ void espconn_dns_setserver(uint8 numdns, ip_addr_t *dnsserver);
|
||||
* be < DNS_MAX_SERVERS = 2
|
||||
* Returns : dnsserver -- IP address of the DNS server to set
|
||||
*******************************************************************************/
|
||||
ip_addr_t espconn_dns_getserver(uint8 numdns);
|
||||
ipv4_addr_t espconn_dns_getserver(uint8 numdns);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -31,16 +31,16 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ip_addr {
|
||||
struct ipv4_addr {
|
||||
uint32 addr;
|
||||
};
|
||||
|
||||
typedef struct ip_addr ip_addr_t;
|
||||
typedef struct ipv4_addr ipv4_addr_t;
|
||||
|
||||
struct ip_info {
|
||||
struct ip_addr ip;
|
||||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
struct ipv4_addr ip;
|
||||
struct ipv4_addr netmask;
|
||||
struct ipv4_addr gw;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -51,7 +51,7 @@ struct ip_info {
|
||||
* @arg mask network identifier mask
|
||||
* @return !0 if the network identifiers of both address match
|
||||
*/
|
||||
#define ip_addr_netcmp(addr1, addr2, mask) (((addr1)->addr & \
|
||||
#define ipv4_addr_netcmp(addr1, addr2, mask) (((addr1)->addr & \
|
||||
(mask)->addr) == \
|
||||
((addr2)->addr & \
|
||||
(mask)->addr))
|
||||
@ -64,15 +64,15 @@ struct ip_info {
|
||||
((uint32)((b) & 0xff) << 8) | \
|
||||
(uint32)((a) & 0xff)
|
||||
|
||||
#define ip4_addr1(ipaddr) (((uint8*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((uint8*)(ipaddr))[1])
|
||||
#define ip4_addr3(ipaddr) (((uint8*)(ipaddr))[2])
|
||||
#define ip4_addr4(ipaddr) (((uint8*)(ipaddr))[3])
|
||||
#define ipv4_addr1(ipaddr) (((uint8*)(ipaddr))[0])
|
||||
#define ipv4_addr2(ipaddr) (((uint8*)(ipaddr))[1])
|
||||
#define ipv4_addr3(ipaddr) (((uint8*)(ipaddr))[2])
|
||||
#define ipv4_addr4(ipaddr) (((uint8*)(ipaddr))[3])
|
||||
|
||||
#define ip4_addr1_16(ipaddr) ((uint16)ip4_addr1(ipaddr))
|
||||
#define ip4_addr2_16(ipaddr) ((uint16)ip4_addr2(ipaddr))
|
||||
#define ip4_addr3_16(ipaddr) ((uint16)ip4_addr3(ipaddr))
|
||||
#define ip4_addr4_16(ipaddr) ((uint16)ip4_addr4(ipaddr))
|
||||
#define ipv4_addr1_16(ipaddr) ((uint16)ipv4_addr1(ipaddr))
|
||||
#define ipv4_addr2_16(ipaddr) ((uint16)ipv4_addr2(ipaddr))
|
||||
#define ipv4_addr3_16(ipaddr) ((uint16)ipv4_addr3(ipaddr))
|
||||
#define ipv4_addr4_16(ipaddr) ((uint16)ipv4_addr4(ipaddr))
|
||||
|
||||
|
||||
/** 255.255.255.255 */
|
||||
@ -81,10 +81,10 @@ struct ip_info {
|
||||
#define IPADDR_ANY ((uint32)0x00000000UL)
|
||||
uint32 ipaddr_addr(const char *cp);
|
||||
|
||||
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
|
||||
ip4_addr2_16(ipaddr), \
|
||||
ip4_addr3_16(ipaddr), \
|
||||
ip4_addr4_16(ipaddr)
|
||||
#define IP2STR(ipaddr) ipv4_addr1_16(ipaddr), \
|
||||
ipv4_addr2_16(ipaddr), \
|
||||
ipv4_addr3_16(ipaddr), \
|
||||
ipv4_addr4_16(ipaddr)
|
||||
|
||||
#define IPSTR "%d.%d.%d.%d"
|
||||
|
||||
|
@ -1,342 +0,0 @@
|
||||
/*
|
||||
* ESPRESSIF MIT License
|
||||
*
|
||||
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
|
||||
*
|
||||
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
|
||||
* it is free of charge, to any person obtaining a copy of this software and associated
|
||||
* documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef __LWIP_API_MESH_H__
|
||||
#define __LWIP_API_MESH_H__
|
||||
|
||||
#include "ip_addr.h"
|
||||
#include "user_interface.h"
|
||||
#include "espconn.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_MESH_GROUP_ID_LEN (6)
|
||||
|
||||
typedef void (* espconn_mesh_callback)();
|
||||
typedef void (* espconn_mesh_scan_callback)(void *arg, int8_t status);
|
||||
|
||||
enum mesh_type {
|
||||
MESH_CLOSE = 0,
|
||||
MESH_LOCAL,
|
||||
MESH_ONLINE,
|
||||
MESH_NONE = 0xFF
|
||||
};
|
||||
/** \defgroup Mesh_APIs Mesh APIs
|
||||
* @brief Mesh APIs
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/** @addtogroup Mesh_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum mesh_status {
|
||||
MESH_DISABLE = 0,
|
||||
MESH_WIFI_CONN,
|
||||
MESH_NET_CONN,
|
||||
MESH_LOCAL_AVAIL,
|
||||
MESH_ONLINE_AVAIL
|
||||
};
|
||||
|
||||
enum mesh_node_type {
|
||||
MESH_NODE_PARENT = 0,
|
||||
MESH_NODE_CHILD,
|
||||
MESH_NODE_ALL
|
||||
};
|
||||
|
||||
struct mesh_scan_para_type {
|
||||
espconn_mesh_scan_callback usr_scan_cb; // scan done callback
|
||||
uint8_t grp_id[ESP_MESH_GROUP_ID_LEN]; // group id
|
||||
bool grp_set; // group set
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check whether the IP address is mesh local IP address or not.
|
||||
*
|
||||
* @attention 1. The range of mesh local IP address is 2.255.255.* ~ max_hop.255.255.*.
|
||||
* @attention 2. IP pointer should not be NULL. If the IP pointer is NULL, it will return false.
|
||||
*
|
||||
* @param struct ip_addr *ip : IP address
|
||||
*
|
||||
* @return true : the IP address is mesh local IP address
|
||||
* @return false : the IP address is not mesh local IP address
|
||||
*/
|
||||
bool espconn_mesh_local_addr(struct ip_addr *ip);
|
||||
|
||||
/**
|
||||
* @brief Get the information of router used by mesh network.
|
||||
*
|
||||
* @attention 1. The function should be called after mesh_enable_done
|
||||
*
|
||||
* @param struct station_config *router: router inforamtion
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_get_router(struct station_config *router);
|
||||
|
||||
/**
|
||||
* @brief Set the information of router used by mesh network.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param struct station_config *router: router information.
|
||||
* user should initialize the ssid and password.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_router(struct station_config *router);
|
||||
|
||||
/**
|
||||
* @brief Set server setup by user.
|
||||
*
|
||||
* @attention If users wants to use themself server, they use the function.
|
||||
* but the function must be called before espconn_mesh_enable.
|
||||
* at the same time, users need to implement the server.
|
||||
*
|
||||
* @param struct ip_addr *ip : ip address of server.
|
||||
* @param uint16_t port : port used by server.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_server_init(struct ip_addr *ip, uint16_t port);
|
||||
|
||||
/**
|
||||
* @brief Get the information of mesh node.
|
||||
*
|
||||
* @param enum mesh_node_type typ : mesh node type.
|
||||
* @param uint8_t **info : the information will be saved in *info.
|
||||
* @param uint8_t *count : the node count in *info.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_get_node_info(enum mesh_node_type type,
|
||||
uint8_t **info, uint8_t *count);
|
||||
|
||||
/**
|
||||
* @brief Set WiFi cryption algrithm and password for mesh node.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param AUTH_MODE mode : cryption algrithm (WPA/WAP2/WPA_WPA2).
|
||||
* @param uint8_t *passwd : password of WiFi.
|
||||
* @param uint8_t passwd_len : length of password (8 <= passwd_len <= 64).
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_encrypt_init(AUTH_MODE mode, uint8_t *passwd, uint8_t passwd_len);
|
||||
/**
|
||||
* @brief Set prefix of SSID for mesh node.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param uint8_t *prefix : prefix of SSID.
|
||||
* @param uint8_t prefix_len : length of prefix (0 < passwd_len <= 22).
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_ssid_prefix(uint8_t *prefix, uint8_t prefix_len);
|
||||
|
||||
/**
|
||||
* @brief Set max hop for mesh network.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param uint8_t max_hops : max hop of mesh network (1 <= max_hops < 10, 4 is recommended).
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_max_hops(uint8_t max_hops);
|
||||
|
||||
/**
|
||||
* @brief Set group ID of mesh node.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param uint8_t *grp_id : group ID.
|
||||
* @param uint16_t gid_len: length of group ID, now gid_len = 6.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_group_id_init(uint8_t *grp_id, uint16_t gid_len);
|
||||
|
||||
/**
|
||||
* @brief Set the curent device type.
|
||||
*
|
||||
* @param uint8_t dev_type : device type of mesh node
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_dev_type(uint8_t dev_type);
|
||||
/**
|
||||
* @brief Get the curent device type.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return device type
|
||||
*/
|
||||
uint8_t espconn_mesh_get_dev_type();
|
||||
|
||||
/**
|
||||
* @brief Try to establish mesh connection to server.
|
||||
*
|
||||
* @attention If espconn_mesh_connect fail, returns non-0 value, there is no connection, so it
|
||||
* won't enter any espconn callback.
|
||||
*
|
||||
* @param struct espconn *usr_esp : the network connection structure, the usr_esp to
|
||||
* listen to the connection
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_RTE - Routing Problem
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ISCONN - Already connected
|
||||
* - ESPCONN_ARG - Illegal argument, can't find the corresponding connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
int8_t espconn_mesh_connect(struct espconn *usr_esp);
|
||||
|
||||
/**
|
||||
* @brief Disconnect a mesh connection.
|
||||
*
|
||||
* @attention Do not call this API in any espconn callback. If needed, please use system
|
||||
* task to trigger espconn_mesh_disconnect.
|
||||
*
|
||||
* @param struct espconn *usr_esp : the network connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
|
||||
int8_t espconn_mesh_disconnect(struct espconn *usr_esp);
|
||||
|
||||
/**
|
||||
* @brief Get current mesh status.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return the current mesh status, please refer to enum mesh_status.
|
||||
*/
|
||||
int8_t espconn_mesh_get_status();
|
||||
|
||||
/**
|
||||
* @brief Send data through mesh network.
|
||||
*
|
||||
* @attention Please call espconn_mesh_sent after espconn_sent_callback of the pre-packet.
|
||||
*
|
||||
* @param struct espconn *usr_esp : the network connection structure
|
||||
* @param uint8 *pdata : pointer of data
|
||||
* @param uint16 len : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - out of memory
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding network transmission
|
||||
* according to structure espconn
|
||||
* - ESPCONN_MAXNUM - buffer of sending data is full
|
||||
* - ESPCONN_IF - send UDP data fail
|
||||
*/
|
||||
int8_t espconn_mesh_sent(struct espconn *usr_esp, uint8 *pdata, uint16 len);
|
||||
|
||||
/**
|
||||
* @brief Get max hop of mesh network.
|
||||
*
|
||||
* @param null.
|
||||
*
|
||||
* @return the current max hop of mesh
|
||||
*/
|
||||
uint8_t espconn_mesh_get_max_hops();
|
||||
|
||||
/**
|
||||
* @brief To enable mesh network.
|
||||
*
|
||||
* @attention 1. the function should be called in user_init.
|
||||
* @attention 2. if mesh node can not scan the mesh AP, it will be isolate node without trigger enable_cb.
|
||||
* user can use espconn_mesh_get_status to get current status of node.
|
||||
* @attention 3. if user try to enable online mesh, but node fails to establish mesh connection
|
||||
* the node will work with local mesh.
|
||||
*
|
||||
* @param espconn_mesh_callback enable_cb : callback function of mesh-enable
|
||||
* @param enum mesh_type type : type of mesh, local or online.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_enable(espconn_mesh_callback enable_cb, enum mesh_type type);
|
||||
|
||||
/**
|
||||
* @brief To disable mesh network.
|
||||
*
|
||||
* @attention When mesh network is disabed, the system will trigger disable_cb.
|
||||
*
|
||||
* @param espconn_mesh_callback disable_cb : callback function of mesh-disable
|
||||
* @param enum mesh_type type : type of mesh, local or online.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_disable(espconn_mesh_callback disable_cb);
|
||||
|
||||
/**
|
||||
* @brief To print version of mesh.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_print_ver();
|
||||
|
||||
/**
|
||||
* @brief To get AP around node.
|
||||
*
|
||||
* @attention User can get normal AP or mesh AP using the function.
|
||||
* If user plans to get normal AP, he/she needs to clear grp_set flag in para.
|
||||
* If user plans to get mesh AP, he/she needs to set grp_set and grp_id;
|
||||
*
|
||||
* @param struct mesh_scan_para_type *para : callback function of mesh-disable
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_scan(struct mesh_scan_para_type *para);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -2,10 +2,14 @@
|
||||
#define __SNTP_H__
|
||||
|
||||
#include "os_type.h"
|
||||
#ifdef LWIP_OPEN_SRC
|
||||
|
||||
#include "lwip/init.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
#if LWIP_VERSION_MAJOR == 1
|
||||
#define ipv4_addr_t ip_addr_t
|
||||
#else
|
||||
#include "ip_addr.h"
|
||||
typedef struct ip4_addr ipv4_addr_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -43,15 +47,15 @@ void sntp_stop(void);
|
||||
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS
|
||||
* @param dnsserver IP address of the NTP server to set
|
||||
*/
|
||||
void sntp_setserver(unsigned char idx, ip_addr_t *addr);
|
||||
void sntp_setserver(unsigned char idx, ipv4_addr_t *addr);
|
||||
/**
|
||||
* Obtain one of the currently configured by IP address (or DHCP) NTP servers
|
||||
*
|
||||
* @param numdns the index of the NTP server
|
||||
* @return IP address of the indexed NTP server or "ip_addr_any" if the NTP
|
||||
* @return IP address of the indexed NTP server or "ipv4_addr_any" if the NTP
|
||||
* server has not been configured by address (or at all).
|
||||
*/
|
||||
ip_addr_t sntp_getserver(unsigned char idx);
|
||||
ipv4_addr_t sntp_getserver(unsigned char idx);
|
||||
/**
|
||||
* Initialize one of the NTP servers by name
|
||||
*
|
||||
|
@ -27,9 +27,18 @@
|
||||
|
||||
#include "os_type.h"
|
||||
#ifdef LWIP_OPEN_SRC
|
||||
|
||||
#include "lwip/init.h"
|
||||
#if LWIP_VERSION_MAJOR == 1
|
||||
#define ipv4_addr ip_addr
|
||||
#endif
|
||||
#include "lwip/ip_addr.h"
|
||||
#if LWIP_VERSION_MAJOR != 1
|
||||
typedef struct ip4_addr ipv4_addr_t;
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include "ip_addr.h"
|
||||
#error LWIP_OPEN_SRC must be defined
|
||||
#endif
|
||||
|
||||
#include "queue.h"
|
||||
@ -356,13 +365,13 @@ struct station_info {
|
||||
STAILQ_ENTRY(station_info) next;
|
||||
|
||||
uint8 bssid[6];
|
||||
struct ip_addr ip;
|
||||
struct ipv4_addr ip;
|
||||
};
|
||||
|
||||
struct dhcps_lease {
|
||||
bool enable;
|
||||
struct ip_addr start_ip;
|
||||
struct ip_addr end_ip;
|
||||
struct ipv4_addr start_ip;
|
||||
struct ipv4_addr end_ip;
|
||||
};
|
||||
|
||||
enum dhcps_offer_option{
|
||||
@ -519,9 +528,9 @@ typedef struct {
|
||||
} Event_StaMode_AuthMode_Change_t;
|
||||
|
||||
typedef struct {
|
||||
struct ip_addr ip;
|
||||
struct ip_addr mask;
|
||||
struct ip_addr gw;
|
||||
struct ipv4_addr ip;
|
||||
struct ipv4_addr mask;
|
||||
struct ipv4_addr gw;
|
||||
} Event_StaMode_Got_IP_t;
|
||||
|
||||
typedef struct {
|
||||
@ -531,7 +540,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint8 mac[6];
|
||||
struct ip_addr ip;
|
||||
struct ipv4_addr ip;
|
||||
uint8 aid;
|
||||
} Event_SoftAPMode_Distribute_Sta_IP_t;
|
||||
|
||||
|
@ -114,6 +114,8 @@ SECTIONS
|
||||
*liblwip2-1460.a:(.literal .text .literal.* .text.*)
|
||||
*liblwip2-536-feat.a:(.literal .text .literal.* .text.*)
|
||||
*liblwip2-1460-feat.a:(.literal .text .literal.* .text.*)
|
||||
*liblwip6-536-feat.a:(.literal .text .literal.* .text.*)
|
||||
*liblwip6-1460-feat.a:(.literal .text .literal.* .text.*)
|
||||
*libbearssl.a:(.literal .text .literal.* .text.*)
|
||||
*libaxtls.a:(.literal .text .literal.* .text.*)
|
||||
*libat.a:(.literal.* .text.*)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tools/sdk/lib/liblwip6-1460-feat.a
Normal file
BIN
tools/sdk/lib/liblwip6-1460-feat.a
Normal file
Binary file not shown.
BIN
tools/sdk/lib/liblwip6-536-feat.a
Normal file
BIN
tools/sdk/lib/liblwip6-536-feat.a
Normal file
Binary file not shown.
Submodule tools/sdk/lwip2/builder updated: 80224f017d...fab2c912f3
@ -90,14 +90,14 @@ typedef uint32_t sys_prot_t; // not really used
|
||||
ip4_addr3_16(ipaddr), \
|
||||
ip4_addr4_16(ipaddr)
|
||||
|
||||
// ip_addr / ip_info: do not exist in lwip2 (only in lwip1.4)
|
||||
struct ip_addr {
|
||||
// ipv4_addr / ip_info: do not exist in lwip2 (only in lwip1.4)
|
||||
struct ipv4_addr {
|
||||
uint32_t addr;
|
||||
};
|
||||
struct ip_info {
|
||||
struct ip_addr ip;
|
||||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
struct ipv4_addr ip;
|
||||
struct ipv4_addr netmask;
|
||||
struct ipv4_addr gw;
|
||||
};
|
||||
|
||||
///////////////////////////////
|
||||
|
@ -24,8 +24,8 @@
|
||||
|
||||
#if ULWIPDEBUG
|
||||
//#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
|
||||
//#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH)
|
||||
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON)
|
||||
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH)
|
||||
//#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON)
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1,5 +1,5 @@
|
||||
// generated by makefiles/make-lwip2-hash
|
||||
#ifndef LWIP_HASH_H
|
||||
#define LWIP_HASH_H
|
||||
#define LWIP_HASH_STR "STABLE-2_1_0_RELEASE/glue:arduino-2.4.2-13-g80224f0"
|
||||
#define LWIP_HASH_STR "STABLE-2_1_2_RELEASE/glue:1.0"
|
||||
#endif // LWIP_HASH_H
|
||||
|
@ -83,14 +83,14 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define lwip_htons(x) (x)
|
||||
#define lwip_ntohs(x) (x)
|
||||
#define lwip_htonl(x) (x)
|
||||
#define lwip_ntohl(x) (x)
|
||||
#define PP_HTONS(x) (x)
|
||||
#define PP_NTOHS(x) (x)
|
||||
#define PP_HTONL(x) (x)
|
||||
#define PP_NTOHL(x) (x)
|
||||
#define lwip_htons(x) ((u16_t)(x))
|
||||
#define lwip_ntohs(x) ((u16_t)(x))
|
||||
#define lwip_htonl(x) ((u32_t)(x))
|
||||
#define lwip_ntohl(x) ((u32_t)(x))
|
||||
#define PP_HTONS(x) ((u16_t)(x))
|
||||
#define PP_NTOHS(x) ((u16_t)(x))
|
||||
#define PP_HTONL(x) ((u32_t)(x))
|
||||
#define PP_NTOHL(x) ((u32_t)(x))
|
||||
#else /* BYTE_ORDER != BIG_ENDIAN */
|
||||
#ifndef lwip_htons
|
||||
u16_t lwip_htons(u16_t x);
|
||||
|
@ -49,14 +49,6 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Define LWIP_ERR_T in cc.h if you want to use
|
||||
* a different type for your platform (must be signed). */
|
||||
#ifdef LWIP_ERR_T
|
||||
typedef LWIP_ERR_T err_t;
|
||||
#else /* LWIP_ERR_T */
|
||||
typedef s8_t err_t;
|
||||
#endif /* LWIP_ERR_T*/
|
||||
|
||||
/** Definitions for error constants. */
|
||||
typedef enum {
|
||||
/** No error, everything OK. */
|
||||
@ -96,6 +88,14 @@ typedef enum {
|
||||
ERR_ARG = -16
|
||||
} err_enum_t;
|
||||
|
||||
/** Define LWIP_ERR_T in cc.h if you want to use
|
||||
* a different type for your platform (must be signed). */
|
||||
#ifdef LWIP_ERR_T
|
||||
typedef LWIP_ERR_T err_t;
|
||||
#else /* LWIP_ERR_T */
|
||||
typedef s8_t err_t;
|
||||
#endif /* LWIP_ERR_T*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -54,7 +54,7 @@ extern "C" {
|
||||
/** x.X.x: Minor version of the stack */
|
||||
#define LWIP_VERSION_MINOR 1
|
||||
/** x.x.X: Revision of the stack */
|
||||
#define LWIP_VERSION_REVISION 0
|
||||
#define LWIP_VERSION_REVISION 2
|
||||
/** For release candidates, this is set to 1..254
|
||||
* For official releases, this is set to 255 (LWIP_RC_RELEASE)
|
||||
* For development versions (Git), this is set to 0 (LWIP_RC_DEVELOPMENT) */
|
||||
|
@ -2378,7 +2378,7 @@
|
||||
* LWIP_IPV6==1: Enable IPv6
|
||||
*/
|
||||
#if !defined LWIP_IPV6 || defined __DOXYGEN__
|
||||
#define LWIP_IPV6 0
|
||||
#error LWIP_IPV6 must be defined
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -3531,7 +3531,7 @@
|
||||
*/
|
||||
|
||||
#ifndef LWIP_FEATURES
|
||||
#error LWIP_FEATURES is not defined
|
||||
#error LWIP_FEATURES must be defined
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user