Commit Graph

109 Commits

Author SHA1 Message Date
Ivan Grokhotkov
47659be5b8
build system: remove lwip from common requirements
lwip was added to common requirements list to provide "sys/socket.h"
header to all components without additional requirements specified.

However, lwip pulls in a lot of dependencies on other components.
This commit removes lwip from common requirements to reduce the number
of components in G1-only apps.

To compensate for this removal, the following changes are made:
- newlib (which is a common requirement) has a public dependency on
  lwip if lwip is present in the build. This ensures that sys/socket.h
  is available as long as lwip component is included into the build.
- lwip is now a public requirement of esp-tls since esp_tls.h includes
  sys/socket.h header.
- lwip is now a public requirement o esp_http_client because
  sys/socket.h is included from esp_http_client.h
- lwip is now a private requirement of esp_wifi for "smartconfig_ack"
- lwip is now a private requirement of mqtt for socket functions
- lwip is now a public requirement of tcp_transport because
  esp_transport_tcp.h includes sys/socket.h header.
- mbedtls checks if lwip component is present in the build. If yes,
  net_sockets.c is added to the build, along with the dependency on
  lwip. Previously lwip was a public requirement of mbedtls
  unconditionally.

system/g1_components test app is updated to reflect the changes

Default public dependencies of a component before and after this
change, except common requirements:

- esp_timer (public dependency of freertos)
- bootloader_support (public dependency of esp_hw_support)
- vfs (public dependency of lwip)
- esp_wifi (public dependency of lwip)
- esp_event (public dependency of esp_wifi)
- esp_netif (public dependency of esp_event)
- esp_eth (public dependency of esp_netif)
- esp_phy (public dependency of esp_wifi)

After:

- esp_timer (public dependency of freertos)
- bootloader_support (public dependency of esp_hw_support)

Altogether, the following components have been always added as
public requirements to all other components, and are not added now
([breaking-change]):

- lwip
- vfs
- esp_wifi
- esp_event
- esp_netif
- esp_eth
- esp_phy

Application components now need to explicitly declare dependencies on
these components.
2022-05-02 20:47:17 +02:00
Euripedes Rocha
f2c77bb70f tcp_transport: Fix documentation for connect functions
Documentation was incorrectly point that we return the socket number.
 The function returns an integer related to the status of the connection.

Closes https://github.com/espressif/esp-idf/issues/8416
2022-04-19 14:18:05 +00:00
David Čermák
a7c1112ca4 Merge branch 'feature/ws_client_support_cont_frames' into 'master'
transport_ws: Parse and expose frame fin flag

Closes IDFGH-6767 and IDFGH-6737

See merge request espressif/esp-idf!17748
2022-04-14 23:18:12 +08:00
MacDue
1ca3a4fbe3 transport_ws: Parse and expose frame fin flag
Note: esp_websocket_client still needs patching to expose this
2022-04-12 11:31:51 +01:00
songruojing
bdb5b11b39 unit test: move unit-test_app test_utils_task_delete API to be a utils API (unity_utils_task_delete) in unity component 2022-03-30 15:11:08 +08:00
Mahavir Jain
e97b034b3e transport_ssl: use return value from close for non-TLS case
Also fix copyright header for this file
2022-02-07 17:17:16 +05:30
Dániel Buga
2ffa82a397 Set success when closing socket
Closes https://github.com/espressif/esp-idf/pull/8337
Closes IDFGH-6709
2022-02-07 17:16:36 +05:30
xutao
e794786c74 tcp_transport: fix tcp transport execption pointer 2022-01-19 13:44:20 +01:00
Euripedes Rocha
ae8eeaade9 tcp_transport: Fix Websocket transport initialization
In case of a failure in alocation of WS transport handle, parent leaks.
2021-12-06 14:28:30 -03:00
Roland Dobai
766aa57084 Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
Axel Lin
9d07e89f13 tcp_transport: Fix NULL pointer dereference in esp_transport_esp_tls_create
Add missing NULL checking to prevent NULL pointer dereference if calloc failed.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
2021-09-08 11:04:08 +08:00
liuhan
37e08d38a4 tls: Modify tls optimize both mbedtls and wolfssl 2021-06-28 10:22:24 +08:00
David Čermák
b1981204f3 Merge branch 'bugfix/tcp_transport_cleanup_tls_ctx' into 'master'
tcp_transport: Fix to cleanup esp-tls context on close

