\hypertarget{stream_8c}{
\section{stream.c File Reference}
\label{stream_8c}\index{stream.c@{stream.c}}
}
{\ttfamily \#include \char`\"{}spp\_\-ai.h\char`\"{}}\par
{\ttfamily \#include $<$stdio.h$>$}\par
{\ttfamily \#include $<$stdlib.h$>$}\par
{\ttfamily \#include $<$time.h$>$}\par
{\ttfamily \#include $<$unistd.h$>$}\par
{\ttfamily \#include $<$pthread.h$>$}\par
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
PRIVATE void \hyperlink{group__stream_ga80016adf701c717a6ebfb5b15b8a5749}{\_\-AI\_\-stream\_\-free} (struct \hyperlink{structpkt__info}{pkt\_\-info} $\ast$stream)
\begin{DoxyCompactList}\small\item\em Remove a stream from the hash table (private function). \item\end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__stream_ga24b1131374e5059564b8a12380c4eb75}{AI\_\-hashcleanup\_\-thread} (void $\ast$arg)
\begin{DoxyCompactList}\small\item\em Thread called for cleaning up the hash table from the traffic streams older than a certain threshold. \item\end{DoxyCompactList}\item 
void \hyperlink{group__stream_ga7d71c5645b9baff7b6c4b9a181bf80c5}{AI\_\-pkt\_\-enqueue} (SFSnortPacket $\ast$pkt)
\begin{DoxyCompactList}\small\item\em Function called for appending a new packet to the hash table, creating a new stream or appending it to an existing stream. \item\end{DoxyCompactList}\item 
struct \hyperlink{structpkt__info}{pkt\_\-info} $\ast$ \hyperlink{group__stream_ga2efedcabbfd12c5345f0c93a3dd4735c}{AI\_\-get\_\-stream\_\-by\_\-key} (struct \hyperlink{structpkt__key}{pkt\_\-key} key)
\begin{DoxyCompactList}\small\item\em Get a TCP stream by key. \item\end{DoxyCompactList}\item 
void \hyperlink{group__stream_ga8749989cee2ac05a7de058faac280c02}{AI\_\-set\_\-stream\_\-observed} (struct \hyperlink{structpkt__key}{pkt\_\-key} key)
\begin{DoxyCompactList}\small\item\em Set the flag \char`\"{}observed\char`\"{} on a stream associated to a security alert, so that it won't be removed from the hash table. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
PRIVATE struct \hyperlink{structpkt__info}{pkt\_\-info} $\ast$ \hyperlink{stream_8c_a57e23cda853e9d11c37723a962ef2f68}{hash} = NULL
\item 
PRIVATE time\_\-t \hyperlink{stream_8c_a0597864b078ff448f28432db86950309}{start\_\-time} = 0
\item 
PRIVATE pthread\_\-mutex\_\-t \hyperlink{stream_8c_a4e01edd07102e71480b323db2b8f57c8}{hash\_\-mutex} = PTHREAD\_\-MUTEX\_\-INITIALIZER
\end{DoxyCompactItemize}


\subsection{Variable Documentation}
\hypertarget{stream_8c_a57e23cda853e9d11c37723a962ef2f68}{
\index{stream.c@{stream.c}!hash@{hash}}
\index{hash@{hash}!stream.c@{stream.c}}
\subsubsection[{hash}]{\setlength{\rightskip}{0pt plus 5cm}PRIVATE struct {\bf pkt\_\-info}$\ast$ {\bf hash} = NULL}}
\label{stream_8c_a57e23cda853e9d11c37723a962ef2f68}
\hypertarget{stream_8c_a4e01edd07102e71480b323db2b8f57c8}{
\index{stream.c@{stream.c}!hash\_\-mutex@{hash\_\-mutex}}
\index{hash\_\-mutex@{hash\_\-mutex}!stream.c@{stream.c}}
\subsubsection[{hash\_\-mutex}]{\setlength{\rightskip}{0pt plus 5cm}PRIVATE pthread\_\-mutex\_\-t {\bf hash\_\-mutex} = PTHREAD\_\-MUTEX\_\-INITIALIZER}}
\label{stream_8c_a4e01edd07102e71480b323db2b8f57c8}
pthread mutex for managing the access of multiple readers/writers to the hash table \hypertarget{stream_8c_a0597864b078ff448f28432db86950309}{
\index{stream.c@{stream.c}!start\_\-time@{start\_\-time}}
\index{start\_\-time@{start\_\-time}!stream.c@{stream.c}}
\subsubsection[{start\_\-time}]{\setlength{\rightskip}{0pt plus 5cm}PRIVATE time\_\-t {\bf start\_\-time} = 0}}
\label{stream_8c_a0597864b078ff448f28432db86950309}
