|
esp_iot_framework
v0.1.0-alpha
© 2026 AmakeSasha, distributed under a license Apache-2.0
|
Management of HTTP/HTTPS endpoints and server tuning. More...
Functions | |
| esp_err_t | eif_set_server_config_https (const httpd_ssl_config_t *const server_config) |
| Tune the HTTPS server settings. More... | |
| esp_err_t | eif_set_server_config_http (const httpd_config_t *const server_config) |
| Tune the HTTP server settings. More... | |
| esp_err_t | eif_set_uri_handlers (const httpd_uri_t *const uri_handlers, size_t uri_handlers_count) |
| Register custom URI handlers (endpoints). More... | |
This module allows registering custom routes and fine-tuning server. The framework automatically manages the server lifecycle, starting it only when a valid IP is obtained and stopping it upon disconnection.
CONFIG_EIF_ENABLE_TLS flag from Kconfig via idf.py menuconfig. Depending on this setting, the server will operate in either HTTP or HTTPS mode, and the corresponding configuration functions will be available.If you frequently intersect between HTTP and HTTPS during development and need custom server settings, you can use the following construct:
| esp_err_t eif_set_server_config_https | ( | const httpd_ssl_config_t *const | server_config | ) |
CONFIG_EIF_ENABLE_TLS is enabled.Overrides default HTTPS server parameters (ports, stack size, timeouts, etc.). You can also change the server's HTTP settings via server_config. The framework creates an internal copy of the structure, so the original data's lifecycle no longer matters after the call.
eif_initialize() but before eif_wifi_initialize().server_config are explicitly overwritten with the following values:cacert_pem - NULLprvtkey_pem - NULLcacert_len - 0prvtkey_len - 0transport_mode - HTTPD_SSL_TRANSPORT_SECUREsession_tickets - falsehttpd.max_uri_handlers - calculated automatically| server_config | Pointer to server configuration. Use HTTPD_SSL_CONFIG_DEFAULT() as base. |
ESP_OK: Configuration applied.ESP_ERR_INVALID_ARG: If server_config is NULL.Example of use:
| esp_err_t eif_set_server_config_http | ( | const httpd_config_t *const | server_config | ) |
CONFIG_EIF_ENABLE_TLS is disabled.Overrides default HTTP server parameters (ports, stack size, priority, timeouts, etc.). You can also change the server's HTTP settings via server_config. The framework creates an internal copy of the structure, so the original data's lifecycle no longer matters after the call.
eif_initialize() but before eif_wifi_initialize().server_config are explicitly overwritten with the following values:max_uri_handlers - calculated automatically| server_config | Pointer to server configuration. Use HTTPD_DEFAULT_CONFIG() as base. |
ESP_OK: Configuration applied.ESP_ERR_INVALID_ARG: If server_config is NULL.Example of use:
| esp_err_t eif_set_uri_handlers | ( | const httpd_uri_t *const | uri_handlers, |
| size_t | uri_handlers_count | ||
| ) |
eif_initialize() but before eif_wifi_initialize().Passes application-specific routes (e.g., /api/data, /status) to the framework. The passed handlers are automatically registered in the server at startup. The framework creates an internal copy of the structure, so the original data's lifecycle no longer matters after the call. When the function is called again, the handlers saved in advance will be deleted.
uri_handlers_count. If the count exceeds the actual array length, a Buffer Overread will occur. If the count is less than the actual length, Truncation will occur (only the first uri_handlers_count elements will be registered). | uri_handlers | Array of URI structures defining paths and callbacks. |
| uri_handlers_count | Number of elements in the array. |
ESP_OK: Handlers stored successfully.ESP_ERR_INVALID_ARG: If uri_handlers is NULL.ESP_ERR_NO_MEM: Failed to allocate memory for the internal copy.Example of use: