core-legacy/include/router.h
Tobias Reisinger 6c6e5023da add: status for mqtt
fix: refactor connection handlers
2020-06-26 01:01:46 +02:00

35 lines
687 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_WEBSOCKET = (1 << 5)
} 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 */