Skip to content

Commit

Permalink
Update to sdk 2.2
Browse files Browse the repository at this point in the history
Initial commit for
nodemcu#2225 .

Replay patches from Espressif's repository at
https://github.com/espressif/ESP8266_NONOS_SDK between tags v2.1.0 and
v2.2.0:

	0001-sync-from-ccca00f2.patch

		Superseded by existing changes, but lines reordered in app/driver/key.c
		to minimize divergences.

	0002-sync-from-3f38ad5a.patch

		Upstream files only

	0003-Update-links.patch

		Not meaningful to NodeMCU

	0004-sync-from-01990ad0.patch
	0005-sync-from-cdf6877d.patch

		Upstream files only

	0006-sync-from-f29e744c.patch

		Upstream files only, user_interface.h override non-conflicting

	0009-feat-lwip-Move-lwip-source-code-to-third_party-folde.patch

		Merged change to lwip/app/espconn_udp.c; rest is just moves or
		appears to not apply.

	0010-feat-mbedtls-Add-mbedtls-source-code-in-third_party-.patch

		Does not apply; we use our own mbedtls

	0011-added-C-support.patch

		Merged to Makefile

	0012-feat-mbedtls-Rebuild-libmbedtls.patch

		Already applied

	0013-fix-at-Fix-some-bugs-of-AT.patch

		Upstream files only

	0014-feat-err_t-Redefine-err_t-to-s32_t.patch

		Merged to app/include/arch/cc.h and ./app/include/lwip/app/espconn.h;
		the rest is upstream files.

	0015-fix-wpa-Fix-wpa-wpa2-ptk-gtk-reinstallation-vulnerab.patch
	0016-fix-wifi-Remove-group-key-entry-before-connecting-to.patch
	0017-feat-lib-Remove-time-function-in-libmain.patch

		Upstream files only

	0018-feat-espconn-Modification-for-espconn.patch

		Merged to app/include/lwip/app/espconn.h,
		app/include/lwip/app/espconn_tcp.h, app/lwip/app/espconn.c,
		app/lwip/app/espconn_tcp.c

	0019-feat-at-Use-new-espconn_recv-to-fix-tcp-server-issue.patch
	0020-feat-examples-Update-mqtt-demo-and-auto-bin-generate.patch

		Upstream files only

	0021-wifi-Add-scan-threshold-and-dwell-time.patch
	0022-feat-wifi-Add-country-code-API.patch
	0023-feat-wifi-Record-more-information-of-scanned-ap.patch

		Upstream files only, user_interface.h override non-conflicting

	0024-fix-example-Fix-IoT_Demo-user-sector-error.patch

		Upstream files only

	0025-fix-lwip-Fix-sequence-number-error-of-RST-ACK.patch

		Merged app/lwip/core/tcp_in.c

	0026-fix-mbedtls-Fix-memory-leak.patch

		Merged app/mbedtls/app/lwIPSocket.c

	0027-fix-mbedtls-Fix-call-send-callback-function-failed.patch

		Merged app/mbedtls/app/espconn_mbedtls.c

	0028-feat-Add-USE_OPTIMIZE_PRINTF-in-third_party-Makefile.patch

		Merged app/Makefile

	0029-fix-api-Fix-ets_delay_us-declaration.patch

		Upstream files only, osapi.h override non-conflicting

	0030-fix-wifi-Remove-max_tx_power-in-wifi_country_t-in-li.patch
	0031-fix-wifi-Fix-softAP-wrong-behavior-after-call-system.patch
	0032-fix-wifi-bugfix-of-scan-fail-after-connected-if-max-.patch
	0033-feat-at-Enable-scan-time-scan-type-and-add-scan-resu.patch
	0034-feat-at-Add-command-AT-CWCOUNTRY.patch
	0035-fix-at-Fix-that-AT-CIPSTART-causes-busy-if-the-serve.patch

		Upstream files only

	0036-feat-mbedtls-Speed-up-mbedtls-handshake-process.patch

		Merged app/mbedtls/app/espconn_mbedtls.c

	0037-fix-api-Fix-os_calloc-declaration.patch

		Merged app/include/lwip/mem.h; sdk-overrides/include/mem.h
		non-conflicting.

	0038-fix-mbedtls-Fix-disconnect-callback-function-never-b.patch

		Merged app/mbedtls/app/espconn_mbedtls.c; minor revision to logic in
		6576af9.  Whitespace fixes.

	0039-feat-at-Add-country-code-start-channel-in-AT-CWCOUNT.patch
	0040-fix-net80211-Fix-Null-pointer-in-ieee80211_rfid_locp.patch

		Upstream files only

	0041-feat-wifi-Add-new-esp_init_data_default-v08-bin.patch

		Upstream files only, but impacts Makefile

	0042-fix-mbedtls-Fix-load-cert-fail-when-the-private-key-.patch

		Merged app/mbedtls/app/espconn_mbedtls.c

	0043-fix-wifi-The-start-channel-can-be-any-valid-channel.patch
	0044-fix-wifi-Fix-scan-do-not-start-after-connect.patch
	0045-feat-wifi-Add-keep-connection-for-station-to-keep-co.patch
	0046-feat-at-Update-AT-version-to-1.6.0.0.patch
	0047-fix-at-Fix-GSLP-too-long-time.patch
	0048-fix-at-Fix-the-message-is-incorrect-when-creating-UD.patch
	0049-feat-at-Add-AT-CIPSERVERMAXCONN.patch

		Upstream files only

	0050-feat-system-Add-softap-distributes-station-ip-event.patch

		Upstream files only, user_interface.h override non-conflicting

	0051-feat-example-Use-libmbedtls.a-instead-of-libssl.a-in.patch

		Upstream files only

	0052-feat-mesh-Remove-mesh-support.patch

		Upstream files only, but go ahead and remove comment from
		ld/nodemcu.ld.

	0053-fix-example-Fix-forget-to-add-integer-parameter-when.patch

		Upstream files only

	0054-fix-mbedtls-Fix-reconnect_callback-is-not-triggered-.patch

		Merged app/mbedtls/app/espconn_mbedtls.c

	0055-feat-at-Add-AT-SYSMSG-to-enable-some-report-informat.patch
	0056-fix-at-Fix-the-incorrect-link-id-when-client-connect.patch
	0057-fix-at-Fix-the-bug-that-it-should-be-error-when-the-.patch
	0058-fix-smartconfig-Fix-the-smartconfig-scan-time-issue.patch
	0059-fix-lwip-Fix-the-bug-of-lwip-output.patch

		Upstream files only

	0060-fix-lwip-Fix-the-length-of-TCP-data-in-one-packet-is.patch
	0061-fix-lwip-Fix-send-TCP-data-with-two-or-more-pbuf.patch

		Merged app/lwip/core/tcp_out.c

	0062-fix-wifi-Fix-assert-happen-when-smartconfig-start-th.patch

		Upstream files only

	0063-fix-mbedtls-Fix-memory-leak-when-ESP8266-as-SSL-TLS-.patch

		Merged app/mbedtls/app/espconn_mbedtls.c

	0064-fix-mbedtls-Fix-already-freed-and-exception-bug-when.patch

		Merged app/mbedtls/app/lwIPSocket.c

	0065-fix-at-Fix-bug-that-there-is-no-result-when-sending-.patch
	0066-feat-example-Add-AT-bin-version.patch
	0067-feat-version-Update-version-to-2.2.0-and-add-version.patch
	0068-feat-bin-Update-AT-bin-for-SDK-2.2.0.patch

		Upstream files only

