\hypertarget{classIoIpSocket}{
\section{IoIpSocket Class Reference}
\label{classIoIpSocket}\index{IoIpSocket@{IoIpSocket}}
}


A base class for I/O IP raw socket communication.  




{\ttfamily \#include $<$io\_\-ip\_\-socket.hh$>$}

Inheritance diagram for IoIpSocket:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classIoIpSocket}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classIoIpSocket_a22e21cfccb32a8920f4e534e6e30e9ca}{IoIpSocket} (\hyperlink{classFeaDataPlaneManager}{FeaDataPlaneManager} \&fea\_\-data\_\-plane\_\-manager, const \hyperlink{classIfTree}{IfTree} \&iftree, int family, uint8\_\-t ip\_\-protocol)
\begin{DoxyCompactList}\small\item\em Constructor for a given address family and protocol. \item\end{DoxyCompactList}\item 
\hypertarget{classIoIpSocket_aeb1e4835eb465803704e52ff266d15d3}{
virtual \hyperlink{classIoIpSocket_aeb1e4835eb465803704e52ff266d15d3}{$\sim$IoIpSocket} ()}
\label{classIoIpSocket_aeb1e4835eb465803704e52ff266d15d3}

\begin{DoxyCompactList}\small\item\em Virtual destructor. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_af3813acbd62730eb63871aa3a47b68ff}{start} (string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Start operation. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_aaeac72103b1b88e63ae78d3dd344d39a}{stop} (string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Stop operation. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_a72c7a64ff65b7056efb566487eee8e20}{set\_\-multicast\_\-ttl} (int ttl, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} default TTL (or hop-\/limit in \hyperlink{classIPv6}{IPv6}) for \hyperlink{protocolthe-p}{the} outgoing multicast packets. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_aef19264ce87ab1f44e2386f4d90e22c9}{enable\_\-multicast\_\-loopback} (bool is\_\-enabled, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Enable/disable multicast loopback when transmitting multicast packets. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_a73366298efc49aea5d9da273753df980}{set\_\-default\_\-multicast\_\-interface} (const string \&if\_\-name, const string \&vif\_\-name, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Set default interface for transmitting multicast packets. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_ab4d391cf9771e31ea3c9d25657f0174f}{join\_\-multicast\_\-group} (const string \&if\_\-name, const string \&vif\_\-name, const \hyperlink{classIPvX}{IPvX} \&group, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Join a multicast group on an interface. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_a3dc58c2cd1360f7980d2c991f17ba45a}{leave\_\-multicast\_\-group} (const string \&if\_\-name, const string \&vif\_\-name, const \hyperlink{classIPvX}{IPvX} \&group, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Leave a multicast group on an interface. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_a9c120d282dafba95b0ff9de59cb1f9ef}{send\_\-packet} (const string \&if\_\-name, const string \&vif\_\-name, const \hyperlink{classIPvX}{IPvX} \&src\_\-address, const \hyperlink{classIPvX}{IPvX} \&dst\_\-address, int32\_\-t ip\_\-ttl, int32\_\-t ip\_\-tos, bool ip\_\-router\_\-alert, bool ip\_\-internet\_\-control, const vector$<$ uint8\_\-t $>$ \&ext\_\-headers\_\-type, const vector$<$ vector$<$ uint8\_\-t $>$ $>$ \&ext\_\-headers\_\-payload, const vector$<$ uint8\_\-t $>$ \&payload, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em \hyperlink{structSend}{Send} a raw IP packet. \item\end{DoxyCompactList}\item 
\hyperlink{classXorpFd}{XorpFd} $\ast$ \hyperlink{classIoIpSocket_aad46e79a09755420d534bef7edd95516}{findExistingInputSocket} (const string \&if\_\-name, const string \&vif\_\-name)
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} file descriptor for receiving protocol messages on \hyperlink{protocolthe-p}{the} specified vif. \item\end{DoxyCompactList}\item 
\hyperlink{classXorpFd}{XorpFd} $\ast$ \hyperlink{classIoIpSocket_a6948bab69c8432699cb01faa21d9f85e}{mcast\_\-protocol\_\-fd\_\-in} ()
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} input file descriptor to be used for multicast routing. \item\end{DoxyCompactList}\item 
\hypertarget{classIoIpSocket_a23f6e974f1106a96a9b7d590b4382306}{
void \hyperlink{classIoIpSocket_a23f6e974f1106a96a9b7d590b4382306}{notifyDeletingIface} (const string \&ifname)}
\label{classIoIpSocket_a23f6e974f1106a96a9b7d590b4382306}

