\hypertarget{classPacket}{
\section{Packet Class Reference}
\label{classPacket}\index{Packet@{Packet}}
}


An OLSR packet containing Messages.  




{\ttfamily \#include $<$message.hh$>$}

Inheritance diagram for Packet:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=1.061611cm]{classPacket}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classPacket_a9f33861768571bbc0cfd35438a604dd9}{
{\bfseries Packet} (\hyperlink{classMessageDecoder}{MessageDecoder} \&md, \hyperlink{structOlsrTypes_a0be5017ad053311658089d9a795c63ac}{OlsrTypes::FaceID} faceid=0)}
\label{classPacket_a9f33861768571bbc0cfd35438a604dd9}

\item 
size\_\-t \hyperlink{classPacket_a9b236ee9d6c45b4ec50ae9900462f4af}{length} () const 
\item 
size\_\-t \hyperlink{classPacket_adf9718413b200d5d72fc6abbd542da24}{mtu\_\-bound} () const 
\item 
size\_\-t \hyperlink{classPacket_a647b23b356b445e0107c1fcca50b6692}{bounded\_\-length} () const 
\item 
\hypertarget{classPacket_a123fe9c5fd868683d91f9eb7d651d0ff}{
void {\bfseries decode} (uint8\_\-t $\ast$ptr, size\_\-t len)  throw (InvalidPacket)}
\label{classPacket_a123fe9c5fd868683d91f9eb7d651d0ff}

\item 
size\_\-t \hyperlink{classPacket_a5e045bdfa838ca847be9042cdb05f119}{decode\_\-packet\_\-header} (uint8\_\-t $\ast$ptr, size\_\-t len)  throw (InvalidPacket)
\begin{DoxyCompactList}\small\item\em Decode an OLSR packet header. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_ab13870adf8a96f499581589f1d1463ce}{
bool \hyperlink{classPacket_ab13870adf8a96f499581589f1d1463ce}{encode} (vector$<$ uint8\_\-t $>$ \&pkt)}
\label{classPacket_ab13870adf8a96f499581589f1d1463ce}

\begin{DoxyCompactList}\small\item\em Encode a packet, including any nested messages. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_adb0fbd1969f0b744b39829d6f4d4b581}{
void {\bfseries update\_\-encoded\_\-seqno} (vector$<$ uint8\_\-t $>$ \&pkt)}
\label{classPacket_adb0fbd1969f0b744b39829d6f4d4b581}

\item 
\hypertarget{classPacket_af5dad66b2e522c43bb1ef3106958da9c}{
uint16\_\-t {\bfseries seqno} () const }
\label{classPacket_af5dad66b2e522c43bb1ef3106958da9c}

\item 
\hypertarget{classPacket_a37b3a843ff1dfaac30596154e8569747}{
void {\bfseries set\_\-seqno} (uint16\_\-t seqno)}
\label{classPacket_a37b3a843ff1dfaac30596154e8569747}

\item 
\hypertarget{classPacket_aeed670b250aeabd739cd1ed25a80c625}{
\hyperlink{structOlsrTypes_a0be5017ad053311658089d9a795c63ac}{OlsrTypes::FaceID} {\bfseries faceid} () const }
\label{classPacket_aeed670b250aeabd739cd1ed25a80c625}

\item 
\hypertarget{classPacket_ae22540034f8489664dd9cbf6a49e2a00}{
uint32\_\-t {\bfseries mtu} () const }
\label{classPacket_ae22540034f8489664dd9cbf6a49e2a00}

\item 
\hypertarget{classPacket_a1d7848891c975dd00ee15fe8f4053fa2}{
void {\bfseries set\_\-mtu} (const uint32\_\-t mtu)}
\label{classPacket_a1d7848891c975dd00ee15fe8f4053fa2}

\item 
\hypertarget{classPacket_ab7f116beec8e8c21da12ba932e0c5e82}{
void {\bfseries set\_\-faceid} (\hyperlink{structOlsrTypes_a0be5017ad053311658089d9a795c63ac}{OlsrTypes::FaceID} faceid)}
\label{classPacket_ab7f116beec8e8c21da12ba932e0c5e82}

\item 
string \hyperlink{classPacket_a3026248269c695b180d7a47db0aa7a2e}{str} () const 
\item 
\hypertarget{classPacket_aaa7818d5d1e08aa6555f912e202f20c2}{
void {\bfseries add\_\-message} (\hyperlink{classMessage}{Message} $\ast$m)}
\label{classPacket_aaa7818d5d1e08aa6555f912e202f20c2}