Apply local changes to build:

	app/include/lwip/app/espconn.h pulls changes (and license decl) from
	upstream SDK.  Makefile is altered to use this file ahead of the
	SDK's.

	Remove lwip's sntp support, since it was never really wired in anyway.
	See nodemcu#2042 for more
	information.  Patch Makefile to strip time.o, the consumer of lwip's
	sntp functionality, from libmain.a, resulting in much
	easier-to-understand error messages.

	This has consequences for mbedtls.  The simplest thing to do, which is,
	impressively, not a change in behavior, is to completely disable TLS
	certificate time validation; a later patch can optionally couple this to
	RTCTIME support.

	Similarly, it happens that the sqlite3 import was calling time(), but
	this was not going to work out well for it.  Just stub it out to always
	return unix timestamp 0, as would have happened anyway.

Changes unprocessed:

	0007-sync-from-080c37e1.patch
	0008-feat-lib-Compile-some-libraries-with-ffunction-secti.patch

		These two make changes to the linker script; perhaps
		they are worth porting over, but I have not done so
		here.

This is build-tested (ADC, BIT, COLOR_UTILS, CRON, CRYPTO, DHT, ENCODER,
FILE, GPIO, HTTP, I2C, MQTT, NET, NODE, OW, PCM, PERF, PWM, RTCFIFO,
RTCMEM, RTCTIME, SNTP, SPI, SQLITE3, STRUCT, TLS, TMR, UART, WIFI,
WS2812, WS2812_EFFECTS) and boots, but only limited run-time testing has
been performed.  Testing done does, however, include having made a few
TLS connections through the HTTP module, so things are not hopelessly
broken, at the very least.
  • Loading branch information
