cueOS  2.4
cueOS - Universal Show Control OS for ARM
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
http_request.h
1
14#ifndef HTTP_REQUEST_H_
15#define HTTP_REQUEST_H_
16
17#include <stdint.h>
18#include <stdlib.h>
19#include "http_response.h"
20
21
23typedef void(*router_fn)(http_request_s *req);
35typedef struct {
36 char *arg;
37 char *val;
39
44typedef struct http_request{
45 char *raw_data;
46 uint16_t raw_len;
47 char *uri;
48 char *content;
51 uint8_t param_count;
52 uint8_t retry_count;
53 uint16_t content_length;
58
59
62uint8_t http_request_parse(http_request_s *req, struct pbuf *p);
63
64#endif
65
http_method_e
Enumeration of HTTP method string indexes.
Definition: http_defs.h:62
http_version_e
Enumeration of HTTP versions string indexes.
Definition: http_defs.h:73
void http_request_free(http_request_s *req)
Safely frees an HTTP request instance.
Definition: http_request.c:247
struct http_request http_request_s
HTTP request object.
Definition: http_request.h:22
http_request_s * http_request_new(router_fn router)
Creates a new HTTP request instance.
Definition: http_request.c:224
void(* router_fn)(http_request_s *req)
Definition: http_request.h:23
uint8_t http_request_parse(http_request_s *req, struct pbuf *p)
Extracts and parses HTTP method headers and content from received data and calls the router function ...
Definition: http_request.c:293
HTTP uri parameter object.
Definition: http_request.h:35
HTTP request object.
Definition: http_request.h:44
uint8_t param_count
Definition: http_request.h:51
http_version_e http_version
Definition: http_request.h:50
http_method_e method
Definition: http_request.h:49
http_param_s * params
Definition: http_request.h:55
uint16_t content_length
Definition: http_request.h:53
char * content
Definition: http_request.h:48
http_response_s * res
Definition: http_request.h:56
router_fn router
Definition: http_request.h:54
uint8_t retry_count
Definition: http_request.h:52
char * raw_data
Definition: http_request.h:45
uint16_t raw_len
Definition: http_request.h:46
HTTP response structure object.
Definition: http_response.h:35