\item 
\hypertarget{classPacket_a433cb07a13c22a49637d937d761c3153}{
void {\bfseries clear} ()}
\label{classPacket_a433cb07a13c22a49637d937d761c3153}

\item 
\hypertarget{classPacket_a3ce536a8b66cdb5eb4e50dc9266b9395}{
const vector$<$ \hyperlink{classMessage}{Message} $\ast$ $>$ \& {\bfseries messages} ()}
\label{classPacket_a3ce536a8b66cdb5eb4e50dc9266b9395}

\item 
vector$<$ \hyperlink{classMessage}{Message} $\ast$ $>$ \& \hyperlink{classPacket_a5daf97b938f874a5f16c37135734c21f}{get\_\-messages} ()
\begin{DoxyCompactList}\small\item\em Get a non-\/const reference to a packet's messages. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_a94233e59f5e00127242e19ec5c4bb0c1}{
bool {\bfseries valid} () const }
\label{classPacket_a94233e59f5e00127242e19ec5c4bb0c1}

\item 
\hypertarget{classPacket_acbc2578f46cfce1a8c7b9ce40e535275}{
vector$<$ uint8\_\-t $>$ \& {\bfseries get} ()}
\label{classPacket_acbc2578f46cfce1a8c7b9ce40e535275}

\item 
\hypertarget{classPacket_a88ff64c32bc728fe608d8a78d39030a7}{
void {\bfseries store} (uint8\_\-t $\ast$ptr, size\_\-t len)}
\label{classPacket_a88ff64c32bc728fe608d8a78d39030a7}

\item 
\hypertarget{classPacket_a10c94154dc8032904c0312908b94cacd}{
{\bfseries Packet} (\hyperlink{structOspfTypes_a60eb031df0c10af753789ae76b185ec2}{OspfTypes::Version} version)}
\label{classPacket_a10c94154dc8032904c0312908b94cacd}

\item 
size\_\-t \hyperlink{classPacket_a94355fd66062ebc7a1cd9a3f466c392d}{decode\_\-standard\_\-header} (uint8\_\-t $\ast$ptr, size\_\-t \&len)  throw (InvalidPacket)
\begin{DoxyCompactList}\small\item\em Decode standard header. \item\end{DoxyCompactList}\item 
virtual \hyperlink{classPacket}{Packet} $\ast$ \hyperlink{classPacket_af6b945f661691c93345e93bd3d01fd2d}{decode} (uint8\_\-t $\ast$ptr, size\_\-t len) const =0  throw (InvalidPacket)
\begin{DoxyCompactList}\small\item\em Decode \hyperlink{protocolthe-p}{the} packet. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classPacket_ac518e68200f72597352d3c22b3f39e7c}{encode\_\-standard\_\-header} (uint8\_\-t $\ast$ptr, size\_\-t len)
\begin{DoxyCompactList}\small\item\em Encode standard header. \item\end{DoxyCompactList}\item 
virtual bool \hyperlink{classPacket_a7770f0bf62b3d0ecf7a1d1ae7652a023}{encode} (vector$<$ uint8\_\-t $>$ \&pkt)=0
\begin{DoxyCompactList}\small\item\em Encode \hyperlink{protocolthe-p}{the} packet. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_a88ff64c32bc728fe608d8a78d39030a7}{
void \hyperlink{classPacket_a88ff64c32bc728fe608d8a78d39030a7}{store} (uint8\_\-t $\ast$ptr, size\_\-t len)}
\label{classPacket_a88ff64c32bc728fe608d8a78d39030a7}

\begin{DoxyCompactList}\small\item\em \hyperlink{classStore}{Store} \hyperlink{protocolthe-p}{the} original packet, required for authentication. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_acbc2578f46cfce1a8c7b9ce40e535275}{
vector$<$ uint8\_\-t $>$ \& \hyperlink{classPacket_acbc2578f46cfce1a8c7b9ce40e535275}{get} ()}
\label{classPacket_acbc2578f46cfce1a8c7b9ce40e535275}

\begin{DoxyCompactList}\small\item\em Get a reference to \hyperlink{protocolthe-p}{the} original packet data, required for authentication. \item\end{DoxyCompactList}\item 
\hyperlink{structOspfTypes_a60eb031df0c10af753789ae76b185ec2}{OspfTypes::Version} \hyperlink{classPacket_a80297687383937bb17f8b63948999f8c}{get\_\-version} () const 
\item 
virtual \hyperlink{structOspfTypes_abe52a1f48e880751028d473f6a9f780d}{OspfTypes::Type} \hyperlink{classPacket_aa0f90dc35cd40f34f6eac3a7cdb8d69b}{get\_\-type} () const =0
\begin{DoxyCompactList}\small\item\em It is \hyperlink{protocolthe-p}{the} responsibilty of \hyperlink{protocolthe-p}{the} derived type to return this information. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_ac3c5dc3b84185cfaac88fa3a4d732c4d}{
\hyperlink{structOspfTypes_a8fc36f0cbcee50cfdb0d10b192aaa53a}{OspfTypes::RouterID} \hyperlink{classPacket_ac3c5dc3b84185cfaac88fa3a4d732c4d}{get\_\-router\_\-id} () const }
\label{classPacket_ac3c5dc3b84185cfaac88fa3a4d732c4d}

