\hypertarget{classPacketQueue}{
\section{PacketQueue$<$ A $>$ Class Template Reference}
\label{classPacketQueue}\index{PacketQueue@{PacketQueue}}
}


Outbound packet queue.  




{\ttfamily \#include $<$packet\_\-queue.hh$>$}

\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classPacketQueue_aea94354b8c9efb767703b4376443d1cd}{
typedef list$<$ const \hyperlink{classRipPacket}{RipPacket}$<$ A $>$ $\ast$ $>$ {\bfseries QueueRep}}
\label{classPacketQueue_aea94354b8c9efb767703b4376443d1cd}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classPacketQueue_a8b15e784c13baf3feb6c5d23b2ced978}{enqueue\_\-packet} (const \hyperlink{classRipPacket}{RipPacket}$<$ A $>$ $\ast$pkt)
\begin{DoxyCompactList}\small\item\em Place packet in ready to sent queue. \item\end{DoxyCompactList}\item 
bool \hyperlink{classPacketQueue_a38f141cb558919447c7b3cfd3887cbaf}{empty} () const 
\item 
const \hyperlink{classRipPacket}{RipPacket}$<$ A $>$ $\ast$ \hyperlink{classPacketQueue_a7dc68292be70ded389c20a33e4dc92ad}{head} () const 
\begin{DoxyCompactList}\small\item\em Peek at head packet if it exists. \item\end{DoxyCompactList}\item 
\hypertarget{classPacketQueue_a66d0ef6105c5af5c98cb20b21b250d53}{
void \hyperlink{classPacketQueue_a66d0ef6105c5af5c98cb20b21b250d53}{pop\_\-head} ()}
\label{classPacketQueue_a66d0ef6105c5af5c98cb20b21b250d53}

\begin{DoxyCompactList}\small\item\em Remove head packet. \item\end{DoxyCompactList}\item 
bool \hyperlink{classPacketQueue_add4eebfd5b410ba8a7d91108b1f96dd5}{drop\_\-old} ()
\begin{DoxyCompactList}\small\item\em Discard packet behind head packet to make space for new packets. \item\end{DoxyCompactList}\item 
\hypertarget{classPacketQueue_a4554cc4cc98423163ac2464430980088}{
void \hyperlink{classPacketQueue_a4554cc4cc98423163ac2464430980088}{flush\_\-packets} ()}
\label{classPacketQueue_a4554cc4cc98423163ac2464430980088}

\begin{DoxyCompactList}\small\item\em Flush queued packets. \item\end{DoxyCompactList}\item 
\hypertarget{classPacketQueue_a1722f5f7cfba4c436a71a3bc8e8a8547}{
void \hyperlink{classPacketQueue_a1722f5f7cfba4c436a71a3bc8e8a8547}{set\_\-max\_\-buffered\_\-bytes} (uint32\_\-t mb)}
\label{classPacketQueue_a1722f5f7cfba4c436a71a3bc8e8a8547}

\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} maximum amount of data to buffer. \item\end{DoxyCompactList}\item 
\hypertarget{classPacketQueue_a85df754a7fd9ad34f8096234364c2c7b}{
uint32\_\-t \hyperlink{classPacketQueue_a85df754a7fd9ad34f8096234364c2c7b}{max\_\-buffered\_\-bytes} () const }
\label{classPacketQueue_a85df754a7fd9ad34f8096234364c2c7b}

\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} maximum amount of buffered data. \item\end{DoxyCompactList}\item 
\hypertarget{classPacketQueue_a465190a2ecdb60fe6229f0dbe9e64d66}{
uint32\_\-t \hyperlink{classPacketQueue_a465190a2ecdb60fe6229f0dbe9e64d66}{buffered\_\-bytes} () const }
\label{classPacketQueue_a465190a2ecdb60fe6229f0dbe9e64d66}

\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} current amount of buffered data. \item\end{DoxyCompactList}\item 
\hypertarget{classPacketQueue_a82ae5b62540bda78e0d3767588c01490}{
uint32\_\-t \hyperlink{classPacketQueue_a82ae5b62540bda78e0d3767588c01490}{drop\_\-count} () const }
\label{classPacketQueue_a82ae5b62540bda78e0d3767588c01490}

\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} number of packets dropped from queue. \item\end{DoxyCompactList}\item 
\hypertarget{classPacketQueue_ae77f185ab958c7d6a82a332020a6ad37}{
void \hyperlink{classPacketQueue_ae77f185ab958c7d6a82a332020a6ad37}{reset\_\-drop\_\-count} ()}
\label{classPacketQueue_ae77f185ab958c7d6a82a332020a6ad37}

