Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
fota_http.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Espressif Systems (Shanghai) Co., Ltd.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
11
12#ifndef ZEPHYR_INCLUDE_MGMT_FOTA_HTTP_H_
13#define ZEPHYR_INCLUDE_MGMT_FOTA_HTTP_H_
14
15#include <stdbool.h>
16#include <stddef.h>
17#include <stdint.h>
18
19#include <zephyr/dfu/mcuboot.h>
21
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
38 size_t written;
40 size_t total;
43};
44
54typedef void (*fota_http_progress_cb_t)(const struct fota_http_progress *progress, void *user_data);
55
64typedef void (*fota_http_done_cb_t)(int result, void *user_data);
65
72 const char *url;
78 const char *const *headers;
79#if defined(CONFIG_FOTA_HTTP_SHA256_CHECK) || defined(__DOXYGEN__)
85#endif
86#if defined(CONFIG_FOTA_HTTP_TLS) || defined(__DOXYGEN__)
101 const char *tls_hostname;
102#endif
117#if defined(CONFIG_FOTA_HTTP_RESUME) || defined(__DOXYGEN__)
118 bool resume;
119#endif
120};
121
159
180 fota_http_done_cb_t done_cb);
181
192
220int fota_http_apply(uint8_t image_index, bool permanent);
221
235int fota_http_confirm(uint8_t image_index);
236
247
260
272
279
293int fota_http_tls_add_ca(const void *cert, size_t len);
294
308int fota_http_tls_add_client_cert(const void *cert, size_t cert_len, const void *key,
309 size_t key_len);
310
311#ifdef __cplusplus
312}
313#endif
314
318
319#endif /* ZEPHYR_INCLUDE_MGMT_FOTA_HTTP_H_ */
int fota_http_tls_add_ca(const void *cert, size_t len)
Register the CA certificate used to authenticate https servers.
int fota_http_get_image_header(uint8_t image_index, struct mcuboot_img_header *header)
Read the MCUboot header of the image in the secondary slot.
int fota_http_get_download_slot(uint8_t image_index)
Flash area identifier of the slot a download is written to.
bool fota_http_confirm_pending(void)
Check whether the running image still has to be confirmed.
int fota_http_download(const struct fota_http_download_params *params)
Download a firmware image into the MCUboot secondary slot.
int fota_http_apply(uint8_t image_index, bool permanent)
Request MCUboot to boot a downloaded image on the next reset.
int fota_http_confirm(uint8_t image_index)
Confirm a running image so the bootloader stops reverting it.
void(* fota_http_progress_cb_t)(const struct fota_http_progress *progress, void *user_data)
Progress callback.
Definition fota_http.h:54
size_t fota_http_nvm_bytes_written(void)
Bytes written to non-volatile memory by the most recent download.
int fota_http_cancel(void)
Abort the download in progress.
int fota_http_tls_add_client_cert(const void *cert, size_t cert_len, const void *key, size_t key_len)
Register a client certificate and key for mutual TLS.
void(* fota_http_done_cb_t)(int result, void *user_data)
Completion callback of fota_http_download_async().
Definition fota_http.h:64
int fota_http_download_async(const struct fota_http_download_params *params, fota_http_done_cb_t done_cb)
Download a firmware image on the library thread.
int sec_tag_t
Secure tag, a reference to TLS credential.
Definition tls_credentials.h:90
MCUboot public API for MCUboot control of image boot process.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Parameters of a download.
Definition fota_http.h:67
size_t sec_tag_count
Number of entries in sec_tags.
Definition fota_http.h:94
const sec_tag_t * sec_tags
Optional TLS security tags to use instead of <code class='doxyxref' data-stype='kconfig:option' data...
Definition fota_http.h:92
fota_http_progress_cb_t progress_cb
Optional progress callback.
Definition fota_http.h:104
void * user_data
Passed to the callbacks untouched.
Definition fota_http.h:106
const char * url
Absolute URL of the form "http://host[:port]/path", or "https" when <code class='doxyxref' data-styp...
Definition fota_http.h:72
const char *const * headers
Optional NULL terminated list of extra request headers.
Definition fota_http.h:78
uint8_t image_index
Image to update in a multi-image layout, 0 for the only image.
Definition fota_http.h:108
const uint8_t * sha256
Optional expected SHA-256 digest of the image, 32 bytes.
Definition fota_http.h:84
bool resume
Continue a previously interrupted download.
Definition fota_http.h:118
const char * tls_hostname
Optional host name to verify the server certificate against, when it differs from the URL host.
Definition fota_http.h:101
Transfer state reported while an image is being written.
Definition fota_http.h:36
size_t total
Total image size, or 0 when the server did not announce it.
Definition fota_http.h:40
size_t written
Bytes present in the slot so far, including resumed data.
Definition fota_http.h:38
int http_status
HTTP status code of the response.
Definition fota_http.h:42
Model for the MCUBoot image header.
Definition mcuboot.h:131
TLS credentials management.