]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - libcurl.h
reworked GL shader detection a bit, now works on Mac with Intel GMA 945 again
[xonotic/darkplaces.git] / libcurl.h
1 enum
2 {
3         CURLCBSTATUS_OK = 0,
4         CURLCBSTATUS_FAILED = -1, // failed for generic reason (e.g. buffer too small)
5         CURLCBSTATUS_ABORTED = -2, // aborted by curl --cancel
6         CURLCBSTATUS_SERVERERROR = -3, // only used if no HTTP status code is available
7         CURLCBSTATUS_UNKNOWN = -4 // should never happen
8 };
9 typedef void (*curl_callback_t) (int status, size_t length_received, unsigned char *buffer, void *cbdata);
10 // code is one of the CURLCBSTATUS constants, or the HTTP error code (when > 0).
11
12 void Curl_Run(void);
13 qboolean Curl_Running(void);
14 qboolean Curl_Begin_ToFile(const char *URL, double maxspeed, const char *name, qboolean ispak, qboolean forthismap);
15
16 qboolean Curl_Begin_ToMemory(const char *URL, double maxspeed, unsigned char *buf, size_t bufsize, curl_callback_t callback, void *cbdata);
17 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);
18         // NOTE: if these return false, the callback will NOT get called, so free your buffer then!
19 void Curl_Cancel_ToMemory(curl_callback_t callback, void *cbdata);
20         // removes all downloads with the given callback and cbdata (this does NOT call the callbacks!)
21
22 void Curl_Init(void);
23 void Curl_Init_Commands(void);
24 void Curl_Shutdown(void);
25 void Curl_CancelAll(void);
26 void Curl_Clear_forthismap(void);
27 qboolean Curl_Have_forthismap(void);
28 void Curl_Register_predownload(void);
29
30 void Curl_ClearRequirements(void);
31 void Curl_RequireFile(const char *filename);
32 void Curl_SendRequirements(void);
33
34 typedef struct Curl_downloadinfo_s
35 {
36         char filename[MAX_QPATH];
37         double progress;
38         double speed;
39         qboolean queued;
40 }
41 Curl_downloadinfo_t;
42 Curl_downloadinfo_t *Curl_GetDownloadInfo(int *nDownloads, const char **additional_info);
43         // this may and should be Z_Free()ed
44         // the result is actually an array
45         // an additional info string may be returned in additional_info as a
46         // pointer to a static string (but the argument may be NULL if the caller
47         // does not care)