\begin{DoxyCompactList}\small\item\em Interface is going away..clean up \hyperlink{protocolthe-p}{the} sockets for \hyperlink{protocolthe-p}{the} associated vif(s) \item\end{DoxyCompactList}\item 
\hypertarget{classIoIpSocket_ae56fb98ef8b73f1e8be064e410fa7fcc}{
void {\bfseries notifyErasingIface} (const string \&ifname)}
\label{classIoIpSocket_ae56fb98ef8b73f1e8be064e410fa7fcc}

\item 
\hypertarget{classIoIpSocket_ae8109a2e2da5dd0930108968f1029efe}{
void \hyperlink{classIoIpSocket_ae8109a2e2da5dd0930108968f1029efe}{notifyDeletingVif} (const string \&ifname, const string \&vifname)}
\label{classIoIpSocket_ae8109a2e2da5dd0930108968f1029efe}

\begin{DoxyCompactList}\small\item\em VIF is going away..clean up \hyperlink{protocolthe-p}{the} socket. \item\end{DoxyCompactList}\item 
\hypertarget{classIoIpSocket_af45b07dbedeacbc1ef2084ce65cba50d}{
void {\bfseries notifyErasingVif} (const string \&ifname, const string \&vifname)}
\label{classIoIpSocket_af45b07dbedeacbc1ef2084ce65cba50d}

\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{classIoIpSocket_a15a2bac3faf8125bb222974b9019e529}{open\_\-proto\_\-sockets} (string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Open \hyperlink{protocolthe-p}{the} protocol sockets. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_a461930c0f43cf284e64ba168f875578d}{initializeInputSocket} (\hyperlink{classXorpFd}{XorpFd} $\ast$rv, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Returns XORP\_\-ERROR on error. \item\end{DoxyCompactList}\item 
\hyperlink{classXorpFd}{XorpFd} $\ast$ \hyperlink{classIoIpSocket_a1266c374202b9aa10b13858d00802118}{findOrCreateInputSocket} (const string \&if\_\-name, const string \&vif\_\-name, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Find or create an input socket for \hyperlink{protocolthe-p}{the} specified VIF. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_addf7a7f492877bc4405a874e9af7ceed}{close\_\-proto\_\-sockets} (string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Close \hyperlink{protocolthe-p}{the} protocol sockets. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_a5099e9e487ccc9ba900e640ad4c7d808}{cleanupXorpFd} (\hyperlink{classXorpFd}{XorpFd} $\ast$fd)
\begin{DoxyCompactList}\small\item\em Helper method to close a single socket. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_ad9152c0bebd695e16ec668589cc24a8e}{enable\_\-ip\_\-hdr\_\-include} (bool is\_\-enabled, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Enable/disable \hyperlink{protocolthe-p}{the} \char`\"{}Header Included\char`\"{} option (for \hyperlink{classIPv4}{IPv4}) on \hyperlink{protocolthe-p}{the} outgoing protocol socket. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_a21cb85e22a23d9be513045160a029dd5}{enable\_\-recv\_\-pktinfo} (\hyperlink{classXorpFd}{XorpFd} $\ast$input\_\-fd, bool is\_\-enabled, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em Enable/disable receiving information about a packet received on \hyperlink{protocolthe-p}{the} incoming protocol socket. \item\end{DoxyCompactList}\item 
void \hyperlink{classIoIpSocket_a56247c75760dbe15898c9bb52b68ce41}{proto\_\-socket\_\-read} (\hyperlink{classXorpFd}{XorpFd} fd, IoEventType type)
\begin{DoxyCompactList}\small\item\em Read data from a protocol socket, and then call \hyperlink{protocolthe-p}{the} appropriate protocol module to process it. \item\end{DoxyCompactList}\item 
int \hyperlink{classIoIpSocket_a9cd19750df1941747013c12793123fa2}{proto\_\-socket\_\-transmit} (const \hyperlink{classIfTreeInterface}{IfTreeInterface} $\ast$ifp, const \hyperlink{classIfTreeVif}{IfTreeVif} $\ast$vifp, const \hyperlink{classIPvX}{IPvX} \&src\_\-address, const \hyperlink{classIPvX}{IPvX} \&dst\_\-address, string \&error\_\-msg)
\begin{DoxyCompactList}\small\item\em \hyperlink{classTransmit}{Transmit} a packet on a protocol socket. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classIoIpSocket_a01034874e65981e053c2fe52d3be302a}{
map$<$ string, \hyperlink{classXorpFd}{XorpFd} $\ast$ $>$ {\bfseries \_\-proto\_\-sockets\_\-in}}
\label{classIoIpSocket_a01034874e65981e053c2fe52d3be302a}

