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>
31#define K_THREAD_STACK_MEMBER K_KERNEL_STACK_MEMBER
163 char buf[CONFIG_DOWNLOAD_CLIENT_BUF_SIZE];
214 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.
#define K_THREAD_STACK_MEMBER
Definition download_client.h:31
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:36
@ DOWNLOAD_CLIENT_EVT_CLOSED
Definition download_client.h:79
@ DOWNLOAD_CLIENT_EVT_ERROR
Definition download_client.h:75
@ DOWNLOAD_CLIENT_EVT_FRAGMENT
Definition download_client.h:41
@ DOWNLOAD_CLIENT_EVT_DONE
Definition download_client.h:77
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:146
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:119
uint8_t sec_tag_count
Definition download_client.h:114
int family
Definition download_client.h:124
size_t frag_size_override
Definition download_client.h:128
bool set_tls_hostname
Definition download_client.h:130
const int * sec_tag_list
Definition download_client.h:110
Download client configuration options.
Definition download_client.h:105
int error
Definition download_client.h:96
enum download_client_evt_id id
Definition download_client.h:92
struct download_fragment fragment
Definition download_client.h:98
Download client event.
Definition download_client.h:90
struct download_client::@199 coap
struct k_sem wait_for_download
Definition download_client.h:210
const char * host
Definition download_client.h:175
bool has_header
Definition download_client.h:190
size_t progress
Definition download_client.h:170
bool set_native_tls
Definition download_client.h:220
size_t offset
Definition download_client.h:165
struct coap_pending pending
Definition download_client.h:202
k_tid_t tid
Definition download_client.h:206
enum download_client::@200 state
struct k_mutex mutex
Definition download_client.h:154
int proto
Definition download_client.h:184
struct download_client_cfg config
Definition download_client.h:181
size_t file_size
Definition download_client.h:168
bool close_when_done
Definition download_client.h:223
struct k_thread thread
Definition download_client.h:208
const char * file
Definition download_client.h:179
char buf[CONFIG_DOWNLOAD_CLIENT_BUF_SIZE]
Definition download_client.h:163
bool connection_close
Definition download_client.h:192
struct sockaddr remote_addr
Definition download_client.h:160
int fd
Definition download_client.h:157
@ DOWNLOAD_CLIENT_FINISHED
Definition download_client.h:229
@ DOWNLOAD_CLIENT_CLOSING
Definition download_client.h:230
@ DOWNLOAD_CLIENT_DOWNLOADING
Definition download_client.h:228
@ DOWNLOAD_CLIENT_IDLE
Definition download_client.h:226
@ DOWNLOAD_CLIENT_CONNECTING
Definition download_client.h:227
download_client_callback_t callback
Definition download_client.h:217
struct coap_block_context block_ctx
Definition download_client.h:199
bool ranged
Definition download_client.h:194
struct download_client::@198 http
Download client instance.
Definition download_client.h:152
const void * buf
Definition download_client.h:83
size_t len
Definition download_client.h:84
Definition download_client.h:82