Write doxygen comments for Firewall
This commit is contained in:
parent
c9c269f8eb
commit
0c40644f3d
12 changed files with 307 additions and 0 deletions
14
doxygen/html/classfw_1_1_firewall.js
Normal file
14
doxygen/html/classfw_1_1_firewall.js
Normal file
|
@ -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 ]
|
||||||
|
];
|
37
doxygen/html/search/all_d.html
Normal file
37
doxygen/html/search/all_d.html
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head><title></title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
|
<meta name="generator" content="Doxygen 1.9.4"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="search.css"/>
|
||||||
|
<script type="text/javascript" src="all_d.js"></script>
|
||||||
|
<script type="text/javascript" src="search.js"></script>
|
||||||
|
</head>
|
||||||
|
<body class="SRPage">
|
||||||
|
<div id="SRIndex">
|
||||||
|
<div class="SRStatus" id="Loading">Loading...</div>
|
||||||
|
<div id="SRResults"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
createResults();
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
<div class="SRStatus" id="Searching">Searching...</div>
|
||||||
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
document.getElementById("Loading").style.display="none";
|
||||||
|
document.getElementById("NoMatches").style.display="none";
|
||||||
|
var searchResults = new SearchResults("searchResults");
|
||||||
|
searchResults.Search();
|
||||||
|
window.addEventListener("message", function(event) {
|
||||||
|
if (event.data == "take_focus") {
|
||||||
|
var elem = searchResults.NavNext(0);
|
||||||
|
if (elem) elem.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
4
doxygen/html/search/all_d.js
Normal file
4
doxygen/html/search/all_d.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
var searchData=
|
||||||
|
[
|
||||||
|
['update_5frule_5fof_5ffirewall_0',['update_rule_of_firewall',['../classfw_1_1_firewall.html#a987ec9a98b7d6ef56cf569e0290b3594',1,'fw::Firewall']]]
|
||||||
|
];
|
37
doxygen/html/search/all_e.html
Normal file
37
doxygen/html/search/all_e.html
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head><title></title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
|
<meta name="generator" content="Doxygen 1.9.4"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="search.css"/>
|
||||||
|
<script type="text/javascript" src="all_e.js"></script>
|
||||||
|
<script type="text/javascript" src="search.js"></script>
|
||||||
|
</head>
|
||||||
|
<body class="SRPage">
|
||||||
|
<div id="SRIndex">
|
||||||
|
<div class="SRStatus" id="Loading">Loading...</div>
|
||||||
|
<div id="SRResults"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
createResults();
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
<div class="SRStatus" id="Searching">Searching...</div>
|
||||||
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
document.getElementById("Loading").style.display="none";
|
||||||
|
document.getElementById("NoMatches").style.display="none";
|
||||||
|
var searchResults = new SearchResults("searchResults");
|
||||||
|
searchResults.Search();
|
||||||
|
window.addEventListener("message", function(event) {
|
||||||
|
if (event.data == "take_focus") {
|
||||||
|
var elem = searchResults.NavNext(0);
|
||||||
|
if (elem) elem.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
5
doxygen/html/search/all_e.js
Normal file
5
doxygen/html/search/all_e.js
Normal file
|
@ -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']]]
|
||||||
|
];
|
37
doxygen/html/search/functions_a.html
Normal file
37
doxygen/html/search/functions_a.html
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head><title></title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
|
<meta name="generator" content="Doxygen 1.9.4"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="search.css"/>
|
||||||
|
<script type="text/javascript" src="functions_a.js"></script>
|
||||||
|
<script type="text/javascript" src="search.js"></script>
|
||||||
|
</head>
|
||||||
|
<body class="SRPage">
|
||||||
|
<div id="SRIndex">
|
||||||
|
<div class="SRStatus" id="Loading">Loading...</div>
|
||||||
|
<div id="SRResults"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
createResults();
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
<div class="SRStatus" id="Searching">Searching...</div>
|
||||||
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
document.getElementById("Loading").style.display="none";
|
||||||
|
document.getElementById("NoMatches").style.display="none";
|
||||||
|
var searchResults = new SearchResults("searchResults");
|
||||||
|
searchResults.Search();
|
||||||
|
window.addEventListener("message", function(event) {
|
||||||
|
if (event.data == "take_focus") {
|
||||||
|
var elem = searchResults.NavNext(0);
|
||||||
|
if (elem) elem.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
5
doxygen/html/search/functions_a.js
Normal file
5
doxygen/html/search/functions_a.js
Normal file
|
@ -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']]]
|
||||||
|
];
|
37
doxygen/html/search/functions_b.html
Normal file
37
doxygen/html/search/functions_b.html
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head><title></title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
|
<meta name="generator" content="Doxygen 1.9.4"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="search.css"/>
|
||||||
|
<script type="text/javascript" src="functions_b.js"></script>
|
||||||
|
<script type="text/javascript" src="search.js"></script>
|
||||||
|
</head>
|
||||||
|
<body class="SRPage">
|
||||||
|
<div id="SRIndex">
|
||||||
|
<div class="SRStatus" id="Loading">Loading...</div>
|
||||||
|
<div id="SRResults"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
createResults();
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
<div class="SRStatus" id="Searching">Searching...</div>
|
||||||
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
document.getElementById("Loading").style.display="none";
|
||||||
|
document.getElementById("NoMatches").style.display="none";
|
||||||
|
var searchResults = new SearchResults("searchResults");
|
||||||
|
searchResults.Search();
|
||||||
|
window.addEventListener("message", function(event) {
|
||||||
|
if (event.data == "take_focus") {
|
||||||
|
var elem = searchResults.NavNext(0);
|
||||||
|
if (elem) elem.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
4
doxygen/html/search/functions_b.js
Normal file
4
doxygen/html/search/functions_b.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
var searchData=
|
||||||
|
[
|
||||||
|
['update_5frule_5fof_5ffirewall_0',['update_rule_of_firewall',['../classfw_1_1_firewall.html#a987ec9a98b7d6ef56cf569e0290b3594',1,'fw::Firewall']]]
|
||||||
|
];
|
37
doxygen/html/search/functions_c.html
Normal file
37
doxygen/html/search/functions_c.html
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head><title></title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
|
<meta name="generator" content="Doxygen 1.9.4"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="search.css"/>
|
||||||
|
<script type="text/javascript" src="functions_c.js"></script>
|
||||||
|
<script type="text/javascript" src="search.js"></script>
|
||||||
|
</head>
|
||||||
|
<body class="SRPage">
|
||||||
|
<div id="SRIndex">
|
||||||
|
<div class="SRStatus" id="Loading">Loading...</div>
|
||||||
|
<div id="SRResults"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
createResults();
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
<div class="SRStatus" id="Searching">Searching...</div>
|
||||||
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||||
|
document.getElementById("Loading").style.display="none";
|
||||||
|
document.getElementById("NoMatches").style.display="none";
|
||||||
|
var searchResults = new SearchResults("searchResults");
|
||||||
|
searchResults.Search();
|
||||||
|
window.addEventListener("message", function(event) {
|
||||||
|
if (event.data == "take_focus") {
|
||||||
|
var elem = searchResults.NavNext(0);
|
||||||
|
if (elem) elem.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/* @license-end */
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
5
doxygen/html/search/functions_c.js
Normal file
5
doxygen/html/search/functions_c.js
Normal file
|
@ -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']]]
|
||||||
|
];
|
|
@ -12,22 +12,107 @@
|
||||||
|
|
||||||
namespace fw
|
namespace fw
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief The Firewall will handle rules as linked list
|
||||||
|
*
|
||||||
|
*/
|
||||||
class Firewall : public Storage
|
class Firewall : public Storage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Construct a new Firewall object,
|
||||||
|
* retrieve current amount of firewall rules and
|
||||||
|
* restore them from Storage
|
||||||
|
*/
|
||||||
Firewall();
|
Firewall();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Destroy the Firewall object
|
||||||
|
*
|
||||||
|
*/
|
||||||
~Firewall();
|
~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();
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
bool is_packet_allowed(struct pbuf *pbuf);
|
||||||
|
|
||||||
protected:
|
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);
|
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);
|
my_packet_t *get_packet_information(struct pbuf *pbuf);
|
||||||
|
|
||||||
uint8_t amount_of_rules = 0;
|
uint8_t amount_of_rules = 0;
|
||||||
|
|
Reference in a new issue