Work around because AF_UNSPEC does not check available addresses when
determining result.
If you have a global scope IPv6 address, then first check for IPv6 DNS result;
if you don't have an IPv6, or there is no IPv6 result, then check IPv4.
This allows IPv6-only networks to connect to dual-stack destinations, as they
will get the IPv6 address (rather than the unusable IPv4).
It also means a dual-stack host to a dual-stack destination will preference
IPv6.
There is no effect if you are on an IPv4-only network, or it is an IPv4-only
destination.
Similar to NetworkClient, check the family of the passed in address and configure the socket and socket address accordingly, for both IPv6 and IPv4 support.
* feat(net): Add support for esp_netif flags
Provides better automation for setting IP/DNS
* feat(net): Show DHCPC status as OFF when static IP is used
* fix(dns): Handle IPv6 DNS server address results
If the result from esp_netif_get_dns_info is an IPv6 address, then parse to an IPAddress.
* fix(dns): Use getaddrinfo for DNS, to fix some IPv6 issues
Replace hostbyname with getaddrinfo for better IPv6 support. The API is also
simpler, as it has no callbacks (they are handled internally). Allows
dual-stack networks to connect to IPv6-only destinations.
Still does not work for IPv6-only networks, as IPv6 DNS is not enabled in the
pre-built ESP-IDF libraries.
* feat(libs): Add ESP-NOW Arduino library
* Update libraries/ESP_NOW/src/ESP32_NOW.cpp
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Update libraries/ESP_NOW/src/ESP32_NOW.cpp
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* fix(esp-now): Add check if Wifi is started.
* Fix ESP_NOW_Serial
* Add ESP NOW Serial Example
* Add comment
* Skip esp-now example for esp32h2
* Add broadcast address constant
* Change return value to align with other APIs
* Apply suggested changes
* Improve example
* Fix example
* Improve serial example
* Add argument to receive callback to know if a message was broadcasted
* Update libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp
* Simplify example
* Add broadcast example
* Change comments
* Change comment
* Improve broadcast master example
* Remove examples using IDF's API
* Fix example
* Add network example
* Add skip file
* Add LMK back
* Add logs
* Improve example
* Fix example
* Apply @suglider suggestions from code review
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
* Add documentation
* fix examples links in docs
* Apply @lucasssvaz suggestions to docs
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Update espnow.rst
* Update examples
* make onSent optional and remove underscores for virtual functions
* Make onRecieve also optional and make constructor protected
---------
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: me-no-dev <hristo@espressif.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
* Matched pin numbers in doco to numbers in variants files
* Non-breaking dashes
* Changed SD examples to make REASSIGN_PINS more transparent. Fixes#9082
---------
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Create ESP_NetworkInterface class and have Ethernet extending it
* Update CMakeLists.txt
* Split networking from WiFi (H2 can now use Ethernet)
Now all libs have been checked yet. More to do on WiFi side
* Fix build errors
* Guard WiFi classes and fix RMII ETH examples
* Decouple network related libraries from WiFi
* Fix examples and WiFiUpdate
* Guard WiFiProv lib to compile only on WiFi chips
* Add periman string for network and "fix" mdns on the first ETH
* Revert back location of Client/Server/Udp in order to accept some PRs
* Fix periman
* Some fixes from merging master
* Fix web server missing fs.h
* Move Client, Server and Udp out of WiFi
* More fixes
* more fixes
* Fix CMakekLists and rework lib menu dependencies
* Fix CMake issues
* move back WiFiClient to rebase with master
* Update ETH_TLK110.ino
* Move back WiFiClient
* Update progress
* Update WiFiGeneric.cpp
* More fixes
* Switch AP to the new interface
* Cleanup
* Rename AP methods
* Add extra interface info for Printable
* Rename IPv6 getters to clarify that they are returning LinkLocal address
cc @sgryphon
* Rename network classes
cc @sgryphon
* Update NetworkManager.h
* Rename WiFi Server and UDP
* Rename WiFiClient and WiFiClientSecure
* Update CMakeLists.txt
* Update on-push.sh
* Rename Network library
* Remove unnecessary guard
* Get the correct interface MAC address for mDND Workstation service
* Apply suggestions from code review
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
---------
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* feat: onReceiveExample.ino
Adds a new example that uses HardwareSerial::onReceive(). The example demosntrates how to read all the data sent to UART0, considering that the end of transmission is defined by a period of time with UART in idle state.
* fix: onReceiveExample.ino
Fixes typos
* feat: add explanation header
* fix: mutex release
* fix: add Mutex verification
* feat: Mutex error message
* feat: Mutex NULL testing
* feat(hwcdc): fix delay
Fixes delay when CDC is disconnected. At this time is only fixes it when USB cable is unplugged.
* feat(hwcdc): fix delay
fixes delay when CDC is not connected. It was only considering when the USB cable was not plugged.
* feat(hwcdc): add 2 methods
Adds 2 new methods:
- isPlugged() will return true when USB cable is plugged, false otherwise.
- isConnected() will return true when USB CDC is connected to a application in the USB Host side and communication is stablished.
* feat(hwcdc): adjusts APIs
Fixes the example to use the new added APIs for checking if USB cable is plugged and for checking if CDC is connected.
* fixes api declaration
* fixes API declaration
* feat(hw_cdc):fixes the hardware cdc jtag plugged/unplugged status
This will use a new IDF 5.1 feature to detect if the USB HW CDC is plugged or not. This can be checked testing HWCDCSerial.
It also fixes issues related to timeout or delays while writing to the HW Serial when USB is unplugged.
* feat(usb): Creates HWSerial_Events.ino example
* feat: adds .skip.esp32
Skips the ESP32 SoC test given that it has no USB
* feat: adds .skip.esp32s2
Skips the ESP32S2 because it has no HW CDC JTAG interface
* fix: fixes issues with Ubuntu CI
Only compiles the example in case it is using Hardware CD and JTAG mode.
* feat(serialcdc): non block functions
modifies write and flush to do not clock in case CDC host is not connected to the CDC client from the C3/S3/C6/H2
* fix(HWCDC): changes made demands testing for CDC ON BOOT
* feat(hwcdc): Improves HWSerial_Events.ino
Improves the example by adding more information about USB being plugged and CDC being connected.
* feat(hwcdc): solves CDC connection issue
Detects correctly when CDC is or not connected.
Deals with USB unplugged while the sketch is printing to CDD.
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Update cores/esp32/HWCDC.cpp
* Apply suggestions from code review
---------
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* [W5500] Support no-IRQ
Requires this commit from ESP-IDF to be cherry picked:
fd0a1dc53c
* Remove unrelated code to support ETH_PHY_JL1101
* remove the commented check and fix the error message
* Guard feature to be enabled when IDF backports it to v5.1
---------
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
* fix(esp32): 🐛 Fixed "Invalid mbox" in the Wi-Fi example
* fix: changes the code to actually connect to the WiFi in roder to get time and date
* fix: removing call to WiFi.begin() at the end of the sketch. It must be called at first.
---------
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Update subpart ("PostArg") parsing to ignore extra headers instead of silently failing.
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* RMT (featt): adds a new function to set EOT level after RMT writing
* RMT (feat): adds new feature to set the EOT level after writing RMT channel
* adds return value to rmtSetEOT()
* adds bool return to rmtSetEOT()
* adds return value to the rmtSetEOT() function
* FIX (rmt): fixes eot_level setting using flags in the TX structure
* RMT(feat): Create RMT_EndOfTransmissionState.ino example
* Update cores/esp32/esp32-hal-rmt.h
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Update cores/esp32/esp32-hal-rmt.c
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Update cores/esp32/esp32-hal-rmt.c
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
---------
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Split start_ssl_client into two phases; to allow the implementation of protocols that use some sort of in-band STARTTLS or STARTSSL signal to upgrade a plaint text connection to SSL/TLS. Examples of these protocols are XMPP, SMTP and various database TCP connections.
* Remove removed setTimeout that was accidentally included (was removed for IDF >=5), bring timeout inline with the other timeouts (ints), fix cert/key checks to look if there is actually something there (all issues caught by the CI/CD on windows-latest
* Quell compiler warning; use the right timeout
* Newer versions of MBEDTLS make the client key struct private (and most of the x509 struct too), so absent of a non-null pointer we cannot check wether it is populated. Solve this by looking at the version (as 0 is not a valid x509 version).
* Fix another \(rightfull\) compiler warning iwth the version pointer
* Quell CI/CD runs on non-WiFi supporting hardare
* Quell CI/CD runs on non-WiFi supporting hardare
* Fix typo in directory name
* Apply suggestions from code review
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Rename Files
* Remove leftover file
---------
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* feature: create a Trust on First Use example the quell the increasingly common copy & paste of the insecure approach making it to production
* Quell CI/CD runs on non-WiFi supporting hardare
* Update libraries/WiFiClientSecure/examples/WiFiClientInsecure/WiFiClientInsecure.ino
typo/improvement to text
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Update libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino
typo/improvement to text
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Update libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino
Fix formatting
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Update libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino
typo/improvement to text
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Update libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino
typo/improvement to text
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Update libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino
typo/improvement to text
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Update libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino
typo/improvement to text
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Update libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino
typo/improvement to text
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
* Various things can all stop_ssl_socket() which sets the socket to -1; but the WiFiClientSecure checks for _connected. So we want to make sure the latter is always set. And thus have moved the state handling around *ssl_client down into the C code; below WiFiClientSecure.
* Unitialized NVRAM/EEPROM is actual set to 0xFF; so adjust for this. And print the LF/CR for the header lines.
* Update libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino
---------
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>