nwf committed Feb 20, 2018
1 parent 1117e9e commit 0614e6b
Show file tree
Hide file tree
Showing 23 changed files with 407 additions and 1,343 deletions.
29 changes: 24 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.NOTPARALLEL:

# SDK version NodeMCU is locked to
SDK_VER:=2.1.0
SDK_VER:=2.2.0

# no patch: SDK_BASE_VER equals SDK_VER and sdk dir depends on sdk_extracted
SDK_BASE_VER:=$(SDK_VER)
Expand All @@ -13,13 +13,13 @@ SDK_DIR_DEPENDS:=sdk_extracted
#SDK_DIR_DEPENDS:=sdk_patched

SDK_FILE_VER:=$(SDK_BASE_VER)
SDK_FILE_SHA1:=66a4272894dc1bcec19f5f8bf79fee80f60a021b
SDK_FILE_SHA1:=8b63f1066d3560ff77f119e8ba30a9c39e7baaad
#SDK_PATCH_VER:=$(SDK_VER)_patch_20160704
#SDK_PATCH_SHA1:=388d9e91df74e3b49fca126da482cf822cf1ebf1
# Ensure we search "our" SDK before the tool-chain's SDK (if any)
TOP_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
SDK_DIR:=$(TOP_DIR)/sdk/esp_iot_sdk_v$(SDK_VER)
CCFLAGS:= -I$(TOP_DIR)/sdk-overrides/include -I$(SDK_DIR)/include
CCFLAGS:= -I$(TOP_DIR)/sdk-overrides/include -I$(TOP_DIR)/app/include/lwip/app -I$(SDK_DIR)/include
LDFLAGS:= -L$(SDK_DIR)/lib -L$(SDK_DIR)/ld $(LDFLAGS)

ifdef DEBUG
Expand All @@ -39,6 +39,7 @@ ifeq ($(OS),Windows_NT)
# It is xcc
AR = xt-ar
CC = xt-xcc
CXX = xt-xcc
NM = xt-nm
CPP = xt-cpp
OBJCOPY = xt-objcopy
Expand All @@ -50,6 +51,7 @@ ifeq ($(OS),Windows_NT)
CCFLAGS += -ffunction-sections -fno-jump-tables -fdata-sections
AR = xtensa-lx106-elf-ar
CC = xtensa-lx106-elf-gcc
CXX = xtensa-lx106-elf-g++
NM = xtensa-lx106-elf-nm
CPP = xtensa-lx106-elf-cpp
OBJCOPY = xtensa-lx106-elf-objcopy
Expand Down Expand Up @@ -77,6 +79,7 @@ else
CCFLAGS += -ffunction-sections -fno-jump-tables -fdata-sections
AR = xtensa-lx106-elf-ar
CC = $(WRAPCC) xtensa-lx106-elf-gcc
CXX = $(WRAPCC) xtensa-lx106-elf-g++
NM = xtensa-lx106-elf-nm
CPP = $(WRAPCC) xtensa-lx106-elf-gcc -E
OBJCOPY = xtensa-lx106-elf-objcopy
Expand Down Expand Up @@ -104,6 +107,7 @@ ESPTOOL ?= ../tools/esptool.py


CSRCS ?= $(wildcard *.c)
CXXSRCS ?= $(wildcard *.cpp)
ASRCs ?= $(wildcard *.s)
ASRCS ?= $(wildcard *.S)
SUBDIRS ?= $(patsubst %/,%,$(dir $(filter-out tools/Makefile,$(wildcard */Makefile))))
Expand All @@ -112,10 +116,12 @@ ODIR := .output
OBJODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/obj

