\hypertarget{classip__packet}{}\section{ip\+\_\+packet Class Reference} \label{classip__packet}\index{ip\+\_\+packet@{ip\+\_\+packet}} 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. {\ttfamily \#include $<$ip\+\_\+packet.\+h$>$} Inheritance diagram for ip\+\_\+packet\+:\begin{figure}[H] \begin{center} \leavevmode \includegraphics[height=2.000000cm]{classip__packet} \end{center} \end{figure} \subsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \hypertarget{classip__packet_a331b530912b6fa3b2bbc9a6f0dbe6d90}{}\hyperlink{classip__packet_a331b530912b6fa3b2bbc9a6f0dbe6d90}{ip\+\_\+packet} ()\label{classip__packet_a331b530912b6fa3b2bbc9a6f0dbe6d90} \begin{DoxyCompactList}\small\item\em Constructor. \end{DoxyCompactList}\item void \hyperlink{classip__packet_a5542509eb012fbf4f831dfec39f27307}{set\+I\+P\+S\+Address} (string) \begin{DoxyCompactList}\small\item\em Saves the source I\+P address in std string format. \end{DoxyCompactList}\item void \hyperlink{classip__packet_a6083cc5d06be5bb11c266efbdd961f61}{set\+I\+P\+D\+Address} (string) \begin{DoxyCompactList}\small\item\em Saves the destination I\+P address in std string format. \end{DoxyCompactList}\item void \hyperlink{classip__packet_a661b3d3c30388290ce4f479c6a00b38c}{set\+I\+P\+Proto} (char) \begin{DoxyCompactList}\small\item\em Saves the I\+P protocol to (T\+C\+P$\vert$\+U\+D\+P) \end{DoxyCompactList}\item void \hyperlink{classip__packet_a33ac2122569abba5eea67bd117e3790e}{set\+I\+P\+S\+Port} (unsigned short) \begin{DoxyCompactList}\small\item\em Saves the source port. \end{DoxyCompactList}\item void \hyperlink{classip__packet_a96103b6cecb324c633e5bd74fee281e2}{set\+I\+P\+D\+Port} (unsigned short) \begin{DoxyCompactList}\small\item\em Saves the destinaation port. \end{DoxyCompactList}\item void \hyperlink{classip__packet_ac46158915c7d7a4a652ede4246fad8df}{set\+Payload} (char $\ast$, int) \begin{DoxyCompactList}\small\item\em Saves the payload string of bytes into a string. \end{DoxyCompactList}\item string \hyperlink{classip__packet_ac4baa351e90aa90ee8bedd1239d24183}{get\+I\+P\+S\+Address} () \begin{DoxyCompactList}\small\item\em Returns the source I\+P address. \end{DoxyCompactList}\item string \hyperlink{classip__packet_a5396956d60ddb6a1bb1bd2f6f2b4751b}{get\+I\+P\+D\+Address} () \begin{DoxyCompactList}\small\item\em Returns the destination I\+P address. \end{DoxyCompactList}\item string \hyperlink{classip__packet_a8b774913ecf9d9cda07dd088818ef481}{get\+Payload} () \begin{DoxyCompactList}\small\item\em Returns the I\+P packet payload. \end{DoxyCompactList}\item char \hyperlink{classip__packet_a78e1e0e7d107ac449fe224d95bcbd999}{get\+I\+P\+Proto} () \begin{DoxyCompactList}\small\item\em Returns the I\+P protocol type. \end{DoxyCompactList}\item unsigned short \hyperlink{classip__packet_a9697bad155ec10c25151a6c1f5a434b0}{get\+I\+P\+S\+Port} () \begin{DoxyCompactList}\small\item\em Returns the source port. \end{DoxyCompactList}\item unsigned short \hyperlink{classip__packet_a1a31307b3e7912ba3a1817041725660e}{get\+I\+P\+D\+Port} () \begin{DoxyCompactList}\small\item\em Returns the destination port. \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection*{Private Attributes} \begin{DoxyCompactItemize} \item \hypertarget{classip__packet_a4225b27fe714e0a321e1dd04355e5370}{}string {\bfseries ip\+\_\+src}\label{classip__packet_a4225b27fe714e0a321e1dd04355e5370} \item string \hyperlink{classip__packet_af3a920730b654dc7d26e155d509234fc}{ip\+\_\+dst} \item char \hyperlink{classip__packet_a6d562e562de60c518542cd250d9986b0}{ip\+\_\+p} \item unsigned short \hyperlink{classip__packet_a51f1c0f6cc53460164467a7e80d849b5}{d\+\_\+port} \item unsigned short \hyperlink{classip__packet_a12b33dcaa7ab59d15f3ce4b8ca6750fd}{s\+\_\+port} \item string \hyperlink{classip__packet_a68c32f352a4f43fd910fb3bba3ddfae0}{payload} \end{DoxyCompactItemize} \subsection{Detailed Description} 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. \subsection{Member Function Documentation} \hypertarget{classip__packet_a5396956d60ddb6a1bb1bd2f6f2b4751b}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+D\+Address@{get\+I\+P\+D\+Address}} \index{get\+I\+P\+D\+Address@{get\+I\+P\+D\+Address}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{get\+I\+P\+D\+Address}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::get\+I\+P\+D\+Address ( \begin{DoxyParamCaption} {} \end{DoxyParamCaption} )}\label{classip__packet_a5396956d60ddb6a1bb1bd2f6f2b4751b} Returns the destination I\+P address. \begin{DoxyReturn}{Returns} the destination I\+P address \end{DoxyReturn} \hypertarget{classip__packet_a1a31307b3e7912ba3a1817041725660e}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+D\+Port@{get\+I\+P\+D\+Port}} \index{get\+I\+P\+D\+Port@{get\+I\+P\+D\+Port}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{get\+I\+P\+D\+Port}]{\setlength{\rightskip}{0pt plus 5cm}unsigned short ip\+\_\+packet\+::get\+I\+P\+D\+Port ( \begin{DoxyParamCaption} {} \end{DoxyParamCaption} )}\label{classip__packet_a1a31307b3e7912ba3a1817041725660e} Returns the destination port. \begin{DoxyReturn}{Returns} the destination port \end{DoxyReturn} Devuelve el puerto destino \begin{DoxyReturn}{Returns} el puerto destino \end{DoxyReturn} \hypertarget{classip__packet_a78e1e0e7d107ac449fe224d95bcbd999}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+Proto@{get\+I\+P\+Proto}} \index{get\+I\+P\+Proto@{get\+I\+P\+Proto}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{get\+I\+P\+Proto}]{\setlength{\rightskip}{0pt plus 5cm}char ip\+\_\+packet\+::get\+I\+P\+Proto ( \begin{DoxyParamCaption} {} \end{DoxyParamCaption} )}\label{classip__packet_a78e1e0e7d107ac449fe224d95bcbd999} Returns the I\+P protocol type. \begin{DoxyReturn}{Returns} the I\+P protocol \end{DoxyReturn} \hypertarget{classip__packet_ac4baa351e90aa90ee8bedd1239d24183}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+S\+Address@{get\+I\+P\+S\+Address}} \index{get\+I\+P\+S\+Address@{get\+I\+P\+S\+Address}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{get\+I\+P\+S\+Address}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::get\+I\+P\+S\+Address ( \begin{DoxyParamCaption} {} \end{DoxyParamCaption} )}\label{classip__packet_ac4baa351e90aa90ee8bedd1239d24183} Returns the source I\+P address. \begin{DoxyReturn}{Returns} the source I\+P address \end{DoxyReturn} \hypertarget{classip__packet_a9697bad155ec10c25151a6c1f5a434b0}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+I\+P\+S\+Port@{get\+I\+P\+S\+Port}} \index{get\+I\+P\+S\+Port@{get\+I\+P\+S\+Port}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{get\+I\+P\+S\+Port}]{\setlength{\rightskip}{0pt plus 5cm}unsigned short ip\+\_\+packet\+::get\+I\+P\+S\+Port ( \begin{DoxyParamCaption} {} \end{DoxyParamCaption} )}\label{classip__packet_a9697bad155ec10c25151a6c1f5a434b0} Returns the source port. \begin{DoxyReturn}{Returns} the source port \end{DoxyReturn} Devuelve el puerto fuente \begin{DoxyReturn}{Returns} el puerto fuente \end{DoxyReturn} \hypertarget{classip__packet_a8b774913ecf9d9cda07dd088818ef481}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!get\+Payload@{get\+Payload}} \index{get\+Payload@{get\+Payload}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{get\+Payload}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::get\+Payload ( \begin{DoxyParamCaption} {} \end{DoxyParamCaption} )}\label{classip__packet_a8b774913ecf9d9cda07dd088818ef481} Returns the I\+P packet payload. \begin{DoxyReturn}{Returns} the I\+P packet payload \end{DoxyReturn} \hypertarget{classip__packet_a6083cc5d06be5bb11c266efbdd961f61}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+D\+Address@{set\+I\+P\+D\+Address}} \index{set\+I\+P\+D\+Address@{set\+I\+P\+D\+Address}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{set\+I\+P\+D\+Address}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+D\+Address ( \begin{DoxyParamCaption} \item[{string}]{addr} \end{DoxyParamCaption} )}\label{classip__packet_a6083cc5d06be5bb11c266efbdd961f61} Saves the destination I\+P address in std string format. \begin{DoxyParams}{Parameters} {\em addr} & destination I\+P address \\ \hline \end{DoxyParams} \hypertarget{classip__packet_a96103b6cecb324c633e5bd74fee281e2}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+D\+Port@{set\+I\+P\+D\+Port}} \index{set\+I\+P\+D\+Port@{set\+I\+P\+D\+Port}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{set\+I\+P\+D\+Port}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+D\+Port ( \begin{DoxyParamCaption} \item[{unsigned short}]{port} \end{DoxyParamCaption} )}\label{classip__packet_a96103b6cecb324c633e5bd74fee281e2} Saves the destinaation port. \begin{DoxyParams}{Parameters} {\em port} & destination port \\ \hline \end{DoxyParams} \hypertarget{classip__packet_a661b3d3c30388290ce4f479c6a00b38c}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+Proto@{set\+I\+P\+Proto}} \index{set\+I\+P\+Proto@{set\+I\+P\+Proto}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{set\+I\+P\+Proto}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+Proto ( \begin{DoxyParamCaption} \item[{char}]{proto} \end{DoxyParamCaption} )}\label{classip__packet_a661b3d3c30388290ce4f479c6a00b38c} Saves the I\+P protocol to (T\+C\+P$\vert$\+U\+D\+P) \begin{DoxyParams}{Parameters} {\em proto} & protocol number (6 $\vert$ 17) \\ \hline \end{DoxyParams} \hypertarget{classip__packet_a5542509eb012fbf4f831dfec39f27307}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+S\+Address@{set\+I\+P\+S\+Address}} \index{set\+I\+P\+S\+Address@{set\+I\+P\+S\+Address}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{set\+I\+P\+S\+Address}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+S\+Address ( \begin{DoxyParamCaption} \item[{string}]{addr} \end{DoxyParamCaption} )}\label{classip__packet_a5542509eb012fbf4f831dfec39f27307} Saves the source I\+P address in std string format. \begin{DoxyParams}{Parameters} {\em addr} & source I\+P address \\ \hline \end{DoxyParams} \hypertarget{classip__packet_a33ac2122569abba5eea67bd117e3790e}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+I\+P\+S\+Port@{set\+I\+P\+S\+Port}} \index{set\+I\+P\+S\+Port@{set\+I\+P\+S\+Port}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{set\+I\+P\+S\+Port}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+I\+P\+S\+Port ( \begin{DoxyParamCaption} \item[{unsigned short}]{port} \end{DoxyParamCaption} )}\label{classip__packet_a33ac2122569abba5eea67bd117e3790e} Saves the source port. \begin{DoxyParams}{Parameters} {\em port} & source port \\ \hline \end{DoxyParams} \hypertarget{classip__packet_ac46158915c7d7a4a652ede4246fad8df}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!set\+Payload@{set\+Payload}} \index{set\+Payload@{set\+Payload}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{set\+Payload}]{\setlength{\rightskip}{0pt plus 5cm}void ip\+\_\+packet\+::set\+Payload ( \begin{DoxyParamCaption} \item[{char $\ast$}]{pl, } \item[{int}]{len} \end{DoxyParamCaption} )}\label{classip__packet_ac46158915c7d7a4a652ede4246fad8df} Saves the payload string of bytes into a string. \begin{DoxyParams}{Parameters} {\em pl} & the packet payload \\ \hline {\em len} & length of the payload \\ \hline \end{DoxyParams} \subsection{Member Data Documentation} \hypertarget{classip__packet_a51f1c0f6cc53460164467a7e80d849b5}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!d\+\_\+port@{d\+\_\+port}} \index{d\+\_\+port@{d\+\_\+port}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{d\+\_\+port}]{\setlength{\rightskip}{0pt plus 5cm}unsigned short ip\+\_\+packet\+::d\+\_\+port\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_a51f1c0f6cc53460164467a7e80d849b5} destination port / puerto destino \hypertarget{classip__packet_af3a920730b654dc7d26e155d509234fc}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!ip\+\_\+dst@{ip\+\_\+dst}} \index{ip\+\_\+dst@{ip\+\_\+dst}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{ip\+\_\+dst}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::ip\+\_\+dst\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_af3a920730b654dc7d26e155d509234fc} source and dest address / direccion fuente y destino \hypertarget{classip__packet_a6d562e562de60c518542cd250d9986b0}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!ip\+\_\+p@{ip\+\_\+p}} \index{ip\+\_\+p@{ip\+\_\+p}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{ip\+\_\+p}]{\setlength{\rightskip}{0pt plus 5cm}char ip\+\_\+packet\+::ip\+\_\+p\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_a6d562e562de60c518542cd250d9986b0} 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}} \index{payload@{payload}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{payload}]{\setlength{\rightskip}{0pt plus 5cm}string ip\+\_\+packet\+::payload\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_a68c32f352a4f43fd910fb3bba3ddfae0} Data payload (content of the packet) / carga del paquete \hypertarget{classip__packet_a12b33dcaa7ab59d15f3ce4b8ca6750fd}{}\index{ip\+\_\+packet@{ip\+\_\+packet}!s\+\_\+port@{s\+\_\+port}} \index{s\+\_\+port@{s\+\_\+port}!ip\+\_\+packet@{ip\+\_\+packet}} \subsubsection[{s\+\_\+port}]{\setlength{\rightskip}{0pt plus 5cm}unsigned short ip\+\_\+packet\+::s\+\_\+port\hspace{0.3cm}{\ttfamily [private]}}\label{classip__packet_a12b33dcaa7ab59d15f3ce4b8ca6750fd} source port / puerto fuente The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize} \item ip\+\_\+packet.\+h\item ip\+\_\+packet.\+cpp\end{DoxyCompactItemize}