\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} Router ID. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_a2ebb4172d8ddaa20aad4e9815dbc7993}{
void \hyperlink{classPacket_a2ebb4172d8ddaa20aad4e9815dbc7993}{set\_\-router\_\-id} (\hyperlink{structOspfTypes_a8fc36f0cbcee50cfdb0d10b192aaa53a}{OspfTypes::RouterID} id)}
\label{classPacket_a2ebb4172d8ddaa20aad4e9815dbc7993}

\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} Router ID. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_a5ca601e5116ee1e701847802f193c07f}{
\hyperlink{structOspfTypes_a8276e5e81192074d7c95e445995d18c6}{OspfTypes::AreaID} \hyperlink{classPacket_a5ca601e5116ee1e701847802f193c07f}{get\_\-area\_\-id} () const }
\label{classPacket_a5ca601e5116ee1e701847802f193c07f}

\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} Area ID. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_acbdc1239d17ded08bfeee4d9cd88fd59}{
void \hyperlink{classPacket_acbdc1239d17ded08bfeee4d9cd88fd59}{set\_\-area\_\-id} (\hyperlink{structOspfTypes_a8276e5e81192074d7c95e445995d18c6}{OspfTypes::AreaID} id)}
\label{classPacket_acbdc1239d17ded08bfeee4d9cd88fd59}

\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} Area ID. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_ab0baf9422c191a47855a55cca9395e02}{
uint16\_\-t \hyperlink{classPacket_ab0baf9422c191a47855a55cca9395e02}{get\_\-auth\_\-type} () const }
\label{classPacket_ab0baf9422c191a47855a55cca9395e02}

\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} \hyperlink{classAuth}{Auth} Type. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_aa97fa6c60f4c22aae9cc5c7bf61052d8}{
void \hyperlink{classPacket_aa97fa6c60f4c22aae9cc5c7bf61052d8}{set\_\-auth\_\-type} (uint16\_\-t auth\_\-type)}
\label{classPacket_aa97fa6c60f4c22aae9cc5c7bf61052d8}

\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} \hyperlink{classAuth}{Auth} Type. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_a32882119fbe07a4ccd4ee37f76978f79}{
uint8\_\-t \hyperlink{classPacket_a32882119fbe07a4ccd4ee37f76978f79}{get\_\-instance\_\-id} () const }
\label{classPacket_a32882119fbe07a4ccd4ee37f76978f79}

\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} Instance ID. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_a2eb601a6793345676640362cc8980a22}{
void \hyperlink{classPacket_a2eb601a6793345676640362cc8980a22}{set\_\-instance\_\-id} (uint8\_\-t instance\_\-id)}
\label{classPacket_a2eb601a6793345676640362cc8980a22}

\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} Instance ID. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classPacket_aaf4729d7fa5ac50f98dabb71a4e35697}{get\_\-standard\_\-header\_\-length} ()
\item 
size\_\-t \hyperlink{classPacket_a88940403183f9c1f2431b26a6ac65388}{decode\_\-point} () const 
\begin{DoxyCompactList}\small\item\em Decode Point. \item\end{DoxyCompactList}\item 
string \hyperlink{classPacket_a98b97623c9e4e31dac6f347efcb8aa87}{standard} () const 
\begin{DoxyCompactList}\small\item\em Generate a printable representation of \hyperlink{protocolthe-p}{the} standard header. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_a199b8de9151d3b573682410737f2a5ff}{
virtual string \hyperlink{classPacket_a199b8de9151d3b573682410737f2a5ff}{str} () const =0}
\label{classPacket_a199b8de9151d3b573682410737f2a5ff}

\begin{DoxyCompactList}\small\item\em Generate a printable representation of \hyperlink{protocolthe-p}{the} packet. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classPacket_a657554a64e1c3736fbf9274e0feaa7cb}{
static size\_\-t {\bfseries get\_\-packet\_\-header\_\-length} ()}
\label{classPacket_a657554a64e1c3736fbf9274e0feaa7cb}