OBJS := $(CSRCS:%.c=$(OBJODIR)/%.o) \
$(CXXSRCS:%.cpp=$(OBJODIR)/%.o) \
$(ASRCs:%.s=$(OBJODIR)/%.o) \
$(ASRCS:%.S=$(OBJODIR)/%.o)

DEPS := $(CSRCS:%.c=$(OBJODIR)/%.d) \
$(CXXSCRS:%.cpp=$(OBJODIR)/%.d) \
$(ASRCs:%.s=$(OBJODIR)/%.d) \
$(ASRCS:%.S=$(OBJODIR)/%.d)

Expand Down Expand Up @@ -206,9 +212,11 @@ sdk_patched: sdk_extracted $(TOP_DIR)/sdk/.patched-$(SDK_VER)

$(TOP_DIR)/sdk/.extracted-$(SDK_BASE_VER): $(TOP_DIR)/cache/v$(SDK_FILE_VER).zip
mkdir -p "$(dir $@)"
(cd "$(dir $@)" && rm -fr esp_iot_sdk_v$(SDK_VER) ESP8266_NONOS_SDK-$(SDK_VER) && unzip $(TOP_DIR)/cache/v$(SDK_FILE_VER).zip ESP8266_NONOS_SDK-$(SDK_VER)/lib/* ESP8266_NONOS_SDK-$(SDK_VER)/ld/eagle.rom.addr.v6.ld ESP8266_NONOS_SDK-$(SDK_VER)/include/* ESP8266_NONOS_SDK-$(SDK_VER)/bin/esp_init_data_default.bin)
(cd "$(dir $@)" && rm -fr esp_iot_sdk_v$(SDK_VER) ESP8266_NONOS_SDK-$(SDK_VER) && unzip $(TOP_DIR)/cache/v$(SDK_FILE_VER).zip ESP8266_NONOS_SDK-$(SDK_VER)/lib/* ESP8266_NONOS_SDK-$(SDK_VER)/ld/eagle.rom.addr.v6.ld ESP8266_NONOS_SDK-$(SDK_VER)/include/* ESP8266_NONOS_SDK-$(SDK_VER)/bin/esp_init_data_default_v05.bin)
mv $(dir $@)/ESP8266_NONOS_SDK-$(SDK_VER) $(dir $@)/esp_iot_sdk_v$(SDK_VER)
rm -f $(SDK_DIR)/lib/liblwip.a
rm -f $(SDK_DIR)/lib/liblwip.a $(SDK_DIR)/lib/libssl.a $(SDK_DIR)/lib/libmbedtls.a
ar d $(SDK_DIR)/lib/libmain.a time.o
ar d $(SDK_DIR)/lib/libc.a lib_a-time.o
touch $@

$(TOP_DIR)/sdk/.patched-$(SDK_VER): $(TOP_DIR)/cache/esp_iot_sdk_v$(SDK_PATCH_VER).zip
Expand Down Expand Up @@ -306,6 +314,17 @@ $(OBJODIR)/%.d: %.c
sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$

$(OBJODIR)/%.o: %.cpp
@mkdir -p $(OBJODIR);
$(CXX) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) -o $@ -c $<

$(OBJODIR)/%.d: %.cpp
@mkdir -p $(OBJODIR);
@echo DEPEND: $(CXX) -M $(CFLAGS) $<
@set -e; rm -f $@; \
sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$

$(OBJODIR)/%.o: %.s
@mkdir -p $(OBJODIR);
$(CC) $(CFLAGS) -o $@ -c $<
Expand Down
1 change: 1 addition & 0 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ CONFIGURATION_DEFINES = -D__ets__ \
-DLWIP_OPEN_SRC \
-DPBUF_RSV_FOR_WLAN \
-DEBUF_LWIP \
-DUSE_OPTIMIZE_PRINTF \
-DMBEDTLS_USER_CONFIG_FILE=\"user_mbedtls.h\" \

DEFINES += \
Expand Down
2 changes: 1 addition & 1 deletion app/driver/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ key_50ms_cb(struct single_key_param *single_key)
LOCAL void
key_intr_handler(void *arg)
{
struct keys_param *keys = arg;
uint8 i;
uint32 gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
struct keys_param *keys = arg;

for (i = 0; i < keys->key_num; i++) {
if (gpio_status & BIT(keys->single_key[i]->gpio_id)) {
Expand Down
2 changes: 1 addition & 1 deletion app/include/arch/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ typedef uint32_t mem_ptr_t;
#define U32_F "d"
#define X32_F "x"


#define LWIP_ERR_T s32_t

//#define PACK_STRUCT_FIELD(x) x __attribute__((packed))
#define PACK_STRUCT_FIELD(x) x
Expand Down
214 changes: 211 additions & 3 deletions app/include/lwip/app/espconn.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
/*
* ESPRESSIF MIT License
*
* Copyright (c) 2016 <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 __ESPCONN_H__
#define __ESPCONN_H__

#include "lwip/err.h"
#include "lwip/dns.h"
#include "os_type.h"
#include "lwip/app/espconn_buf.h"
Expand Down Expand Up @@ -37,8 +62,7 @@ typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
#define ESPCONN_NODATA -17 /* No data can be read */

#define ESPCONN_HANDSHAKE -28 /* ssl handshake failed */
#define ESPCONN_RESP_TIMEOUT -29 /* ssl handshake no response*/
#define ESPCONN_PROTO_MSG -61 /* ssl application invalid */
#define ESPCONN_SSL_INVALID_DATA -61 /* ssl application invalid */

#define ESPCONN_SSL 0x01
#define ESPCONN_NORM 0x00
Expand Down Expand Up @@ -121,6 +145,7 @@ enum espconn_option{
ESPCONN_NODELAY = 0x02,
ESPCONN_COPY = 0x04,
ESPCONN_KEEPALIVE = 0x08,
ESPCONN_MANUALRECV = 0x10,
ESPCONN_END
};

Expand Down Expand Up @@ -461,6 +486,17 @@ extern sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callbac
*******************************************************************************/
extern sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callback write_finish_fn);

