\hypertarget{classArpHeader}{
\section{ArpHeader Class Reference}
\label{classArpHeader}\index{ArpHeader@{ArpHeader}}
}


an ARP packet.  




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

\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
enum {\bfseries Op} \{ {\bfseries ARP\_\-REQUEST} =  1, 
{\bfseries ARP\_\-REPLY}
 \}
\item 
enum {\bfseries HwFmt} \{ {\bfseries HW\_\-ETHER} =  1
 \}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classArpHeader_a2c43be79bd5d02c28049a5c3e7e14cad}{
{\bfseries ArpHeader} (const vector$<$ uint8\_\-t $>$ \&pkt)}
\label{classArpHeader_a2c43be79bd5d02c28049a5c3e7e14cad}

\item 
void \hyperlink{classArpHeader_a580ea926a3015d840f1591f0be7fb79e}{set\_\-sender} (const \hyperlink{classMac}{Mac} \&mac, const \hyperlink{classIPv4}{IPv4} \&ip)
\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} sender information in \hyperlink{protocolthe-p}{the} ARP packet. \item\end{DoxyCompactList}\item 
void \hyperlink{classArpHeader_a3f2295150ed9c3a8b499efed00e75763}{set\_\-request} (const \hyperlink{classIPv4}{IPv4} \&ip)
\begin{DoxyCompactList}\small\item\em Create an ARP request for an IP address. \item\end{DoxyCompactList}\item 
void \hyperlink{classArpHeader_a6bf06939986976c2fdb324fb8f46a378}{set\_\-reply} (const \hyperlink{classMac}{Mac} \&mac, const \hyperlink{classIPv4}{IPv4} \&ip)
\begin{DoxyCompactList}\small\item\em Create an ARP reply. \item\end{DoxyCompactList}\item 
uint32\_\-t \hyperlink{classArpHeader_a521f9639253acbc43c987ea5f11e1a81}{size} () const 
\begin{DoxyCompactList}\small\item\em The size of \hyperlink{protocolthe-p}{the} ARP packet (ARP header + data). \item\end{DoxyCompactList}\item 
bool \hyperlink{classArpHeader_a481b8f290881b1c3822487e51087ab12}{is\_\-request} () const 
\begin{DoxyCompactList}\small\item\em Determine whether it is an ARP request. \item\end{DoxyCompactList}\item 
\hyperlink{classIPv4}{IPv4} \hyperlink{classArpHeader_a33ac7558baa51ac9b9b15800bfccad85}{get\_\-request} () const 
\begin{DoxyCompactList}\small\item\em If an ARP request, return \hyperlink{protocolthe-p}{the} IP address that is being asked for. \item\end{DoxyCompactList}\item 
void \hyperlink{classArpHeader_a12de15652812ee784250a0c6d142af94}{make\_\-reply} (vector$<$ uint8\_\-t $>$ \&out, const \hyperlink{classMac}{Mac} \&mac) const 
\begin{DoxyCompactList}\small\item\em If this is an ARP request, create an ARP reply with \hyperlink{protocolthe-p}{the} give MAC address. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{classArpHeader_a7a9fc8d67bbbe78c1f63749ade5941ef}{make\_\-gratuitous} (vector$<$ uint8\_\-t $>$ \&payload, const \hyperlink{classMac}{Mac} \&mac, const \hyperlink{classIPv4}{IPv4} \&ip)
\begin{DoxyCompactList}\small\item\em Create a gratuitous ARP. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classArpHeader_a32b43a08901d260f2690a560cd528fa8}{
enum ArpHeader::Op {\bfseries \_\-\_\-attribute\_\-\_\-}}
\label{classArpHeader_a32b43a08901d260f2690a560cd528fa8}

\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classArpHeader_a65f0d0e43b05117df8487f526528e5c0}{
uint16\_\-t {\bfseries ah\_\-hw\_\-fmt}}
\label{classArpHeader_a65f0d0e43b05117df8487f526528e5c0}

\item 
\hypertarget{classArpHeader_a83be0b7a74a1c204e58f02a67bdd8b29}{
uint16\_\-t {\bfseries ah\_\-proto\_\-fmt}}
\label{classArpHeader_a83be0b7a74a1c204e58f02a67bdd8b29}