\item 
\hypertarget{classIoIpSocket_a1e517765ee669a16ec5799aacaa545ab}{
\hyperlink{classXorpFd}{XorpFd} {\bfseries \_\-proto\_\-socket\_\-out}}
\label{classIoIpSocket_a1e517765ee669a16ec5799aacaa545ab}

\item 
\hypertarget{classIoIpSocket_acfba1324510bf427c55d152659899c3b}{
bool {\bfseries \_\-is\_\-ip\_\-hdr\_\-included}}
\label{classIoIpSocket_acfba1324510bf427c55d152659899c3b}

\item 
\hypertarget{classIoIpSocket_a340d69467d07af504a2454c8cd22de19}{
uint16\_\-t {\bfseries \_\-ip\_\-id}}
\label{classIoIpSocket_a340d69467d07af504a2454c8cd22de19}

\item 
\hypertarget{classIoIpSocket_ab869e006efd7c2c5b1de45aca4f70f87}{
uint8\_\-t $\ast$ {\bfseries \_\-rcvbuf}}
\label{classIoIpSocket_ab869e006efd7c2c5b1de45aca4f70f87}

\item 
\hypertarget{classIoIpSocket_a80b3b4120360292fbc93594d43654c98}{
uint8\_\-t $\ast$ {\bfseries \_\-sndbuf}}
\label{classIoIpSocket_a80b3b4120360292fbc93594d43654c98}

\item 
\hypertarget{classIoIpSocket_a137294e2873862c0c69151eafb68f4cf}{
uint8\_\-t $\ast$ {\bfseries \_\-rcvcmsgbuf}}
\label{classIoIpSocket_a137294e2873862c0c69151eafb68f4cf}

\item 
\hypertarget{classIoIpSocket_a2623e6348c48430f7973e10d614184c5}{
uint8\_\-t $\ast$ {\bfseries \_\-sndcmsgbuf}}
\label{classIoIpSocket_a2623e6348c48430f7973e10d614184c5}

\item 
\hypertarget{classIoIpSocket_afc9a67be3b5915d8da5c521053ab2dd8}{
struct iovec {\bfseries \_\-rcviov} \mbox{[}1\mbox{]}}
\label{classIoIpSocket_afc9a67be3b5915d8da5c521053ab2dd8}

\item 
\hypertarget{classIoIpSocket_a89b63e44502c60a4fb4451c5a5e455a0}{
struct iovec {\bfseries \_\-sndiov} \mbox{[}1\mbox{]}}
\label{classIoIpSocket_a89b63e44502c60a4fb4451c5a5e455a0}

\item 
\hypertarget{classIoIpSocket_adc2ddfc6a256779838c44436b8d0c0b7}{
struct msghdr {\bfseries \_\-rcvmh}}
\label{classIoIpSocket_adc2ddfc6a256779838c44436b8d0c0b7}

\item 
\hypertarget{classIoIpSocket_a013c2bbf7ce1fd39f201f4a0af0b1a97}{
struct msghdr {\bfseries \_\-sndmh}}
\label{classIoIpSocket_a013c2bbf7ce1fd39f201f4a0af0b1a97}

\item 
\hypertarget{classIoIpSocket_acadbbaf376ace0c90f7f22f707b16500}{
struct sockaddr\_\-in {\bfseries \_\-from4}}
\label{classIoIpSocket_acadbbaf376ace0c90f7f22f707b16500}

