Typedef anjay_download_next_block_handler_t

Typedef Documentation

typedef avs_error_t anjay_download_next_block_handler_t(anjay_t *anjay, const uint8_t *data, size_t data_size, const anjay_etag_t *etag, void *user_data)

Called each time a chunk of data is received from remote host. It is guaranteed to be called with consecutive chunks of data, starting from anjay_download_config_t::start_offset.

Param anjay:

Anjay object managing the download process.

Param data:

Received data.

Param data_size:

Number of bytes available in data .

Param etag:

ETag option sent by the server. Should be saved if the client may need to resume the transfer after it gets interrupted.

Param user_data:

Value of anjay_download_config_t::user_data passed to anjay_download .

Return:

Should return:

  • AVS_OK on success,

  • an error value if an error occurred, in which case the download will be terminated with ANJAY_DOWNLOAD_ERR_FAILED result.