33 lines
648 B
C
33 lines
648 B
C
#ifndef CORE_ROUTER_H
|
|
#define CORE_ROUTER_H
|
|
|
|
#include <mongoose.h>
|
|
#include <endpoint.h>
|
|
|
|
#define ROUTER_ENDPOINTS_MAX_COUNT 128
|
|
|
|
typedef enum
|
|
{
|
|
HTTP_METHOD_GET = (1 << 0),
|
|
HTTP_METHOD_POST = (1 << 1),
|
|
HTTP_METHOD_PUT = (1 << 2),
|
|
HTTP_METHOD_DELETE = (1 << 3),
|
|
HTTP_METHOD_OPTIONS = (1 << 4)
|
|
} http_method_e;
|
|
|
|
endpoint_t*
|
|
router_get_not_found_endpoint();
|
|
|
|
void
|
|
router_init();
|
|
|
|
endpoint_t*
|
|
router_register_endpoint(const char *route, int method, endpoint_func_f func);
|
|
|
|
endpoint_t*
|
|
router_find_endpoint(const char *uri_str, size_t uri_len, struct mg_str *method_str);
|
|
|
|
void
|
|
router_free();
|
|
|
|
#endif /* CORE_ROUTER_H */
|