This commit avoids OOMs on an udp corner case where a delay() in the main
loop would allow memory filling.
A memory leak has been observed with such semantically forbidden delay,
unsolved yet, and preventing to use a simple counter instead of walking
through a linked list. The count limit is however small.
The method #send(int, char*, char*[, size_t])) is a virtual method which
calculates the size of the content then calls #send_P(int, PGM_P, PGM_P,
size_t). This particular implementation of #send_P differs from the other
implementations of #send and #send_P in that it uses #sendContent for
headers and always calls #sendContent_P for contents even when the
contents is not specified.
The method #sendContent is intended for body and prepends the chunksize
in chunk mode but this breaks the HTTP protocol which does not expect a
chunksize prior to the headers.
Fix is simply to do the same thing as all the other methods - call
_currentClient.write and only call #sendContent_P if there is content to
send.
- Add uint8ArrayToMultiString and bufferedUint8ArrayToMultiString TypeConversionFunctions to facilitate transfer of Strings containing null values.
- Add HKDF to CryptoInterface.
- Add ChaCha20 + Poly1305 AEAD to CryptoInterface.
- Add customizable nonce generator to CryptoInterface.
- Add ability to automatically encrypt/decrypt ESP-NOW messages via AEAD (ChaCha20 + Poly1305), independent from encrypted ESP-NOW connections.
- Greatly improve performance of incrementSessionKey, espnowGetMessageID, espnowSetMessageID and all non-template TypeConversionFunctions. The average performance increase is roughly a factor 5. Fun fact: Printing a MAC to a HEX String is now over twice as fast when using TypeConversionFunctions compared to using standard functionality like sprintf.
- Add uint64ToUint8Array and uint8ArrayToUint64 TypeConversionFunctions.
- Make it possible to use String values as ESP-NOW and FloodingMesh key seeds, instead of just requiring plain key arrays.
- Add customizable responseTransmittedHook to sendEspnowResponses.
- Add _responsesToSendMutex to make the new responseTransmittedHook safe to use.
- Remove verboseModePrinting from sendPeerRequestConfirmations method to reduce performance variations.
- Fix faulty messageID generation in FloodingMesh.
- Make assert checks more complete and easier to understand in the setMetadataDelimiter method of FloodingMesh.
- Rename EspnowEncryptionKey to EspnowEncryptedConnectionKey since there are now multiple encryption keys.
- Rename acceptsUnencryptedRequests to acceptsUnverifiedRequests, unencryptedMessageID to unsynchronizedMessageID, receivedEncryptedMessage to receivedEncryptedTransmission, since there are now multiple modes of encryption.
- Rename resultArrayLength to outputLength in CryptoInterface and remove its value restrictions in order to match the BearSSL functionality.
- Improve performance of FloodingMesh::encryptedBroadcast.
- Rename FloodingMesh methods maxUnencryptedMessageSize/maxEncryptedMessageSize to maxUnencryptedMessageLength/maxEncryptedMessageLength, so that String length naming is consistent within the library.
- Update examples to illustrate the new features.
- Improve comments.
* Remove user_interface.h from gdbstub includes
Avoid a warning by not including the unneeded "user_interface.h" from
gdbstub.c. Leftover from original stub code from the SDK, this include
is unnecessary in the Arduino core.
* Add example to ensure gdbstub compiles in CI
Ensure the same user_interface warning doesn't occur in the future by
adding the example shown in the GDB docs to the CI build process.
This is all @dirkx , whose PR unfortunately got borked when we were
trying to update it to the new format. As @dirkx said:
When sending POST responses of well over a K - _write() may not sent it
all. Make sure we do -- but cap the individual writes - as somehow large
2-3k blobs seem to cause instability (on my 12F units).
Supercedes #2528
* EspSoftwareSerial: ctor/begin() compatibility to AVR/ESP8266/ESP32 HW release 6.2.0
* Release 6.2.1: In loopback example, explicit pin settings and for ESP32, realistic max. bps for single stop bit config.
* Loopback example can exploit new invert API in HardwareSerial
* EspSoftwareSerial 6.3.0
Fixes#6811 which found an issue where connecting to scripts.google.com
would *occasionally* cause a crash. On inspection, it was found that up
to 5828 bytes of stack were used once in a while, so expand the stack to
5900 bytes to cover this case plus a little extra.
Replaces abandoned #1817 and #2694
Add optional std::function callback (so it supports lambdas and normal
functions) via ::onStart, ::onEnd, ::onProgress, and ::onError methods.
Update example with their use.
From @baruch's original pull request:
The callback is called when the upgrade actually starts rather than just
the initial query so that the user can know that it will not take longer
and can also prepare for the upgrade by shutting down other works.
From @karlp's original pull request:
Incomplete: I've not updated any documentation yet. If this style looks
good, I'll happily go and update the documentation (likewise for the
examples)
* Add const char* content to ESP8266WebSerer::send()
Supercedes #3492
Allow sending raw binary data or strings directly without conversion to
a String to reduce memory overhead when possible.
From original @timw1971 PR #3492
Added public functions to allow content to be uploaded using const
char*. For some cases, this can remove the need for content to be copied
into a String, and thus can be considerably more space-efficient.
* Fix example formatting
* Make GIF example use static const array
* Make the example really need to use const char*
Make the generated GIF dynamic in the example and move the original to
PROGMEM (since that's where const arrays like this belong).
Fixes#6792
Only append the "l" to ".htm" when there actually is a ".html" file
present. If not, fall-thru like before and try .gz through the normal
paths.
* [SSDP] add `schema(Print &) const`
Supercedes #2806
Make SSDP::schema(WiFiClient&) use a by-ref (reduce stack use)
Add a SSDP::schema(Print&)
From @Palatis' original PR:
useful when using AsyncWebServer.
* Use ip.toString, only export Print& schema interface
Because WiFiClient inherits a Print interface, replace the
::schema(WiFiClient&) with ::schema(Print&) which is source compatible
with existing code and allows the functionality requested in the initial
PR.
Use ip.toString() in the templates instead of breaking up the octets of
the address.
* Fix compile errors and backwards compatibility
Fixes#6767 . Remove the `undef F` from SysCall.h as it is not needed
nor used in the SD or SDFS libraries. This puts F() strings back in
flash when using the SD/SDFS libs.
* Backport from ESP32
* Use new library layout (.../src)
* Cleanup test case.
* C++ style cast required.
* Whitespace
* Inlining via header has better baseline ROM footprint.
* Reordered functions for better code-compare to master
* Reduces ROM footprint some more.
* Avoid unnecessary parameter passing - refactoring, same generated footprint.
* Reformat example sources
- Add more HMAC and hash functions to CryptoInterface.
- Add MeshCryptoInterface as a holder of mesh specific crypto functionality.
- Rename broadcastMetadataDelimiter to metadataDelimiter in FloodingMesh since it is not just used for broadcasts, and to save some typing.
* EspSoftwareSerial release 5.3.5 with performance/error rate improvement in TX
* EspSoftwareSerial 5.3.6 with CI fix and, tadaaa, reliable tx and rx at 115200bps and beyond.
* Version 5.4.0 stabilized work of past 24h.
* define two weak functions defaulting to no-op
redefine them to do something useful when either spiffs or littlefs are used
* noop
* single entry point for closing FSes
* rename functions, override when instanciated, add link to explanation
* spiffs: call end on destructor
- Move cryptographic functions from JsonTranslator to CryptoInterface.
- Make AP activation separate from FloodingMesh::begin().
- Fix English bug.
- Improve comments.
- Update HelloEspnow.ino and HelloMesh.ino examples.
- Fix bug with TransmissionOutcomesUpdateHook not being called when the TCP/IP backend retained WiFi.status() == WL_CONNECTED.
- Add BroadcastTransmissionRedundancy and related functionality to reduce the transmission loss during broadcasts. Broadcast transmissions are now re-transmitted once per default. Broadcast throughput halved per default.
- Add getSenderAPMac method.
- Add FloodingMesh example in the HelloMesh.ino file.
- Improve JSON identifier names.
- Improve comments.
- Improve documentation.
- Avoid single character String concatenations done via String literals instead of char literals, as this is inefficient because of temporary String creations (#6571).
- Make it possible to transfer elements directly between connectionQueues.
- Add defaultBSSID value.
- Fix bug where encrypted Espnow-connections expired 1 ms too late.
- Add MutexTracker::captureBan() functionality and use it in the espnowReceiveCallbackWrapper method to ensure a consistent mutex environment there.
- Rename acceptRequest to acceptRequests since several requests can be accepted, not just one.
- Reorganize EspnowMeshBackend.cpp.
- Split sendEspnowResponses() method into sendEspnowResponses() and sendPeerRequestConfirmations().
- Add sendStoredEspnowMessages() method to provide the same functionality as the previous version of sendEspnowResponses().
- Add logic for handling peerRequestConfirmations received at the same time as a peer request is being made, to avoid lockups when there are simultaneous cyclic peer requests.
- Add logic for handling simultaneous reciprocal peer requests.
- Include MAC addresses in HMAC calculations for peer requests and use HMAC for all unencrypted peer request messages, to make sure we receive valid MAC combinations.
- Add asserts to ensure ESP-NOW encryption integrity during code changes.
- Add estimatedMaxDuration argument to performEspnowMaintainance and related methods.
- Add methods to EncryptedConnectionData for setting peer MAC.
- Remove createEncryptionRequestMessage function from JsonTranslator since it is not used, to increase clarity.
- Add encryptedConnectionsSoftLimit() and related functionality.
- Add mutex to protect connectionQueue usage during attemptTransmission.
- Add _ongoingPeerRequestMac variable.
- Add reservedEncryptedConnections() method.
- Add TransmissionOutcomesUpdateHook() callback.
- Add constConnectionQueue() method to allow connectionQueue usage while connectionQueue mutex is active.
- Rearrange attemptAutoEncryptingTransmission argument order to increase efficiency.
- Add functionality for serializing the unencrypted ESP-NOW connection.
- Add some constness.
- Improve comments.
- Improve documentation.
- Update keywords.txt.
* Cleanup base64::encode functions
The implementation choice here using libb64 is generally good as it
is a relatively fast implementation, however the adaptation to
use PROGMEM for the translation function was a bad choice, as reading
randomly PROGMEM with byte-wide access is very very very slow.
Doing a naive if-snake is between 20% and 55% faster and uses less
flash (about 120 bytes less) and also for reasons I don't understand
8 bytes less data RAM (maybe the removal of static?).
In addition the base64::encode function was allocating for larger
input a huge amount of memory (twice the total size). we can reduce
that by doing a chunk-wise conversation to base64.
* Create authorisation base64 encoded string without newlines
Rather than first creating a string with newlines and then
stripping it away in the fast path of constructing the query,
we can call the right method and trust that the result does
not have newlines anymore.
There are actually several instances where we pass in read-only
parameters as pass-by-value, where in the case of String() that
is inefficient as it involves copy-constructor/temp string creations.
We can avoid that, similarly to single character string concatenations
done via string literals instead of char literals.
* Add time to filesystem API
Support the ESP32 File::getLastWrite() call and setting the time on
all filesystems automatically (assuming the system clock has
been set properly and time(NULL) returns the proper time!).
Adds Dir::fileTime() to get the time of a file being listed, similar to
Dir::fileName() and Dir::fileSize().
Adds ::setTimeCallback(time_t (*cb)()) to File, Dir, and FS, allowing
users to override the default timestamp on a per-file, directory, or
filesystem basis. By default, a simple callback returning time(nullptr)
is implemented.
LittleFS uses the 't' attribute and should be backwards compatible.
SD/SDFS work and include wrappers for obsolete SdFat timestamp callbacks
using the MSDOS time.
This PR does not update SPIFFS, due to compatability concerns and a
possible massive rewrite which would make it possible to determine if an
old-style ot metadata enabled FS is present at mount time.
Includes an updated SD/listfiles and LittleFS_time example.
Replaces #6315
* Add links to new mklittlefs w/timestamp support
Include the update mklittlefs which generated 't' metadata on imported
files.
../tools/sdk/lwip2/include/netif/lowpan6_opts.h
* Add explicit note about timestamp being local time
* Address review concerns
Clean up some awkward object instantiations.
Remove the _enableTime flag/setter from SPIFFS.
Clean up the FSConfig constructors using C++ style init lists.