20#ifndef DOWNLOAD_CLIENT_H__
21#define DOWNLOAD_CLIENT_H__
23#include <zephyr/kernel.h>
24#include <zephyr/types.h>
25#include <zephyr/net/coap.h>
161 char buf[CONFIG_DOWNLOAD_CLIENT_BUF_SIZE];
212 CONFIG_DOWNLOAD_CLIENT_STACK_SIZE);
int download_client_get(struct download_client *client, const char *host, const struct download_client_cfg *config, const char *file, size_t from)
Download a file asynchronously.
int download_client_downloaded_size_get(struct download_client *client, size_t *size)
Retrieve the number of bytes downloaded so far.
int download_client_init(struct download_client *client, download_client_callback_t callback)
Initialize the download client.
int download_client_start(struct download_client *client, const char *file, size_t from)
Download a file.
download_client_evt_id
Download client event IDs.
Definition: download_client.h:34
@ DOWNLOAD_CLIENT_EVT_CLOSED
Definition: download_client.h:77
@ DOWNLOAD_CLIENT_EVT_ERROR
Definition: download_client.h:73
@ DOWNLOAD_CLIENT_EVT_FRAGMENT
Definition: download_client.h:39
@ DOWNLOAD_CLIENT_EVT_DONE
Definition: download_client.h:75
int download_client_set_host(struct download_client *client, const char *host, const struct download_client_cfg *config)
Set a target hostname.
int(* download_client_callback_t)(const struct download_client_evt *event)
Download client asynchronous event handler.
Definition: download_client.h:144
int download_client_disconnect(struct download_client *client)
Initiate disconnection.
int download_client_file_size_get(struct download_client *client, size_t *size)
Retrieve the size of the file being downloaded, in bytes.
uint8_t pdn_id
Definition: download_client.h:117
uint8_t sec_tag_count
Definition: download_client.h:112
int family
Definition: download_client.h:122
size_t frag_size_override
Definition: download_client.h:126
bool set_tls_hostname
Definition: download_client.h:128
const int * sec_tag_list
Definition: download_client.h:108
Download client configuration options.
Definition: download_client.h:103
int error
Definition: download_client.h:94
enum download_client_evt_id id
Definition: download_client.h:90
struct download_fragment fragment
Definition: download_client.h:96
Download client event.
Definition: download_client.h:88
struct k_sem wait_for_download
Definition: download_client.h:208
const char * host
Definition: download_client.h:173
bool has_header
Definition: download_client.h:188
size_t progress
Definition: download_client.h:168
bool set_native_tls
Definition: download_client.h:218
size_t offset
Definition: download_client.h:163
struct coap_pending pending
Definition: download_client.h:200
k_tid_t tid
Definition: download_client.h:204
struct k_mutex mutex
Definition: download_client.h:152
int proto
Definition: download_client.h:182
struct download_client::@196 coap
struct download_client_cfg config
Definition: download_client.h:179
size_t file_size
Definition: download_client.h:166
bool close_when_done
Definition: download_client.h:221
struct k_thread thread
Definition: download_client.h:206
const char * file
Definition: download_client.h:177
char buf[CONFIG_DOWNLOAD_CLIENT_BUF_SIZE]
Definition: download_client.h:161
bool connection_close
Definition: download_client.h:190
struct download_client::@195 http
struct sockaddr remote_addr
Definition: download_client.h:158
@ DOWNLOAD_CLIENT_FINISHED
Definition: download_client.h:227
@ DOWNLOAD_CLIENT_CLOSING
Definition: download_client.h:228
@ DOWNLOAD_CLIENT_DOWNLOADING
Definition: download_client.h:226
@ DOWNLOAD_CLIENT_IDLE
Definition: download_client.h:224
@ DOWNLOAD_CLIENT_CONNECTING
Definition: download_client.h:225
int fd
Definition: download_client.h:155
enum download_client::@197 state
download_client_callback_t callback
Definition: download_client.h:215
struct coap_block_context block_ctx
Definition: download_client.h:197
bool ranged
Definition: download_client.h:192
K_THREAD_STACK_MEMBER(thread_stack, CONFIG_DOWNLOAD_CLIENT_STACK_SIZE)
Download client instance.
Definition: download_client.h:150
const void * buf
Definition: download_client.h:81
size_t len
Definition: download_client.h:82
Definition: download_client.h:80