\end{DoxyCompactItemize}
\subsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classPacket_abfb28f91506c04138987db668a195d9b}{
static const size\_\-t {\bfseries STANDARD\_\-HEADER\_\-V2} = 24}
\label{classPacket_abfb28f91506c04138987db668a195d9b}

\item 
\hypertarget{classPacket_ae7e3d211b6213748eccd9b2d8afa0a80}{
static const size\_\-t {\bfseries STANDARD\_\-HEADER\_\-V3} = 16}
\label{classPacket_ae7e3d211b6213748eccd9b2d8afa0a80}

\item 
\hypertarget{classPacket_a7b8a0e9254844d76bd57987170e71abb}{
static const size\_\-t {\bfseries VERSION\_\-OFFSET} = 0}
\label{classPacket_a7b8a0e9254844d76bd57987170e71abb}

\item 
\hypertarget{classPacket_a6c2daf6df5a2b926c35a0df551fa00c4}{
static const size\_\-t {\bfseries TYPE\_\-OFFSET} = 1}
\label{classPacket_a6c2daf6df5a2b926c35a0df551fa00c4}

\item 
\hypertarget{classPacket_a250715df9fc4829adee4f48bf2494ce2}{
static const size\_\-t {\bfseries LEN\_\-OFFSET} = 2}
\label{classPacket_a250715df9fc4829adee4f48bf2494ce2}

\item 
\hypertarget{classPacket_ae176c3c28b7fd24cf8f1a2e9abd6390a}{
static const size\_\-t {\bfseries ROUTER\_\-ID\_\-OFFSET} = 4}
\label{classPacket_ae176c3c28b7fd24cf8f1a2e9abd6390a}

\item 
\hypertarget{classPacket_ae7895e319d54ac9b055bada5a7f4a7e8}{
static const size\_\-t {\bfseries AREA\_\-ID\_\-OFFSET} = 8}
\label{classPacket_ae7895e319d54ac9b055bada5a7f4a7e8}

\item 
\hypertarget{classPacket_a1b0ac9ef91dd2fe8c6769640f6ef280a}{
static const size\_\-t {\bfseries CHECKSUM\_\-OFFSET} = 12}
\label{classPacket_a1b0ac9ef91dd2fe8c6769640f6ef280a}

\item 
\hypertarget{classPacket_a318f138e45b6e297baa64adc76022361}{
static const size\_\-t {\bfseries AUTH\_\-TYPE\_\-OFFSET} = 14}
\label{classPacket_a318f138e45b6e297baa64adc76022361}

\item 
\hypertarget{classPacket_aa8cd77db063bb7165c3851ba41918f1b}{
static const size\_\-t {\bfseries AUTH\_\-PAYLOAD\_\-OFFSET} = 16}
\label{classPacket_aa8cd77db063bb7165c3851ba41918f1b}

\item 
\hypertarget{classPacket_afe181aaabe30c9dc30235d6c1d77d99e}{
static const size\_\-t {\bfseries AUTH\_\-PAYLOAD\_\-SIZE} = 8}
\label{classPacket_afe181aaabe30c9dc30235d6c1d77d99e}

\item 
\hypertarget{classPacket_a97c02939d23756203263aa76f3d21efd}{
static const size\_\-t {\bfseries INSTANCE\_\-ID\_\-OFFSET} = 14}
\label{classPacket_a97c02939d23756203263aa76f3d21efd}

\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classPacket_a07b068400cf50e463bc1644869a2a659}{
\hyperlink{classMessageDecoder}{MessageDecoder} \& {\bfseries \_\-message\_\-decoder}}
\label{classPacket_a07b068400cf50e463bc1644869a2a659}

\item 
\hypertarget{classPacket_af0c5229a63dc0abd86934e8e46095ed3}{
bool {\bfseries \_\-is\_\-valid}}
\label{classPacket_af0c5229a63dc0abd86934e8e46095ed3}

\item 
\hypertarget{classPacket_ae8c21fd3ff75b58b8104206f920fae5e}{
\hyperlink{structOlsrTypes_a0be5017ad053311658089d9a795c63ac}{OlsrTypes::FaceID} {\bfseries \_\-faceid}}
\label{classPacket_ae8c21fd3ff75b58b8104206f920fae5e}

\item 
\hypertarget{classPacket_addc7d5238be27d1aa4ba53abe46dd773}{
uint16\_\-t {\bfseries \_\-seqno}}
\label{classPacket_addc7d5238be27d1aa4ba53abe46dd773}

\item 
\hypertarget{classPacket_aea051e566618ab6db74bdb0dd007a78e}{
uint32\_\-t {\bfseries \_\-mtu}}
\label{classPacket_aea051e566618ab6db74bdb0dd007a78e}

