Skip to content
Newer
Older
100644 70 lines (58 sloc) 1.7 KB
f74cdfa @elginer Use git. Why not before?
authored Nov 14, 2010
1 /*
2 * Haskell FFI friendly wrappers to curl_easy_* functions
3 * for setting/getting option values. Could import these into
4 * .hs without too much trouble, but calling out to 'typed'
5 * versions saves the C compiler from issuing warnings.
6 *
7 * (c) 2007-2009, Galois, Inc.
8 *
9 */
10 #include <curl/curl.h>
11
12 int curl_easy_getinfo_long(void *curl, long tg, long *pl)
13 {
14 return curl_easy_getinfo(curl, CURLINFO_LONG+tg, pl);
15 }
16
17 int curl_easy_getinfo_string(void *curl, long tg, char **s)
18 {
19 return curl_easy_getinfo(curl, CURLINFO_STRING+tg, s);
20 }
21
22 int curl_easy_getinfo_double(void *curl, long tg, double *d)
23 {
24 return curl_easy_getinfo(curl, CURLINFO_DOUBLE+tg, d);
25 }
26
27 int curl_easy_getinfo_slist(void *curl, long tg, char ***s)
28 {
29 return curl_easy_getinfo(curl, CURLINFO_SLIST+tg, s);
30 }
31
32
33 int curl_easy_setopt_long(void *curl, int i, long x)
34 { return curl_easy_setopt(curl,i,x); }
35
36 int curl_easy_setopt_longlong(void *curl, int i, long long x)
37 { return curl_easy_setopt(curl,i,x); }
38
39 int curl_easy_setopt_string(void *curl, int i, char *x)
40 { return curl_easy_setopt(curl,i,x); }
41
42 int curl_easy_setopt_ptr(void *curl, int i, void *x)
43 { return curl_easy_setopt(curl,i,x); }
44
45 /*
46 * Function curl_version_str()
47 *
48 * Returns the libcurl version number as a "MAJOR.MINOR.PATCH" string.
49 *
50 * Note: a static string, so no free()ing required (or asked for! :-)
51 */
52 char*
53 curl_version_str() {
54 return LIBCURL_VERSION;
55 }
56
57 /*
58 * Function curl_version_num()
59 *
60 * Returns the libcurl version number in 3-byte format 0xXXYYZZ,
61 * representing major,minor and patch levels. Encoded in a (host)
62 * 'int' value, making for easy comparisons.
63 *
64 * See curlver.h for complete story.
65 */
66 int
67 curl_version_num() {
68 return LIBCURL_VERSION_NUM;
69 }
Something went wrong with that request. Please try again.