HTTP client. More...
Data Structures | |
struct | vtm_http_client_req |
struct | vtm_http_client_res |
Macros | |
#define | VTM_HTTP_CL_OPT_NO_CERT_CHECK 1 |
#define | VTM_HTTP_CL_OPT_TIMEOUT 2 |
Typedefs | |
typedef struct vtm_http_client | vtm_http_client |
Functions | |
VTM_API vtm_http_client * | vtm_http_client_new (void) |
VTM_API void | vtm_http_client_free (vtm_http_client *cl) |
VTM_API int | vtm_http_client_set_opt (vtm_http_client *cl, int opt, const void *val, size_t len) |
VTM_API int | vtm_http_client_request (vtm_http_client *cl, struct vtm_http_client_req *req, struct vtm_http_client_res *res) |
VTM_API void | vtm_http_client_res_release (struct vtm_http_client_res *res) |
#define VTM_HTTP_CL_OPT_NO_CERT_CHECK 1 |
expects bool
#define VTM_HTTP_CL_OPT_TIMEOUT 2 |
expects unsigned long, value is millisceonds
VTM_API vtm_http_client* vtm_http_client_new | ( | void | ) |
Creates a new client.
VTM_API void vtm_http_client_free | ( | vtm_http_client * | cl | ) |
Releases the client and all allocated resources.
After this call the client pointer is no longer valid.
cl | the client that should be released |
VTM_API int vtm_http_client_set_opt | ( | vtm_http_client * | cl, |
int | opt, | ||
const void * | val, | ||
size_t | len | ||
) |
Sets one of the possible options.
The possible options are macros starting with VTM_HTTP_CL_OPT_.
cl | the client where the option should be set |
opt | the option that should be set |
val | pointer to new value of the option |
len | size of the value |
VTM_API int vtm_http_client_request | ( | vtm_http_client * | cl, |
struct vtm_http_client_req * | req, | ||
struct vtm_http_client_res * | res | ||
) |
Sends specified HTTP request and retrieves response.
This call blocks until the response was received or the timeout elapsed.
cl | the client that should make the request | |
req | the request parameters | |
[out] | res | the response is stored here |
VTM_API void vtm_http_client_res_release | ( | struct vtm_http_client_res * | res | ) |
Releases all allocated resources of the given response.
res | the response that should be released |