See merge request espressif/esp-idf!14076
2021-06-24 04:24:15 +00:00
liuhan
8b02c9026a transport: Add CONFI_WS_TRANSPORT for optimize the code size 2021-06-22 10:51:04 +08:00
David Cermak
1a7e75036b tcp_transport: Fix to cleanup esp-tls context on close 2021-06-20 21:21:22 +02:00
David Cermak
f68d7d7023 esp_tls: Renamed public API to indicate the Plain TCP connection
Also added parameter checks if used from as a public API
and updated the `is_plein_tcp` description that it's possible to connect
directly using plain tcp transport with the new API.
2021-05-25 10:55:50 +02:00
David Cermak
38fd2ed10b tcp_transport: Rename common tcp/ssl internals to base-transport
Also uses INVALID_SOCKET macro instead of magic number (-1)
2021-05-25 10:55:45 +02:00
David Cermak
6cf077169e tcp_transport: Rework test to split test code and use fixtures 2021-05-25 07:04:02 +02:00
David Cermak
f249ddd9ae esp_transport: Use tcp_connect from esp_tls for plain TCP
so we don't have to allocate esp_tls structure (~2KB) to save heap when using plain TCP connection

Closes https://github.com/espressif/esp-idf/issues/6940
2021-05-25 07:04:02 +02:00
Axel Lin
aa333d4ab9 tcp_transport: Fix NULL pointer dereference if esp_transport_init returns NULL
Add missing NULL test for esp_transport_init() call.
Otherwise, it will hit NULL pointer dereference when assign t->_get_socket.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
2021-05-03 15:46:59 +08:00
Aditya Patwardhan
d74f7d2d04 tcp_transport: Add option to enable crt_bundle for SSL connection 2021-04-07 05:31:21 +00:00
David Cermak
86bcd9fc21 tcp_transport: Fix error handling of esp_tls_init() 2021-03-24 12:24:23 +00:00
David Cermak
70361fc35d tcp_transport/test: Fix wrong use of transport in set-interface 2021-03-11 19:21:00 +00:00
yuanjm
a412eb867c tcp_transport: Add bind device function to unit test 2021-03-10 02:19:29 +00:00
yuanjm
c62cbd1254 transport: Support bind socket to specified interface in transport and esp-tls 2021-03-10 02:19:29 +00:00
David Cermak
1921ae8973 tcp_transport: Reduce lwip dependecy for tcp_transport/http_client 2021-02-16 09:01:35 +01:00
David Cermak
1fa0db8d44 tcp_transport: Allow for using transport independently from list
For compatibility reasons, support also transports separately if the transport is used
before attaching to parent list. In this case we create an internal context which is
independent on the foundation transport and used preferably
2021-02-16 09:01:35 +01:00
David Cermak
0e97517a1c tcp_transport: Add unit test to exercise tcp/ssl transport init 2021-02-16 09:00:43 +01:00
David Cermak
6b318fe583 esp_tls: Updated connection method to use non-blocking connect
For better control over connection timeouts
To be in line with former tcp_transport, as esp-tls is not used for
plain tcp transports
2021-02-16 09:00:43 +01:00
David Cermak
2c28ffffee tcp_transport/esp_tls: Use common TCP transport to reduce code duplication
For high level review of the changes.
2021-02-16 09:00:43 +01:00
David Cermak
391d7bf271 tcp_transport: Add TCP transport connection errors
Transport's error_handle is used to capture different types of errors
including esp_err_t from esp-tls and socket/system errors.
This change adds the following error codes for TCP transport:
* connection closed by a FIN flag (clean closure from server)
* DNS resolution problem
* connection timeout
These errors are already defined in esp-tls component and since this
component will be used in the future for both TCP and SSL transport, we
currently report these issues in transport::error_handle::esp_tls_last_error
of standard esp error type (esp_err_t)

Closes https://github.com/espressif/esp-mqtt/issues/182
2021-02-16 09:00:43 +01:00
aditi_lonkar
7bf205162c tcp_transport: Fix some memory leak issues by coverity static analyzer. 2021-01-25 03:37:47 +00:00
David Čermák
a461f8f115 Merge branch 'bugfix/ws_transport_ping' into 'master'
ws_transport: Add option to propagate control packets to the app

Closes IDFGH-4478

