DTS Application Library
0.2.3
Application library containing referenced objects and interfaces to common libraries
|
Interface to libCURL. More...
Files | |
file | curl.c |
CURL Interface. | |
Data Structures | |
struct | curl_progress |
Allow progress monitoring. | |
struct | curl_password |
CURL Authentification callback. | |
struct | curl_post |
HTTP post data structure. More... | |
struct | basic_auth |
Basic authentification structure. More... | |
struct | curlbuf |
Buffer containing the result of a curl transaction. More... | |
Typedefs | |
typedef struct curl_post | curl_post |
Forward decleration of structure. More... | |
typedef struct basic_auth *(* | curl_authcb )(const char *, const char *, void *) |
Callback to set the authentification ie on error 401. More... | |
typedef int(* | curl_progress_func )(void *, double, double, double, double) |
CURL callback function called when there is progress (CURLOPT_PROGRESSFUNCTION). More... | |
typedef void(* | curl_progress_pause )(void *, int) |
Callback function to control the progress bar. More... | |
typedef void *(* | curl_progress_newdata )(void *) |
Create a new progress data structure. More... | |
Functions | |
int | curlinit (void) |
Initilise the CURL library. More... | |
void | curlclose (void) |
Un reference CURL. This is required for each call to curlinit(). More... | |
struct curlbuf * | curl_geturl (const char *def_url, struct basic_auth *bauth, curl_authcb authcb, void *auth_data) |
Fetch the URL using CURL (HTTP GET) More... | |
struct curlbuf * | curl_posturl (const char *def_url, struct basic_auth *bauth, struct curl_post *post, curl_authcb authcb, void *auth_data) |
Fetch the URL using CURL (HTTP POST) More... | |
struct curlbuf * | curl_ungzip (struct curlbuf *cbuf) |
If the buffer contains GZIP data uncompress it. More... | |
struct basic_auth * | curl_newauth (const char *user, const char *passwd) |
Create a new auth structure with initial vallues. More... | |
struct curl_post * | curl_newpost (void) |
Create a HTTP Post data structure. More... | |
void | curl_postitem (struct curl_post *post, const char *name, const char *value) |
Add a item value pair to post structure. More... | |
char * | url_escape (char *url) |
Escape and return the url. More... | |
char * | url_unescape (char *url) |
UN escape and return the url. More... | |
void | curl_setprogress (curl_progress_func cb, curl_progress_pause p_cb, curl_progress_newdata d_cb, void *data) |
Configure global progress handling. More... | |
void | curl_setauth_cb (curl_authcb auth_cb, void *data) |
Set global password callback. More... | |
struct xml_doc * | curl_buf2xml (struct curlbuf *cbuf) |
Create a XML document from from buffer (application/xml) More... | |
Interface to libCURL.
typedef struct basic_auth*(* curl_authcb)(const char *, const char *, void *) |
typedef int(* curl_progress_func)(void *, double, double, double, double) |
CURL callback function called when there is progress (CURLOPT_PROGRESSFUNCTION).
clientp | Reference to userdata supplied. |
dltotal | Total download bytes. |
dlnow | Current bytes downloaded. |
ultotal | Total upload bytes. |
ulnow | Current upload bytes. |
typedef void*(* curl_progress_newdata)(void *) |
Create a new progress data structure.
curl_setprogress() allows setting a default progress callback if set it will call a callback to create a new callback progress userdata for the current session.
data | Reference to userdata supplied to curl_setprogress(). |
typedef void(* curl_progress_pause)(void *, int) |
Create a XML document from from buffer (application/xml)
cbuf | CURL request buffer. |
Definition at line 489 of file curl.c.
References curlbuf::body, curlbuf::bsize, curlbuf::c_type, curl_ungzip(), and xml_loadbuf().
struct curlbuf* curl_geturl | ( | const char * | def_url, |
struct basic_auth * | bauth, | ||
curl_authcb | authcb, | ||
void * | auth_data | ||
) |
Fetch the URL using CURL (HTTP GET)
def_url | URL to fetch. |
bauth | Basic auth structure to initilise auth. |
authcb | Callback if authentification is required. |
auth_data | Reference to userdata passed in auth callback. |
struct basic_auth* curl_newauth | ( | const char * | user, |
const char * | passwd | ||
) |
Create a new auth structure with initial vallues.
user | Optional initial username to set. |
passwd | Optional initial password to set. |
Definition at line 328 of file curl.c.
References objalloc(), basic_auth::passwd, and basic_auth::user.
struct curl_post* curl_newpost | ( | void | ) |
Create a HTTP Post data structure.
Definition at line 356 of file curl.c.
References curl_post::first, curl_post::last, and objalloc().
void curl_postitem | ( | struct curl_post * | post, |
const char * | name, | ||
const char * | value | ||
) |
Add a item value pair to post structure.
post | Post structure created with curl_newpost() |
name | Name of the pair. |
value | Value of the pair. |
Definition at line 370 of file curl.c.
References curl_post::first, curl_post::last, objlock(), and objunlock().
struct curlbuf* curl_posturl | ( | const char * | def_url, |
struct basic_auth * | bauth, | ||
struct curl_post * | post, | ||
curl_authcb | authcb, | ||
void * | auth_data | ||
) |
Fetch the URL using CURL (HTTP POST)
def_url | URL to fetch. |
bauth | Basic auth structure to initilise auth. |
post | Reference to curl post structure. |
authcb | Callback if authentification is required. |
auth_data | Reference to userdata passed in auth callback. |
void curl_setauth_cb | ( | curl_authcb | auth_cb, |
void * | data | ||
) |
Set global password callback.
auth_cb | Authentification call back. |
data | Reference to userdata passed in callback. |
Definition at line 470 of file curl.c.
References objalloc(), objref(), and objunref().
void curl_setprogress | ( | curl_progress_func | cb, |
curl_progress_pause | p_cb, | ||
curl_progress_newdata | d_cb, | ||
void * | data | ||
) |
Configure global progress handling.
cb | CURL progress function callback. |
p_cb | CURL progress control (pause) callback. |
d_cb | CURL progress data allocation callback. |
data | initial data passed to d_cb. |
Definition at line 442 of file curl.c.
References objalloc(), objref(), and objunref().
If the buffer contains GZIP data uncompress it.
cbuf | Curl buffer to uncompress. |
Definition at line 295 of file curl.c.
References curlbuf::body, curlbuf::bsize, gzinflatebuf(), and is_gzip().
Referenced by curl_buf2xml().
void curlclose | ( | void | ) |
Un reference CURL. This is required for each call to curlinit().
Definition at line 122 of file curl.c.
References objunref().
int curlinit | ( | void | ) |
Initilise the CURL library.
Definition at line 92 of file curl.c.
References objalloc(), objlock(), objref(), objunlock(), and objunref().
Referenced by url_escape(), and url_unescape().
char* url_escape | ( | char * | url | ) |
Escape and return the url.
url | URL to escape |
Definition at line 385 of file curl.c.
References curlinit(), objlock(), objunlock(), and objunref().
char* url_unescape | ( | char * | url | ) |
UN escape and return the url.
url | URL to un escape |
Definition at line 407 of file curl.c.
References curlinit(), objlock(), objunlock(), and objunref().