show endpoints when route not found

This commit is contained in:
Florian Hoss 2022-05-02 16:31:48 +02:00
parent e012c82e16
commit a40b81b45d
5 changed files with 96 additions and 23 deletions

View file

@ -14,6 +14,14 @@
namespace fw
{
typedef struct api_endpoints
{
char uri[20];
char method[7];
char description[30];
struct api_endpoints *next;
} api_endpoint_t;
class API : public Rules
{
private:
@ -24,11 +32,13 @@ namespace fw
BearSSL::ServerSessions *serverCache;
#endif
credential_t credentials;
api_endpoint_t *endpoint_head = NULL;
ok_t setup_auth(const char *, const char *);
ok_t setup_auth(const char *username, const char *password);
auth_t check_auth();
void setup_routing(const char *, const char *);
void setup_routing(const char *cert, const char *key);
void add_api_endpoint(const char *uri, const char *method, const char *description);
void get_firewall_rule_handler();
void get_firewall_rules_handler();
void post_firewall_handler();
@ -42,6 +52,8 @@ namespace fw
void json_message_response(String message, const uint16_t response_code);
String construct_json_firewall_rule(firewall_rule_t *);
String construct_json_firewall();
String construct_json_endpoint(api_endpoint_t *);
String construct_json_endpoints();
protected:
void handle_client();