\item 
\hypertarget{classIoIpSocket_a1537182bf160860c63da195d1e59adbf}{
struct sockaddr\_\-in {\bfseries \_\-to4}}
\label{classIoIpSocket_a1537182bf160860c63da195d1e59adbf}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
A base class for I/O IP raw socket communication. Each protocol 'registers' for I/O and gets assigned one object of this class. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classIoIpSocket_a22e21cfccb32a8920f4e534e6e30e9ca}{
\index{IoIpSocket@{IoIpSocket}!IoIpSocket@{IoIpSocket}}
\index{IoIpSocket@{IoIpSocket}!IoIpSocket@{IoIpSocket}}
\subsubsection[{IoIpSocket}]{\setlength{\rightskip}{0pt plus 5cm}IoIpSocket::IoIpSocket (
\begin{DoxyParamCaption}
\item[{{\bf FeaDataPlaneManager} \&}]{fea\_\-data\_\-plane\_\-manager, }
\item[{const {\bf IfTree} \&}]{iftree, }
\item[{int}]{family, }
\item[{uint8\_\-t}]{ip\_\-protocol}
\end{DoxyParamCaption}
)}}
\label{classIoIpSocket_a22e21cfccb32a8920f4e534e6e30e9ca}


Constructor for a given address family and protocol. 


