This repository has been archived on 2024-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
esp-firewall/doxygen/html/_firewall_8hpp_source.html

160 lines
17 KiB
HTML
Raw Permalink Normal View History

2022-07-30 11:46:19 +02:00
<!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>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ESP32/ESP8266 Firewall: src/Firewall.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">ESP32/ESP8266 Firewall<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">a software firewall for ESP23 or ESP8266</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('_firewall_8hpp_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle"><div class="title">Firewall.hpp</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="preprocessor">#ifndef FIREWALL_HPP</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="preprocessor">#define FIREWALL_HPP</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="preprocessor">#include &quot;Utils.hpp&quot;</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="preprocessor">#include &quot;Storage.hpp&quot;</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="preprocessor">#include &quot;WiFiClient.h&quot;</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="preprocessor">#include &quot;lwip/netif.h&quot;</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include &quot;lwip/pbuf.h&quot;</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="preprocessor">#include &quot;lwip/ip4.h&quot;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#include &quot;lwip/prot/udp.h&quot;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="preprocessor">#include &quot;lwip/prot/tcp.h&quot;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">namespace </span>fw</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span>{</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"><a class="line" href="classfw_1_1_firewall.html"> 19</a></span> <span class="keyword">class </span><a class="code hl_class" href="classfw_1_1_firewall.html">Firewall</a> : <span class="keyword">public</span> <a class="code hl_class" href="classfw_1_1_storage.html">Storage</a></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> {</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">public</span>:</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <a class="code hl_function" href="classfw_1_1_firewall.html#a2cc2717bd5999bc9a2f24ae33e4abd42">Firewall</a>();</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <a class="code hl_function" href="classfw_1_1_firewall.html#a2c7c043d66b645ecc15e71561132057d">~Firewall</a>();</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <a class="code hl_struct" href="structfirewall__rule__t.html">firewall_rule_t</a> *<a class="code hl_function" href="classfw_1_1_firewall.html#a86f7d6ef56888f673fa46c4bc9ad3009">get_rule_head</a>();</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classfw_1_1_firewall.html#aae2a4a36257033c91f8f183b11de82c5">add_rule_to_firewall</a>(<a class="code hl_struct" href="structfirewall__rule__t.html">firewall_rule_t</a> *rule_ptr, <span class="keyword">const</span> <span class="keywordtype">bool</span> save_in_eeprom = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> </div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <a class="code hl_struct" href="structfirewall__rule__t.html">firewall_rule_t</a> *<a class="code hl_function" href="classfw_1_1_firewall.html#aae2a4a36257033c91f8f183b11de82c5">add_rule_to_firewall</a>(String *args);</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <a class="code hl_struct" href="structfirewall__rule__t.html">firewall_rule_t</a> *<a class="code hl_function" href="classfw_1_1_firewall.html#a987ec9a98b7d6ef56cf569e0290b3594">update_rule_of_firewall</a>(String *args, <span class="keyword">const</span> uint8_t key);</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <a class="code hl_struct" href="structfirewall__rule__t.html">firewall_rule_t</a> *<a class="code hl_function" href="classfw_1_1_firewall.html#a7aa017cfb1ae6d6748d3f8c48e18dcf2">get_rule_from_firewall</a>(<span class="keyword">const</span> uint8_t key);</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> ok_t <a class="code hl_function" href="classfw_1_1_firewall.html#a25fac8da12651a927c8285aa75e213d1">delete_rule_from_firewall</a>(<span class="keyword">const</span> uint8_t key);</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classfw_1_1_firewall.html#a81eca0d34c28e5c4244b557a1f8e047d">is_packet_allowed</a>(<span class="keyword">struct</span> pbuf *pbuf);</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> </div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keyword">protected</span>:</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classfw_1_1_firewall.html#a26fea38729777e00e5ee3a8d58f785b1">rule_allows_packet</a>(<a class="code hl_struct" href="structfirewall__rule__t.html">firewall_rule_t</a> *rule_ptr, <a class="code hl_struct" href="structmy__packet__t.html">my_packet_t</a> *packet);</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> </div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <a class="code hl_struct" href="structmy__packet__t.html">my_packet_t</a> *<a class="code hl_function" href="classfw_1_1_firewall.html#a6815085477349f902e77cc5564b1b5ba">get_packet_information</a>(<span class="keyword">struct</span> pbuf *pbuf);</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> </div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> uint8_t amount_of_rules = 0;</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <a class="code hl_struct" href="structfirewall__rule__t.html">firewall_rule_t</a> *rule_head = NULL;</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> };</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span>}</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> </div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="aclassfw_1_1_firewall_html"><div class="ttname"><a href="classfw_1_1_firewall.html">fw::Firewall</a></div><div class="ttdoc">The Firewall will handle Firewall rules as linked list.</div><div class="ttdef"><b>Definition:</b> Firewall.hpp:20</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_a25fac8da12651a927c8285aa75e213d1"><div class="ttname"><a href="classfw_1_1_firewall.html#a25fac8da12651a927c8285aa75e213d1">fw::Firewall::delete_rule_from_firewall</a></div><div class="ttdeci">ok_t delete_rule_from_firewall(const uint8_t key)</div><div class="ttdoc">delete rule from the firewall linked list, update amount of rules, store new order of rules in Storag...</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:88</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_a26fea38729777e00e5ee3a8d58f785b1"><div class="ttname"><a href="classfw_1_1_firewall.html#a26fea38729777e00e5ee3a8d58f785b1">fw::Firewall::rule_allows_packet</a></div><div class="ttdeci">bool rule_allows_packet(firewall_rule_t *rule_ptr, my_packet_t *packet)</div><div class="ttdoc">checks if network packet is allowed by the rule</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:151</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_a2c7c043d66b645ecc15e71561132057d"><div class="ttname"><a href="classfw_1_1_firewall.html#a2c7c043d66b645ecc15e71561132057d">fw::Firewall::~Firewall</a></div><div class="ttdeci">~Firewall()</div><div class="ttdoc">Destroy the Firewall object.</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:15</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_a2cc2717bd5999bc9a2f24ae33e4abd42"><div class="ttname"><a href="classfw_1_1_firewall.html#a2cc2717bd5999bc9a2f24ae33e4abd42">fw::Firewall::Firewall</a></div><div class="ttdeci">Firewall()</div><div class="ttdoc">Construct a new Firewall object, retrieve current amount of firewall rules and restore them from Stor...</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:5</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_a6815085477349f902e77cc5564b1b5ba"><div class="ttname"><a href="classfw_1_1_firewall.html#a6815085477349f902e77cc5564b1b5ba">fw::Firewall::get_packet_information</a></div><div class="ttdeci">my_packet_t * get_packet_information(struct pbuf *pbuf)</div><div class="ttdoc">prepares the necessary information to check packet</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:128</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_a7aa017cfb1ae6d6748d3f8c48e18dcf2"><div class="ttname"><a href="classfw_1_1_firewall.html#a7aa017cfb1ae6d6748d3f8c48e18dcf2">fw::Firewall::get_rule_from_firewall</a></div><div class="ttdeci">firewall_rule_t * get_rule_from_firewall(const uint8_t key)</div><div class="ttdoc">retrieve rule from the firewall linked list</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:73</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_a81eca0d34c28e5c4244b557a1f8e047d"><div class="ttname"><a href="classfw_1_1_firewall.html#a81eca0d34c28e5c4244b557a1f8e047d">fw::Firewall::is_packet_allowed</a></div><div class="ttdeci">bool is_packet_allowed(struct pbuf *pbuf)</div><div class="ttdoc">checks if network packet is allowed to pass firewall</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:166</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_a86f7d6ef56888f673fa46c4bc9ad3009"><div class="ttname"><a href="classfw_1_1_firewall.html#a86f7d6ef56888f673fa46c4bc9ad3009">fw::Firewall::get_rule_head</a></div><div class="ttdeci">firewall_rule_t * get_rule_head()</div><div class="ttdoc">Get the current rule head, it indicates the first rule position of the linked list.</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:19</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_a987ec9a98b7d6ef56cf569e0290b3594"><div class="ttname"><a href="classfw_1_1_firewall.html#a987ec9a98b7d6ef56cf569e0290b3594">fw::Firewall::update_rule_of_firewall</a></div><div class="ttdeci">firewall_rule_t * update_rule_of_firewall(String *args, const uint8_t key)</div><div class="ttdoc">update rule of firewall, store it in Storage</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:58</div></div>
<div class="ttc" id="aclassfw_1_1_firewall_html_aae2a4a36257033c91f8f183b11de82c5"><div class="ttname"><a href="classfw_1_1_firewall.html#aae2a4a36257033c91f8f183b11de82c5">fw::Firewall::add_rule_to_firewall</a></div><div class="ttdeci">void add_rule_to_firewall(firewall_rule_t *rule_ptr, const bool save_in_eeprom=true)</div><div class="ttdoc">add a new rule to the linked list, update amount of rules, store it in Storage if save_in_eeprom is t...</div><div class="ttdef"><b>Definition:</b> Firewall.cpp:24</div></div>
<div class="ttc" id="aclassfw_1_1_storage_html"><div class="ttname"><a href="classfw_1_1_storage.html">fw::Storage</a></div><div class="ttdoc">The Storage will handle Firewall rules in EEPROM.</div><div class="ttdef"><b>Definition:</b> Storage.hpp:18</div></div>
<div class="ttc" id="astructfirewall__rule__t_html"><div class="ttname"><a href="structfirewall__rule__t.html">firewall_rule_t</a></div><div class="ttdef"><b>Definition:</b> Utils.hpp:51</div></div>
<div class="ttc" id="astructmy__packet__t_html"><div class="ttname"><a href="structmy__packet__t.html">my_packet_t</a></div><div class="ttdef"><b>Definition:</b> Utils.hpp:64</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><b>Firewall.hpp</b></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4 </li>
</ul>
</div>
</body>
</html>