Add optional query parser.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-05-12 14:49:01 +02:00
parent 4a168ae6c0
commit 45017a514e
2 changed files with 93 additions and 0 deletions

View File

@@ -84,6 +84,7 @@ typedef enum {
REST_ROUTE_NONE = 0x0,
REST_ROUTE_REQUIRE_AUTH = 0x1,
REST_ROUTE_REQUIRE_TLS = 0x2,
REST_ROUTE_ALLOW_QUERY = 0x4
} rest_route_flags_t;
typedef int (*rest_route_param_parser_t)(const char *str, const char *param_str, rest_param_t params_out[REST_MAX_REQUEST_PARAMS]);
@@ -122,6 +123,11 @@ typedef struct {
uint8_t user_id;
} rest_session_t;
typedef struct {
const char *key;
const char *value;
} rest_query_t;
typedef struct {
rest_http_method_t method;
char path[REST_MAX_PATH_SIZE];
@@ -130,6 +136,8 @@ typedef struct {
const char *content_type;
char *headers[REST_HEADER_TOTAL_COUNT];
rest_param_t params[REST_MAX_REQUEST_PARAMS];
rest_query_t *query;
uint8_t query_count;
rest_session_t *session;
rest_request_conn_type_t conn_type;
} rest_request_t;