\hypertarget{classIoLinkPcap}{
\section{IoLinkPcap Class Reference}
\label{classIoLinkPcap}\index{IoLinkPcap@{IoLinkPcap}}
}


A base class for I/O link raw pcap(3)-\/based communication.  




{\ttfamily \#include $<$io\_\-link\_\-pcap.hh$>$}

Inheritance diagram for IoLinkPcap:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classIoLinkPcap}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classIoLinkPcap_a2ec4145958d10dbf685d401cf8465fc8}{IoLinkPcap} (\hyperlink{classFeaDataPlaneManager}{FeaDataPlaneManager} \&fea\_\-data\_\-plane\_\-manager, const \hyperlink{classIfTree}{IfTree} \&iftree, const string \&if\_\-name, const string \&vif\_\-name, uint16\_\-t ether\_\-type, const string \&filter\_\-program)
\begin{DoxyCompactList}\small\item\em Constructor for link-\/level access for a given interface and vif. \item\end{DoxyCompactList}\item 
\hypertarget{classIoLinkPcap_a459a885c26acf0570c50ee26da1ed197}{
virtual \hyperlink{classIoLinkPcap_a459a885c26acf0570c50ee26da1ed197}{$\sim$IoLinkPcap} ()}
\label{classIoLinkPcap_a459a885c26acf0570c50ee26da1ed197}

\begin{DoxyCompactList}\small\item\em Virtual destructor. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoLinkPcap_a8c72e12777c9cb1a6a01666a01b9d10f}{start} (string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Start operation. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoLinkPcap_a965f09afee86c0cc7eb63e926b841a2d}{stop} (string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Stop operation. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoLinkPcap_a9a4759c58b3359e5eb07d4df5fd89fa0}{join\_\-multicast\_\-group} (const \hyperlink{classMac}{Mac} \&group, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Join a multicast group on an interface. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoLinkPcap_a647a07dba8ba92ac789e9ce16e9cfce5}{leave\_\-multicast\_\-group} (const \hyperlink{classMac}{Mac} \&group, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Leave a multicast group on an interface. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoLinkPcap_a63fd2a41a6ae0262d54b844284a9ded3}{send\_\-packet} (const \hyperlink{classMac}{Mac} \&src\_\-address, const \hyperlink{classMac}{Mac} \&dst\_\-address, uint16\_\-t ether\_\-type, const vector$<$ uint8\_\-t $>$ \&payload, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em \hyperlink{structSend}{Send} a link-\/level packet. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{classIoLinkPcap_a19691ed9d16602ef0fd28cf8072e8de9}{open\_\-pcap\_\-access} (string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Open \hyperlink{protocolthe-p}{the} pcap access. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoLinkPcap_aad5ad230518faec7ef46ed5510e11ab1}{close\_\-pcap\_\-access} (string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Close \hyperlink{protocolthe-p}{the} pcap access. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoLinkPcap_a42743013bed4745179eb7d47879718d0}{join\_\-leave\_\-multicast\_\-group} (bool is\_\-join, const \hyperlink{classMac}{Mac} \&group, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Join or leave a multicast group on an interface. \item\end{DoxyCompactList}\item 
void \hyperlink{classIoLinkPcap_aca732e8555c6f6808f59bf0ebe666ac3}{ioevent\_\-read\_\-cb} (\hyperlink{classXorpFd}{XorpFd} fd, IoEventType type)
\begin{DoxyCompactList}\small\item\em Callback that is called when there data to read from \hyperlink{protocolthe-p}{the} system. \item\end{DoxyCompactList}\item 
\hypertarget{classIoLinkPcap_ad76aecadbd279c2e8937f41af4e6d44c}{
void \hyperlink{classIoLinkPcap_ad76aecadbd279c2e8937f41af4e6d44c}{recv\_\-data} ()}
\label{classIoLinkPcap_ad76aecadbd279c2e8937f41af4e6d44c}

\begin{DoxyCompactList}\small\item\em Read data from \hyperlink{protocolthe-p}{the} system, and then call \hyperlink{protocolthe-p}{the} appropriate module to process it. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoLinkPcap_ac0123dff53ac67e87c2de7010f77dff8}{reopen\_\-pcap\_\-access} (string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Reopen \hyperlink{protocolthe-p}{the} pcap access. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classIoLinkPcap_a757be2d364d76dee2ba744b0d35a429c}{
\hyperlink{classXorpFd}{XorpFd} {\bfseries \_\-packet\_\-fd}}
\label{classIoLinkPcap_a757be2d364d76dee2ba744b0d35a429c}

\item 
\hypertarget{classIoLinkPcap_ae5962082ca89508eac59d19be55a66b7}{
pcap\_\-t $\ast$ {\bfseries \_\-pcap}}
\label{classIoLinkPcap_ae5962082ca89508eac59d19be55a66b7}

\item 
\hypertarget{classIoLinkPcap_a4d20fb270c8ad787f42740ed2859548e}{
int {\bfseries \_\-datalink\_\-type}}
\label{classIoLinkPcap_a4d20fb270c8ad787f42740ed2859548e}

\item 
\hypertarget{classIoLinkPcap_a325fefd4327a90776a52b01628fa1a99}{
char $\ast$ {\bfseries \_\-pcap\_\-errbuf}}
\label{classIoLinkPcap_a325fefd4327a90776a52b01628fa1a99}

\item 
\hypertarget{classIoLinkPcap_a18a2b4394ac581244069d7f38f85bf15}{
int {\bfseries \_\-multicast\_\-sock}}
\label{classIoLinkPcap_a18a2b4394ac581244069d7f38f85bf15}

\item 
\hypertarget{classIoLinkPcap_ae61e4c8eb0e26e5193b2efeff5b3a769}{
\hyperlink{classXorpTask}{XorpTask} {\bfseries \_\-recv\_\-data\_\-task}}
\label{classIoLinkPcap_ae61e4c8eb0e26e5193b2efeff5b3a769}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
A base class for I/O link raw pcap(3)-\/based communication. Each protocol 'registers' for link raw I/O per interface and vif and gets assigned one object (per interface and vif) of this class. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classIoLinkPcap_a2ec4145958d10dbf685d401cf8465fc8}{
\index{IoLinkPcap@{IoLinkPcap}!IoLinkPcap@{IoLinkPcap}}
\index{IoLinkPcap@{IoLinkPcap}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{IoLinkPcap}]{\setlength{\rightskip}{0pt plus 5cm}IoLinkPcap::IoLinkPcap (
\begin{DoxyParamCaption}
\item[{{\bf FeaDataPlaneManager} \&}]{fea\_\-data\_\-plane\_\-manager, }
\item[{const {\bf IfTree} \&}]{iftree, }
\item[{const string \&}]{if\_\-name, }
\item[{const string \&}]{vif\_\-name, }
\item[{uint16\_\-t}]{ether\_\-type, }
\item[{const string \&}]{filter\_\-program}
\end{DoxyParamCaption}
)}}
\label{classIoLinkPcap_a2ec4145958d10dbf685d401cf8465fc8}