/******************************************************************************
* FunctionName : espconn_send
* Description : sent data for client or server
* Parameters : espconn -- espconn to set for client or server
* psent -- data to send
* length -- length of data to send
* Returns : none
*******************************************************************************/
extern sint8 espconn_send(struct espconn *espconn, uint8 *psent, uint16 length);


/******************************************************************************
* FunctionName : espconn_sent
* Description : sent data for client or server
Expand Down Expand Up @@ -573,7 +609,163 @@ extern sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *o
* - ESPCONN_ARG: dns client not initialized or invalid hostname
*******************************************************************************/

extern sint8 espconn_gethostbyname(struct espconn *pespconn, const char *name, ip_addr_t *addr, dns_found_callback found);
extern err_t espconn_gethostbyname(struct espconn *pespconn, const char *name, ip_addr_t *addr, dns_found_callback found);

/******************************************************************************
* FunctionName : espconn_abort
* Description : Forcely abort with host
* Parameters : espconn -- the espconn used to connect with the host
* Returns : result
*******************************************************************************/

extern sint8 espconn_abort(struct espconn *espconn);

/******************************************************************************
* FunctionName : espconn_encry_connect
* Description : The function given as connection
* Parameters : espconn -- the espconn used to connect with the host
* Returns : none
*******************************************************************************/

extern sint8 espconn_secure_connect(struct espconn *espconn);

/******************************************************************************
* FunctionName : espconn_encry_disconnect
* Description : The function given as the disconnection
* Parameters : espconn -- the espconn used to disconnect with the host
* Returns : none
*******************************************************************************/

extern sint8 espconn_secure_disconnect(struct espconn *espconn);

/******************************************************************************
* FunctionName : espconn_secure_send
* Description : sent data for client or server
* Parameters : espconn -- espconn to set for client or server
* psent -- data to send
* length -- length of data to send
* Returns : none
*******************************************************************************/

extern sint8 espconn_secure_send(struct espconn *espconn, uint8 *psent, uint16 length);

/******************************************************************************
* FunctionName : espconn_encry_sent
* Description : sent data for client or server
* Parameters : espconn -- espconn to set for client or server
* psent -- data to send
* length -- length of data to send
* Returns : none
*******************************************************************************/

extern sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length);

