123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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=9"/>
- <meta name="generator" content="Doxygen 1.8.9.1"/>
- <title>My Project: Fichero Fuente sniffer.h</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="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>
- <script type="text/javascript">
- $(document).ready(function() { init_search(); });
- </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 style="height: 56px;">
- <td style="padding-left: 0.5em;">
- <div id="projectname">My Project
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generado por Doxygen 1.8.9.1 -->
- <script type="text/javascript">
- var searchBox = new SearchBox("searchBox", "search",false,'Buscar');
- </script>
- <div id="navrow1" class="tabs">
- <ul class="tablist">
- <li><a href="index.html"><span>Página principal</span></a></li>
- <li><a href="annotated.html"><span>Clases</span></a></li>
- <li class="current"><a href="files.html"><span>Archivos</span></a></li>
- <li>
- <div id="MSearchBox" class="MSearchBoxInactive">
- <span class="left">
- <img id="MSearchSelect" src="search/mag_sel.png"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- alt=""/>
- <input type="text" id="MSearchField" value="Buscar" accesskey="S"
- onfocus="searchBox.OnSearchFieldFocus(true)"
- onblur="searchBox.OnSearchFieldFocus(false)"
- onkeyup="searchBox.OnSearchFieldChange(event)"/>
- </span><span class="right">
- <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
- </span>
- </div>
- </li>
- </ul>
- </div>
- <div id="navrow2" class="tabs2">
- <ul class="tablist">
- <li><a href="files.html"><span>Lista de archivos</span></a></li>
- </ul>
- </div>
- </div><!-- top -->
- <!-- 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">sniffer.h</div> </div>
- </div><!--header-->
- <div class="contents">
- <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef SNIFFER_H</span></div>
- <div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define SNIFFER_H</span></div>
- <div class="line"><a name="l00003"></a><span class="lineno"> 3</span> </div>
- <div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include <QObject></span></div>
- <div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include <QString></span></div>
- <div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include <QDebug></span></div>
- <div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include "ip_packet.h"</span></div>
- <div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include <QWaitCondition></span></div>
- <div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include <QMutex></span></div>
- <div class="line"><a name="l00010"></a><span class="lineno"> 10</span> </div>
- <div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include <pcap.h></span></div>
- <div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include <stdio.h></span></div>
- <div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include <string.h></span></div>
- <div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include <stdlib.h></span></div>
- <div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include <ctype.h></span></div>
- <div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <cstring></span></div>
- <div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <errno.h></span></div>
- <div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <sys/types.h></span></div>
- <div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include <sys/socket.h></span></div>
- <div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#include <netinet/in.h></span></div>
- <div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <arpa/inet.h></span></div>
- <div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include "ethernet_hdr.h"</span></div>
- <div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include "ip_hdr.h"</span></div>
- <div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include "tcp_hdr.h"</span></div>
- <div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include "udp_hdr.h"</span></div>
- <div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div>
- <div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment">/* default snap length (maximum bytes per packet to capture) */</span></div>
- <div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#define SNAP_LEN 1518</span></div>
- <div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div>
- <div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="comment">/* ethernet headers are always exactly 14 bytes [1] */</span></div>
- <div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#define SIZE_ETHERNET 14</span></div>
- <div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div>
- <div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#define IPV4 8</span></div>
- <div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="keyword">class </span><a class="code" href="class_sniffer.html">Sniffer</a> : <span class="keyword">public</span> QObject</div>
- <div class="line"><a name="l00041"></a><span class="lineno"> 41</span> {</div>
- <div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  Q_OBJECT</div>
- <div class="line"><a name="l00043"></a><span class="lineno"> 43</span> </div>
- <div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="keyword">public</span>:</div>
- <div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div>
- <div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <a class="code" href="class_sniffer.html#a8039cbd5f487a357321d57337a664d3d">Sniffer</a>() ;</div>
- <div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div>
- <div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <a class="code" href="class_sniffer.html#a8039cbd5f487a357321d57337a664d3d">Sniffer</a>(QWaitCondition *pw, QMutex *mx, <span class="keywordtype">int</span> *ps) ;</div>
- <div class="line"><a name="l00067"></a><span class="lineno"> 67</span> </div>
- <div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <a class="code" href="class_sniffer.html#a8ad3b97292e2cc274f31d87701f92be2">~Sniffer</a>() ;</div>
- <div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div>
- <div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  vector<ip_packet> * <a class="code" href="class_sniffer.html#a791027d276cfcc5e6849132ecf8e80b6">getPacketList</a>() ;</div>
- <div class="line"><a name="l00085"></a><span class="lineno"> 85</span> </div>
- <div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keywordtype">string</span> <a class="code" href="class_sniffer.html#a3dd95c60c5b8554e1bedc22b36ae488c">format_payload</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *payload, <span class="keywordtype">int</span> len);</div>
- <div class="line"><a name="l00099"></a><span class="lineno"> 99</span> </div>
- <div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keywordtype">string</span> <a class="code" href="class_sniffer.html#a02101b56a75804d1ed39a1c04ba36ab2">format_hex_ascii_line</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *payload, <span class="keywordtype">int</span> len, <span class="keywordtype">int</span> offset);</div>
- <div class="line"><a name="l00115"></a><span class="lineno"> 115</span> </div>
- <div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keywordtype">void</span> <a class="code" href="class_sniffer.html#a94d7cd87d0f181c3cf2e5ec851e370b6">find_devices</a>(vector<string> &) ;</div>
- <div class="line"><a name="l00125"></a><span class="lineno"> 125</span> </div>
- <div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordtype">void</span> <a class="code" href="class_sniffer.html#ab706811aa2b285e4c0f55491703c105a">setDevice</a>(<span class="keywordtype">string</span>) ;</div>
- <div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div>
- <div class="line"><a name="l00135"></a><span class="lineno"> 135</span> <span class="keyword">public</span> slots:</div>
- <div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keywordtype">void</span> <a class="code" href="class_sniffer.html#a6fc78b66d2f4dce0cc3662dacf171514">process</a>() ;</div>
- <div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div>
- <div class="line"><a name="l00138"></a><span class="lineno"> 138</span> signals:</div>
- <div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="keywordtype">void</span> resultReady(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> index);</div>
- <div class="line"><a name="l00140"></a><span class="lineno"> 140</span> </div>
- <div class="line"><a name="l00141"></a><span class="lineno"> 141</span> <span class="keyword">private</span>:</div>
- <div class="line"><a name="l00142"></a><span class="lineno"> 142</span> </div>
- <div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  vector<ip_packet> packet_list ;</div>
- <div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  QWaitCondition *wait_pause ;</div>
- <div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  QMutex * mutex ;</div>
- <div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="keywordtype">string</span> device ;</div>
- <div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keywordtype">string</span> filter ;</div>
- <div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="keywordtype">int</span> *pause ;</div>
- <div class="line"><a name="l00149"></a><span class="lineno"> 149</span> </div>
- <div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordtype">void</span> <a class="code" href="class_sniffer.html#ac05f935a6ec2830d6bf42b607f071910">print_payload</a>(<span class="keyword">const</span> u_char *payload, <span class="keywordtype">int</span> len);</div>
- <div class="line"><a name="l00160"></a><span class="lineno"> 160</span> </div>
- <div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordtype">void</span> <a class="code" href="class_sniffer.html#a70598d5001a30cc8e801f1262770cdf6">print_hex_ascii_line</a>(<span class="keyword">const</span> u_char *payload, <span class="keywordtype">int</span> len, <span class="keywordtype">int</span> offset);</div>
- <div class="line"><a name="l00173"></a><span class="lineno"> 173</span> </div>
- <div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  <span class="keywordtype">void</span></div>
- <div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <a class="code" href="class_sniffer.html#a0179e32fee6a0f7c2a13f37d64a7fae0">got_packet</a>(<span class="keyword">const</span> <span class="keyword">struct</span> pcap_pkthdr *header, <span class="keyword">const</span> u_char *packet);</div>
- <div class="line"><a name="l00185"></a><span class="lineno"> 185</span> </div>
- <div class="line"><a name="l00186"></a><span class="lineno"> 186</span> };</div>
- <div class="line"><a name="l00187"></a><span class="lineno"> 187</span> </div>
- <div class="line"><a name="l00188"></a><span class="lineno"> 188</span> <span class="preprocessor">#endif // SNIFFER_H</span></div>
- <div class="ttc" id="class_sniffer_html_a0179e32fee6a0f7c2a13f37d64a7fae0"><div class="ttname"><a href="class_sniffer.html#a0179e32fee6a0f7c2a13f37d64a7fae0">Sniffer::got_packet</a></div><div class="ttdeci">void got_packet(const struct pcap_pkthdr *header, const u_char *packet)</div><div class="ttdoc">Secciona el paquete recibido. Extrae la informacion necesaria. </div><div class="ttdef"><b>Definition:</b> sniffer.cpp:394</div></div>
- <div class="ttc" id="class_sniffer_html_a3dd95c60c5b8554e1bedc22b36ae488c"><div class="ttname"><a href="class_sniffer.html#a3dd95c60c5b8554e1bedc22b36ae488c">Sniffer::format_payload</a></div><div class="ttdeci">string format_payload(const char *payload, int len)</div><div class="ttdoc">Formatea la carga de un torrente de bytes a un cadena de caracteres ascii. </div><div class="ttdef"><b>Definition:</b> sniffer.cpp:342</div></div>
- <div class="ttc" id="class_sniffer_html_a8ad3b97292e2cc274f31d87701f92be2"><div class="ttname"><a href="class_sniffer.html#a8ad3b97292e2cc274f31d87701f92be2">Sniffer::~Sniffer</a></div><div class="ttdeci">~Sniffer()</div><div class="ttdoc">Destructor, no hace nada. </div><div class="ttdef"><b>Definition:</b> sniffer.cpp:35</div></div>
- <div class="ttc" id="class_sniffer_html_a6fc78b66d2f4dce0cc3662dacf171514"><div class="ttname"><a href="class_sniffer.html#a6fc78b66d2f4dce0cc3662dacf171514">Sniffer::process</a></div><div class="ttdeci">void process()</div><div class="ttdoc">El sniffer se corre como un hilo por separado y la funcion process es la funcion principal de el hilo...</div><div class="ttdef"><b>Definition:</b> sniffer.cpp:45</div></div>
- <div class="ttc" id="class_sniffer_html_a70598d5001a30cc8e801f1262770cdf6"><div class="ttname"><a href="class_sniffer.html#a70598d5001a30cc8e801f1262770cdf6">Sniffer::print_hex_ascii_line</a></div><div class="ttdeci">void print_hex_ascii_line(const u_char *payload, int len, int offset)</div><div class="ttdoc">Imprime la carga en ascii a std output. </div><div class="ttdef"><b>Definition:</b> sniffer.cpp:157</div></div>
- <div class="ttc" id="class_sniffer_html_ac05f935a6ec2830d6bf42b607f071910"><div class="ttname"><a href="class_sniffer.html#ac05f935a6ec2830d6bf42b607f071910">Sniffer::print_payload</a></div><div class="ttdeci">void print_payload(const u_char *payload, int len)</div><div class="ttdoc">Imprime la carga en ascii. </div><div class="ttdef"><b>Definition:</b> sniffer.cpp:278</div></div>
- <div class="ttc" id="class_sniffer_html_ab706811aa2b285e4c0f55491703c105a"><div class="ttname"><a href="class_sniffer.html#ab706811aa2b285e4c0f55491703c105a">Sniffer::setDevice</a></div><div class="ttdeci">void setDevice(string)</div><div class="ttdoc">Ajusta el dispositivo para caputurar paquetes a dev. </div><div class="ttdef"><b>Definition:</b> sniffer.cpp:561</div></div>
- <div class="ttc" id="class_sniffer_html_a791027d276cfcc5e6849132ecf8e80b6"><div class="ttname"><a href="class_sniffer.html#a791027d276cfcc5e6849132ecf8e80b6">Sniffer::getPacketList</a></div><div class="ttdeci">vector< ip_packet > * getPacketList()</div><div class="ttdoc">Devuelve la lista de paquetes que contiene los paquetes que son Ethernet -> IP -> (TCP|UDP) ...</div><div class="ttdef"><b>Definition:</b> sniffer.cpp:520</div></div>
- <div class="ttc" id="class_sniffer_html_a94d7cd87d0f181c3cf2e5ec851e370b6"><div class="ttname"><a href="class_sniffer.html#a94d7cd87d0f181c3cf2e5ec851e370b6">Sniffer::find_devices</a></div><div class="ttdeci">void find_devices(vector< string > &)</div><div class="ttdoc">Encuentra los dispositivos de red en la computadora, y los almacena en el vector devs. </div><div class="ttdef"><b>Definition:</b> sniffer.cpp:533</div></div>
- <div class="ttc" id="class_sniffer_html_a8039cbd5f487a357321d57337a664d3d"><div class="ttname"><a href="class_sniffer.html#a8039cbd5f487a357321d57337a664d3d">Sniffer::Sniffer</a></div><div class="ttdeci">Sniffer()</div><div class="ttdoc">Constructor, no hace nada. </div><div class="ttdef"><b>Definition:</b> sniffer.cpp:8</div></div>
- <div class="ttc" id="class_sniffer_html_a02101b56a75804d1ed39a1c04ba36ab2"><div class="ttname"><a href="class_sniffer.html#a02101b56a75804d1ed39a1c04ba36ab2">Sniffer::format_hex_ascii_line</a></div><div class="ttdeci">string format_hex_ascii_line(const char *payload, int len, int offset)</div><div class="ttdoc">Devuelve una cadena de caracteres con los bytes de una linea de la carga en ascii. </div><div class="ttdef"><b>Definition:</b> sniffer.cpp:219</div></div>
- <div class="ttc" id="class_sniffer_html"><div class="ttname"><a href="class_sniffer.html">Sniffer</a></div><div class="ttdoc">The Sniffer class is the one that use the pcap library to extract the packet information. It discards any packet that is not Ethernet->IP->(TCP|UDP), and pass up to the GUI the packets that are Ethernet->IP->(TCP|UDP). </div><div class="ttdef"><b>Definition:</b> sniffer.h:40</div></div>
- </div><!-- fragment --></div><!-- contents -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generado el Miércoles, 24 de Junio de 2015 15:25:32 para My Project por  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.9.1
- </small></address>
- </body>
- </html>
|