\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 family} & \hyperlink{protocolthe-p}{the} address family (AF\_\-INET or AF\_\-INET6 for \hyperlink{classIPv4}{IPv4} and \hyperlink{classIPv6}{IPv6} respectively). \\
\hline
{\em ip\_\-protocol} & \hyperlink{protocolthe-p}{the} IP protocol number (IPPROTO\_\-$\ast$). \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\hypertarget{classIoIpSocket_a5099e9e487ccc9ba900e640ad4c7d808}{
\index{IoIpSocket@{IoIpSocket}!cleanupXorpFd@{cleanupXorpFd}}
\index{cleanupXorpFd@{cleanupXorpFd}!IoIpSocket@{IoIpSocket}}
\subsubsection[{cleanupXorpFd}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::cleanupXorpFd (
\begin{DoxyParamCaption}
\item[{{\bf XorpFd} $\ast$}]{fd}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoIpSocket_a5099e9e487ccc9ba900e640ad4c7d808}


Helper method to close a single socket. 

Does not remove from socket map structure. Deletes memory associated with 'fd'. \hypertarget{classIoIpSocket_addf7a7f492877bc4405a874e9af7ceed}{
\index{IoIpSocket@{IoIpSocket}!close\_\-proto\_\-sockets@{close\_\-proto\_\-sockets}}
\index{close\_\-proto\_\-sockets@{close\_\-proto\_\-sockets}!IoIpSocket@{IoIpSocket}}
\subsubsection[{close\_\-proto\_\-sockets}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::close\_\-proto\_\-sockets (
\begin{DoxyParamCaption}
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoIpSocket_addf7a7f492877bc4405a874e9af7ceed}


Close \hyperlink{protocolthe-p}{the} protocol sockets. 


\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{classIoIpSocket_ad9152c0bebd695e16ec668589cc24a8e}{
\index{IoIpSocket@{IoIpSocket}!enable\_\-ip\_\-hdr\_\-include@{enable\_\-ip\_\-hdr\_\-include}}
\index{enable\_\-ip\_\-hdr\_\-include@{enable\_\-ip\_\-hdr\_\-include}!IoIpSocket@{IoIpSocket}}
\subsubsection[{enable\_\-ip\_\-hdr\_\-include}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::enable\_\-ip\_\-hdr\_\-include (
\begin{DoxyParamCaption}
\item[{bool}]{is\_\-enabled, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoIpSocket_ad9152c0bebd695e16ec668589cc24a8e}


Enable/disable \hyperlink{protocolthe-p}{the} \char`\"{}Header Included\char`\"{} option (for \hyperlink{classIPv4}{IPv4}) on \hyperlink{protocolthe-p}{the} outgoing protocol socket. 

If enabled, \hyperlink{protocolthe-p}{the} IP header of a raw packet should be created by \hyperlink{protocolthe-p}{the} application itself, otherwise \hyperlink{protocolthe-p}{the} kernel will build it. Note: used only for \hyperlink{classIPv4}{IPv4}. In RFC-\/3542, IPV6\_\-PKTINFO has similar functions, but because it requires \hyperlink{protocolthe-p}{the} interface index and outgoing address, it is of little use for our purpose. Also, in RFC-\/2292 this option was a flag, so for compatibility reasons we better not set it here; instead, we will use sendmsg() to specify \hyperlink{protocolthe-p}{the} header's field values.


\begin{DoxyParams}{Parameters}
{\em is\_\-enabled} & if true, enable \hyperlink{protocolthe-p}{the} option, otherwise disable it. \\
\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{classIoIpSocket_aef19264ce87ab1f44e2386f4d90e22c9}{
\index{IoIpSocket@{IoIpSocket}!enable\_\-multicast\_\-loopback@{enable\_\-multicast\_\-loopback}}
\index{enable\_\-multicast\_\-loopback@{enable\_\-multicast\_\-loopback}!IoIpSocket@{IoIpSocket}}
\subsubsection[{enable\_\-multicast\_\-loopback}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::enable\_\-multicast\_\-loopback (
\begin{DoxyParamCaption}
\item[{bool}]{is\_\-enabled, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoIpSocket_aef19264ce87ab1f44e2386f4d90e22c9}


Enable/disable multicast loopback when transmitting multicast packets. 

If \hyperlink{protocolthe-p}{the} multicast loopback is enabled, a transmitted multicast packet will be delivered back to this host (assuming \hyperlink{protocolthe-p}{the} host is a member of \hyperlink{protocolthe-p}{the} same multicast group).


\begin{DoxyParams}{Parameters}
{\em is\_\-enabled} & if true, enable \hyperlink{protocolthe-p}{the} loopback, otherwise disable it. \\
\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{classIoIp_af5b13a9b0424555a615021ecc8955f1e}{IoIp}.

\hypertarget{classIoIpSocket_a21cb85e22a23d9be513045160a029dd5}{
\index{IoIpSocket@{IoIpSocket}!enable\_\-recv\_\-pktinfo@{enable\_\-recv\_\-pktinfo}}
\index{enable\_\-recv\_\-pktinfo@{enable\_\-recv\_\-pktinfo}!IoIpSocket@{IoIpSocket}}
\subsubsection[{enable\_\-recv\_\-pktinfo}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::enable\_\-recv\_\-pktinfo (
\begin{DoxyParamCaption}
\item[{{\bf XorpFd} $\ast$}]{input\_\-fd, }
\item[{bool}]{is\_\-enabled, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoIpSocket_a21cb85e22a23d9be513045160a029dd5}


Enable/disable receiving information about a packet received on \hyperlink{protocolthe-p}{the} incoming protocol socket. 

If enabled, values such as interface index, destination address and IP TTL (a.k.a. hop-\/limit in \hyperlink{classIPv6}{IPv6}), and hop-\/by-\/hop options will be received as well.


\begin{DoxyParams}{Parameters}
{\em is\_\-enabled} & if true, set \hyperlink{protocolthe-p}{the} option, otherwise reset it. \\
\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{classIoIpSocket_aad46e79a09755420d534bef7edd95516}{
\index{IoIpSocket@{IoIpSocket}!findExistingInputSocket@{findExistingInputSocket}}
\index{findExistingInputSocket@{findExistingInputSocket}!IoIpSocket@{IoIpSocket}}
\subsubsection[{findExistingInputSocket}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XorpFd}$\ast$ IoIpSocket::findExistingInputSocket (
\begin{DoxyParamCaption}
\item[{const string \&}]{if\_\-name, }
\item[{const string \&}]{vif\_\-name}
\end{DoxyParamCaption}
)}}
\label{classIoIpSocket_aad46e79a09755420d534bef7edd95516}


Get \hyperlink{protocolthe-p}{the} file descriptor for receiving protocol messages on \hyperlink{protocolthe-p}{the} specified vif. 

\begin{DoxyReturn}{Returns}
a reference to \hyperlink{protocolthe-p}{the} file descriptor for receiving protocol messages. 
\end{DoxyReturn}
\hypertarget{classIoIpSocket_a1266c374202b9aa10b13858d00802118}{
\index{IoIpSocket@{IoIpSocket}!findOrCreateInputSocket@{findOrCreateInputSocket}}
\index{findOrCreateInputSocket@{findOrCreateInputSocket}!IoIpSocket@{IoIpSocket}}
\subsubsection[{findOrCreateInputSocket}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XorpFd}$\ast$ IoIpSocket::findOrCreateInputSocket (
\begin{DoxyParamCaption}
\item[{const string \&}]{if\_\-name, }
\item[{const string \&}]{vif\_\-name, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoIpSocket_a1266c374202b9aa10b13858d00802118}


Find or create an input socket for \hyperlink{protocolthe-p}{the} specified VIF. 

Returns NULL if \hyperlink{protocolthe-p}{the} socket cannot be found or created. \hypertarget{classIoIpSocket_a461930c0f43cf284e64ba168f875578d}{
\index{IoIpSocket@{IoIpSocket}!initializeInputSocket@{initializeInputSocket}}
\index{initializeInputSocket@{initializeInputSocket}!IoIpSocket@{IoIpSocket}}
\subsubsection[{initializeInputSocket}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::initializeInputSocket (
\begin{DoxyParamCaption}
\item[{{\bf XorpFd} $\ast$}]{rv, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoIpSocket_a461930c0f43cf284e64ba168f875578d}


Returns XORP\_\-ERROR on error. 

\hypertarget{classIoIpSocket_ab4d391cf9771e31ea3c9d25657f0174f}{
\index{IoIpSocket@{IoIpSocket}!join\_\-multicast\_\-group@{join\_\-multicast\_\-group}}
\index{join\_\-multicast\_\-group@{join\_\-multicast\_\-group}!IoIpSocket@{IoIpSocket}}
\subsubsection[{join\_\-multicast\_\-group}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::join\_\-multicast\_\-group (
\begin{DoxyParamCaption}
\item[{const string \&}]{if\_\-name, }
\item[{const string \&}]{vif\_\-name, }
\item[{const {\bf IPvX} \&}]{group, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoIpSocket_ab4d391cf9771e31ea3c9d25657f0174f}


Join a multicast group on an interface. 


\begin{DoxyParams}{Parameters}
{\em if\_\-name} & \hyperlink{protocolthe-p}{the} name of \hyperlink{protocolthe-p}{the} interface to join \hyperlink{protocolthe-p}{the} multicast group. \\
\hline
{\em vif\_\-name} & \hyperlink{protocolthe-p}{the} name of \hyperlink{protocolthe-p}{the} vif to join \hyperlink{protocolthe-p}{the} multicast group. \\
\hline
{\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{classIoIp_a91c6bbb67097f3f40cbf3c3c6ff80dcc}{IoIp}.

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


Leave a multicast group on an interface. 


\begin{DoxyParams}{Parameters}
{\em if\_\-name} & \hyperlink{protocolthe-p}{the} name of \hyperlink{protocolthe-p}{the} interface to leave \hyperlink{protocolthe-p}{the} multicast group. \\
\hline
{\em vif\_\-name} & \hyperlink{protocolthe-p}{the} name of \hyperlink{protocolthe-p}{the} vif to leave \hyperlink{protocolthe-p}{the} multicast group. \\
\hline
{\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{classIoIp_a22d7f9077a618fbdeb689146dad3a741}{IoIp}.

\hypertarget{classIoIpSocket_a6948bab69c8432699cb01faa21d9f85e}{
\index{IoIpSocket@{IoIpSocket}!mcast\_\-protocol\_\-fd\_\-in@{mcast\_\-protocol\_\-fd\_\-in}}
\index{mcast\_\-protocol\_\-fd\_\-in@{mcast\_\-protocol\_\-fd\_\-in}!IoIpSocket@{IoIpSocket}}
\subsubsection[{mcast\_\-protocol\_\-fd\_\-in}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XorpFd}$\ast$ IoIpSocket::mcast\_\-protocol\_\-fd\_\-in (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoIpSocket_a6948bab69c8432699cb01faa21d9f85e}


Get \hyperlink{protocolthe-p}{the} input file descriptor to be used for multicast routing. 

This should not be bound to any specific interface. Returns NULL if cannot find or create one. 

Implements \hyperlink{classIoIp_a8efca10514cd213b44539b5a8397a404}{IoIp}.

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


Open \hyperlink{protocolthe-p}{the} protocol sockets. 

The protocol sockets are specific to \hyperlink{protocolthe-p}{the} particular protocol of this entry.


\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{classIoIpSocket_a56247c75760dbe15898c9bb52b68ce41}{
\index{IoIpSocket@{IoIpSocket}!proto\_\-socket\_\-read@{proto\_\-socket\_\-read}}
\index{proto\_\-socket\_\-read@{proto\_\-socket\_\-read}!IoIpSocket@{IoIpSocket}}
\subsubsection[{proto\_\-socket\_\-read}]{\setlength{\rightskip}{0pt plus 5cm}void IoIpSocket::proto\_\-socket\_\-read (
\begin{DoxyParamCaption}
\item[{{\bf XorpFd}}]{fd, }
\item[{IoEventType}]{type}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoIpSocket_a56247c75760dbe15898c9bb52b68ce41}


Read data from a protocol socket, and then call \hyperlink{protocolthe-p}{the} appropriate protocol module to process it. 

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{classIoIpSocket_a9cd19750df1941747013c12793123fa2}{
\index{IoIpSocket@{IoIpSocket}!proto\_\-socket\_\-transmit@{proto\_\-socket\_\-transmit}}
\index{proto\_\-socket\_\-transmit@{proto\_\-socket\_\-transmit}!IoIpSocket@{IoIpSocket}}
\subsubsection[{proto\_\-socket\_\-transmit}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::proto\_\-socket\_\-transmit (
\begin{DoxyParamCaption}
\item[{const {\bf IfTreeInterface} $\ast$}]{ifp, }
\item[{const {\bf IfTreeVif} $\ast$}]{vifp, }
\item[{const {\bf IPvX} \&}]{src\_\-address, }
\item[{const {\bf IPvX} \&}]{dst\_\-address, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classIoIpSocket_a9cd19750df1941747013c12793123fa2}


\hyperlink{classTransmit}{Transmit} a packet on a protocol socket. 


\begin{DoxyParams}{Parameters}
{\em ifp} & \hyperlink{protocolthe-p}{the} interface to send \hyperlink{protocolthe-p}{the} packet on. \\
\hline
{\em vifp} & \hyperlink{protocolthe-p}{the} vif to send \hyperlink{protocolthe-p}{the} packet on. \\
\hline
{\em src\_\-address} & \hyperlink{protocolthe-p}{the} IP source address. \\
\hline
{\em dst\_\-address} & \hyperlink{protocolthe-p}{the} IP destination address. \\
\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{classIoIpSocket_a9c120d282dafba95b0ff9de59cb1f9ef}{
\index{IoIpSocket@{IoIpSocket}!send\_\-packet@{send\_\-packet}}
\index{send\_\-packet@{send\_\-packet}!IoIpSocket@{IoIpSocket}}
\subsubsection[{send\_\-packet}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::send\_\-packet (
\begin{DoxyParamCaption}
\item[{const string \&}]{if\_\-name, }
\item[{const string \&}]{vif\_\-name, }
\item[{const {\bf IPvX} \&}]{src\_\-address, }
\item[{const {\bf IPvX} \&}]{dst\_\-address, }
\item[{int32\_\-t}]{ip\_\-ttl, }
\item[{int32\_\-t}]{ip\_\-tos, }
\item[{bool}]{ip\_\-router\_\-alert, }
\item[{bool}]{ip\_\-internet\_\-control, }
\item[{const vector$<$ uint8\_\-t $>$ \&}]{ext\_\-headers\_\-type, }
\item[{const vector$<$ vector$<$ uint8\_\-t $>$ $>$ \&}]{ext\_\-headers\_\-payload, }
\item[{const vector$<$ uint8\_\-t $>$ \&}]{payload, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoIpSocket_a9c120d282dafba95b0ff9de59cb1f9ef}


\hyperlink{structSend}{Send} a raw IP packet. 


\begin{DoxyParams}{Parameters}
{\em if\_\-name} & \hyperlink{protocolthe-p}{the} interface to send \hyperlink{protocolthe-p}{the} packet on. It is essential for multicast. In \hyperlink{protocolthe-p}{the} unicast case this field may be empty. \\
\hline
{\em vif\_\-name} & \hyperlink{protocolthe-p}{the} vif to send \hyperlink{protocolthe-p}{the} packet on. It is essential for multicast. In \hyperlink{protocolthe-p}{the} unicast case this field may be empty. \\
\hline
{\em src\_\-address} & \hyperlink{protocolthe-p}{the} IP source address. \\
\hline
{\em dst\_\-address} & \hyperlink{protocolthe-p}{the} IP destination address. \\
\hline
{\em ip\_\-ttl} & \hyperlink{protocolthe-p}{the} IP TTL (hop-\/limit). If it has a negative value, \hyperlink{protocolthe-p}{the} TTL will be set internally before transmission. \\
\hline
{\em ip\_\-tos} & \hyperlink{protocolthe-p}{the} Type Of Service (Diffserv/ECN bits for \hyperlink{classIPv4}{IPv4} or IP traffic class for \hyperlink{classIPv6}{IPv6}). If it has a negative value, \hyperlink{protocolthe-p}{the} TOS will be set internally before transmission. \\
\hline
{\em ip\_\-router\_\-alert} & if true, then add \hyperlink{protocolthe-p}{the} IP Router Alert option to \hyperlink{protocolthe-p}{the} IP packet. \\
\hline
{\em ip\_\-internet\_\-control} & if true, then this is IP control traffic. \\
\hline
{\em ext\_\-headers\_\-type} & a vector of integers with \hyperlink{protocolthe-p}{the} types of \hyperlink{protocolthe-p}{the} optional \hyperlink{classIPv6}{IPv6} extention headers. \\
\hline
{\em ext\_\-headers\_\-payload} & a vector of payload data, one for each optional \hyperlink{classIPv6}{IPv6} extention header. The number of entries must match ext\_\-headers\_\-type. \\
\hline
{\em payload} & \hyperlink{protocolthe-p}{the} payload, everything after \hyperlink{protocolthe-p}{the} IP header and options. \\
\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{classIoIp_a553edc941a439bbc824ae8404e1ea8d3}{IoIp}.

\hypertarget{classIoIpSocket_a73366298efc49aea5d9da273753df980}{
\index{IoIpSocket@{IoIpSocket}!set\_\-default\_\-multicast\_\-interface@{set\_\-default\_\-multicast\_\-interface}}
\index{set\_\-default\_\-multicast\_\-interface@{set\_\-default\_\-multicast\_\-interface}!IoIpSocket@{IoIpSocket}}
\subsubsection[{set\_\-default\_\-multicast\_\-interface}]{\setlength{\rightskip}{0pt plus 5cm}int IoIpSocket::set\_\-default\_\-multicast\_\-interface (
\begin{DoxyParamCaption}
\item[{const string \&}]{if\_\-name, }
\item[{const string \&}]{vif\_\-name, }
\item[{string \&}]{error\_\-msg}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classIoIpSocket_a73366298efc49aea5d9da273753df980}


Set default interface for transmitting multicast packets. 


\begin{DoxyParams}{Parameters}
{\em if\_\-name} & \hyperlink{protocolthe-p}{the} name of \hyperlink{protocolthe-p}{the} interface that would become \hyperlink{protocolthe-p}{the} default multicast interface. \\
\hline
{\em vif\_\-name} & \hyperlink{protocolthe-p}{the} name of \hyperlink{protocolthe-p}{the} vif that would become \hyperlink{protocolthe-p}{the} default multicast interface. \\
\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{classIoIp_a1e2751f4f32a1b51ebe63331c968ee51}{IoIp}.

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


Set \hyperlink{protocolthe-p}{the} default TTL (or hop-\/limit in \hyperlink{classIPv6}{IPv6}) for \hyperlink{protocolthe-p}{the} outgoing multicast packets. 


\begin{DoxyParams}{Parameters}
{\em ttl} & \hyperlink{protocolthe-p}{the} desired IP TTL (a.k.a. hop-\/limit in \hyperlink{classIPv6}{IPv6}) value. \\
\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{classIoIp_a9615f67c69c07d97453b3efe7392bc7e}{IoIp}.

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


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{classIoIp_a62b9862050aca745cc7da7b2eb18400a}{IoIp}.

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


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{classIoIp_a44e244066d12564df8449cde234a5ef1}{IoIp}.



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\_\-ip\_\-socket.hh\end{DoxyCompactItemize}