Constructor for link-\/level access for a given interface and vif. 


\begin{DoxyParams}{Parameters}
{\em fea\_\-data\_\-plane\_\-manager} & \hyperlink{protocolthe-p}{the} corresponding data plane manager (\hyperlink{classFeaDataPlaneManager}{FeaDataPlaneManager}). \\
\hline
{\em iftree} & \hyperlink{protocolthe-p}{the} interface tree to use. \\
\hline
{\em if\_\-name} & \hyperlink{protocolthe-p}{the} interface name. \\
\hline
{\em vif\_\-name} & \hyperlink{protocolthe-p}{the} vif name. \\
\hline
{\em ether\_\-type} & \hyperlink{protocolthe-p}{the} EtherType protocol number. If it is 0 then it is unused. \\
\hline
{\em filter\_\-program} & \hyperlink{protocolthe-p}{the} optional filter program to be applied on \hyperlink{protocolthe-p}{the} received packets. The program uses tcpdump(1) style expression. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\hypertarget{classIoLinkPcap_aad5ad230518faec7ef46ed5510e11ab1}{
\index{IoLinkPcap@{IoLinkPcap}!close\_\-pcap\_\-access@{close\_\-pcap\_\-access}}
\index{close\_\-pcap\_\-access@{close\_\-pcap\_\-access}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{close\_\-pcap\_\-access}]{\setlength{\rightskip}{0pt plus 5cm}int IoLinkPcap::close\_\-pcap\_\-access (
\begin{DoxyParamCaption}
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoLinkPcap_aad5ad230518faec7ef46ed5510e11ab1}


Close \hyperlink{protocolthe-p}{the} pcap access. 


\begin{DoxyParams}{Parameters}
{\em error\_\-msg} & \hyperlink{protocolthe-p}{the} error message (if error). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}
\hypertarget{classIoLinkPcap_aca732e8555c6f6808f59bf0ebe666ac3}{
\index{IoLinkPcap@{IoLinkPcap}!ioevent\_\-read\_\-cb@{ioevent\_\-read\_\-cb}}
\index{ioevent\_\-read\_\-cb@{ioevent\_\-read\_\-cb}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{ioevent\_\-read\_\-cb}]{\setlength{\rightskip}{0pt plus 5cm}void IoLinkPcap::ioevent\_\-read\_\-cb (
\begin{DoxyParamCaption}
\item[{{\bf XorpFd}}]{fd, }
\item[{IoEventType}]{type}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoLinkPcap_aca732e8555c6f6808f59bf0ebe666ac3}


Callback that is called when there data to read from \hyperlink{protocolthe-p}{the} system. 

This is called as a IoEventCb callback. 
\begin{DoxyParams}{Parameters}
{\em fd} & file descriptor that with event caused this method to be called. \\
\hline
{\em type} & \hyperlink{protocolthe-p}{the} event type. \\
\hline
\end{DoxyParams}
\hypertarget{classIoLinkPcap_a42743013bed4745179eb7d47879718d0}{
\index{IoLinkPcap@{IoLinkPcap}!join\_\-leave\_\-multicast\_\-group@{join\_\-leave\_\-multicast\_\-group}}
\index{join\_\-leave\_\-multicast\_\-group@{join\_\-leave\_\-multicast\_\-group}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{join\_\-leave\_\-multicast\_\-group}]{\setlength{\rightskip}{0pt plus 5cm}int IoLinkPcap::join\_\-leave\_\-multicast\_\-group (
\begin{DoxyParamCaption}
\item[{bool}]{is\_\-join, }
\item[{const {\bf Mac} \&}]{group, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoLinkPcap_a42743013bed4745179eb7d47879718d0}


Join or leave a multicast group on an interface. 


\begin{DoxyParams}{Parameters}
{\em is\_\-join} & if true, then join \hyperlink{protocolthe-p}{the} group, otherwise leave. \\
\hline
{\em group} & \hyperlink{protocolthe-p}{the} multicast group to join/leave. \\
\hline
{\em error\_\-msg} & \hyperlink{protocolthe-p}{the} error message (if error). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}
\hypertarget{classIoLinkPcap_a9a4759c58b3359e5eb07d4df5fd89fa0}{
\index{IoLinkPcap@{IoLinkPcap}!join\_\-multicast\_\-group@{join\_\-multicast\_\-group}}
\index{join\_\-multicast\_\-group@{join\_\-multicast\_\-group}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{join\_\-multicast\_\-group}]{\setlength{\rightskip}{0pt plus 5cm}int IoLinkPcap::join\_\-multicast\_\-group (
\begin{DoxyParamCaption}
\item[{const {\bf Mac} \&}]{group, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoLinkPcap_a9a4759c58b3359e5eb07d4df5fd89fa0}


Join a multicast group on an interface. 


\begin{DoxyParams}{Parameters}
{\em group} & \hyperlink{protocolthe-p}{the} multicast group to join. \\
\hline
{\em error\_\-msg} & \hyperlink{protocolthe-p}{the} error message (if error). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}


Implements \hyperlink{classIoLink_aa168bbec4e173df4fac5ba558c5b2c98}{IoLink}.

\hypertarget{classIoLinkPcap_a647a07dba8ba92ac789e9ce16e9cfce5}{
\index{IoLinkPcap@{IoLinkPcap}!leave\_\-multicast\_\-group@{leave\_\-multicast\_\-group}}
\index{leave\_\-multicast\_\-group@{leave\_\-multicast\_\-group}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{leave\_\-multicast\_\-group}]{\setlength{\rightskip}{0pt plus 5cm}int IoLinkPcap::leave\_\-multicast\_\-group (
\begin{DoxyParamCaption}
\item[{const {\bf Mac} \&}]{group, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoLinkPcap_a647a07dba8ba92ac789e9ce16e9cfce5}


Leave a multicast group on an interface. 


\begin{DoxyParams}{Parameters}
{\em group} & \hyperlink{protocolthe-p}{the} multicast group to leave. \\
\hline
{\em error\_\-msg} & \hyperlink{protocolthe-p}{the} error message (if error). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}


Implements \hyperlink{classIoLink_a2a406d731b6767d1fdb4a57deee12aa7}{IoLink}.

\hypertarget{classIoLinkPcap_a19691ed9d16602ef0fd28cf8072e8de9}{
\index{IoLinkPcap@{IoLinkPcap}!open\_\-pcap\_\-access@{open\_\-pcap\_\-access}}
\index{open\_\-pcap\_\-access@{open\_\-pcap\_\-access}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{open\_\-pcap\_\-access}]{\setlength{\rightskip}{0pt plus 5cm}int IoLinkPcap::open\_\-pcap\_\-access (
\begin{DoxyParamCaption}
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoLinkPcap_a19691ed9d16602ef0fd28cf8072e8de9}


Open \hyperlink{protocolthe-p}{the} pcap access. 


\begin{DoxyParams}{Parameters}
{\em error\_\-msg} & \hyperlink{protocolthe-p}{the} error message (if error). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}
\hypertarget{classIoLinkPcap_ac0123dff53ac67e87c2de7010f77dff8}{
\index{IoLinkPcap@{IoLinkPcap}!reopen\_\-pcap\_\-access@{reopen\_\-pcap\_\-access}}
\index{reopen\_\-pcap\_\-access@{reopen\_\-pcap\_\-access}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{reopen\_\-pcap\_\-access}]{\setlength{\rightskip}{0pt plus 5cm}int IoLinkPcap::reopen\_\-pcap\_\-access (
\begin{DoxyParamCaption}
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoLinkPcap_ac0123dff53ac67e87c2de7010f77dff8}


Reopen \hyperlink{protocolthe-p}{the} pcap access. 


\begin{DoxyParams}{Parameters}
{\em error\_\-msg} & \hyperlink{protocolthe-p}{the} error message (if error). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}
\hypertarget{classIoLinkPcap_a63fd2a41a6ae0262d54b844284a9ded3}{
\index{IoLinkPcap@{IoLinkPcap}!send\_\-packet@{send\_\-packet}}
\index{send\_\-packet@{send\_\-packet}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{send\_\-packet}]{\setlength{\rightskip}{0pt plus 5cm}int IoLinkPcap::send\_\-packet (
\begin{DoxyParamCaption}
\item[{const {\bf Mac} \&}]{src\_\-address, }
\item[{const {\bf Mac} \&}]{dst\_\-address, }
\item[{uint16\_\-t}]{ether\_\-type, }
\item[{const vector$<$ uint8\_\-t $>$ \&}]{payload, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoLinkPcap_a63fd2a41a6ae0262d54b844284a9ded3}


\hyperlink{structSend}{Send} a link-\/level packet. 


\begin{DoxyParams}{Parameters}
{\em src\_\-address} & \hyperlink{protocolthe-p}{the} MAC source address. \\
\hline
{\em dst\_\-address} & \hyperlink{protocolthe-p}{the} MAC destination address. \\
\hline
{\em ether\_\-type} & \hyperlink{protocolthe-p}{the} EtherType protocol number. \\
\hline
{\em payload} & \hyperlink{protocolthe-p}{the} payload, everything after \hyperlink{protocolthe-p}{the} MAC header. \\
\hline
{\em error\_\-msg} & \hyperlink{protocolthe-p}{the} error message (if error). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}


Implements \hyperlink{classIoLink_a882c92570e6ead04be86f330e6e8ae75}{IoLink}.

\hypertarget{classIoLinkPcap_a8c72e12777c9cb1a6a01666a01b9d10f}{
\index{IoLinkPcap@{IoLinkPcap}!start@{start}}
\index{start@{start}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{start}]{\setlength{\rightskip}{0pt plus 5cm}int IoLinkPcap::start (
\begin{DoxyParamCaption}
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoLinkPcap_a8c72e12777c9cb1a6a01666a01b9d10f}


Start operation. 


\begin{DoxyParams}{Parameters}
{\em error\_\-msg} & \hyperlink{protocolthe-p}{the} error message (if error). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}


Implements \hyperlink{classIoLink_a08291a6eca72e4aba820b2afdaedf1d6}{IoLink}.

\hypertarget{classIoLinkPcap_a965f09afee86c0cc7eb63e926b841a2d}{
\index{IoLinkPcap@{IoLinkPcap}!stop@{stop}}
\index{stop@{stop}!IoLinkPcap@{IoLinkPcap}}
\subsubsection[{stop}]{\setlength{\rightskip}{0pt plus 5cm}int IoLinkPcap::stop (
\begin{DoxyParamCaption}
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoLinkPcap_a965f09afee86c0cc7eb63e926b841a2d}


Stop operation. 


\begin{DoxyParams}{Parameters}
{\em error\_\-msg} & \hyperlink{protocolthe-p}{the} error message (if error). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}


Implements \hyperlink{classIoLink_a1b02443c11bbd3ec25d9a82e2b862af4}{IoLink}.



The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/fea/data\_\-plane/io/io\_\-link\_\-pcap.hh\end{DoxyCompactItemize}
