]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - libcurl.h
Release the mouse during loading screen
[xonotic/darkplaces.git] / libcurl.h
1 #include <stddef.h>
2 #include "qtypes.h"
3 #include "qdefs.h"
4
5 enum
6 {
7         CURLCBSTATUS_OK = 0,
8         CURLCBSTATUS_FAILED = -1, // failed for generic reason (e.g. buffer too small)
9         CURLCBSTATUS_ABORTED = -2, // aborted by curl --cancel
10         CURLCBSTATUS_SERVERERROR = -3, // only used if no HTTP status code is available
11         CURLCBSTATUS_UNKNOWN = -4 // should never happen
12 };
13 typedef void (*curl_callback_t) (int status, size_t length_received, unsigned char *buffer, void *cbdata);
14 // code is one of the CURLCBSTATUS constants, or the HTTP error code (when > 0).
15
16 void Curl_Frame(void);
17 void Curl_Select(double *microseconds);
18 qbool Curl_Running(void);
19 qbool Curl_Begin_ToFile(const char *URL, double maxspeed, const char *name, int loadtype, qbool forthismap);
20
21 qbool Curl_Begin_ToMemory(const char *URL, double maxspeed, unsigned char *buf, size_t bufsize, curl_callback_t callback, void *cbdata);
22 qbool 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);
23 void Curl_Cancel_ToMemory(curl_callback_t callback, void* cbdata);
24
25 void Curl_Init(void);
26 void Curl_Init_Commands(void);
27 void Curl_Shutdown(void);
28 void Curl_CancelAll(void);
29 void Curl_Clear_forthismap(void);
30 qbool Curl_Have_forthismap(void);
31 void Curl_Register_predownload(void);
32
33 void Curl_ClearRequirements(void);
34 void Curl_RequireFile(const char *filename);
35 void Curl_SendRequirements(void);
36
37 typedef struct Curl_downloadinfo_s
38 {
39         char filename[MAX_QPATH];
40         double progress;
41         double speed;
42         qbool queued;
43 }
44 Curl_downloadinfo_t;
45 Curl_downloadinfo_t *Curl_GetDownloadInfo(int *nDownloads, const char **additional_info, char *addinfo, size_t addinfolength);
46         // this may and should be Z_Free()ed
47         // the result is actually an array
48         // an additional info string may be returned in additional_info as a
49         // pointer to a static string (but the argument may be NULL if the caller
50         // does not care)