//
// Created by xajhu on 2021/7/1 0001.
//

#ifndef DAEMON_AGENT_NETWORD_INET_MISC_H
#define DAEMON_AGENT_NETWORD_INET_MISC_H
#ifdef __cplusplus
extern "C" {
#endif

int inet_api_init(void);

typedef void (*on_http_response)(void        *pData,
                                 unsigned int size,
                                 const char  *pReqUrl,
                                 const char  *pDlPath,
                                 const char  *pTaskUuid,
                                 int          iFinished,
                                 void        *pUserData);
typedef void (*on_progress_changed)(const char   *pReqUrl,
                                    const char   *pTaskUuid,
                                    unsigned char uPercent,
                                    void         *pUserData);

const char *inet_download_file_async(const char         *pURL,
                                     const char         *pPath,
                                     on_http_response    onRespCb,
                                     on_progress_changed onProgressCb,
                                     void               *pData);

const char *inet_http_post_async(const char *pURL, const char *pPost, on_http_response onRespCb, void *pData);

int inet_cancel_dl(const char *pTaskUuid);
#ifdef __cplusplus
}
#endif
#endif    //DAEMON_AGENT_NETWORD_INET_MISC_H