Struct anjay_download_config

Struct Documentation

struct anjay_download_config

Public Members

const char *url

Required. coap://, coaps://, http:// or https:// URL

size_t start_offset

If the download gets interrupted for some reason, and the client is aware of how much data it managed to successfully download, it can resume the transfer from a specific offset.

const anjay_etag_t *etag

If start_offset is not 0, etag should be set to a value returned by the server during the transfer before it got interrupted.

anjay_download_next_block_handler_t *on_next_block

Required. Called after receiving a chunk of data from remote server.

anjay_download_finished_handler_t *on_download_finished

Required. Called after the download is finished or aborted.

void *user_data

Opaque pointer passed to download handlers.

anjay_security_config_t security_config

DTLS security configuration. Required if coaps:// is used, ignored for coap:// transfers.

Contents of any data aggregated as pointers within is copied as needed, so it is safe to free all related resources array after the call to anjay_download.

avs_coap_udp_tx_params_t *coap_tx_params

Pointer to CoAP transmission parameters object. If NULL, downloader will inherit parameters from Anjay.

avs_time_duration_t tcp_request_timeout

Time of inactivity that will cause the download to time out when using TCP-based transports (i.e., CoAP+TCP or HTTP).

If uninitialized or otherwise non-positive (including zero and invalid value), the value passed as anjay_configuration_t::coap_tcp_request_timeout (or its default, which is 30 seconds) will be used for CoAP+TCP, and AVS_NET_SOCKET_DEFAULT_RECV_TIMEOUT (i.e., 30 seconds) will be used for HTTP.

bool prefer_same_socket_downloads

If set to true, the downloader module will attempt performing downloads over the same sockets as existing LwM2M Servers (if the download URI is found to match the URI of some LwM2M Server). Moreover, if set to true, security_config as well as coap_tx_params MAY or MAY NOT be used depending on whether the new socket is created or an existing one can be reused.