\item 
\hypertarget{classPacket_a19fd69f4280715b5f8cf38e2a57b2f77}{
vector$<$ \hyperlink{classMessage}{Message} $\ast$ $>$ {\bfseries \_\-messages}}
\label{classPacket_a19fd69f4280715b5f8cf38e2a57b2f77}

\item 
\hypertarget{classPacket_a52e335c158aad2c922168e06830e74f1}{
vector$<$ uint8\_\-t $>$ {\bfseries \_\-pkt}}
\label{classPacket_a52e335c158aad2c922168e06830e74f1}

\item 
\hypertarget{classPacket_ab3f833e8b5ad0bc3314b29159d0940ca}{
const \hyperlink{structOspfTypes_a60eb031df0c10af753789ae76b185ec2}{OspfTypes::Version} {\bfseries \_\-version}}
\label{classPacket_ab3f833e8b5ad0bc3314b29159d0940ca}

\item 
\hypertarget{classPacket_a4356ae5cac385c95120524462a25e453}{
bool \hyperlink{classPacket_a4356ae5cac385c95120524462a25e453}{\_\-valid}}
\label{classPacket_a4356ae5cac385c95120524462a25e453}

\begin{DoxyCompactList}\small\item\em Set to true when \hyperlink{protocolthe-p}{the} standard header fields are set. \item\end{DoxyCompactList}\item 
\hyperlink{structOspfTypes_a8fc36f0cbcee50cfdb0d10b192aaa53a}{OspfTypes::RouterID} \hyperlink{classPacket_a19d12d58ed7c02e87623dc9406a71b8e}{\_\-router\_\-id}
\begin{DoxyCompactList}\small\item\em Standard header. \item\end{DoxyCompactList}\item 
\hypertarget{classPacket_a11ae1c9ddb1587070e8a8184ac07b3e1}{
\hyperlink{structOspfTypes_a8276e5e81192074d7c95e445995d18c6}{OspfTypes::AreaID} {\bfseries \_\-area\_\-id}}
\label{classPacket_a11ae1c9ddb1587070e8a8184ac07b3e1}

\item 
\hypertarget{classPacket_a70a4492f5ae3c0f0d3ccde3ee2218c8a}{
\hyperlink{structOspfTypes_aa9ff5527ceed0789d66d95912c1bdf52}{OspfTypes::AuType} {\bfseries \_\-auth\_\-type}}
\label{classPacket_a70a4492f5ae3c0f0d3ccde3ee2218c8a}

\item 
\hypertarget{classPacket_ac3571345c57a219d044dcd3504ff405d}{
uint8\_\-t {\bfseries \_\-auth} \mbox{[}AUTH\_\-PAYLOAD\_\-SIZE\mbox{]}}
\label{classPacket_ac3571345c57a219d044dcd3504ff405d}

\item 
\hypertarget{classPacket_a6766faed6525f28473dfae24d84e278a}{
uint8\_\-t {\bfseries \_\-instance\_\-id}}
\label{classPacket_a6766faed6525f28473dfae24d84e278a}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
An OLSR packet containing Messages. All packet decode routines must inherit from this interface.

Packets contain Messages. They are coalesced up up to \hyperlink{protocolthe-p}{the} available MTU size, to save power on devices where transmission may have a high energy cost.

Also provides some utility routines to perform common packet processing. 

