123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- \hypertarget{class_sniffer}{}\section{Sniffer Class Reference}
- \label{class_sniffer}\index{Sniffer@{Sniffer}}
-
-
- The \hyperlink{class_sniffer}{Sniffer} class is the one that use the pcap library to extract the packet information. It discards any packet that is not Ethernet-\/$>$I\+P-\/$>$(T\+C\+P$\vert$\+U\+D\+P), and pass up to the G\+U\+I the packets that are Ethernet-\/$>$I\+P-\/$>$(T\+C\+P$\vert$\+U\+D\+P).
-
-
-
-
- {\ttfamily \#include $<$sniffer.\+h$>$}
-
- Inheritance diagram for Sniffer\+:\begin{figure}[H]
- \begin{center}
- \leavevmode
- \includegraphics[height=2.000000cm]{class_sniffer}
- \end{center}
- \end{figure}
- \subsection*{Public Slots}
- \begin{DoxyCompactItemize}
- \item
- \hypertarget{class_sniffer_a6fc78b66d2f4dce0cc3662dacf171514}{}void \hyperlink{class_sniffer_a6fc78b66d2f4dce0cc3662dacf171514}{process} ()\label{class_sniffer_a6fc78b66d2f4dce0cc3662dacf171514}
-
- \begin{DoxyCompactList}\small\item\em The sniffer is run as a separate thread and the function process is the main function of the thread. It is the sniffer. \end{DoxyCompactList}\end{DoxyCompactItemize}
- \subsection*{Signals}
- \begin{DoxyCompactItemize}
- \item
- \hypertarget{class_sniffer_a7d0fd40379b7e5f49aff18ac20cb1c45}{}void {\bfseries result\+Ready} (unsigned long index)\label{class_sniffer_a7d0fd40379b7e5f49aff18ac20cb1c45}
-
- \end{DoxyCompactItemize}
- \subsection*{Public Member Functions}
- \begin{DoxyCompactItemize}
- \item
- \hypertarget{class_sniffer_a8039cbd5f487a357321d57337a664d3d}{}\hyperlink{class_sniffer_a8039cbd5f487a357321d57337a664d3d}{Sniffer} ()\label{class_sniffer_a8039cbd5f487a357321d57337a664d3d}
-
- \begin{DoxyCompactList}\small\item\em Constructor, does nothing. \end{DoxyCompactList}\item
- \hyperlink{class_sniffer_a8e5f1474f756be527b4c39a3e9a83893}{Sniffer} (Q\+Wait\+Condition $\ast$pw, Q\+Mutex $\ast$mx, int $\ast$ps)
- \begin{DoxyCompactList}\small\item\em Sets the mutexes for the inter communication between the sniffer and the G\+U\+I. \end{DoxyCompactList}\item
- \hypertarget{class_sniffer_a8ad3b97292e2cc274f31d87701f92be2}{}\hyperlink{class_sniffer_a8ad3b97292e2cc274f31d87701f92be2}{$\sim$\+Sniffer} ()\label{class_sniffer_a8ad3b97292e2cc274f31d87701f92be2}
-
- \begin{DoxyCompactList}\small\item\em Destructor, does nothing. \end{DoxyCompactList}\item
- vector$<$ \hyperlink{classip__packet}{ip\+\_\+packet} $>$ $\ast$ \hyperlink{class_sniffer_a791027d276cfcc5e6849132ecf8e80b6}{get\+Packet\+List} ()
- \begin{DoxyCompactList}\small\item\em Returns the packet list that contains the packets that are Ethernet -\/$>$ I\+P -\/$>$ (T\+C\+P$\vert$\+U\+D\+P) \end{DoxyCompactList}\item
- string \hyperlink{class_sniffer_a3dd95c60c5b8554e1bedc22b36ae488c}{format\+\_\+payload} (const char $\ast$payload, int len)
- \begin{DoxyCompactList}\small\item\em Formats the payload from a byte stream into a string of ascci. \end{DoxyCompactList}\item
- string \hyperlink{class_sniffer_a02101b56a75804d1ed39a1c04ba36ab2}{format\+\_\+hex\+\_\+ascii\+\_\+line} (const char $\ast$payload, int len, int offset)
- \begin{DoxyCompactList}\small\item\em Return string with the bytes of a payload line in ascii. \end{DoxyCompactList}\item
- void \hyperlink{class_sniffer_a94d7cd87d0f181c3cf2e5ec851e370b6}{find\+\_\+devices} (vector$<$ string $>$ \&)
- \begin{DoxyCompactList}\small\item\em Find the network devices in the computer, and store them in vector devs. \end{DoxyCompactList}\item
- void \hyperlink{class_sniffer_ab706811aa2b285e4c0f55491703c105a}{set\+Device} (string)
- \begin{DoxyCompactList}\small\item\em Sets the device to capture packets to dev. \end{DoxyCompactList}\end{DoxyCompactItemize}
- \subsection*{Private Member Functions}
- \begin{DoxyCompactItemize}
- \item
- void \hyperlink{class_sniffer_ac05f935a6ec2830d6bf42b607f071910}{print\+\_\+payload} (const u\+\_\+char $\ast$payload, int len)
- \begin{DoxyCompactList}\small\item\em Prints the payload in ascii. \end{DoxyCompactList}\item
- void \hyperlink{class_sniffer_a70598d5001a30cc8e801f1262770cdf6}{print\+\_\+hex\+\_\+ascii\+\_\+line} (const u\+\_\+char $\ast$payload, int len, int offset)
- \begin{DoxyCompactList}\small\item\em Prints to std output the a payload in ascii. \end{DoxyCompactList}\item
- void \hyperlink{class_sniffer_a0179e32fee6a0f7c2a13f37d64a7fae0}{got\+\_\+packet} (const struct pcap\+\_\+pkthdr $\ast$header, const u\+\_\+char $\ast$packet)
- \begin{DoxyCompactList}\small\item\em Disects the received packet. Takes out the info needed. \end{DoxyCompactList}\end{DoxyCompactItemize}
- \subsection*{Private Attributes}
- \begin{DoxyCompactItemize}
- \item
- \hypertarget{class_sniffer_ad3ad83091913a50effd7468d8d7ca590}{}vector$<$ \hyperlink{classip__packet}{ip\+\_\+packet} $>$ {\bfseries packet\+\_\+list}\label{class_sniffer_ad3ad83091913a50effd7468d8d7ca590}
-
- \item
- \hypertarget{class_sniffer_a36e1964fbc960b60a09b425a7cd1c0f6}{}Q\+Wait\+Condition $\ast$ {\bfseries wait\+\_\+pause}\label{class_sniffer_a36e1964fbc960b60a09b425a7cd1c0f6}
-
- \item
- \hypertarget{class_sniffer_ae0d6a92d2224a8c927afe861d45ab182}{}Q\+Mutex $\ast$ {\bfseries mutex}\label{class_sniffer_ae0d6a92d2224a8c927afe861d45ab182}
-
- \item
- \hypertarget{class_sniffer_ac35f2e04e7f7668243a75bd9b9b44028}{}string {\bfseries device}\label{class_sniffer_ac35f2e04e7f7668243a75bd9b9b44028}
-
- \item
- \hypertarget{class_sniffer_abb7dd6858499a14bcf002ba86e2d3f7f}{}string {\bfseries filter}\label{class_sniffer_abb7dd6858499a14bcf002ba86e2d3f7f}
-
- \item
- \hypertarget{class_sniffer_a2fde6ba65f629b1c74b1fcd1b8d2c022}{}int $\ast$ {\bfseries pause}\label{class_sniffer_a2fde6ba65f629b1c74b1fcd1b8d2c022}
-
- \end{DoxyCompactItemize}
-
-
- \subsection{Detailed Description}
- The \hyperlink{class_sniffer}{Sniffer} class is the one that use the pcap library to extract the packet information. It discards any packet that is not Ethernet-\/$>$I\+P-\/$>$(T\+C\+P$\vert$\+U\+D\+P), and pass up to the G\+U\+I the packets that are Ethernet-\/$>$I\+P-\/$>$(T\+C\+P$\vert$\+U\+D\+P).
-
- \subsection{Constructor \& Destructor Documentation}
- \hypertarget{class_sniffer_a8e5f1474f756be527b4c39a3e9a83893}{}\index{Sniffer@{Sniffer}!Sniffer@{Sniffer}}
- \index{Sniffer@{Sniffer}!Sniffer@{Sniffer}}
- \subsubsection[{Sniffer}]{\setlength{\rightskip}{0pt plus 5cm}Sniffer\+::\+Sniffer (
- \begin{DoxyParamCaption}
- \item[{Q\+Wait\+Condition $\ast$}]{pw, }
- \item[{Q\+Mutex $\ast$}]{mx, }
- \item[{int $\ast$}]{ps}
- \end{DoxyParamCaption}
- )}\label{class_sniffer_a8e5f1474f756be527b4c39a3e9a83893}
-
-
- Sets the mutexes for the inter communication between the sniffer and the G\+U\+I.
-
-
- \begin{DoxyParams}{Parameters}
- {\em pw} & used to pause the capture of packets \\
- \hline
- {\em mx} & used to protect critical region \\
- \hline
- {\em ps} & flag to pause the packet capture \\
- \hline
- \end{DoxyParams}
-
-
- \subsection{Member Function Documentation}
- \hypertarget{class_sniffer_a94d7cd87d0f181c3cf2e5ec851e370b6}{}\index{Sniffer@{Sniffer}!find\+\_\+devices@{find\+\_\+devices}}
- \index{find\+\_\+devices@{find\+\_\+devices}!Sniffer@{Sniffer}}
- \subsubsection[{find\+\_\+devices}]{\setlength{\rightskip}{0pt plus 5cm}void Sniffer\+::find\+\_\+devices (
- \begin{DoxyParamCaption}
- \item[{vector$<$ string $>$ \&}]{devs}
- \end{DoxyParamCaption}
- )}\label{class_sniffer_a94d7cd87d0f181c3cf2e5ec851e370b6}
-
-
- Find the network devices in the computer, and store them in vector devs.
-
-
- \begin{DoxyParams}{Parameters}
- {\em devs} & vector of string for device names \\
- \hline
- \end{DoxyParams}
- \hypertarget{class_sniffer_a02101b56a75804d1ed39a1c04ba36ab2}{}\index{Sniffer@{Sniffer}!format\+\_\+hex\+\_\+ascii\+\_\+line@{format\+\_\+hex\+\_\+ascii\+\_\+line}}
- \index{format\+\_\+hex\+\_\+ascii\+\_\+line@{format\+\_\+hex\+\_\+ascii\+\_\+line}!Sniffer@{Sniffer}}
- \subsubsection[{format\+\_\+hex\+\_\+ascii\+\_\+line}]{\setlength{\rightskip}{0pt plus 5cm}string Sniffer\+::format\+\_\+hex\+\_\+ascii\+\_\+line (
- \begin{DoxyParamCaption}
- \item[{const char $\ast$}]{payload, }
- \item[{int}]{len, }
- \item[{int}]{offset}
- \end{DoxyParamCaption}
- )}\label{class_sniffer_a02101b56a75804d1ed39a1c04ba36ab2}
-
-
- Return string with the bytes of a payload line in ascii.
-
-
- \begin{DoxyParams}{Parameters}
- {\em payload} & payload of the packet \\
- \hline
- {\em len} & length of the packet \\
- \hline
- {\em offset} & offset of packet \\
- \hline
- \end{DoxyParams}
- \begin{DoxyReturn}{Returns}
- a string with the bytes of a payload line in ascii
- \end{DoxyReturn}
- \hypertarget{class_sniffer_a3dd95c60c5b8554e1bedc22b36ae488c}{}\index{Sniffer@{Sniffer}!format\+\_\+payload@{format\+\_\+payload}}
- \index{format\+\_\+payload@{format\+\_\+payload}!Sniffer@{Sniffer}}
- \subsubsection[{format\+\_\+payload}]{\setlength{\rightskip}{0pt plus 5cm}string Sniffer\+::format\+\_\+payload (
- \begin{DoxyParamCaption}
- \item[{const char $\ast$}]{payload, }
- \item[{int}]{len}
- \end{DoxyParamCaption}
- )}\label{class_sniffer_a3dd95c60c5b8554e1bedc22b36ae488c}
-
-
- Formats the payload from a byte stream into a string of ascci.
-
-
- \begin{DoxyParams}{Parameters}
- {\em payload} & payload of the packet \\
- \hline
- {\em len} & length of the packet \\
- \hline
- \end{DoxyParams}
- \begin{DoxyReturn}{Returns}
- the payload in a string of ascii
- \end{DoxyReturn}
- \hypertarget{class_sniffer_a791027d276cfcc5e6849132ecf8e80b6}{}\index{Sniffer@{Sniffer}!get\+Packet\+List@{get\+Packet\+List}}
- \index{get\+Packet\+List@{get\+Packet\+List}!Sniffer@{Sniffer}}
- \subsubsection[{get\+Packet\+List}]{\setlength{\rightskip}{0pt plus 5cm}vector$<$ {\bf ip\+\_\+packet} $>$ $\ast$ Sniffer\+::get\+Packet\+List (
- \begin{DoxyParamCaption}
- {}
- \end{DoxyParamCaption}
- )}\label{class_sniffer_a791027d276cfcc5e6849132ecf8e80b6}
-
-
- Returns the packet list that contains the packets that are Ethernet -\/$>$ I\+P -\/$>$ (T\+C\+P$\vert$\+U\+D\+P)
-
- \begin{DoxyReturn}{Returns}
- vector of packets
- \end{DoxyReturn}
- \hypertarget{class_sniffer_a0179e32fee6a0f7c2a13f37d64a7fae0}{}\index{Sniffer@{Sniffer}!got\+\_\+packet@{got\+\_\+packet}}
- \index{got\+\_\+packet@{got\+\_\+packet}!Sniffer@{Sniffer}}
- \subsubsection[{got\+\_\+packet}]{\setlength{\rightskip}{0pt plus 5cm}void Sniffer\+::got\+\_\+packet (
- \begin{DoxyParamCaption}
- \item[{const struct pcap\+\_\+pkthdr $\ast$}]{header, }
- \item[{const u\+\_\+char $\ast$}]{packet}
- \end{DoxyParamCaption}
- )\hspace{0.3cm}{\ttfamily [private]}}\label{class_sniffer_a0179e32fee6a0f7c2a13f37d64a7fae0}
-
-
- Disects the received packet. Takes out the info needed.
-
-
- \begin{DoxyParams}{Parameters}
- {\em pcap\+\_\+pkthdr} & header of the pcap packet \\
- \hline
- {\em packet} & recieved packet \\
- \hline
- \end{DoxyParams}
- \hypertarget{class_sniffer_a70598d5001a30cc8e801f1262770cdf6}{}\index{Sniffer@{Sniffer}!print\+\_\+hex\+\_\+ascii\+\_\+line@{print\+\_\+hex\+\_\+ascii\+\_\+line}}
- \index{print\+\_\+hex\+\_\+ascii\+\_\+line@{print\+\_\+hex\+\_\+ascii\+\_\+line}!Sniffer@{Sniffer}}
- \subsubsection[{print\+\_\+hex\+\_\+ascii\+\_\+line}]{\setlength{\rightskip}{0pt plus 5cm}void Sniffer\+::print\+\_\+hex\+\_\+ascii\+\_\+line (
- \begin{DoxyParamCaption}
- \item[{const u\+\_\+char $\ast$}]{payload, }
- \item[{int}]{len, }
- \item[{int}]{offset}
- \end{DoxyParamCaption}
- )\hspace{0.3cm}{\ttfamily [private]}}\label{class_sniffer_a70598d5001a30cc8e801f1262770cdf6}
-
-
- Prints to std output the a payload in ascii.
-
-
- \begin{DoxyParams}{Parameters}
- {\em payload} & payload of the packet \\
- \hline
- {\em len} & length of the packet \\
- \hline
- {\em offset} & offset \\
- \hline
- \end{DoxyParams}
- \hypertarget{class_sniffer_ac05f935a6ec2830d6bf42b607f071910}{}\index{Sniffer@{Sniffer}!print\+\_\+payload@{print\+\_\+payload}}
- \index{print\+\_\+payload@{print\+\_\+payload}!Sniffer@{Sniffer}}
- \subsubsection[{print\+\_\+payload}]{\setlength{\rightskip}{0pt plus 5cm}void Sniffer\+::print\+\_\+payload (
- \begin{DoxyParamCaption}
- \item[{const u\+\_\+char $\ast$}]{payload, }
- \item[{int}]{len}
- \end{DoxyParamCaption}
- )\hspace{0.3cm}{\ttfamily [private]}}\label{class_sniffer_ac05f935a6ec2830d6bf42b607f071910}
-
-
- Prints the payload in ascii.
-
-
- \begin{DoxyParams}{Parameters}
- {\em payload} & payload of the packet \\
- \hline
- {\em len} & payload length \\
- \hline
- \end{DoxyParams}
- \hypertarget{class_sniffer_ab706811aa2b285e4c0f55491703c105a}{}\index{Sniffer@{Sniffer}!set\+Device@{set\+Device}}
- \index{set\+Device@{set\+Device}!Sniffer@{Sniffer}}
- \subsubsection[{set\+Device}]{\setlength{\rightskip}{0pt plus 5cm}void Sniffer\+::set\+Device (
- \begin{DoxyParamCaption}
- \item[{string}]{dev}
- \end{DoxyParamCaption}
- )}\label{class_sniffer_ab706811aa2b285e4c0f55491703c105a}
-
-
- Sets the device to capture packets to dev.
-
-
- \begin{DoxyParams}{Parameters}
- {\em dev} & name of the device \\
- \hline
- \end{DoxyParams}
-
-
- The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
- \item
- sniffer.\+h\item
- sniffer.\+cpp\end{DoxyCompactItemize}
|