diff --git a/doxygen/html/classfw_1_1_firewall.js b/doxygen/html/classfw_1_1_firewall.js new file mode 100644 index 0000000..3255501 --- /dev/null +++ b/doxygen/html/classfw_1_1_firewall.js @@ -0,0 +1,14 @@ +var classfw_1_1_firewall = +[ + [ "Firewall", "classfw_1_1_firewall.html#a2cc2717bd5999bc9a2f24ae33e4abd42", null ], + [ "~Firewall", "classfw_1_1_firewall.html#a2c7c043d66b645ecc15e71561132057d", null ], + [ "add_rule_to_firewall", "classfw_1_1_firewall.html#aae2a4a36257033c91f8f183b11de82c5", null ], + [ "add_rule_to_firewall", "classfw_1_1_firewall.html#af1d9481f13052673c64aaf88d019e01d", null ], + [ "delete_rule_from_firewall", "classfw_1_1_firewall.html#a25fac8da12651a927c8285aa75e213d1", null ], + [ "get_packet_information", "classfw_1_1_firewall.html#a6815085477349f902e77cc5564b1b5ba", null ], + [ "get_rule_from_firewall", "classfw_1_1_firewall.html#a7aa017cfb1ae6d6748d3f8c48e18dcf2", null ], + [ "get_rule_head", "classfw_1_1_firewall.html#a86f7d6ef56888f673fa46c4bc9ad3009", null ], + [ "is_packet_allowed", "classfw_1_1_firewall.html#a81eca0d34c28e5c4244b557a1f8e047d", null ], + [ "rule_allows_packet", "classfw_1_1_firewall.html#a26fea38729777e00e5ee3a8d58f785b1", null ], + [ "update_rule_of_firewall", "classfw_1_1_firewall.html#a987ec9a98b7d6ef56cf569e0290b3594", null ] +]; \ No newline at end of file diff --git a/doxygen/html/search/all_d.html b/doxygen/html/search/all_d.html new file mode 100644 index 0000000..95d8eec --- /dev/null +++ b/doxygen/html/search/all_d.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/doxygen/html/search/all_d.js b/doxygen/html/search/all_d.js new file mode 100644 index 0000000..167280e --- /dev/null +++ b/doxygen/html/search/all_d.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['update_5frule_5fof_5ffirewall_0',['update_rule_of_firewall',['../classfw_1_1_firewall.html#a987ec9a98b7d6ef56cf569e0290b3594',1,'fw::Firewall']]] +]; diff --git a/doxygen/html/search/all_e.html b/doxygen/html/search/all_e.html new file mode 100644 index 0000000..a54e120 --- /dev/null +++ b/doxygen/html/search/all_e.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/doxygen/html/search/all_e.js b/doxygen/html/search/all_e.js new file mode 100644 index 0000000..5ffddf1 --- /dev/null +++ b/doxygen/html/search/all_e.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['_7eapi_0',['~API',['../classfw_1_1_a_p_i.html#a66ac0bd592bb08d069aea199668670ab',1,'fw::API']]], + ['_7efirewall_1',['~Firewall',['../classfw_1_1_firewall.html#a2c7c043d66b645ecc15e71561132057d',1,'fw::Firewall']]] +]; diff --git a/doxygen/html/search/functions_a.html b/doxygen/html/search/functions_a.html new file mode 100644 index 0000000..7018fc6 --- /dev/null +++ b/doxygen/html/search/functions_a.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/doxygen/html/search/functions_a.js b/doxygen/html/search/functions_a.js new file mode 100644 index 0000000..7128967 --- /dev/null +++ b/doxygen/html/search/functions_a.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['setup_5fauth_0',['setup_auth',['../classfw_1_1_a_p_i.html#a45dcdd4969f70a7f1a02e49a47b16a1d',1,'fw::API']]], + ['setup_5frouting_1',['setup_routing',['../classfw_1_1_a_p_i.html#a90986dc50f303564e6f5af6d3707dd20',1,'fw::API']]] +]; diff --git a/doxygen/html/search/functions_b.html b/doxygen/html/search/functions_b.html new file mode 100644 index 0000000..c0660b0 --- /dev/null +++ b/doxygen/html/search/functions_b.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/doxygen/html/search/functions_b.js b/doxygen/html/search/functions_b.js new file mode 100644 index 0000000..167280e --- /dev/null +++ b/doxygen/html/search/functions_b.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['update_5frule_5fof_5ffirewall_0',['update_rule_of_firewall',['../classfw_1_1_firewall.html#a987ec9a98b7d6ef56cf569e0290b3594',1,'fw::Firewall']]] +]; diff --git a/doxygen/html/search/functions_c.html b/doxygen/html/search/functions_c.html new file mode 100644 index 0000000..b642767 --- /dev/null +++ b/doxygen/html/search/functions_c.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/doxygen/html/search/functions_c.js b/doxygen/html/search/functions_c.js new file mode 100644 index 0000000..5ffddf1 --- /dev/null +++ b/doxygen/html/search/functions_c.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['_7eapi_0',['~API',['../classfw_1_1_a_p_i.html#a66ac0bd592bb08d069aea199668670ab',1,'fw::API']]], + ['_7efirewall_1',['~Firewall',['../classfw_1_1_firewall.html#a2c7c043d66b645ecc15e71561132057d',1,'fw::Firewall']]] +]; diff --git a/src/Firewall.hpp b/src/Firewall.hpp index cae4768..61a0d41 100644 --- a/src/Firewall.hpp +++ b/src/Firewall.hpp @@ -12,22 +12,107 @@ namespace fw { + /** + * @brief The Firewall will handle rules as linked list + * + */ class Firewall : public Storage { public: + /** + * @brief Construct a new Firewall object, + * retrieve current amount of firewall rules and + * restore them from Storage + */ Firewall(); + + /** + * @brief Destroy the Firewall object + * + */ ~Firewall(); + /** + * @brief Get the current rule head, it indicates + * the first rule position of the linked list + * + * @return firewall_rule_t* + */ firewall_rule_t *get_rule_head(); + + /** + * @brief add a new rule to the linked list, + * update amount of rules, + * store it in Storage if save_in_eeprom is true + * + * @param rule_ptr + * @param save_in_eeprom + */ void add_rule_to_firewall(firewall_rule_t *rule_ptr, const bool save_in_eeprom = true); + + /** + * @brief add a new rule to the firewall, + * providing request parameter + * + * @param args + * @return firewall_rule_t* + */ firewall_rule_t *add_rule_to_firewall(String *args); + + /** + * @brief update rule of firewall, + * store it in Storage + * + * @param args + * @param key + * @return firewall_rule_t* + */ firewall_rule_t *update_rule_of_firewall(String *args, const uint8_t key); + + /** + * @brief retrieve rule from the firewall linked list + * + * @param key + * @return firewall_rule_t* + */ firewall_rule_t *get_rule_from_firewall(const uint8_t key); + + /** + * @brief delete rule from the firewall linked list, + * update amount of rules, + * store new order of rules in Storage + * + * @param key + * @return ok_t + */ ok_t delete_rule_from_firewall(const uint8_t key); + + /** + * @brief checks if network packet is allowed to pass firewall + * + * @param pbuf + * @return true + * @return false + */ bool is_packet_allowed(struct pbuf *pbuf); protected: + /** + * @brief checks if network packet is allowed by the rule + * + * @param rule_ptr + * @param packet + * @return true + * @return false + */ bool rule_allows_packet(firewall_rule_t *rule_ptr, my_packet_t *packet); + + /** + * @brief prepares the necessary information to check packet + * + * @param pbuf + * @return my_packet_t* + */ my_packet_t *get_packet_information(struct pbuf *pbuf); uint8_t amount_of_rules = 0;