\subsection{Member Function Documentation}
\hypertarget{classPacket_a647b23b356b445e0107c1fcca50b6692}{
\index{Packet@{Packet}!bounded\_\-length@{bounded\_\-length}}
\index{bounded\_\-length@{bounded\_\-length}!Packet@{Packet}}
\subsubsection[{bounded\_\-length}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Packet::bounded\_\-length (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classPacket_a647b23b356b445e0107c1fcca50b6692}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} size of \hyperlink{protocolthe-p}{the} packet payload which will fit inside \hyperlink{protocolthe-p}{the} MTU without splitting any messages. If no MTU is set, returns \hyperlink{classPacket_a9b236ee9d6c45b4ec50ae9900462f4af}{length()}. 
\end{DoxyReturn}
\hypertarget{classPacket_af6b945f661691c93345e93bd3d01fd2d}{
\index{Packet@{Packet}!decode@{decode}}
\index{decode@{decode}!Packet@{Packet}}
\subsubsection[{decode}]{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf Packet}$\ast$ Packet::decode (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ptr, }
\item[{size\_\-t}]{len}
\end{DoxyParamCaption}
) const  throw ({\bf InvalidPacket})\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{classPacket_af6b945f661691c93345e93bd3d01fd2d}


Decode \hyperlink{protocolthe-p}{the} packet. 

The returned packet must be free'd. 

Implemented in \hyperlink{classHelloPacket_a7e952641e439a304f701e289a5f42cf4}{HelloPacket}, \hyperlink{classDataDescriptionPacket_a06da9e1f6873282ef5df6925f7c38349}{DataDescriptionPacket}, \hyperlink{classLinkStateRequestPacket_a78a1b3041ba545d9bd752de7f83cf42d}{LinkStateRequestPacket}, \hyperlink{classLinkStateUpdatePacket_a7a96424d545268d623584c4e4ccd86e4}{LinkStateUpdatePacket}, and \hyperlink{classLinkStateAcknowledgementPacket_a9e54b7ce6071bdd88305ffdac7e33b5f}{LinkStateAcknowledgementPacket}.

\hypertarget{classPacket_a5e045bdfa838ca847be9042cdb05f119}{
\index{Packet@{Packet}!decode\_\-packet\_\-header@{decode\_\-packet\_\-header}}
\index{decode\_\-packet\_\-header@{decode\_\-packet\_\-header}!Packet@{Packet}}
\subsubsection[{decode\_\-packet\_\-header}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Packet::decode\_\-packet\_\-header (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ptr, }
\item[{size\_\-t}]{len}
\end{DoxyParamCaption}
)  throw ({\bf InvalidPacket})}}
\label{classPacket_a5e045bdfa838ca847be9042cdb05f119}


Decode an OLSR packet header. 

