|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Streaming file upload to an Arduino FS (PROTOCORE_ENABLE_UPLOAD). More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | UploadServiceNs |
| Dispatch table. Addressed by offset, so the layout is asserted below. More... | |
Functions | |
| PROTOCORE_NS_LAYOUT (UploadServiceNs, begin, last_size) | |
| void | protocore_upload_service_begin (uint8_t *work, const char *path, const char *dest_path) |
Register a streaming-upload endpoint. A POST path request streams . | |
| size_t | protocore_upload_service_last_size (uint8_t *work) |
| Bytes written by the most recent upload (for handlers / tests). | |
| uint8_t * | protocore_upload_service_span (void) |
| The PROTOCORE_UPLOAD_SERVICE_BORROW bytes this module's state lives in. | |
Variables | |
| PROTOCORE_NS UploadServiceNs UploadService | PROTOCORE_UNUSED |
| Module namespace. | |
Streaming file upload to an Arduino FS (PROTOCORE_ENABLE_UPLOAD).
Registers a POST route whose request body is streamed straight into a file on a filesystem (LittleFS / SPIFFS / SD) in FILE_CHUNK_SIZE pieces - the upload never has to fit in RAM. Reuses the parser's streaming-body hook (the same mechanism OTA uses), so it is zero-heap and bounded.
One upload at a time (the device runs a single loop task). Only one streaming sink can be installed, so PROTOCORE_ENABLE_UPLOAD and PROTOCORE_ENABLE_OTA share the parser hook - register whichever you need (not both on the same build).
work is PROTOCORE_UPLOAD_SERVICE_BORROW bytes the CALLER took, at an address it knows. It is not held past the call, so nothing here aliases it. How those bytes are carved is this module's and is never named here.
Definition in file upload_service.h.
| PROTOCORE_NS_LAYOUT | ( | UploadServiceNs | , |
| begin | , | ||
| last_size | |||
| ) |
| void protocore_upload_service_begin | ( | uint8_t * | work, |
| const char * | path, | ||
| const char * | dest_path | ||
| ) |
Register a streaming-upload endpoint. A POST path request streams .
| work | PROTOCORE_UPLOAD_SERVICE_BORROW bytes the caller took. Not held past the call. |
| path | the upload URL (e.g. "/upload") |
| dest_path | destination file path (e.g. "/uploads/data.bin") |
| size_t protocore_upload_service_last_size | ( | uint8_t * | work | ) |
Bytes written by the most recent upload (for handlers / tests).
| work | PROTOCORE_UPLOAD_SERVICE_BORROW bytes the caller took. Not held past the call. |
| uint8_t * protocore_upload_service_span | ( | void | ) |
The PROTOCORE_UPLOAD_SERVICE_BORROW bytes this module's state lives in.
Stated beside the namespace rather than on it: an entry takes a borrow, and this is where that borrow comes from. Taken once from the end of the pool, which no mark and no release walks, so the state lasts the life of the program.
| PROTOCORE_NS UploadServiceNs UploadService PROTOCORE_UNUSED |
Module namespace.
Definition at line 62 of file upload_service.h.