Нет описания

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. \hypertarget{classip__packet}{}\section{ip\+\_\+packet Class Reference}
  2. \label{classip__packet}\index{ip\+\_\+packet@{ip\+\_\+packet}}
  3. The \hyperlink{classip__packet}{ip\+\_\+packet} class contains the information extracted from a packet received using pcap for packets that are I\+P/\+T\+C\+P or I\+P/\+U\+D\+P. We only save src and dst addresses and ports, and type of Transport protocol. The class hinerates the fields hardware address field because every I\+P packet is part of a ethernet packet. The remaining packet is stored as payload.
  4. {\ttfamily \#include $<$ip\+\_\+packet.\+h$>$}
  5. Inheritance diagram for ip\+\_\+packet\+:\begin{figure}[H]
  6. \begin{center}
  7. \leavevmode
  8. \includegraphics[height=2.000000cm]{classip__packet}
  9. \end{center}
  10. \end{figure}
  11. \subsection*{Public Member Functions}
  12. \begin{DoxyCompactItemize}
  13. \item
  14. \hypertarget{classip__packet_a331b530912b6fa3b2bbc9a6f0dbe6d90}{}\hyperlink{classip__packet_a331b530912b6fa3b2bbc9a6f0dbe6d90}{ip\+\_\+packet} ()\label{classip__packet_a331b530912b6fa3b2bbc9a6f0dbe6d90}
  15. \begin{DoxyCompactList}\small\item\em Constructor. \end{DoxyCompactList}\item
  16. void \hyperlink{classip__packet_a5542509eb012fbf4f831dfec39f27307}{set\+I\+P\+S\+Address} (string)
  17. \begin{DoxyCompactList}\small\item\em Saves the source I\+P address in std string format. \end{DoxyCompactList}\item
  18. void \hyperlink{classip__packet_a6083cc5d06be5bb11c266efbdd961f61}{set\+I\+P\+D\+Address} (string)
  19. \begin{DoxyCompactList}\small\item\em Saves the destination I\+P address in std string format. \end{DoxyCompactList}\item
  20. void \hyperlink{classip__packet_a661b3d3c30388290ce4f479c6a00b38c}{set\+I\+P\+Proto} (char)
  21. \begin{DoxyCompactList}\small\item\em Saves the I\+P protocol to (T\+C\+P$\vert$\+U\+D\+P) \end{DoxyCompactList}\item
  22. void \hyperlink{classip__packet_a33ac2122569abba5eea67bd117e3790e}{set\+I\+P\+S\+Port} (unsigned short)
  23. \begin{DoxyCompactList}\small\item\em Saves the source port. \end{DoxyCompactList}\item
  24. void \hyperlink{classip__packet_a96103b6cecb324c633e5bd74fee281e2}{set\+I\+P\+D\+Port} (unsigned short)
  25. \begin{DoxyCompactList}\small\item\em Saves the destinaation port. \end{DoxyCompactList}\item
  26. void \hyperlink{classip__packet_ac46158915c7d7a4a652ede4246fad8df}{set\+Payload} (char $\ast$, int)
  27. \begin{DoxyCompactList}\small\item\em Saves the payload string of bytes into a string. \end{DoxyCompactList}\item
  28. string \hyperlink{classip__packet_ac4baa351e90aa90ee8bedd1239d24183}{get\+I\+P\+S\+Address} ()
  29. \begin{DoxyCompactList}\small\item\em Returns the source I\+P address. \end{DoxyCompactList}\item
  30. string \hyperlink{classip__packet_a5396956d60ddb6a1bb1bd2f6f2b4751b}{get\+I\+P\+D\+Address} ()
  31. \begin{DoxyCompactList}\small\item\em Returns the destination I\+P address. \end{DoxyCompactList}\item
  32. string \hyperlink{classip__packet_a8b774913ecf9d9cda07dd088818ef481}{get\+Payload} ()
  33. \begin{DoxyCompactList}\small\item\em Returns the I\+P packet payload. \end{DoxyCompactList}\item
  34. char \hyperlink{classip__packet_a78e1e0e7d107ac449fe224d95bcbd999}{get\+I\+P\+Proto} ()
  35. \begin{DoxyCompactList}\small\item\em Returns the I\+P protocol type. \end{DoxyCompactList}\item
  36. unsigned short \hyperlink{classip__packet_a9697bad155ec10c25151a6c1f5a434b0}{get\+I\+P\+S\+Port} ()
  37. \begin{DoxyCompactList}\small\item\em Returns the source port. \end{DoxyCompactList}\item
  38. unsigned short \hyperlink{classip__packet_a1a31307b3e7912ba3a1817041725660e}{get\+I\+P\+D\+Port} ()
  39. \begin{DoxyCompactList}\small\item\em Returns the destination port. \end{DoxyCompactList}\end{DoxyCompactItemize}
  40. \subsection*{Private Attributes}
  41. \begin{DoxyCompactItemize}
  42. \item
  43. \hypertarget{classip__packet_a4225b27fe714e0a321e1dd04355e5370}{}string {\bfseries ip\+\_\+src}\label{classip__packet_a4225b27fe714e0a321e1dd04355e5370}
  44. \item
  45. string \hyperlink{classip__packet_af3a920730b654dc7d26e155d509234fc}{ip\+\_\+dst}
  46. \item
  47. char \hyperlink{classip__packet_a6d562e562de60c518542cd250d9986b0}{ip\+\_\+p}
  48. \item
  49. unsigned short \hyperlink{classip__packet_a51f1c0f6cc53460164467a7e80d849b5}{d\+\_\+port}
  50. \item
  51. unsigned short \hyperlink{classip__packet_a12b33dcaa7ab59d15f3ce4b8ca6750fd}{s\+\_\+port}
  52. \item
  53. string \hyperlink{classip__packet_a68c32f352a4f43fd910fb3bba3ddfae0}{payload}
  54. \end{DoxyCompactItemize}
  55. \subsection{Detailed Description}
  56. The \hyperlink{classip__packet}{ip\+\_\+packet} class contains the information extracted from a packet received using pcap for packets that are I\+P/\+T\+C\+P or I\+P/\+U\+D\+P. We only save src and dst addresses and ports, and type of Transport protocol. The class hinerates the fields hardware address field because every I\+P packet is part of a ethernet packet. The remaining packet is stored as payload.
  57. \subsection{Member Function Documentation}
  58. \hypertarget{classip__packet_a5396956d60ddb6a1bb1bd2f6f2b4751b}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+D\+Address@{get\+I\+P\+D\+Address}}
  59. \index{get\+I\+P\+D\+Address@{get\+I\+P\+D\+Address}!ip\+\_\+packet@{ip\+\_\+packet}}
  60. \subsubsection[{get\+I\+P\+D\+Address}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::get\+I\+P\+D\+Address (
  61. \begin{DoxyParamCaption}
  62. {}
  63. \end{DoxyParamCaption}
  64. )}\label{classip__packet_a5396956d60ddb6a1bb1bd2f6f2b4751b}
  65. Returns the destination I\+P address.
  66. \begin{DoxyReturn}{Returns}
  67. the destination I\+P address
  68. \end{DoxyReturn}
  69. \hypertarget{classip__packet_a1a31307b3e7912ba3a1817041725660e}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+D\+Port@{get\+I\+P\+D\+Port}}
  70. \index{get\+I\+P\+D\+Port@{get\+I\+P\+D\+Port}!ip\+\_\+packet@{ip\+\_\+packet}}
  71. \subsubsection[{get\+I\+P\+D\+Port}]{\setlength{\rightskip}{0pt plus 5cm}unsigned short ip\+\_\+packet\+::get\+I\+P\+D\+Port (
  72. \begin{DoxyParamCaption}
  73. {}
  74. \end{DoxyParamCaption}
  75. )}\label{classip__packet_a1a31307b3e7912ba3a1817041725660e}
  76. Returns the destination port.
  77. \begin{DoxyReturn}{Returns}
  78. the destination port
  79. \end{DoxyReturn}
  80. Devuelve el puerto destino \begin{DoxyReturn}{Returns}
  81. el puerto destino
  82. \end{DoxyReturn}
  83. \hypertarget{classip__packet_a78e1e0e7d107ac449fe224d95bcbd999}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+Proto@{get\+I\+P\+Proto}}
  84. \index{get\+I\+P\+Proto@{get\+I\+P\+Proto}!ip\+\_\+packet@{ip\+\_\+packet}}
  85. \subsubsection[{get\+I\+P\+Proto}]{\setlength{\rightskip}{0pt plus 5cm}char ip\+\_\+packet\+::get\+I\+P\+Proto (
  86. \begin{DoxyParamCaption}
  87. {}
  88. \end{DoxyParamCaption}
  89. )}\label{classip__packet_a78e1e0e7d107ac449fe224d95bcbd999}
  90. Returns the I\+P protocol type.
  91. \begin{DoxyReturn}{Returns}
  92. the I\+P protocol
  93. \end{DoxyReturn}
  94. \hypertarget{classip__packet_ac4baa351e90aa90ee8bedd1239d24183}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+S\+Address@{get\+I\+P\+S\+Address}}
  95. \index{get\+I\+P\+S\+Address@{get\+I\+P\+S\+Address}!ip\+\_\+packet@{ip\+\_\+packet}}
  96. \subsubsection[{get\+I\+P\+S\+Address}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::get\+I\+P\+S\+Address (
  97. \begin{DoxyParamCaption}
  98. {}
  99. \end{DoxyParamCaption}
  100. )}\label{classip__packet_ac4baa351e90aa90ee8bedd1239d24183}
  101. Returns the source I\+P address.
  102. \begin{DoxyReturn}{Returns}
  103. the source I\+P address
  104. \end{DoxyReturn}
  105. \hypertarget{classip__packet_a9697bad155ec10c25151a6c1f5a434b0}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+S\+Port@{get\+I\+P\+S\+Port}}
  106. \index{get\+I\+P\+S\+Port@{get\+I\+P\+S\+Port}!ip\+\_\+packet@{ip\+\_\+packet}}
  107. \subsubsection[{get\+I\+P\+S\+Port}]{\setlength{\rightskip}{0pt plus 5cm}unsigned short ip\+\_\+packet\+::get\+I\+P\+S\+Port (
  108. \begin{DoxyParamCaption}
  109. {}
  110. \end{DoxyParamCaption}
  111. )}\label{classip__packet_a9697bad155ec10c25151a6c1f5a434b0}
  112. Returns the source port.
  113. \begin{DoxyReturn}{Returns}
  114. the source port
  115. \end{DoxyReturn}
  116. Devuelve el puerto fuente \begin{DoxyReturn}{Returns}
  117. el puerto fuente
  118. \end{DoxyReturn}
  119. \hypertarget{classip__packet_a8b774913ecf9d9cda07dd088818ef481}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+Payload@{get\+Payload}}
  120. \index{get\+Payload@{get\+Payload}!ip\+\_\+packet@{ip\+\_\+packet}}
  121. \subsubsection[{get\+Payload}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::get\+Payload (
  122. \begin{DoxyParamCaption}
  123. {}
  124. \end{DoxyParamCaption}
  125. )}\label{classip__packet_a8b774913ecf9d9cda07dd088818ef481}
  126. Returns the I\+P packet payload.
  127. \begin{DoxyReturn}{Returns}
  128. the I\+P packet payload
  129. \end{DoxyReturn}
  130. \hypertarget{classip__packet_a6083cc5d06be5bb11c266efbdd961f61}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+D\+Address@{set\+I\+P\+D\+Address}}
  131. \index{set\+I\+P\+D\+Address@{set\+I\+P\+D\+Address}!ip\+\_\+packet@{ip\+\_\+packet}}
  132. \subsubsection[{set\+I\+P\+D\+Address}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+D\+Address (
  133. \begin{DoxyParamCaption}
  134. \item[{string}]{addr}
  135. \end{DoxyParamCaption}
  136. )}\label{classip__packet_a6083cc5d06be5bb11c266efbdd961f61}
  137. Saves the destination I\+P address in std string format.
  138. \begin{DoxyParams}{Parameters}
  139. {\em addr} & destination I\+P address \\
  140. \hline
  141. \end{DoxyParams}
  142. \hypertarget{classip__packet_a96103b6cecb324c633e5bd74fee281e2}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+D\+Port@{set\+I\+P\+D\+Port}}
  143. \index{set\+I\+P\+D\+Port@{set\+I\+P\+D\+Port}!ip\+\_\+packet@{ip\+\_\+packet}}
  144. \subsubsection[{set\+I\+P\+D\+Port}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+D\+Port (
  145. \begin{DoxyParamCaption}
  146. \item[{unsigned short}]{port}
  147. \end{DoxyParamCaption}
  148. )}\label{classip__packet_a96103b6cecb324c633e5bd74fee281e2}
  149. Saves the destinaation port.
  150. \begin{DoxyParams}{Parameters}
  151. {\em port} & destination port \\
  152. \hline
  153. \end{DoxyParams}
  154. \hypertarget{classip__packet_a661b3d3c30388290ce4f479c6a00b38c}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+Proto@{set\+I\+P\+Proto}}
  155. \index{set\+I\+P\+Proto@{set\+I\+P\+Proto}!ip\+\_\+packet@{ip\+\_\+packet}}
  156. \subsubsection[{set\+I\+P\+Proto}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+Proto (
  157. \begin{DoxyParamCaption}
  158. \item[{char}]{proto}
  159. \end{DoxyParamCaption}
  160. )}\label{classip__packet_a661b3d3c30388290ce4f479c6a00b38c}
  161. Saves the I\+P protocol to (T\+C\+P$\vert$\+U\+D\+P)
  162. \begin{DoxyParams}{Parameters}
  163. {\em proto} & protocol number (6 $\vert$ 17) \\
  164. \hline
  165. \end{DoxyParams}
  166. \hypertarget{classip__packet_a5542509eb012fbf4f831dfec39f27307}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+S\+Address@{set\+I\+P\+S\+Address}}
  167. \index{set\+I\+P\+S\+Address@{set\+I\+P\+S\+Address}!ip\+\_\+packet@{ip\+\_\+packet}}
  168. \subsubsection[{set\+I\+P\+S\+Address}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+S\+Address (
  169. \begin{DoxyParamCaption}
  170. \item[{string}]{addr}
  171. \end{DoxyParamCaption}
  172. )}\label{classip__packet_a5542509eb012fbf4f831dfec39f27307}
  173. Saves the source I\+P address in std string format.
  174. \begin{DoxyParams}{Parameters}
  175. {\em addr} & source I\+P address \\
  176. \hline
  177. \end{DoxyParams}
  178. \hypertarget{classip__packet_a33ac2122569abba5eea67bd117e3790e}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+S\+Port@{set\+I\+P\+S\+Port}}
  179. \index{set\+I\+P\+S\+Port@{set\+I\+P\+S\+Port}!ip\+\_\+packet@{ip\+\_\+packet}}
  180. \subsubsection[{set\+I\+P\+S\+Port}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+S\+Port (
  181. \begin{DoxyParamCaption}
  182. \item[{unsigned short}]{port}
  183. \end{DoxyParamCaption}
  184. )}\label{classip__packet_a33ac2122569abba5eea67bd117e3790e}
  185. Saves the source port.
  186. \begin{DoxyParams}{Parameters}
  187. {\em port} & source port \\
  188. \hline
  189. \end{DoxyParams}
  190. \hypertarget{classip__packet_ac46158915c7d7a4a652ede4246fad8df}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+Payload@{set\+Payload}}
  191. \index{set\+Payload@{set\+Payload}!ip\+\_\+packet@{ip\+\_\+packet}}
  192. \subsubsection[{set\+Payload}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+Payload (
  193. \begin{DoxyParamCaption}
  194. \item[{char $\ast$}]{pl, }
  195. \item[{int}]{len}
  196. \end{DoxyParamCaption}
  197. )}\label{classip__packet_ac46158915c7d7a4a652ede4246fad8df}
  198. Saves the payload string of bytes into a string.
  199. \begin{DoxyParams}{Parameters}
  200. {\em pl} & the packet payload \\
  201. \hline
  202. {\em len} & length of the payload \\
  203. \hline
  204. \end{DoxyParams}
  205. \subsection{Member Data Documentation}
  206. \hypertarget{classip__packet_a51f1c0f6cc53460164467a7e80d849b5}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!d\+\_\+port@{d\+\_\+port}}
  207. \index{d\+\_\+port@{d\+\_\+port}!ip\+\_\+packet@{ip\+\_\+packet}}
  208. \subsubsection[{d\+\_\+port}]{\setlength{\rightskip}{0pt plus 5cm}unsigned short ip\+\_\+packet\+::d\+\_\+port\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_a51f1c0f6cc53460164467a7e80d849b5}
  209. destination port / puerto destino \hypertarget{classip__packet_af3a920730b654dc7d26e155d509234fc}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!ip\+\_\+dst@{ip\+\_\+dst}}
  210. \index{ip\+\_\+dst@{ip\+\_\+dst}!ip\+\_\+packet@{ip\+\_\+packet}}
  211. \subsubsection[{ip\+\_\+dst}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::ip\+\_\+dst\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_af3a920730b654dc7d26e155d509234fc}
  212. source and dest address / direccion fuente y destino \hypertarget{classip__packet_a6d562e562de60c518542cd250d9986b0}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!ip\+\_\+p@{ip\+\_\+p}}
  213. \index{ip\+\_\+p@{ip\+\_\+p}!ip\+\_\+packet@{ip\+\_\+packet}}
  214. \subsubsection[{ip\+\_\+p}]{\setlength{\rightskip}{0pt plus 5cm}char ip\+\_\+packet\+::ip\+\_\+p\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_a6d562e562de60c518542cd250d9986b0}
  215. type of transport protocol (T\+C\+P$\vert$\+U\+D\+P) $\vert$ tipo de protocolo de transporte (T\+C\+P$\vert$\+U\+D\+P) \hypertarget{classip__packet_a68c32f352a4f43fd910fb3bba3ddfae0}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!payload@{payload}}
  216. \index{payload@{payload}!ip\+\_\+packet@{ip\+\_\+packet}}
  217. \subsubsection[{payload}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::payload\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_a68c32f352a4f43fd910fb3bba3ddfae0}
  218. Data payload (content of the packet) / carga del paquete \hypertarget{classip__packet_a12b33dcaa7ab59d15f3ce4b8ca6750fd}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!s\+\_\+port@{s\+\_\+port}}
  219. \index{s\+\_\+port@{s\+\_\+port}!ip\+\_\+packet@{ip\+\_\+packet}}
  220. \subsubsection[{s\+\_\+port}]{\setlength{\rightskip}{0pt plus 5cm}unsigned short ip\+\_\+packet\+::s\+\_\+port\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_a12b33dcaa7ab59d15f3ce4b8ca6750fd}
  221. source port / puerto fuente
  222. The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
  223. \item
  224. ip\+\_\+packet.\+h\item
  225. ip\+\_\+packet.\+cpp\end{DoxyCompactItemize}