ddnet/src/engine/client/fetcher.h

32 lines
880 B
C
Raw Normal View History

#ifndef ENGINE_CLIENT_FETCHER_H
#define ENGINE_CLIENT_FETCHER_H
#define WIN32_LEAN_AND_MEAN
#include "curl/curl.h"
#include "curl/easy.h"
#include <engine/fetcher.h>
class CFetcher : public IFetcher
{
private:
CURL *m_pHandle;
LOCK m_Lock;
CFetchTask *m_pFirst;
CFetchTask *m_pLast;
class IStorage *m_pStorage;
public:
CFetcher();
virtual bool Init();
~CFetcher();
2015-01-19 22:00:08 +00:00
virtual void QueueAdd(CFetchTask *pTask, const char *pUrl, const char *pDest, int StorageType = 2, void *pUser = 0, COMPFUNC pfnCompCb = 0, PROGFUNC pfnProgCb = 0);
2015-02-12 17:58:54 +00:00
virtual void Escape(char *pBud, size_t size, const char *pStr);
static void FetcherThread(void *pUser);
bool FetchFile(CFetchTask *pTask);
static void WriteToFile(char *pData, size_t size, size_t nmemb, void *pFile);
static int ProgressCallback(void *pUser, double DlTotal, double DlCurr, double UlTotal, double UlCurr);
};
#endif