An OLSR packet is considered valid if its length is greater than \hyperlink{protocolthe-p}{the} size of a standard packet header. The host IP stack takes care of UDP checksums, IP fragmentation and reassembly, and MTU size checks for us. \hypertarget{classPacket_a88940403183f9c1f2431b26a6ac65388}{
\index{Packet@{Packet}!decode\_\-point@{decode\_\-point}}
\index{decode\_\-point@{decode\_\-point}!Packet@{Packet}}
\subsubsection[{decode\_\-point}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Packet::decode\_\-point (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classPacket_a88940403183f9c1f2431b26a6ac65388}


Decode Point. 

If a packet is being decoded \hyperlink{protocolthe-p}{the} standard header has already been processed. This method returns \hyperlink{protocolthe-p}{the} offset at which \hyperlink{protocolthe-p}{the} specific data starts.

\begin{DoxyReturn}{Returns}
The offset at which a derived class should start decoding. 
\end{DoxyReturn}
\hypertarget{classPacket_a94355fd66062ebc7a1cd9a3f466c392d}{
\index{Packet@{Packet}!decode\_\-standard\_\-header@{decode\_\-standard\_\-header}}
\index{decode\_\-standard\_\-header@{decode\_\-standard\_\-header}!Packet@{Packet}}
\subsubsection[{decode\_\-standard\_\-header}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Packet::decode\_\-standard\_\-header (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ptr, }
\item[{size\_\-t \&}]{len}
\end{DoxyParamCaption}
)  throw ({\bf InvalidPacket})}}
\label{classPacket_a94355fd66062ebc7a1cd9a3f466c392d}


Decode standard header. 

Used by \hyperlink{protocolthe-p}{the} derived classes to extract \hyperlink{protocolthe-p}{the} standard header and options field.


\begin{DoxyParams}{Parameters}
{\em len} & if \hyperlink{protocolthe-p}{the} frame is larger than what is specified by \hyperlink{protocolthe-p}{the} header length field drop \hyperlink{protocolthe-p}{the} length down to \hyperlink{protocolthe-p}{the} header length.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} offset where \hyperlink{protocolthe-p}{the} specific header starts. 
\end{DoxyReturn}
\hypertarget{classPacket_a7770f0bf62b3d0ecf7a1d1ae7652a023}{
\index{Packet@{Packet}!encode@{encode}}
\index{encode@{encode}!Packet@{Packet}}
\subsubsection[{encode}]{\setlength{\rightskip}{0pt plus 5cm}virtual bool Packet::encode (
\begin{DoxyParamCaption}
\item[{vector$<$ uint8\_\-t $>$ \&}]{pkt}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{classPacket_a7770f0bf62b3d0ecf7a1d1ae7652a023}


Encode \hyperlink{protocolthe-p}{the} packet. 


\begin{DoxyParams}{Parameters}
{\em pkt} & vector into which \hyperlink{protocolthe-p}{the} packet should be placed. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if \hyperlink{protocolthe-p}{the} encoding suceeded. 
\end{DoxyReturn}


Implemented in \hyperlink{classHelloPacket_ab68d6c757c2d62ccca62b3a9cd45efa2}{HelloPacket}, \hyperlink{classDataDescriptionPacket_a2f396fbb35014043efaa072ef70a2a03}{DataDescriptionPacket}, \hyperlink{classLinkStateRequestPacket_ad84b8647d51d4f0c41da8dad89148362}{LinkStateRequestPacket}, \hyperlink{classLinkStateUpdatePacket_a5976b40e62509cc8b37a9343b7fbea07}{LinkStateUpdatePacket}, and \hyperlink{classLinkStateAcknowledgementPacket_af66e46f21c8b0ddca4587dae59de0f6a}{LinkStateAcknowledgementPacket}.

\hypertarget{classPacket_ac518e68200f72597352d3c22b3f39e7c}{
\index{Packet@{Packet}!encode\_\-standard\_\-header@{encode\_\-standard\_\-header}}
\index{encode\_\-standard\_\-header@{encode\_\-standard\_\-header}!Packet@{Packet}}
\subsubsection[{encode\_\-standard\_\-header}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Packet::encode\_\-standard\_\-header (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ptr, }
\item[{size\_\-t}]{len}
\end{DoxyParamCaption}
)}}
\label{classPacket_ac518e68200f72597352d3c22b3f39e7c}


Encode standard header. 

Used by \hyperlink{protocolthe-p}{the} derived classes to put \hyperlink{protocolthe-p}{the} standard header in \hyperlink{protocolthe-p}{the} packet. Which includes \hyperlink{protocolthe-p}{the} checksum so all other fields should already be in \hyperlink{protocolthe-p}{the} packet.


\begin{DoxyParams}{Parameters}
{\em ptr} & location to start writing header. \\
\hline
{\em len} & size of \hyperlink{protocolthe-p}{the} buffer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The offset that \hyperlink{protocolthe-p}{the} header has been written to. Returns 0 on failure, such as \hyperlink{protocolthe-p}{the} buffer is too small. 
\end{DoxyReturn}
\hypertarget{classPacket_a5daf97b938f874a5f16c37135734c21f}{
\index{Packet@{Packet}!get\_\-messages@{get\_\-messages}}
\index{get\_\-messages@{get\_\-messages}!Packet@{Packet}}
\subsubsection[{get\_\-messages}]{\setlength{\rightskip}{0pt plus 5cm}vector$<${\bf Message}$\ast$$>$\& Packet::get\_\-messages (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classPacket_a5daf97b938f874a5f16c37135734c21f}


Get a non-\/const reference to a packet's messages. 

For debugging use only, ie in simulation of multiple hops.

\begin{DoxyReturn}{Returns}
reference to \hyperlink{protocolthe-p}{the} messages contained within \hyperlink{protocolthe-p}{the} packet. 
\end{DoxyReturn}
\hypertarget{classPacket_aaf4729d7fa5ac50f98dabb71a4e35697}{
\index{Packet@{Packet}!get\_\-standard\_\-header\_\-length@{get\_\-standard\_\-header\_\-length}}
\index{get\_\-standard\_\-header\_\-length@{get\_\-standard\_\-header\_\-length}!Packet@{Packet}}
\subsubsection[{get\_\-standard\_\-header\_\-length}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Packet::get\_\-standard\_\-header\_\-length (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classPacket_aaf4729d7fa5ac50f98dabb71a4e35697}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} standard header length for this version of OSPF. 
\end{DoxyReturn}
\hypertarget{classPacket_aa0f90dc35cd40f34f6eac3a7cdb8d69b}{
\index{Packet@{Packet}!get\_\-type@{get\_\-type}}
\index{get\_\-type@{get\_\-type}!Packet@{Packet}}
\subsubsection[{get\_\-type}]{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf OspfTypes::Type} Packet::get\_\-type (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{classPacket_aa0f90dc35cd40f34f6eac3a7cdb8d69b}


It is \hyperlink{protocolthe-p}{the} responsibilty of \hyperlink{protocolthe-p}{the} derived type to return this information. 

\begin{DoxyReturn}{Returns}
The type this packet represents. 
\end{DoxyReturn}


Implemented in \hyperlink{classHelloPacket_affb0bf4c17eacca50dca86c74a2bd78c}{HelloPacket}, \hyperlink{classDataDescriptionPacket_a1670258f487b852f95603125ed9a33d7}{DataDescriptionPacket}, \hyperlink{classLinkStateRequestPacket_a833f4151edf67f0103b5ef3cb06ccfcc}{LinkStateRequestPacket}, \hyperlink{classLinkStateUpdatePacket_aa84f2a060f4b28fe5fdbe7064e2bf368}{LinkStateUpdatePacket}, and \hyperlink{classLinkStateAcknowledgementPacket_a322c3eb4c6b16d4ac02fad157906b75e}{LinkStateAcknowledgementPacket}.

\hypertarget{classPacket_a80297687383937bb17f8b63948999f8c}{
\index{Packet@{Packet}!get\_\-version@{get\_\-version}}
\index{get\_\-version@{get\_\-version}!Packet@{Packet}}
\subsubsection[{get\_\-version}]{\setlength{\rightskip}{0pt plus 5cm}{\bf OspfTypes::Version} Packet::get\_\-version (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classPacket_a80297687383937bb17f8b63948999f8c}
\begin{DoxyReturn}{Returns}
The version this packet represents. 
\end{DoxyReturn}
\hypertarget{classPacket_a9b236ee9d6c45b4ec50ae9900462f4af}{
\index{Packet@{Packet}!length@{length}}
\index{length@{length}!Packet@{Packet}}
\subsubsection[{length}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Packet::length (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classPacket_a9b236ee9d6c45b4ec50ae9900462f4af}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} size of \hyperlink{protocolthe-p}{the} packet payload. 
\end{DoxyReturn}
\hypertarget{classPacket_adf9718413b200d5d72fc6abbd542da24}{
\index{Packet@{Packet}!mtu\_\-bound@{mtu\_\-bound}}
\index{mtu\_\-bound@{mtu\_\-bound}!Packet@{Packet}}
\subsubsection[{mtu\_\-bound}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Packet::mtu\_\-bound (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classPacket_adf9718413b200d5d72fc6abbd542da24}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} amount of free space in this packet for an OLSR packet payload, after MTU is taken into account. 
\end{DoxyReturn}
\hypertarget{classPacket_a98b97623c9e4e31dac6f347efcb8aa87}{
\index{Packet@{Packet}!standard@{standard}}
\index{standard@{standard}!Packet@{Packet}}
\subsubsection[{standard}]{\setlength{\rightskip}{0pt plus 5cm}string Packet::standard (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classPacket_a98b97623c9e4e31dac6f347efcb8aa87}


Generate a printable representation of \hyperlink{protocolthe-p}{the} standard header. 

Used by \hyperlink{protocolthe-p}{the} derived classes implementing \hyperlink{classPacket_a3026248269c695b180d7a47db0aa7a2e}{str()}. \hypertarget{classPacket_a3026248269c695b180d7a47db0aa7a2e}{
\index{Packet@{Packet}!str@{str}}
\index{str@{str}!Packet@{Packet}}
\subsubsection[{str}]{\setlength{\rightskip}{0pt plus 5cm}string Packet::str (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classPacket_a3026248269c695b180d7a47db0aa7a2e}
\begin{DoxyReturn}{Returns}
a string representation of \hyperlink{protocolthe-p}{the} entire packet. 
\end{DoxyReturn}


Reimplemented in \hyperlink{classHelloPacket_ac1eb84945e62d557b615dc431c30fe3a}{HelloPacket}, \hyperlink{classDataDescriptionPacket_a639de8f193bbe7db1240723bb6333015}{DataDescriptionPacket}, \hyperlink{classLinkStateRequestPacket_a485b6cc5f51c120f42956457d20eaee4}{LinkStateRequestPacket}, \hyperlink{classLinkStateUpdatePacket_a5952b1a81b09ca7b88ccb3fa76d238f3}{LinkStateUpdatePacket}, and \hyperlink{classLinkStateAcknowledgementPacket_a3ed6810bb7531be250d4fafe94afebd2}{LinkStateAcknowledgementPacket}.



\subsection{Member Data Documentation}
\hypertarget{classPacket_a19d12d58ed7c02e87623dc9406a71b8e}{
\index{Packet@{Packet}!\_\-router\_\-id@{\_\-router\_\-id}}
\index{\_\-router\_\-id@{\_\-router\_\-id}!Packet@{Packet}}
\subsubsection[{\_\-router\_\-id}]{\setlength{\rightskip}{0pt plus 5cm}{\bf OspfTypes::RouterID} {\bf Packet::\_\-router\_\-id}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classPacket_a19d12d58ed7c02e87623dc9406a71b8e}


Standard header. 

Version and Type information are constant so therefore not present. 

The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/contrib/olsr/message.hh\item 
/home/greearb/git/xorp.ct.github/xorp/ospf/packet.hh\item 
/home/greearb/git/xorp.ct.github/xorp/contrib/olsr/message.cc\item 
/home/greearb/git/xorp.ct.github/xorp/ospf/packet.cc\end{DoxyCompactItemize}
