Wykres commitów

94 Commity (1d7068e4be430edd92bb63f2d922036dcf5c3cc1)

Autor SHA1 Wiadomość Data
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
Mahavir Jain 49ce8d3fe5 transport_ssl: reset state on connection closure
For url redirection cases (HTTP status 301/302), internal
transport ssl connection state must be reinitialized for
successful (new) connection on updated url.

Closes https://github.com/espressif/esp-idf/issues/4598
2020-04-15 15:22:32 +05:30
xueyunfei 8b036a8405 optimization DNS get function 2020-04-15 03:06:28 +00:00
David Cermak 14992e62c5 ws_client: fix fragmented send setting proper opcodes
Previous implementation violated the RFC by having both the actual opcode and WS_FIN flag set for all fragments of a message.
Fixed by setting the opcode only for the first fragment and WS_FIN for the last one

Closes IDFGH-2938
Closes https://github.com/espressif/esp-idf/issues/4974
2020-04-14 16:11:32 +02:00
Renz Bagaporo 3d0967a58a test: declare requirements and include dirs private 2020-03-23 10:58:50 +08:00
Renz Bagaporo 4d9c573fb6 test, examples: use new component registration function 2020-03-23 10:58:48 +08:00
David Cermak aa3b1da384 esp_tls: added connection timeout to esp_tls_conn_new_sync() 2020-01-16 07:32:19 +00:00
Angus Gratton 4ece6eedae Merge branch 'bugfix/ws_rcv_exceed_buf' into 'master'
tcp_transport/ws_client: websockets now correctly handle messages longer than buffer

Closes IDF-1084 and IDF-1083

See merge request espressif/esp-idf!6740
2020-01-09 13:18:31 +08:00
David Cermak b69ac4448e tcp_transport: added API for client-key password 2020-01-06 21:16:24 +00:00
Marius Vikhammer ffeda3003c tcp_transport/ws_client: websockets now correctly handle messages longer than buffer
transport_ws can now be read multiple times in a row to read frames larger than the buffer.

Added reporting of total payload length and offset to the user in websocket_client.

Added local example test for long messages.

Closes IDF-1083
2020-01-06 17:18:13 +08:00
David N. Junod 9200250f51 Add User-Agent and additional headers to esp_websocket_client
Merges https://github.com/espressif/esp-idf/pull/4345
2019-11-21 21:14:29 +01:00
Angus Gratton 412b202741 Merge branch 'bugfix/ws_client_fix_wait_forever_timeout' into 'master'
ws_client: fix handling timeouts by websocket client.

Closes IDFGH-2161

See merge request espressif/esp-idf!6683
2019-11-20 07:44:25 +08:00
David Cermak e1f982921a ws_client: fix handling timeouts by websocket client.
tcp-transport component did not support wait forever. this update uses value of -1 to request this state.
websocket client uses timeouts in RTOS ticks. fixed recalculation to ms (including special value of -1) to use correctly tcp-transport component

Closes https://github.com/espressif/esp-idf/issues/4316
2019-11-18 10:59:41 +00:00
Marius Vikhammer ed85046138 tcp_transport: added functionality for using ALPN with SSL
Closes IDF-1160
2019-11-13 11:33:13 +08:00
Angus Gratton b7fd8166d5 Merge branch 'bugfix/ws_opcodes_fix' into 'master'
ws_client: fix for not sending ping responses, updated to pass events also for...

See merge request espressif/esp-idf!6111
2019-10-17 12:36:08 +08:00
David Cermak abf9345b85 ws_client: fix for not sending ping responses, updated to pass events also for PING and PONG messages, added interfaces to send both binary and text data
closes https://github.com/espressif/esp-idf/issues/3982
2019-10-14 11:05:27 +02:00