/******************************************************************************
* FunctionName : espconn_secure_set_size
* Description : set the buffer size for client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* size -- buffer size
* Returns : true or false
*******************************************************************************/

extern bool espconn_secure_set_size(uint8 level, uint16 size);

/******************************************************************************
* FunctionName : espconn_secure_get_size
* Description : get buffer size for client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* Returns : buffer size for client or server
*******************************************************************************/

extern sint16 espconn_secure_get_size(uint8 level);

/******************************************************************************
* FunctionName : espconn_secure_ca_enable
* Description : enable the certificate authenticate and set the flash sector
* as client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* flash_sector -- flash sector for save certificate
* Returns : result true or false
*******************************************************************************/

extern bool espconn_secure_ca_enable(uint8 level, uint32 flash_sector );

/******************************************************************************
* FunctionName : espconn_secure_ca_disable
* Description : disable the certificate authenticate as client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* Returns : result true or false
*******************************************************************************/

extern bool espconn_secure_ca_disable(uint8 level);


/******************************************************************************
* FunctionName : espconn_secure_cert_req_enable
* Description : enable the client certificate authenticate and set the flash sector
* as client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* flash_sector -- flash sector for save certificate
* Returns : result true or false
*******************************************************************************/

extern bool espconn_secure_cert_req_enable(uint8 level, uint32 flash_sector );

/******************************************************************************
* FunctionName : espconn_secure_ca_disable
* Description : disable the client certificate authenticate as client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* Returns : result true or false
*******************************************************************************/

extern bool espconn_secure_cert_req_disable(uint8 level);

/******************************************************************************
* FunctionName : espconn_secure_set_default_certificate
* Description : Load the certificates in memory depending on compile-time
* and user options.
* Parameters : certificate -- Load the certificate
* length -- Load the certificate length
* Returns : result true or false
*******************************************************************************/

extern bool espconn_secure_set_default_certificate(const uint8* certificate, uint16 length);

/******************************************************************************
* FunctionName : espconn_secure_set_default_private_key
* Description : Load the key in memory depending on compile-time
* and user options.
* Parameters : private_key -- Load the key
* length -- Load the key length
* Returns : result true or false
*******************************************************************************/

extern bool espconn_secure_set_default_private_key(const uint8* private_key, uint16 length);

/******************************************************************************
* FunctionName : espconn_secure_accept
* Description : The function given as the listen
* Parameters : espconn -- the espconn used to listen the connection
* Returns : result
*******************************************************************************/

extern sint8 espconn_secure_accept(struct espconn *espconn);

/******************************************************************************
* FunctionName : espconn_secure_accepts
* Description : delete the secure server host
* Parameters : espconn -- the espconn used to listen the connection
* Returns : result
*******************************************************************************/

extern sint8 espconn_secure_delete(struct espconn *espconn);


/******************************************************************************
* FunctionName : espconn_igmp_join
Expand All @@ -593,6 +785,22 @@ extern sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
*******************************************************************************/
extern sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);

/******************************************************************************
* FunctionName : espconn_recv_hold
* Description : hold tcp receive
* Parameters : espconn -- espconn to hold
* Returns : none
*******************************************************************************/
extern sint8 espconn_recv_hold(struct espconn *pespconn);

/******************************************************************************
* FunctionName : espconn_recv_unhold
* Description : unhold tcp receive
* Parameters : espconn -- espconn to unhold
* Returns : none
*******************************************************************************/
extern sint8 espconn_recv_unhold(struct espconn *pespconn);

/******************************************************************************
* FunctionName : espconn_mdns_init
* Description : register a device with mdns
Expand Down
3 changes: 3 additions & 0 deletions app/include/lwip/app/espconn_tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#define espconn_keepalive_enable(pcb) ((pcb)->so_options |= SOF_KEEPALIVE)
#define espconn_keepalive_disable(pcb) ((pcb)->so_options &= ~SOF_KEEPALIVE)

#define espconn_manual_recv_disabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_MANUALRECV) != 0)
#define espconn_manual_recv_enabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_MANUALRECV) == 0)

/******************************************************************************
* FunctionName : espconn_kill_oldest_pcb
* Description : A oldest incoming connection has been killed.
Expand Down
Loading

0 comments on commit 0614e6b

Please sign in to comment.