\item 
\hypertarget{classArpHeader_abceab4c013afae9b6234457d83ee11f5}{
uint8\_\-t {\bfseries ah\_\-hw\_\-len}}
\label{classArpHeader_abceab4c013afae9b6234457d83ee11f5}

\item 
\hypertarget{classArpHeader_af56f0a603ad70cd85c32df0ca754ee66}{
uint8\_\-t {\bfseries ah\_\-proto\_\-len}}
\label{classArpHeader_af56f0a603ad70cd85c32df0ca754ee66}

\item 
\hypertarget{classArpHeader_a29f67c988beca085448a33dec0f49e9d}{
uint16\_\-t {\bfseries ah\_\-op}}
\label{classArpHeader_a29f67c988beca085448a33dec0f49e9d}

\item 
\hypertarget{classArpHeader_a7f34e274b94a125154a0ebeddda830ab}{
uint8\_\-t {\bfseries ah\_\-data\_\-store} \mbox{[}6 $\ast$2+4 $\ast$2\mbox{]}}
\label{classArpHeader_a7f34e274b94a125154a0ebeddda830ab}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
an ARP packet. 

\subsection{Member Function Documentation}
\hypertarget{classArpHeader_a33ac7558baa51ac9b9b15800bfccad85}{
\index{ArpHeader@{ArpHeader}!get\_\-request@{get\_\-request}}
\index{get\_\-request@{get\_\-request}!ArpHeader@{ArpHeader}}
\subsubsection[{get\_\-request}]{\setlength{\rightskip}{0pt plus 5cm}{\bf IPv4} ArpHeader::get\_\-request (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classArpHeader_a33ac7558baa51ac9b9b15800bfccad85}


If an ARP request, return \hyperlink{protocolthe-p}{the} IP address that is being asked for. 

\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} IP address being asked for. 
\end{DoxyReturn}
\hypertarget{classArpHeader_a481b8f290881b1c3822487e51087ab12}{
\index{ArpHeader@{ArpHeader}!is\_\-request@{is\_\-request}}
\index{is\_\-request@{is\_\-request}!ArpHeader@{ArpHeader}}
\subsubsection[{is\_\-request}]{\setlength{\rightskip}{0pt plus 5cm}bool ArpHeader::is\_\-request (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classArpHeader_a481b8f290881b1c3822487e51087ab12}


Determine whether it is an ARP request. 

This (usually) implies whether or not it is an ARP reply.

\begin{DoxyReturn}{Returns}
true if it is an ARP request. 
\end{DoxyReturn}
\hypertarget{classArpHeader_a7a9fc8d67bbbe78c1f63749ade5941ef}{
\index{ArpHeader@{ArpHeader}!make\_\-gratuitous@{make\_\-gratuitous}}
\index{make\_\-gratuitous@{make\_\-gratuitous}!ArpHeader@{ArpHeader}}
\subsubsection[{make\_\-gratuitous}]{\setlength{\rightskip}{0pt plus 5cm}void ArpHeader::make\_\-gratuitous (
\begin{DoxyParamCaption}
\item[{vector$<$ uint8\_\-t $>$ \&}]{payload, }
\item[{const {\bf Mac} \&}]{mac, }
\item[{const {\bf IPv4} \&}]{ip}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{classArpHeader_a7a9fc8d67bbbe78c1f63749ade5941ef}


Create a gratuitous ARP. 

I.e., an ARP request for my own IP address -\/ \hyperlink{protocolthe-p}{the} one used in \hyperlink{protocolthe-p}{the} source section of \hyperlink{protocolthe-p}{the} ARP packet.


\begin{DoxyParams}{Parameters}
{\em output} & data (output argument). \\
\hline
{\em MAC} & address of IP. \\
\hline
{\em ip} & IP address to create request for. \\
\hline
\end{DoxyParams}
\hypertarget{classArpHeader_a12de15652812ee784250a0c6d142af94}{
\index{ArpHeader@{ArpHeader}!make\_\-reply@{make\_\-reply}}
\index{make\_\-reply@{make\_\-reply}!ArpHeader@{ArpHeader}}
\subsubsection[{make\_\-reply}]{\setlength{\rightskip}{0pt plus 5cm}void ArpHeader::make\_\-reply (
\begin{DoxyParamCaption}
\item[{vector$<$ uint8\_\-t $>$ \&}]{out, }
\item[{const {\bf Mac} \&}]{mac}
\end{DoxyParamCaption}
) const}}
\label{classArpHeader_a12de15652812ee784250a0c6d142af94}


If this is an ARP request, create an ARP reply with \hyperlink{protocolthe-p}{the} give MAC address. 


\begin{DoxyParams}{Parameters}
{\em out} & \hyperlink{protocolthe-p}{the} ARP reply data (output parameter). \\
\hline
{\em mac} & \hyperlink{protocolthe-p}{the} MAC address of \hyperlink{protocolthe-p}{the} requested IP address. \\
\hline
\end{DoxyParams}
\hypertarget{classArpHeader_a6bf06939986976c2fdb324fb8f46a378}{
\index{ArpHeader@{ArpHeader}!set\_\-reply@{set\_\-reply}}
\index{set\_\-reply@{set\_\-reply}!ArpHeader@{ArpHeader}}
\subsubsection[{set\_\-reply}]{\setlength{\rightskip}{0pt plus 5cm}void ArpHeader::set\_\-reply (
\begin{DoxyParamCaption}
\item[{const {\bf Mac} \&}]{mac, }
\item[{const {\bf IPv4} \&}]{ip}
\end{DoxyParamCaption}
)}}
\label{classArpHeader_a6bf06939986976c2fdb324fb8f46a378}


Create an ARP reply. 


\begin{DoxyParams}{Parameters}
{\em mac} & MAC address of requested IP address. \\
\hline
{\em ip} & IP address requested in \hyperlink{protocolthe-p}{the} ARP request. \\
\hline
\end{DoxyParams}
\hypertarget{classArpHeader_a3f2295150ed9c3a8b499efed00e75763}{
\index{ArpHeader@{ArpHeader}!set\_\-request@{set\_\-request}}
\index{set\_\-request@{set\_\-request}!ArpHeader@{ArpHeader}}
\subsubsection[{set\_\-request}]{\setlength{\rightskip}{0pt plus 5cm}void ArpHeader::set\_\-request (
\begin{DoxyParamCaption}
\item[{const {\bf IPv4} \&}]{ip}
\end{DoxyParamCaption}
)}}
\label{classArpHeader_a3f2295150ed9c3a8b499efed00e75763}


Create an ARP request for an IP address. 


\begin{DoxyParams}{Parameters}
{\em ip} & IP address to ask request for. \\
\hline
\end{DoxyParams}
\hypertarget{classArpHeader_a580ea926a3015d840f1591f0be7fb79e}{
\index{ArpHeader@{ArpHeader}!set\_\-sender@{set\_\-sender}}
\index{set\_\-sender@{set\_\-sender}!ArpHeader@{ArpHeader}}
\subsubsection[{set\_\-sender}]{\setlength{\rightskip}{0pt plus 5cm}void ArpHeader::set\_\-sender (
\begin{DoxyParamCaption}
\item[{const {\bf Mac} \&}]{mac, }
\item[{const {\bf IPv4} \&}]{ip}
\end{DoxyParamCaption}
)}}
\label{classArpHeader_a580ea926a3015d840f1591f0be7fb79e}


Set \hyperlink{protocolthe-p}{the} sender information in \hyperlink{protocolthe-p}{the} ARP packet. 


\begin{DoxyParams}{Parameters}
{\em mac} & source MAC address. \\
\hline
{\em ip} & source IP address. \\
\hline
\end{DoxyParams}
\hypertarget{classArpHeader_a521f9639253acbc43c987ea5f11e1a81}{
\index{ArpHeader@{ArpHeader}!size@{size}}
\index{size@{size}!ArpHeader@{ArpHeader}}
\subsubsection[{size}]{\setlength{\rightskip}{0pt plus 5cm}uint32\_\-t ArpHeader::size (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classArpHeader_a521f9639253acbc43c987ea5f11e1a81}


The size of \hyperlink{protocolthe-p}{the} ARP packet (ARP header + data). 

\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} size of \hyperlink{protocolthe-p}{the} ARP packet. 
\end{DoxyReturn}


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