rsstats 0.0.1
Redis Enterprise Statistic collector
libhttp.h
Go to the documentation of this file.
1
21#ifndef __LIBHTTP_H__
22#define __LIBHTTP_H__
23
25
26HTTPHeader_t* HTTPHeader_new(const char* name, const char* value);
27void HTTPHeader_del(HTTPHeader_t* header);
28HTTPHeader_t* HTTPHeader_basicauth(const char* login, const char* pass);
29char* HTTPHeader_getname(HTTPHeader_t* header);
31
32
33typedef struct HTTP_s HTTP_t;
34
36void HTTP_del(HTTP_t* http);
37char* HTTP_setbody(HTTP_t* http, const char* body);
38char* HTTP_getbody(HTTP_t* http);
39
40/* API to implement
41 *
42 * typedef enum HTTPStatus_e HTTPStatus_t;
43 * typedef enum HTTPMethod_e HTTPMethod_t;
44 * typedef struct HTTPUri_s HTTPUri_t;
45 * typedef enum HTTPVersion_e HTTPVersion_t;
46 *
47 * void HTTP_addheader(HTTP_t*, HTTPHeader_t*);
48 * void HTTP_delheader(HTTP_t*, HTTPHeader_t*);
49 * HTTPHeader_t* HTTP_firstheader(HTTP_t*);
50 * HTTPHeader_t* HTTP_nextheader(HTTPHeader_t*);
51 * HTTPHeader_t* HTTP_findheader(HTTPHeader_t*);
52 *
53 * char* HTTP_buildrequest(HTTPMethod_t, HTTPUri_t*, HTTPVersion_t);
54 * void HTTP_parserequest(const char* request, HTTP_Method_t, HTTPUri_t*, HTTPVersion_t);
55 * char* HTTP_buildstatus(HTTPVersion_t, HTTPStatus_t);
56 * void HTTP_parsestatus(const char* reply, HTTPVersion_t*, HTTPStatus_t*);
57 * char* HTTP_buildcontents(HTTP_t*);
58 * HTTP_t* HTTP_parsecontents(const char* reply);
59 */
60
61typedef enum HTTPVersion_e {
70
71typedef enum HTTPMethod_e {
83
84/* POC style API */
85void HTTP_addheader(HTTP_t* http, const char* name, const char* value);
86char* HTTP_getheaders(const HTTP_t* http);
87char* HTTP_getrequest(const HTTPMethod_t method, const char* uri, const HTTPVersion_t version);
88
89
90#endif /* __LIBHTTP_H__ */
const char *const name
Definition: cJSON.h:268
enum HTTPVersion_e HTTPVersion_t
char * HTTP_setbody(HTTP_t *http, const char *body)
Definition: libhttp.c:159
char * HTTPHeader_getvalue(HTTPHeader_t *header)
Definition: libhttp.c:106
void HTTPHeader_del(HTTPHeader_t *header)
Definition: libhttp.c:62
void HTTP_del(HTTP_t *http)
Definition: libhttp.c:136
void HTTP_addheader(HTTP_t *http, const char *name, const char *value)
Definition: libhttp.c:190
HTTPMethod_e
Definition: libhttp.h:71
@ HTTPMETHOD_PUT
Definition: libhttp.h:75
@ HTTPMETHOD_POST
Definition: libhttp.h:74
@ HTTPMETHOD_CONNECT
Definition: libhttp.h:77
@ HTTPMETHOD_TRACE
Definition: libhttp.h:79
@ HTTPMETHOD_PATCH
Definition: libhttp.h:80
@ HTTPMETHOD_DELETE
Definition: libhttp.h:76
@ HTTPMETHOD_OPTIONS
Definition: libhttp.h:78
@ HTTPMETHOD_GET
Definition: libhttp.h:72
@ HTTPMETHOD_INVALID
Definition: libhttp.h:81
@ HTTPMETHOD_HEAD
Definition: libhttp.h:73
HTTPVersion_e
Definition: libhttp.h:61
@ HTTPVERSION_HTTP11b
Definition: libhttp.h:65
@ HTTPVERSION_INVALID
Definition: libhttp.h:68
@ HTTPVERSION_HTTP09
Definition: libhttp.h:62
@ HTTPVERSION_HTTP2
Definition: libhttp.h:66
@ HTTPVERSION_HTTP10
Definition: libhttp.h:63
@ HTTPVERSION_HTTP3
Definition: libhttp.h:67
@ HTTPVERSION_HTTP11
Definition: libhttp.h:64
enum HTTPMethod_e HTTPMethod_t
HTTP_t * HTTP_new()
Definition: libhttp.c:111
char * HTTP_getheaders(const HTTP_t *http)
Definition: libhttp.c:214
HTTPHeader_t * HTTPHeader_basicauth(const char *login, const char *pass)
Definition: libhttp.c:72
char * HTTP_getbody(HTTP_t *http)
Definition: libhttp.c:176
HTTPHeader_t * HTTPHeader_new(const char *name, const char *value)
Definition: libhttp.c:38
char * HTTPHeader_getname(HTTPHeader_t *header)
Definition: libhttp.c:101
char * HTTP_getrequest(const HTTPMethod_t method, const char *uri, const HTTPVersion_t version)
Definition: libhttp.c:248
Definition: libhttp.c:28
char * body
Definition: libhttp.c:30
char * value
Definition: libhttp.c:35