File: libcurl.h

package info (click to toggle)
darkplaces 0~20180412~beta1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,200 kB
  • sloc: ansic: 176,886; makefile: 485; pascal: 455; perl: 372; objc: 245; sh: 102
file content (45 lines) | stat: -rw-r--r-- 1,948 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
enum
{
	CURLCBSTATUS_OK = 0,
	CURLCBSTATUS_FAILED = -1, // failed for generic reason (e.g. buffer too small)
	CURLCBSTATUS_ABORTED = -2, // aborted by curl --cancel
	CURLCBSTATUS_SERVERERROR = -3, // only used if no HTTP status code is available
	CURLCBSTATUS_UNKNOWN = -4 // should never happen
};
typedef void (*curl_callback_t) (int status, size_t length_received, unsigned char *buffer, void *cbdata);
// code is one of the CURLCBSTATUS constants, or the HTTP error code (when > 0).

void Curl_Run(void);
qboolean Curl_Running(void);
qboolean Curl_Begin_ToFile(const char *URL, double maxspeed, const char *name, int loadtype, qboolean forthismap);

qboolean Curl_Begin_ToMemory(const char *URL, double maxspeed, unsigned char *buf, size_t bufsize, curl_callback_t callback, void *cbdata);
qboolean Curl_Begin_ToMemory_POST(const char *URL, const char *extraheaders, double maxspeed, const char *post_content_type, const unsigned char *postbuf, size_t postbufsize, unsigned char *buf, size_t bufsize, curl_callback_t callback, void *cbdata);
void Curl_Cancel_ToMemory(curl_callback_t callback, void* cbdata);

void Curl_Init(void);
void Curl_Init_Commands(void);
void Curl_Shutdown(void);
void Curl_CancelAll(void);
void Curl_Clear_forthismap(void);
qboolean Curl_Have_forthismap(void);
void Curl_Register_predownload(void);

void Curl_ClearRequirements(void);
void Curl_RequireFile(const char *filename);
void Curl_SendRequirements(void);

typedef struct Curl_downloadinfo_s
{
	char filename[MAX_QPATH];
	double progress;
	double speed;
	qboolean queued;
}
Curl_downloadinfo_t;
Curl_downloadinfo_t *Curl_GetDownloadInfo(int *nDownloads, const char **additional_info, char *addinfo, size_t addinfolength);
	// this may and should be Z_Free()ed
	// the result is actually an array
	// an additional info string may be returned in additional_info as a
	// pointer to a static string (but the argument may be NULL if the caller
	// does not care)