Ei kuvausta

class_sniffer.html 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.9.1"/>
  7. <title>My Project: Sniffer Class Reference</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript" src="dynsections.js"></script>
  11. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  12. <script type="text/javascript" src="search/searchdata.js"></script>
  13. <script type="text/javascript" src="search/search.js"></script>
  14. <script type="text/javascript">
  15. $(document).ready(function() { init_search(); });
  16. </script>
  17. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  18. </head>
  19. <body>
  20. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  21. <div id="titlearea">
  22. <table cellspacing="0" cellpadding="0">
  23. <tbody>
  24. <tr style="height: 56px;">
  25. <td style="padding-left: 0.5em;">
  26. <div id="projectname">My Project
  27. </div>
  28. </td>
  29. </tr>
  30. </tbody>
  31. </table>
  32. </div>
  33. <!-- end header part -->
  34. <!-- Generated by Doxygen 1.8.9.1 -->
  35. <script type="text/javascript">
  36. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  37. </script>
  38. <div id="navrow1" class="tabs">
  39. <ul class="tablist">
  40. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  41. <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
  42. <li><a href="files.html"><span>Files</span></a></li>
  43. <li>
  44. <div id="MSearchBox" class="MSearchBoxInactive">
  45. <span class="left">
  46. <img id="MSearchSelect" src="search/mag_sel.png"
  47. onmouseover="return searchBox.OnSearchSelectShow()"
  48. onmouseout="return searchBox.OnSearchSelectHide()"
  49. alt=""/>
  50. <input type="text" id="MSearchField" value="Search" accesskey="S"
  51. onfocus="searchBox.OnSearchFieldFocus(true)"
  52. onblur="searchBox.OnSearchFieldFocus(false)"
  53. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  54. </span><span class="right">
  55. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  56. </span>
  57. </div>
  58. </li>
  59. </ul>
  60. </div>
  61. <div id="navrow2" class="tabs2">
  62. <ul class="tablist">
  63. <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
  64. <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
  65. <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
  66. <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
  67. </ul>
  68. </div>
  69. <!-- window showing the filter options -->
  70. <div id="MSearchSelectWindow"
  71. onmouseover="return searchBox.OnSearchSelectShow()"
  72. onmouseout="return searchBox.OnSearchSelectHide()"
  73. onkeydown="return searchBox.OnSearchSelectKey(event)">
  74. </div>
  75. <!-- iframe showing the search results (closed by default) -->
  76. <div id="MSearchResultsWindow">
  77. <iframe src="javascript:void(0)" frameborder="0"
  78. name="MSearchResults" id="MSearchResults">
  79. </iframe>
  80. </div>
  81. </div><!-- top -->
  82. <div class="header">
  83. <div class="summary">
  84. <a href="#pub-slots">Public Slots</a> &#124;
  85. <a href="#signals">Signals</a> &#124;
  86. <a href="#pub-methods">Public Member Functions</a> &#124;
  87. <a href="#pri-methods">Private Member Functions</a> &#124;
  88. <a href="#pri-attribs">Private Attributes</a> &#124;
  89. <a href="class_sniffer-members.html">List of all members</a> </div>
  90. <div class="headertitle">
  91. <div class="title">Sniffer Class Reference</div> </div>
  92. </div><!--header-->
  93. <div class="contents">
  94. <p>The <a class="el" href="class_sniffer.html" title="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). ">Sniffer</a> class is the one that use the pcap library to extract the packet information. It discards any packet that is not Ethernet-&gt;IP-&gt;(TCP|UDP), and pass up to the GUI the packets that are Ethernet-&gt;IP-&gt;(TCP|UDP).
  95. <a href="class_sniffer.html#details">More...</a></p>
  96. <p><code>#include &lt;<a class="el" href="sniffer_8h_source.html">sniffer.h</a>&gt;</code></p>
  97. <div class="dynheader">
  98. Inheritance diagram for Sniffer:</div>
  99. <div class="dyncontent">
  100. <div class="center">
  101. <img src="class_sniffer.png" usemap="#Sniffer_map" alt=""/>
  102. <map id="Sniffer_map" name="Sniffer_map">
  103. </map>
  104. </div></div>
  105. <table class="memberdecls">
  106. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-slots"></a>
  107. Public Slots</h2></td></tr>
  108. <tr class="memitem:a6fc78b66d2f4dce0cc3662dacf171514"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6fc78b66d2f4dce0cc3662dacf171514"></a>
  109. void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a6fc78b66d2f4dce0cc3662dacf171514">process</a> ()</td></tr>
  110. <tr class="memdesc:a6fc78b66d2f4dce0cc3662dacf171514"><td class="mdescLeft">&#160;</td><td class="mdescRight">The sniffer is run as a separate thread and the function process is the main function of the thread. It is the sniffer. <br /></td></tr>
  111. <tr class="separator:a6fc78b66d2f4dce0cc3662dacf171514"><td class="memSeparator" colspan="2">&#160;</td></tr>
  112. </table><table class="memberdecls">
  113. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="signals"></a>
  114. Signals</h2></td></tr>
  115. <tr class="memitem:a7d0fd40379b7e5f49aff18ac20cb1c45"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7d0fd40379b7e5f49aff18ac20cb1c45"></a>
  116. void&#160;</td><td class="memItemRight" valign="bottom"><b>resultReady</b> (unsigned long index)</td></tr>
  117. <tr class="separator:a7d0fd40379b7e5f49aff18ac20cb1c45"><td class="memSeparator" colspan="2">&#160;</td></tr>
  118. </table><table class="memberdecls">
  119. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
  120. Public Member Functions</h2></td></tr>
  121. <tr class="memitem:a8039cbd5f487a357321d57337a664d3d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8039cbd5f487a357321d57337a664d3d"></a>
  122. &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a8039cbd5f487a357321d57337a664d3d">Sniffer</a> ()</td></tr>
  123. <tr class="memdesc:a8039cbd5f487a357321d57337a664d3d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor, does nothing. <br /></td></tr>
  124. <tr class="separator:a8039cbd5f487a357321d57337a664d3d"><td class="memSeparator" colspan="2">&#160;</td></tr>
  125. <tr class="memitem:a8e5f1474f756be527b4c39a3e9a83893"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a8e5f1474f756be527b4c39a3e9a83893">Sniffer</a> (QWaitCondition *pw, QMutex *mx, int *ps)</td></tr>
  126. <tr class="memdesc:a8e5f1474f756be527b4c39a3e9a83893"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the mutexes for the inter communication between the sniffer and the GUI. <a href="#a8e5f1474f756be527b4c39a3e9a83893">More...</a><br /></td></tr>
  127. <tr class="separator:a8e5f1474f756be527b4c39a3e9a83893"><td class="memSeparator" colspan="2">&#160;</td></tr>
  128. <tr class="memitem:a8ad3b97292e2cc274f31d87701f92be2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8ad3b97292e2cc274f31d87701f92be2"></a>
  129. &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a8ad3b97292e2cc274f31d87701f92be2">~Sniffer</a> ()</td></tr>
  130. <tr class="memdesc:a8ad3b97292e2cc274f31d87701f92be2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor, does nothing. <br /></td></tr>
  131. <tr class="separator:a8ad3b97292e2cc274f31d87701f92be2"><td class="memSeparator" colspan="2">&#160;</td></tr>
  132. <tr class="memitem:a791027d276cfcc5e6849132ecf8e80b6"><td class="memItemLeft" align="right" valign="top">vector&lt; <a class="el" href="classip__packet.html">ip_packet</a> &gt; *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a791027d276cfcc5e6849132ecf8e80b6">getPacketList</a> ()</td></tr>
  133. <tr class="memdesc:a791027d276cfcc5e6849132ecf8e80b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the packet list that contains the packets that are Ethernet -&gt; IP -&gt; (TCP|UDP) <a href="#a791027d276cfcc5e6849132ecf8e80b6">More...</a><br /></td></tr>
  134. <tr class="separator:a791027d276cfcc5e6849132ecf8e80b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
  135. <tr class="memitem:a3dd95c60c5b8554e1bedc22b36ae488c"><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a3dd95c60c5b8554e1bedc22b36ae488c">format_payload</a> (const char *payload, int len)</td></tr>
  136. <tr class="memdesc:a3dd95c60c5b8554e1bedc22b36ae488c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Formats the payload from a byte stream into a string of ascci. <a href="#a3dd95c60c5b8554e1bedc22b36ae488c">More...</a><br /></td></tr>
  137. <tr class="separator:a3dd95c60c5b8554e1bedc22b36ae488c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  138. <tr class="memitem:a02101b56a75804d1ed39a1c04ba36ab2"><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a02101b56a75804d1ed39a1c04ba36ab2">format_hex_ascii_line</a> (const char *payload, int len, int offset)</td></tr>
  139. <tr class="memdesc:a02101b56a75804d1ed39a1c04ba36ab2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return string with the bytes of a payload line in ascii. <a href="#a02101b56a75804d1ed39a1c04ba36ab2">More...</a><br /></td></tr>
  140. <tr class="separator:a02101b56a75804d1ed39a1c04ba36ab2"><td class="memSeparator" colspan="2">&#160;</td></tr>
  141. <tr class="memitem:a94d7cd87d0f181c3cf2e5ec851e370b6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a94d7cd87d0f181c3cf2e5ec851e370b6">find_devices</a> (vector&lt; string &gt; &amp;)</td></tr>
  142. <tr class="memdesc:a94d7cd87d0f181c3cf2e5ec851e370b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find the network devices in the computer, and store them in vector devs. <a href="#a94d7cd87d0f181c3cf2e5ec851e370b6">More...</a><br /></td></tr>
  143. <tr class="separator:a94d7cd87d0f181c3cf2e5ec851e370b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
  144. <tr class="memitem:ab706811aa2b285e4c0f55491703c105a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#ab706811aa2b285e4c0f55491703c105a">setDevice</a> (string)</td></tr>
  145. <tr class="memdesc:ab706811aa2b285e4c0f55491703c105a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the device to capture packets to dev. <a href="#ab706811aa2b285e4c0f55491703c105a">More...</a><br /></td></tr>
  146. <tr class="separator:ab706811aa2b285e4c0f55491703c105a"><td class="memSeparator" colspan="2">&#160;</td></tr>
  147. </table><table class="memberdecls">
  148. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-methods"></a>
  149. Private Member Functions</h2></td></tr>
  150. <tr class="memitem:ac05f935a6ec2830d6bf42b607f071910"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#ac05f935a6ec2830d6bf42b607f071910">print_payload</a> (const u_char *payload, int len)</td></tr>
  151. <tr class="memdesc:ac05f935a6ec2830d6bf42b607f071910"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prints the payload in ascii. <a href="#ac05f935a6ec2830d6bf42b607f071910">More...</a><br /></td></tr>
  152. <tr class="separator:ac05f935a6ec2830d6bf42b607f071910"><td class="memSeparator" colspan="2">&#160;</td></tr>
  153. <tr class="memitem:a70598d5001a30cc8e801f1262770cdf6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a70598d5001a30cc8e801f1262770cdf6">print_hex_ascii_line</a> (const u_char *payload, int len, int offset)</td></tr>
  154. <tr class="memdesc:a70598d5001a30cc8e801f1262770cdf6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prints to std output the a payload in ascii. <a href="#a70598d5001a30cc8e801f1262770cdf6">More...</a><br /></td></tr>
  155. <tr class="separator:a70598d5001a30cc8e801f1262770cdf6"><td class="memSeparator" colspan="2">&#160;</td></tr>
  156. <tr class="memitem:a0179e32fee6a0f7c2a13f37d64a7fae0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sniffer.html#a0179e32fee6a0f7c2a13f37d64a7fae0">got_packet</a> (const struct pcap_pkthdr *header, const u_char *packet)</td></tr>
  157. <tr class="memdesc:a0179e32fee6a0f7c2a13f37d64a7fae0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disects the received packet. Takes out the info needed. <a href="#a0179e32fee6a0f7c2a13f37d64a7fae0">More...</a><br /></td></tr>
  158. <tr class="separator:a0179e32fee6a0f7c2a13f37d64a7fae0"><td class="memSeparator" colspan="2">&#160;</td></tr>
  159. </table><table class="memberdecls">
  160. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-attribs"></a>
  161. Private Attributes</h2></td></tr>
  162. <tr class="memitem:ad3ad83091913a50effd7468d8d7ca590"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad3ad83091913a50effd7468d8d7ca590"></a>
  163. vector&lt; <a class="el" href="classip__packet.html">ip_packet</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>packet_list</b></td></tr>
  164. <tr class="separator:ad3ad83091913a50effd7468d8d7ca590"><td class="memSeparator" colspan="2">&#160;</td></tr>
  165. <tr class="memitem:a36e1964fbc960b60a09b425a7cd1c0f6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a36e1964fbc960b60a09b425a7cd1c0f6"></a>
  166. QWaitCondition *&#160;</td><td class="memItemRight" valign="bottom"><b>wait_pause</b></td></tr>
  167. <tr class="separator:a36e1964fbc960b60a09b425a7cd1c0f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
  168. <tr class="memitem:ae0d6a92d2224a8c927afe861d45ab182"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae0d6a92d2224a8c927afe861d45ab182"></a>
  169. QMutex *&#160;</td><td class="memItemRight" valign="bottom"><b>mutex</b></td></tr>
  170. <tr class="separator:ae0d6a92d2224a8c927afe861d45ab182"><td class="memSeparator" colspan="2">&#160;</td></tr>
  171. <tr class="memitem:ac35f2e04e7f7668243a75bd9b9b44028"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac35f2e04e7f7668243a75bd9b9b44028"></a>
  172. string&#160;</td><td class="memItemRight" valign="bottom"><b>device</b></td></tr>
  173. <tr class="separator:ac35f2e04e7f7668243a75bd9b9b44028"><td class="memSeparator" colspan="2">&#160;</td></tr>
  174. <tr class="memitem:abb7dd6858499a14bcf002ba86e2d3f7f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abb7dd6858499a14bcf002ba86e2d3f7f"></a>
  175. string&#160;</td><td class="memItemRight" valign="bottom"><b>filter</b></td></tr>
  176. <tr class="separator:abb7dd6858499a14bcf002ba86e2d3f7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  177. <tr class="memitem:a2fde6ba65f629b1c74b1fcd1b8d2c022"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2fde6ba65f629b1c74b1fcd1b8d2c022"></a>
  178. int *&#160;</td><td class="memItemRight" valign="bottom"><b>pause</b></td></tr>
  179. <tr class="separator:a2fde6ba65f629b1c74b1fcd1b8d2c022"><td class="memSeparator" colspan="2">&#160;</td></tr>
  180. </table>
  181. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  182. <div class="textblock"><p>The <a class="el" href="class_sniffer.html" title="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). ">Sniffer</a> class is the one that use the pcap library to extract the packet information. It discards any packet that is not Ethernet-&gt;IP-&gt;(TCP|UDP), and pass up to the GUI the packets that are Ethernet-&gt;IP-&gt;(TCP|UDP). </p>
  183. </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
  184. <a class="anchor" id="a8e5f1474f756be527b4c39a3e9a83893"></a>
  185. <div class="memitem">
  186. <div class="memproto">
  187. <table class="memname">
  188. <tr>
  189. <td class="memname">Sniffer::Sniffer </td>
  190. <td>(</td>
  191. <td class="paramtype">QWaitCondition *&#160;</td>
  192. <td class="paramname"><em>pw</em>, </td>
  193. </tr>
  194. <tr>
  195. <td class="paramkey"></td>
  196. <td></td>
  197. <td class="paramtype">QMutex *&#160;</td>
  198. <td class="paramname"><em>mx</em>, </td>
  199. </tr>
  200. <tr>
  201. <td class="paramkey"></td>
  202. <td></td>
  203. <td class="paramtype">int *&#160;</td>
  204. <td class="paramname"><em>ps</em>&#160;</td>
  205. </tr>
  206. <tr>
  207. <td></td>
  208. <td>)</td>
  209. <td></td><td></td>
  210. </tr>
  211. </table>
  212. </div><div class="memdoc">
  213. <p>Sets the mutexes for the inter communication between the sniffer and the GUI. </p>
  214. <dl class="params"><dt>Parameters</dt><dd>
  215. <table class="params">
  216. <tr><td class="paramname">pw</td><td>used to pause the capture of packets </td></tr>
  217. <tr><td class="paramname">mx</td><td>used to protect critical region </td></tr>
  218. <tr><td class="paramname">ps</td><td>flag to pause the packet capture </td></tr>
  219. </table>
  220. </dd>
  221. </dl>
  222. </div>
  223. </div>
  224. <h2 class="groupheader">Member Function Documentation</h2>
  225. <a class="anchor" id="a94d7cd87d0f181c3cf2e5ec851e370b6"></a>
  226. <div class="memitem">
  227. <div class="memproto">
  228. <table class="memname">
  229. <tr>
  230. <td class="memname">void Sniffer::find_devices </td>
  231. <td>(</td>
  232. <td class="paramtype">vector&lt; string &gt; &amp;&#160;</td>
  233. <td class="paramname"><em>devs</em></td><td>)</td>
  234. <td></td>
  235. </tr>
  236. </table>
  237. </div><div class="memdoc">
  238. <p>Find the network devices in the computer, and store them in vector devs. </p>
  239. <dl class="params"><dt>Parameters</dt><dd>
  240. <table class="params">
  241. <tr><td class="paramname">devs</td><td>vector of string for device names </td></tr>
  242. </table>
  243. </dd>
  244. </dl>
  245. </div>
  246. </div>
  247. <a class="anchor" id="a02101b56a75804d1ed39a1c04ba36ab2"></a>
  248. <div class="memitem">
  249. <div class="memproto">
  250. <table class="memname">
  251. <tr>
  252. <td class="memname">string Sniffer::format_hex_ascii_line </td>
  253. <td>(</td>
  254. <td class="paramtype">const char *&#160;</td>
  255. <td class="paramname"><em>payload</em>, </td>
  256. </tr>
  257. <tr>
  258. <td class="paramkey"></td>
  259. <td></td>
  260. <td class="paramtype">int&#160;</td>
  261. <td class="paramname"><em>len</em>, </td>
  262. </tr>
  263. <tr>
  264. <td class="paramkey"></td>
  265. <td></td>
  266. <td class="paramtype">int&#160;</td>
  267. <td class="paramname"><em>offset</em>&#160;</td>
  268. </tr>
  269. <tr>
  270. <td></td>
  271. <td>)</td>
  272. <td></td><td></td>
  273. </tr>
  274. </table>
  275. </div><div class="memdoc">
  276. <p>Return string with the bytes of a payload line in ascii. </p>
  277. <dl class="params"><dt>Parameters</dt><dd>
  278. <table class="params">
  279. <tr><td class="paramname">payload</td><td>payload of the packet </td></tr>
  280. <tr><td class="paramname">len</td><td>length of the packet </td></tr>
  281. <tr><td class="paramname">offset</td><td>offset of packet </td></tr>
  282. </table>
  283. </dd>
  284. </dl>
  285. <dl class="section return"><dt>Returns</dt><dd>a string with the bytes of a payload line in ascii </dd></dl>
  286. </div>
  287. </div>
  288. <a class="anchor" id="a3dd95c60c5b8554e1bedc22b36ae488c"></a>
  289. <div class="memitem">
  290. <div class="memproto">
  291. <table class="memname">
  292. <tr>
  293. <td class="memname">string Sniffer::format_payload </td>
  294. <td>(</td>
  295. <td class="paramtype">const char *&#160;</td>
  296. <td class="paramname"><em>payload</em>, </td>
  297. </tr>
  298. <tr>
  299. <td class="paramkey"></td>
  300. <td></td>
  301. <td class="paramtype">int&#160;</td>
  302. <td class="paramname"><em>len</em>&#160;</td>
  303. </tr>
  304. <tr>
  305. <td></td>
  306. <td>)</td>
  307. <td></td><td></td>
  308. </tr>
  309. </table>
  310. </div><div class="memdoc">
  311. <p>Formats the payload from a byte stream into a string of ascci. </p>
  312. <dl class="params"><dt>Parameters</dt><dd>
  313. <table class="params">
  314. <tr><td class="paramname">payload</td><td>payload of the packet </td></tr>
  315. <tr><td class="paramname">len</td><td>length of the packet </td></tr>
  316. </table>
  317. </dd>
  318. </dl>
  319. <dl class="section return"><dt>Returns</dt><dd>the payload in a string of ascii </dd></dl>
  320. </div>
  321. </div>
  322. <a class="anchor" id="a791027d276cfcc5e6849132ecf8e80b6"></a>
  323. <div class="memitem">
  324. <div class="memproto">
  325. <table class="memname">
  326. <tr>
  327. <td class="memname">vector&lt; <a class="el" href="classip__packet.html">ip_packet</a> &gt; * Sniffer::getPacketList </td>
  328. <td>(</td>
  329. <td class="paramname"></td><td>)</td>
  330. <td></td>
  331. </tr>
  332. </table>
  333. </div><div class="memdoc">
  334. <p>Returns the packet list that contains the packets that are Ethernet -&gt; IP -&gt; (TCP|UDP) </p>
  335. <dl class="section return"><dt>Returns</dt><dd>vector of packets </dd></dl>
  336. </div>
  337. </div>
  338. <a class="anchor" id="a0179e32fee6a0f7c2a13f37d64a7fae0"></a>
  339. <div class="memitem">
  340. <div class="memproto">
  341. <table class="mlabels">
  342. <tr>
  343. <td class="mlabels-left">
  344. <table class="memname">
  345. <tr>
  346. <td class="memname">void Sniffer::got_packet </td>
  347. <td>(</td>
  348. <td class="paramtype">const struct pcap_pkthdr *&#160;</td>
  349. <td class="paramname"><em>header</em>, </td>
  350. </tr>
  351. <tr>
  352. <td class="paramkey"></td>
  353. <td></td>
  354. <td class="paramtype">const u_char *&#160;</td>
  355. <td class="paramname"><em>packet</em>&#160;</td>
  356. </tr>
  357. <tr>
  358. <td></td>
  359. <td>)</td>
  360. <td></td><td></td>
  361. </tr>
  362. </table>
  363. </td>
  364. <td class="mlabels-right">
  365. <span class="mlabels"><span class="mlabel">private</span></span> </td>
  366. </tr>
  367. </table>
  368. </div><div class="memdoc">
  369. <p>Disects the received packet. Takes out the info needed. </p>
  370. <dl class="params"><dt>Parameters</dt><dd>
  371. <table class="params">
  372. <tr><td class="paramname">pcap_pkthdr</td><td>header of the pcap packet </td></tr>
  373. <tr><td class="paramname">packet</td><td>recieved packet </td></tr>
  374. </table>
  375. </dd>
  376. </dl>
  377. </div>
  378. </div>
  379. <a class="anchor" id="a70598d5001a30cc8e801f1262770cdf6"></a>
  380. <div class="memitem">
  381. <div class="memproto">
  382. <table class="mlabels">
  383. <tr>
  384. <td class="mlabels-left">
  385. <table class="memname">
  386. <tr>
  387. <td class="memname">void Sniffer::print_hex_ascii_line </td>
  388. <td>(</td>
  389. <td class="paramtype">const u_char *&#160;</td>
  390. <td class="paramname"><em>payload</em>, </td>
  391. </tr>
  392. <tr>
  393. <td class="paramkey"></td>
  394. <td></td>
  395. <td class="paramtype">int&#160;</td>
  396. <td class="paramname"><em>len</em>, </td>
  397. </tr>
  398. <tr>
  399. <td class="paramkey"></td>
  400. <td></td>
  401. <td class="paramtype">int&#160;</td>
  402. <td class="paramname"><em>offset</em>&#160;</td>
  403. </tr>
  404. <tr>
  405. <td></td>
  406. <td>)</td>
  407. <td></td><td></td>
  408. </tr>
  409. </table>
  410. </td>
  411. <td class="mlabels-right">
  412. <span class="mlabels"><span class="mlabel">private</span></span> </td>
  413. </tr>
  414. </table>
  415. </div><div class="memdoc">
  416. <p>Prints to std output the a payload in ascii. </p>
  417. <dl class="params"><dt>Parameters</dt><dd>
  418. <table class="params">
  419. <tr><td class="paramname">payload</td><td>payload of the packet </td></tr>
  420. <tr><td class="paramname">len</td><td>length of the packet </td></tr>
  421. <tr><td class="paramname">offset</td><td>offset </td></tr>
  422. </table>
  423. </dd>
  424. </dl>
  425. </div>
  426. </div>
  427. <a class="anchor" id="ac05f935a6ec2830d6bf42b607f071910"></a>
  428. <div class="memitem">
  429. <div class="memproto">
  430. <table class="mlabels">
  431. <tr>
  432. <td class="mlabels-left">
  433. <table class="memname">
  434. <tr>
  435. <td class="memname">void Sniffer::print_payload </td>
  436. <td>(</td>
  437. <td class="paramtype">const u_char *&#160;</td>
  438. <td class="paramname"><em>payload</em>, </td>
  439. </tr>
  440. <tr>
  441. <td class="paramkey"></td>
  442. <td></td>
  443. <td class="paramtype">int&#160;</td>
  444. <td class="paramname"><em>len</em>&#160;</td>
  445. </tr>
  446. <tr>
  447. <td></td>
  448. <td>)</td>
  449. <td></td><td></td>
  450. </tr>
  451. </table>
  452. </td>
  453. <td class="mlabels-right">
  454. <span class="mlabels"><span class="mlabel">private</span></span> </td>
  455. </tr>
  456. </table>
  457. </div><div class="memdoc">
  458. <p>Prints the payload in ascii. </p>
  459. <dl class="params"><dt>Parameters</dt><dd>
  460. <table class="params">
  461. <tr><td class="paramname">payload</td><td>payload of the packet </td></tr>
  462. <tr><td class="paramname">len</td><td>payload length </td></tr>
  463. </table>
  464. </dd>
  465. </dl>
  466. </div>
  467. </div>
  468. <a class="anchor" id="ab706811aa2b285e4c0f55491703c105a"></a>
  469. <div class="memitem">
  470. <div class="memproto">
  471. <table class="memname">
  472. <tr>
  473. <td class="memname">void Sniffer::setDevice </td>
  474. <td>(</td>
  475. <td class="paramtype">string&#160;</td>
  476. <td class="paramname"><em>dev</em></td><td>)</td>
  477. <td></td>
  478. </tr>
  479. </table>
  480. </div><div class="memdoc">
  481. <p>Sets the device to capture packets to dev. </p>
  482. <dl class="params"><dt>Parameters</dt><dd>
  483. <table class="params">
  484. <tr><td class="paramname">dev</td><td>name of the device </td></tr>
  485. </table>
  486. </dd>
  487. </dl>
  488. </div>
  489. </div>
  490. <hr/>The documentation for this class was generated from the following files:<ul>
  491. <li><a class="el" href="sniffer_8h_source.html">sniffer.h</a></li>
  492. <li>sniffer.cpp</li>
  493. </ul>
  494. </div><!-- contents -->
  495. <!-- start footer part -->
  496. <hr class="footer"/><address class="footer"><small>
  497. Generated on Wed Jun 24 2015 15:25:13 for My Project by &#160;<a href="http://www.doxygen.org/index.html">
  498. <img class="footer" src="doxygen.png" alt="doxygen"/>
  499. </a> 1.8.9.1
  500. </small></address>
  501. </body>
  502. </html>