Downloader#
Functions
-
static inline int downloader_prepare(struct downloader *self, const struct downloader_param *param, downloader_data_cb_t data_cb, void *cb_ctx)#
Prepares the downloader with the given parameters.
This function sets up the downloader instance with the specified parameters, callback function, and callback context. It prepares the downloader for subsequent download operations.
- Parameters:
self – [in] Pointer to the downloader instance to be prepared.
param – [in] Pointer to the downloader parameters structure.
data_cb – [in] Callback function to be called when data is received.
cb_ctx – [in] Context to be passed to the callback function.
- Returns:
int Status code indicating the result of the preparation. 0 on success, negative value on error or failure.
-
static inline int downloader_process(struct downloader *self)#
Processes the downloader instance.
This function performs the necessary operations to process the downloader instance. It handles the downloading tasks and manages the state of the downloader.
- Parameters:
self – [in] Pointer to the downloader instance to be processed.
- Returns:
int Status code indicating the result of the processing. 0 on successful completion of the download, -EINPROGRESS if the download is still in progress, other negative values on error or failure.
-
static inline int downloader_cancel(struct downloader *self)#
Cancels the ongoing download operation.
This function cancels the current download operation for the given downloader instance. It stops any ongoing download tasks and cleans up any resources associated with the download.
- Parameters:
self – [in] Pointer to the downloader instance for which the download is to be canceled.
- Returns:
int Status code indicating the result of the cancellation. 0 on successful cancellation, negative value on error or failure.
-
static inline void downloader_delete(struct downloader *self)#
Deletes the downloader instance.
This function cleans up and deletes the downloader instance, releasing any resources that were allocated during its lifetime. It prepares the downloader for destruction.
- Parameters:
self – [in] Pointer to the downloader instance to be deleted.
Typedefs
-
typedef void (*downloader_data_cb_t)(const void *data, size_t datasize, void *ctx)#
-
struct downloader_param#
- #include <downloader.h>
-
struct downloader_api#
- #include <downloader.h>
Public Members
-
int (*prepare)(struct downloader *self, const struct downloader_param *param, downloader_data_cb_t data_cb, void *cb_ctx)#
-
int (*process)(struct downloader *self)#
-
int (*cancel)(struct downloader *self)#
-
void (*terminate)(struct downloader *self)#
-
int (*prepare)(struct downloader *self, const struct downloader_param *param, downloader_data_cb_t data_cb, void *cb_ctx)#