Write doxygen comments for Firewall

This commit is contained in:
Florian Hoss 2022-07-30 11:25:15 +02:00
parent c9c269f8eb
commit 0c40644f3d
12 changed files with 307 additions and 0 deletions

View file

@ -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;