See merge request espressif/esp-idf!11957
2021-01-22 19:21:43 +08:00
David Cermak
acc7bd2ca4 ws_transport: Add option to propagate control packets to the app
Client could choose if they want to receive control packets and handle
them.
* If disabled (default) the transport itself tries to handle PING
and CLOSE frames automatically during read operation. If handled
correctly, read outputs 0 indicating no (actual app) data received.
* if enabled, all control frames are passed to the application to be
  processed there.

Closes https://github.com/espressif/esp-idf/issues/6307
2021-01-22 07:22:41 +00:00
yuanjm
044c3e3e74 Modify esp-tls and tcp_transport to support keep alive for tcp and ssl connection
Closes IDFGH-4543
2021-01-22 06:56:28 +00:00
David Cermak
ce519ee783 tcp_transport: Extend transport error storage for socket error
Everytime we report error and log errno, we also capture the actual
errno to an internal storage so that user application can retrieve
its value.
2020-11-12 12:46:22 +00:00
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Aditya Patwardhan
fa42beac97 esp32/esp-tls: remove dependancy of esp_https_client and tcp_transport on mbedtls 2020-10-23 05:16:06 +00:00
Aditya Patwardhan
91b88acaec tcp_transport: Added required API to support Digital Signature for SSL 2020-09-22 18:31:31 +05:30
Ivan Grokhotkov
b6467257b9 Merge branch 'feature/cmock_component' into 'master'
cmock as component replacing unity

See merge request espressif/esp-idf!9859
2020-09-10 16:06:20 +08:00
Jakob Hasse
20c068ef3b cmock: added cmock as component
* changing dependencies from unity->cmock
* added component.mk and Makefile.projbuild
* ignore test dir in gen_esp_err_to_name.py
* added some brief introduction of CMock in IDF
2020-09-02 16:38:37 +08:00
xutao
bd2daccb22 transport: fix transport ssl blocking
In SSL mode, if `esp_transport_poll_read` function is used, the cache data in mebdtls will be blocked
2020-09-02 07:01:01 +00:00
David Cermak
5e9f8b52e7 tcp_transport: Added internal API for underlying socket, used for custom select on connection end for WS
Internal tcp_transport functions could now use custom socket operations.
This is used for WebSocket transport, when we typically wait for clean
connection closure, i.e. selecting for read/error with expected errno or
recv size=0 while socket readable (=connection terminated by FIN flag)
2020-08-18 06:42:22 +00:00
Chen Yi Qun
caaf62bdad driver, http_client, web_socket, tcp_transport: remove __FILE__ from log messages
__FILE__ macro in the error messages adds full paths to the production binarys, remove __FILE__ from the ESP_LOGE.

Closes https://github.com/espressif/esp-idf/issues/5637
Merges https://github.com/espressif/esp-idf/pull/5638
2020-08-03 15:21:36 +08:00
Marius Vikhammer
a392e4e57b websocket: add configurable ws_transport buffer size
Closes IDFGH-3566
Closes https://github.com/espressif/esp-idf/issues/5513
2020-07-20 10:02:31 +00:00
Aditya Patwardhan
423e600d46 secure_element: atecc608_ecdsa example
* Replaced crypotoauthlib with esp-cryptoauthlib
* Added menuconfig option for esp-tls about using HSM
* Added error codes for HSM in esp-tls,
* Added support to select different type of ATECC608A chips
* Added README, updated docs
* tcp_transport: Added option to enable secure_element for ssl

Closes https://github.com/espressif/esp-idf/issues/4432
2020-05-21 13:08:30 +05:30
David Cermak
a8e370eced tcp_transport: unit test for tcp connection timeout 2020-05-05 15:53:09 +02:00
David Cermak
6182e6f303 tcp_transport: close to return error only for socket error or invalid args
Closes https://github.com/espressif/esp-idf/issues/4872
2020-05-05 15:53:09 +02:00
boarchuz
0c7204e934 tcp_transport: Implement connect timeout
Merges https://github.com/espressif/esp-idf/pull/3791
Closes https://github.com/espressif/esp-idf/issues/5004
2020-05-05 15:53:09 +02:00
Jiang Jiang Jian
80e5eb896c Merge branch 'optimization/DNS_get_function' into 'master'
lw-ip:optimization DNS get function

Closes WIFI-1566

See merge request espressif/esp-idf!8244
2020-04-20 16:52:22 +08:00