XROAD
http_client.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <string.h>
8 #include <common/xroad_string.h>
9 #include <common/xroad_xml.h>
10 #include <common/xroad_map.h>
11 #include <common/xroad_list.h>
12 
13 #ifdef __cplusplus
14 extern "C"
15 {
16 #endif
17 
18 typedef struct http_client_s http_client_t;
19 typedef struct http_request_s http_request_t;
20 
21 typedef int64_t http_req_id_t;
22 
26 typedef struct
27 {
31  void* ctx;
41  void (*on_data)(http_req_id_t, int64_t, const void*, size_t, xroad_list_t*, void*);
43 
44 typedef enum
45 {
46  http_verb_get = 1,
47  http_verb_post = 2,
48  http_verb_put = 3,
49  http_verb_delete = 4
50 } http_verb_t;
51 
57 xroad_str_t http_verb_to_str(http_verb_t verb);
58 
64 http_client_t* http_client_create(xroad_xml_tag_t cfg);
65 
72 xroad_errno_t http_client_reconfig(http_client_t* c, xroad_xml_tag_t cfg);
73 
78 void http_client_destroy(http_client_t* c);
79 
90 http_req_id_t http_client_perform(
91  http_client_t* c, http_verb_t verb, xroad_str_t path, xroad_list_t* headers, http_client_callback_t cback,
92  const void* data, size_t len);
93 
98 void http_client_cancel_request(http_req_id_t req);
99 
106 
107 #ifdef __cplusplus
108 }
109 #endif
xroad_str_t http_client_escape(xroad_str_t str)
http_client_t * http_client_create(xroad_xml_tag_t cfg)
http_req_id_t http_client_perform(http_client_t *c, http_verb_t verb, xroad_str_t path, xroad_list_t *headers, http_client_callback_t cback, const void *data, size_t len)
void http_client_destroy(http_client_t *c)
xroad_str_t http_verb_to_str(http_verb_t verb)
void http_client_cancel_request(http_req_id_t req)
xroad_errno_t http_client_reconfig(http_client_t *c, xroad_xml_tag_t cfg)
Definition: http_client.h:27
void * ctx
Definition: http_client.h:31
Definition: xroad_string.h:29
struct xroad_list_s xroad_list_t
see common/xroad_list.h for deaails
Definition: xroad_common_fwd.h:24