\begin{DoxyCompactList}\small\item\em Reset packet drop counter. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classPacketQueue_a02977b8d7b44a5605138e3e062730ec3}{
QueueRep {\bfseries \_\-ready\_\-packets}}
\label{classPacketQueue_a02977b8d7b44a5605138e3e062730ec3}

\item 
\hypertarget{classPacketQueue_afe054f67ddc5e1e4b71325e6ce4ac097}{
uint32\_\-t {\bfseries \_\-buffered\_\-bytes}}
\label{classPacketQueue_afe054f67ddc5e1e4b71325e6ce4ac097}

\item 
\hypertarget{classPacketQueue_a3a5c0e87283eee5907e72df49552282a}{
uint32\_\-t {\bfseries \_\-max\_\-buffered\_\-bytes}}
\label{classPacketQueue_a3a5c0e87283eee5907e72df49552282a}

\item 
\hypertarget{classPacketQueue_a8ed24ef94ec706ada7668dec1c117894}{
uint32\_\-t {\bfseries \_\-drops}}
\label{classPacketQueue_a8ed24ef94ec706ada7668dec1c117894}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename A$>$ class PacketQueue$<$ A $>$}

Outbound packet queue. The queue is of fixed size and does FIFO. When \hyperlink{protocolthe-p}{the} queue becomes full \hyperlink{protocolthe-p}{the} eldest packet behind \hyperlink{protocolthe-p}{the} head is dropped, ie since \hyperlink{protocolthe-p}{the} head may be in transit. 

\subsection{Member Function Documentation}
\hypertarget{classPacketQueue_add4eebfd5b410ba8a7d91108b1f96dd5}{
\index{PacketQueue@{PacketQueue}!drop\_\-old@{drop\_\-old}}
\index{drop\_\-old@{drop\_\-old}!PacketQueue@{PacketQueue}}
\subsubsection[{drop\_\-old}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename A $>$ bool {\bf PacketQueue}$<$ A $>$::drop\_\-old (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{classPacketQueue_add4eebfd5b410ba8a7d91108b1f96dd5}


Discard packet behind head packet to make space for new packets. 

\begin{DoxyReturn}{Returns}
true if an old packet was dropped, false if no packets dropped. 
\end{DoxyReturn}
\hypertarget{classPacketQueue_a38f141cb558919447c7b3cfd3887cbaf}{
\index{PacketQueue@{PacketQueue}!empty@{empty}}
\index{empty@{empty}!PacketQueue@{PacketQueue}}
\subsubsection[{empty}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename A $>$ bool {\bf PacketQueue}$<$ A $>$::empty (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classPacketQueue_a38f141cb558919447c7b3cfd3887cbaf}
\begin{DoxyReturn}{Returns}
true if no packets are queued, false otherwise. 
\end{DoxyReturn}
\hypertarget{classPacketQueue_a8b15e784c13baf3feb6c5d23b2ced978}{
\index{PacketQueue@{PacketQueue}!enqueue\_\-packet@{enqueue\_\-packet}}
\index{enqueue\_\-packet@{enqueue\_\-packet}!PacketQueue@{PacketQueue}}
\subsubsection[{enqueue\_\-packet}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename A $>$ void {\bf PacketQueue}$<$ A $>$::enqueue\_\-packet (
\begin{DoxyParamCaption}
\item[{const {\bf RipPacket}$<$ A $>$ $\ast$}]{pkt}
\end{DoxyParamCaption}
)}}
\label{classPacketQueue_a8b15e784c13baf3feb6c5d23b2ced978}


Place packet in ready to sent queue. 

The supplied packet is expected to have been allocated with \hyperlink{protocolthe-p}{the} standard new operator and will be destructed by \hyperlink{protocolthe-p}{the} packet queue when it is dropped or popped from \hyperlink{protocolthe-p}{the} queue.

This may cause older packets in \hyperlink{protocolthe-p}{the} queue to be dropped to make sufficient space for new packet. \hypertarget{classPacketQueue_a7dc68292be70ded389c20a33e4dc92ad}{
\index{PacketQueue@{PacketQueue}!head@{head}}
\index{head@{head}!PacketQueue@{PacketQueue}}
\subsubsection[{head}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename A $>$ const {\bf RipPacket}$<$ A $>$ $\ast$ {\bf PacketQueue}$<$ A $>$::head (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classPacketQueue_a7dc68292be70ded389c20a33e4dc92ad}


Peek at head packet if it exists. 

\begin{DoxyReturn}{Returns}
pointer to head packet if it exists, 0 otherwise. 
\end{DoxyReturn}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/rip/packet\_\-queue.hh\item 
/home/greearb/git/xorp.ct.github/xorp/rip/packet\_\-queue.cc\end{DoxyCompactItemize}
