19#ifndef __DOWNLOADER_H__
20#define __DOWNLOADER_H__
22#include <zephyr/kernel.h>
23#include <zephyr/types.h>
24#include <zephyr/net/coap.h>
237 char hostname[CONFIG_DOWNLOADER_MAX_HOSTNAME_SIZE];
239 char file[CONFIG_DOWNLOADER_MAX_FILENAME_SIZE];
310 const char *url,
size_t from);
334 const char *host,
const char *file,
size_t from);
int downloader_init(struct downloader *dl, struct downloader_cfg *cfg)
Initialize the downloader.
int downloader_cancel(struct downloader *dl)
Cancel file download.
int downloader_get_with_host_and_file(struct downloader *dl, const struct downloader_host_cfg *host_cfg, const char *host, const char *file, size_t from)
Download a file asynchronously with host and file as separate parameters.
int downloader_get(struct downloader *dl, const struct downloader_host_cfg *host_cfg, const char *url, size_t from)
Download a file asynchronously.
int downloader_file_size_get(struct downloader *dl, size_t *size)
Retrieve the size of the file being downloaded, in bytes.
int downloader_deinit(struct downloader *dl)
Deinitialize the downloader.
downloader_state
Downloader internal state.
Definition downloader.h:216
@ DOWNLOADER_IDLE
Definition downloader.h:218
@ DOWNLOADER_DEINITIALIZED
Definition downloader.h:217
@ DOWNLOADER_DOWNLOADING
Definition downloader.h:221
@ DOWNLOADER_CONNECTING
Definition downloader.h:219
@ DOWNLOADER_DEINITIALIZING
Definition downloader.h:223
@ DOWNLOADER_CONNECTED
Definition downloader.h:220
@ DOWNLOADER_STOPPING
Definition downloader.h:222
int(* downloader_callback_t)(const struct downloader_evt *event)
Downloader asynchronous event handler.
Definition downloader.h:132
int downloader_downloaded_size_get(struct downloader *dl, size_t *size)
Retrieve the number of bytes downloaded so far.
downloader_evt_id
Downloader event IDs.
Definition downloader.h:33
@ DOWNLOADER_EVT_DEINITIALIZED
Definition downloader.h:88
@ DOWNLOADER_EVT_STOPPED
Definition downloader.h:86
@ DOWNLOADER_EVT_DONE
Definition downloader.h:84
@ DOWNLOADER_EVT_FRAGMENT
Definition downloader.h:40
@ DOWNLOADER_EVT_ERROR
Definition downloader.h:82
Definition downloader_transport.h:39
downloader_callback_t callback
Definition downloader.h:139
char * buf
Definition downloader.h:141
size_t buf_size
Definition downloader.h:143
Downloader configuration options.
Definition downloader.h:137
enum downloader_evt_id id
Definition downloader.h:106
struct downloader_fragment fragment
Definition downloader.h:112
int error
Definition downloader.h:110
Downloader event.
Definition downloader.h:104
const void * buf
Definition downloader.h:96
size_t len
Definition downloader.h:98
Downloader data fragment.
Definition downloader.h:94
bool keep_connection
Definition downloader.h:181
const char * proxy_uri
Definition downloader.h:201
uint8_t pdn_id
Definition downloader.h:165
const int * sec_tag_list
Definition downloader.h:155
const char * if_name
Definition downloader.h:210
bool cid
Definition downloader.h:186
uint8_t redirects_max
Definition downloader.h:206
size_t range_override
Definition downloader.h:173
int(* auth_cb)(int sock)
Definition downloader.h:196
uint8_t sec_tag_count
Definition downloader.h:160
bool set_native_tls
Definition downloader.h:175
int family
Definition downloader.h:191
Downloader host configuration options.
Definition downloader.h:149
size_t progress
Definition downloader.h:243
const struct dl_transport * transport
Definition downloader.h:253
char file[CONFIG_DOWNLOADER_MAX_FILENAME_SIZE]
Definition downloader.h:239
K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_DOWNLOADER_STACK_SIZE)
k_tid_t tid
Definition downloader.h:266
char hostname[CONFIG_DOWNLOADER_MAX_HOSTNAME_SIZE]
Definition downloader.h:237
struct downloader_host_cfg host_cfg
Definition downloader.h:235
size_t buf_offset
Definition downloader.h:245
bool complete
Definition downloader.h:247
size_t file_size
Definition downloader.h:241
enum downloader_state state
Definition downloader.h:262
struct k_mutex mutex
Definition downloader.h:260
struct k_thread thread
Definition downloader.h:264
struct k_sem event_sem
Definition downloader.h:258
uint8_t transport_internal[CONFIG_DOWNLOADER_TRANSPORT_PARAMS_SIZE]
Definition downloader.h:255
struct downloader_cfg cfg
Definition downloader.h:233
Downloader instance.
Definition downloader.h:231