ESP32 HTTPS Server

HTTPNode.hpp
1 #ifndef SRC_HTTPNODE_HPP_
2 #define SRC_HTTPNODE_HPP_
3
4 #include <Arduino.h>
5 #include <string>
6 #undef min
7 #undef max
8 #include <vector>
9 #include "HTTPValidator.hpp"
10
11 namespace httpsserver {
12
13 enum HTTPNodeType {
15 HANDLER_CALLBACK,
17 WEBSOCKET
18 };
19
26 class HTTPNode {
27 public:
28 HTTPNode(const std::string &path, const HTTPNodeType nodeType, const std::string &tag = "");
29 virtual ~HTTPNode();
30
35 const std::string _path;
36
41 const std::string _tag;
42
44 const HTTPNodeType _nodeType;
45
46 bool hasUrlParameter();
47 uint8_t getUrlParamCount();
48 size_t getParamIdx(uint8_t);
49
50 std::vector<HTTPValidator*> * getValidators();
51
52 virtual std::string getMethod() = 0;
53
61 void addURLParamValidator(uint8_t paramIdx, const HTTPValidationFunction * validator);
62
63 private:
64 uint8_t _urlParamCount;
65 size_t * _urlParamIdx;
66 std::vector<HTTPValidator*> * _validators;
67 };
68
69 } // namespace httpserver
70
71 #endif
httpsserver::HANDLER_CALLBACK
Definition: HTTPNode.hpp:15
httpsserver::HTTPNode::_nodeType
const HTTPNodeType _nodeType
Definition: HTTPNode.hpp:44
httpsserver::HTTPNode
Base class for a URL/route-handler in the server.
Definition: HTTPNode.hpp:26
httpsserver::HTTPNode::addURLParamValidator
void addURLParamValidator(uint8_t paramIdx, const HTTPValidationFunction *validator)
Definition: HTTPNode.cpp:62
httpsserver::WEBSOCKET
Definition: HTTPNode.hpp:17
httpsserver::HTTPNodeType
HTTPNodeType
Definition: HTTPNode.hpp:13
httpsserver::HTTPNode::_path
const std::string _path
Definition: HTTPNode.hpp:35
httpsserver
Definition: ConnectionContext.cpp:3
httpsserver::HTTPNode::_tag
const std::string _tag
Definition: HTTPNode.hpp:41