\hypertarget{classTestSocket4TCPClient}{
\section{TestSocket4TCPClient Class Reference}
\label{classTestSocket4TCPClient}\index{TestSocket4TCPClient@{TestSocket4TCPClient}}
}
Inheritance diagram for TestSocket4TCPClient:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classTestSocket4TCPClient}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTestSocket4TCPClient_ad53f29c73c4dbe7d55e0b3ae2a2de180}{
{\bfseries TestSocket4TCPClient} (\hyperlink{classEventLoop}{EventLoop} \&e, const string \&fea\_\-target\_\-name, \hyperlink{classIPv4}{IPv4} finder\_\-host, uint16\_\-t finder\_\-port)}
\label{classTestSocket4TCPClient_ad53f29c73c4dbe7d55e0b3ae2a2de180}

\item 
\hypertarget{classTestSocket4TCPClient_afd4542c0490363aeab695b854e9950a3}{
bool {\bfseries closed} () const }
\label{classTestSocket4TCPClient_afd4542c0490363aeab695b854e9950a3}

\item 
\hypertarget{classTestSocket4TCPClient_a68fd3155c362f8b007330f9ee271ed6a}{
bool {\bfseries connected} () const }
\label{classTestSocket4TCPClient_a68fd3155c362f8b007330f9ee271ed6a}

\item 
bool \hyperlink{classTestSocket4TCPClient_a61bc65eea9752e114b3f3651244ee442}{bind\_\-connect} (\hyperlink{classIPv4}{IPv4} local\_\-addr, uint16\_\-t local\_\-port, \hyperlink{classIPv4}{IPv4} remote\_\-addr, uint16\_\-t remote\_\-port)
\begin{DoxyCompactList}\small\item\em Bind to interface and port, and connect to remote address and port. \item\end{DoxyCompactList}\item 
bool \hyperlink{classTestSocket4TCPClient_a43ca91ac1a0e831207bb1e92bec604fe}{close} ()
\begin{DoxyCompactList}\small\item\em Request closure of \hyperlink{protocolthe-p}{the} client socket. \item\end{DoxyCompactList}\item 
bool \hyperlink{classTestSocket4TCPClient_aa06ae17be7b6de36a8c5162d7484738e}{send\_\-data} (uint32\_\-t bytes)
\begin{DoxyCompactList}\small\item\em \hyperlink{structSend}{Send} data to \hyperlink{protocolthe-p}{the} server through \hyperlink{protocolthe-p}{the} client socket. \item\end{DoxyCompactList}\item 
void \hyperlink{classTestSocket4TCPClient_a0b21affae82fb502000cda7b89b2baba}{start\_\-sending} (uint32\_\-t bytes, uint32\_\-t ipg\_\-ms)
\begin{DoxyCompactList}\small\item\em Start sending packets. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTestSocket4TCPClient_a608ba7f46bf98d2c5db0bf1c4255c18c}{
void {\bfseries bind\_\-connect\_\-cb} (const \hyperlink{classXrlError}{XrlError} \&e, const string $\ast$psockid)}
\label{classTestSocket4TCPClient_a608ba7f46bf98d2c5db0bf1c4255c18c}

\item 
\hypertarget{classTestSocket4TCPClient_a8a26682a5f5a65ea6f2f123e84ce4987}{
void {\bfseries close\_\-cb} (const \hyperlink{classXrlError}{XrlError} \&e)}
\label{classTestSocket4TCPClient_a8a26682a5f5a65ea6f2f123e84ce4987}

\item 
\hypertarget{classTestSocket4TCPClient_a989d61432b458448cf2cc517f1abe402}{
void {\bfseries send\_\-data\_\-cb} (const \hyperlink{classXrlError}{XrlError} \&e)}
\label{classTestSocket4TCPClient_a989d61432b458448cf2cc517f1abe402}

\item 
\hyperlink{structXrlCmdError}{XrlCmdError} \hyperlink{classTestSocket4TCPClient_a291e191fa0ef4c836894eb20b1c232d2}{socket4\_\-user\_\-0\_\-1\_\-recv\_\-event} (const string \&sockid, const string \&if\_\-name, const string \&vif\_\-name, const \hyperlink{classIPv4}{IPv4} \&src\_\-host, const uint32\_\-t \&src\_\-port, const vector$<$ uint8\_\-t $>$ \&data)
\begin{DoxyCompactList}\small\item\em Pure-\/virtual function that needs to be implemented to: \item\end{DoxyCompactList}\item 
\hyperlink{structXrlCmdError}{XrlCmdError} \hyperlink{classTestSocket4TCPClient_ad342fca78cb53e4186269b3f63e11595}{socket4\_\-user\_\-0\_\-1\_\-inbound\_\-connect\_\-event} (const string \&, const \hyperlink{classIPv4}{IPv4} \&, const uint32\_\-t \&, const string \&, bool \&)
\begin{DoxyCompactList}\small\item\em Pure-\/virtual function that needs to be implemented to: \item\end{DoxyCompactList}\item 
\hyperlink{structXrlCmdError}{XrlCmdError} \hyperlink{classTestSocket4TCPClient_a665fa3ba46b63bfe4ef16a921ba58af8}{socket4\_\-user\_\-0\_\-1\_\-outgoing\_\-connect\_\-event} (const string \&sockid)
\begin{DoxyCompactList}\small\item\em Pure-\/virtual function that needs to be implemented to: \item\end{DoxyCompactList}\item 
\hyperlink{structXrlCmdError}{XrlCmdError} \hyperlink{classTestSocket4TCPClient_a2b5bef7cbbc421d5df2be3b4ea7e9224}{socket4\_\-user\_\-0\_\-1\_\-error\_\-event} (const string \&sockid, const string \&error, const bool \&fatal)
\begin{DoxyCompactList}\small\item\em Pure-\/virtual function that needs to be implemented to: \item\end{DoxyCompactList}\item 
\hyperlink{structXrlCmdError}{XrlCmdError} \hyperlink{classTestSocket4TCPClient_ae41f53b4adf76bc3c089aaa6374d5e9a}{socket4\_\-user\_\-0\_\-1\_\-disconnect\_\-event} (const string \&sockid)
\begin{DoxyCompactList}\small\item\em Pure-\/virtual function that needs to be implemented to: \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTestSocket4TCPClient_a3d5c64f1cb81c5fb01f2cccd09da97bf}{
string {\bfseries \_\-sockid}}
\label{classTestSocket4TCPClient_a3d5c64f1cb81c5fb01f2cccd09da97bf}

\item 
\hypertarget{classTestSocket4TCPClient_ace96c035fd04909e0bc94de483404961}{
bool {\bfseries \_\-closed}}
\label{classTestSocket4TCPClient_ace96c035fd04909e0bc94de483404961}

\item 
\hypertarget{classTestSocket4TCPClient_a68675c1023f7bd5d7e5d10a92b49f8e0}{
bool {\bfseries \_\-connected}}
\label{classTestSocket4TCPClient_a68675c1023f7bd5d7e5d10a92b49f8e0}

\end{DoxyCompactItemize}


\subsection{Member Function Documentation}
\hypertarget{classTestSocket4TCPClient_a61bc65eea9752e114b3f3651244ee442}{
\index{TestSocket4TCPClient@{TestSocket4TCPClient}!bind\_\-connect@{bind\_\-connect}}
\index{bind\_\-connect@{bind\_\-connect}!TestSocket4TCPClient@{TestSocket4TCPClient}}
\subsubsection[{bind\_\-connect}]{\setlength{\rightskip}{0pt plus 5cm}bool TestSocket4TCPClient::bind\_\-connect (
\begin{DoxyParamCaption}
\item[{{\bf IPv4}}]{local\_\-addr, }
\item[{uint16\_\-t}]{local\_\-port, }
\item[{{\bf IPv4}}]{remote\_\-addr, }
\item[{uint16\_\-t}]{remote\_\-port}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classTestSocket4TCPClient_a61bc65eea9752e114b3f3651244ee442}


Bind to interface and port, and connect to remote address and port. 

Subsequently, if \hyperlink{protocolthe-p}{the} request is successful \_\-sockid is set to a valid socket identifier, and \_\-closed set to false. If unsuccessful \hyperlink{protocolthe-p}{the} number of xrl errors is bumped by one. \hypertarget{classTestSocket4TCPClient_a43ca91ac1a0e831207bb1e92bec604fe}{
\index{TestSocket4TCPClient@{TestSocket4TCPClient}!close@{close}}
\index{close@{close}!TestSocket4TCPClient@{TestSocket4TCPClient}}
\subsubsection[{close}]{\setlength{\rightskip}{0pt plus 5cm}bool TestSocket4TCPClient::close (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classTestSocket4TCPClient_a43ca91ac1a0e831207bb1e92bec604fe}


Request closure of \hyperlink{protocolthe-p}{the} client socket. 

On success \_\-sockid is cleared. On failure \hyperlink{protocolthe-p}{the} number xrl errors is bumped by one. \hypertarget{classTestSocket4TCPClient_aa06ae17be7b6de36a8c5162d7484738e}{
\index{TestSocket4TCPClient@{TestSocket4TCPClient}!send\_\-data@{send\_\-data}}
\index{send\_\-data@{send\_\-data}!TestSocket4TCPClient@{TestSocket4TCPClient}}
\subsubsection[{send\_\-data}]{\setlength{\rightskip}{0pt plus 5cm}bool TestSocket4TCPClient::send\_\-data (
\begin{DoxyParamCaption}
\item[{uint32\_\-t}]{bytes}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{classTestSocket4TCPClient_aa06ae17be7b6de36a8c5162d7484738e}


\hyperlink{structSend}{Send} data to \hyperlink{protocolthe-p}{the} server through \hyperlink{protocolthe-p}{the} client socket. 

For implementation, see \hyperlink{classTestSocket4TCP_a305ca089a2d858b34a78e1bb1036f280}{TestSocket4TCP::send\_\-data}. 

Implements \hyperlink{classTestSocket4TCP}{TestSocket4TCP}.

\hypertarget{classTestSocket4TCPClient_ae41f53b4adf76bc3c089aaa6374d5e9a}{
\index{TestSocket4TCPClient@{TestSocket4TCPClient}!socket4\_\-user\_\-0\_\-1\_\-disconnect\_\-event@{socket4\_\-user\_\-0\_\-1\_\-disconnect\_\-event}}
\index{socket4\_\-user\_\-0\_\-1\_\-disconnect\_\-event@{socket4\_\-user\_\-0\_\-1\_\-disconnect\_\-event}!TestSocket4TCPClient@{TestSocket4TCPClient}}
\subsubsection[{socket4\_\-user\_\-0\_\-1\_\-disconnect\_\-event}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XrlCmdError} TestSocket4TCPClient::socket4\_\-user\_\-0\_\-1\_\-disconnect\_\-event (
\begin{DoxyParamCaption}
\item[{const string \&}]{sockid}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, protected, virtual\mbox{]}}}}
\label{classTestSocket4TCPClient_ae41f53b4adf76bc3c089aaa6374d5e9a}


Pure-\/virtual function that needs to be implemented to: 

Method invoked by target implementing socket4/0.1 when \hyperlink{protocolthe-p}{the} peer has closed \hyperlink{protocolthe-p}{the} connection. It applies only to TCP sockets. Note that \hyperlink{protocolthe-p}{the} socket itself is left open and must be explicitly closed.


\begin{DoxyParams}{Parameters}
{\em sockid} & \hyperlink{protocolthe-p}{the} identifier associated with socket where \hyperlink{protocolthe-p}{the} event occurred. \\
\hline
\end{DoxyParams}


Implements \hyperlink{classTestSocket4TCP_a2c70f2d9e84bec869130f9f9433a400d}{TestSocket4TCP}.

\hypertarget{classTestSocket4TCPClient_a2b5bef7cbbc421d5df2be3b4ea7e9224}{
\index{TestSocket4TCPClient@{TestSocket4TCPClient}!socket4\_\-user\_\-0\_\-1\_\-error\_\-event@{socket4\_\-user\_\-0\_\-1\_\-error\_\-event}}
\index{socket4\_\-user\_\-0\_\-1\_\-error\_\-event@{socket4\_\-user\_\-0\_\-1\_\-error\_\-event}!TestSocket4TCPClient@{TestSocket4TCPClient}}
\subsubsection[{socket4\_\-user\_\-0\_\-1\_\-error\_\-event}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XrlCmdError} TestSocket4TCPClient::socket4\_\-user\_\-0\_\-1\_\-error\_\-event (
\begin{DoxyParamCaption}
\item[{const string \&}]{sockid, }
\item[{const string \&}]{error, }
\item[{const bool \&}]{fatal}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, protected, virtual\mbox{]}}}}
\label{classTestSocket4TCPClient_a2b5bef7cbbc421d5df2be3b4ea7e9224}


Pure-\/virtual function that needs to be implemented to: 

Method invoked by target implementing socket4/0.1 when an error occurs.


\begin{DoxyParams}{Parameters}
{\em sockid} & \hyperlink{protocolthe-p}{the} identifier associated with socket where \hyperlink{protocolthe-p}{the} event occurred.\\
\hline
{\em error} & a textual description of \hyperlink{protocolthe-p}{the} error.\\
\hline
{\em fatal} & indication of whether socket is shutdown because of error. \\
\hline
\end{DoxyParams}


Implements \hyperlink{classTestSocket4TCP_a6a2c0add6108cadc2a777659c137a817}{TestSocket4TCP}.

\hypertarget{classTestSocket4TCPClient_ad342fca78cb53e4186269b3f63e11595}{
\index{TestSocket4TCPClient@{TestSocket4TCPClient}!socket4\_\-user\_\-0\_\-1\_\-inbound\_\-connect\_\-event@{socket4\_\-user\_\-0\_\-1\_\-inbound\_\-connect\_\-event}}
\index{socket4\_\-user\_\-0\_\-1\_\-inbound\_\-connect\_\-event@{socket4\_\-user\_\-0\_\-1\_\-inbound\_\-connect\_\-event}!TestSocket4TCPClient@{TestSocket4TCPClient}}
\subsubsection[{socket4\_\-user\_\-0\_\-1\_\-inbound\_\-connect\_\-event}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XrlCmdError} TestSocket4TCPClient::socket4\_\-user\_\-0\_\-1\_\-inbound\_\-connect\_\-event (
\begin{DoxyParamCaption}
\item[{const string \&}]{sockid, }
\item[{const {\bf IPv4} \&}]{src\_\-host, }
\item[{const uint32\_\-t \&}]{src\_\-port, }
\item[{const string \&}]{new\_\-sockid, }
\item[{bool \&}]{accept}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, protected, virtual\mbox{]}}}}
\label{classTestSocket4TCPClient_ad342fca78cb53e4186269b3f63e11595}


Pure-\/virtual function that needs to be implemented to: 

Method invoked by target implementing socket4/0.1 when a connection request is received from an \hyperlink{classIPv4}{IPv4} source. It applies only to TCP sockets.


\begin{DoxyParams}{Parameters}
{\em sockid} & \hyperlink{protocolthe-p}{the} identifier associated with socket where \hyperlink{protocolthe-p}{the} event occurred.\\
\hline
{\em src\_\-host} & \hyperlink{protocolthe-p}{the} connecting host.\\
\hline
{\em src\_\-port} & \hyperlink{protocolthe-p}{the} connecting IP port.\\
\hline
{\em new\_\-sockid} & \hyperlink{protocolthe-p}{the} identifier associated with \hyperlink{protocolthe-p}{the} new socket that has been created to handle \hyperlink{protocolthe-p}{the} new connection.\\
\hline
{\em accept} & if true, \hyperlink{protocolthe-p}{the} connection request has been accepted, otherwise it has been rejected. \\
\hline
\end{DoxyParams}


Implements \hyperlink{classTestSocket4TCP_a3fa2fe3daf7b750380d6a5d686e5a2e8}{TestSocket4TCP}.

\hypertarget{classTestSocket4TCPClient_a665fa3ba46b63bfe4ef16a921ba58af8}{
\index{TestSocket4TCPClient@{TestSocket4TCPClient}!socket4\_\-user\_\-0\_\-1\_\-outgoing\_\-connect\_\-event@{socket4\_\-user\_\-0\_\-1\_\-outgoing\_\-connect\_\-event}}
\index{socket4\_\-user\_\-0\_\-1\_\-outgoing\_\-connect\_\-event@{socket4\_\-user\_\-0\_\-1\_\-outgoing\_\-connect\_\-event}!TestSocket4TCPClient@{TestSocket4TCPClient}}
\subsubsection[{socket4\_\-user\_\-0\_\-1\_\-outgoing\_\-connect\_\-event}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XrlCmdError} TestSocket4TCPClient::socket4\_\-user\_\-0\_\-1\_\-outgoing\_\-connect\_\-event (
\begin{DoxyParamCaption}
\item[{const string \&}]{sockid}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, protected, virtual\mbox{]}}}}
\label{classTestSocket4TCPClient_a665fa3ba46b63bfe4ef16a921ba58af8}


Pure-\/virtual function that needs to be implemented to: 

Method invoked by target implementing socket4/0.1 when an outgoing connection request originated by \hyperlink{protocolthe-p}{the} local host is completed. It applies only to TCP sockets. Note that if \hyperlink{protocolthe-p}{the} connection failed, \hyperlink{protocolthe-p}{the} error\_\-event will be dispatched instead.


\begin{DoxyParams}{Parameters}
{\em sockid} & \hyperlink{protocolthe-p}{the} identifier associated with socket where \hyperlink{protocolthe-p}{the} event occurred. \\
\hline
\end{DoxyParams}


Implements \hyperlink{classTestSocket4TCP_ac6799d268b1dbbfd3712711ebfc6254c}{TestSocket4TCP}.

\hypertarget{classTestSocket4TCPClient_a291e191fa0ef4c836894eb20b1c232d2}{
\index{TestSocket4TCPClient@{TestSocket4TCPClient}!socket4\_\-user\_\-0\_\-1\_\-recv\_\-event@{socket4\_\-user\_\-0\_\-1\_\-recv\_\-event}}
\index{socket4\_\-user\_\-0\_\-1\_\-recv\_\-event@{socket4\_\-user\_\-0\_\-1\_\-recv\_\-event}!TestSocket4TCPClient@{TestSocket4TCPClient}}
\subsubsection[{socket4\_\-user\_\-0\_\-1\_\-recv\_\-event}]{\setlength{\rightskip}{0pt plus 5cm}{\bf XrlCmdError} TestSocket4TCPClient::socket4\_\-user\_\-0\_\-1\_\-recv\_\-event (
\begin{DoxyParamCaption}
\item[{const string \&}]{sockid, }
\item[{const string \&}]{if\_\-name, }
\item[{const string \&}]{vif\_\-name, }
\item[{const {\bf IPv4} \&}]{src\_\-host, }
\item[{const uint32\_\-t \&}]{src\_\-port, }
\item[{const vector$<$ uint8\_\-t $>$ \&}]{data}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, protected, virtual\mbox{]}}}}
\label{classTestSocket4TCPClient_a291e191fa0ef4c836894eb20b1c232d2}


Pure-\/virtual function that needs to be implemented to: 

Method invoked by target implementing socket4/0.1 when a packet arrives from an \hyperlink{classIPv4}{IPv4} source.


\begin{DoxyParams}{Parameters}
{\em sockid} & \hyperlink{protocolthe-p}{the} identifier associated with socket where \hyperlink{protocolthe-p}{the} event occurred.\\
\hline
{\em if\_\-name} & \hyperlink{protocolthe-p}{the} interface name \hyperlink{protocolthe-p}{the} packet arrived on, if known. If unknown, then it is an empty string.\\
\hline
{\em vif\_\-name} & \hyperlink{protocolthe-p}{the} vif name \hyperlink{protocolthe-p}{the} packet arrived on, if known. If unknown, then it is an empty string.\\
\hline
{\em src\_\-host} & \hyperlink{protocolthe-p}{the} originating host.\\
\hline
{\em src\_\-port} & \hyperlink{protocolthe-p}{the} originating IP port.\\
\hline
{\em data} & \hyperlink{protocolthe-p}{the} data received. \\
\hline
\end{DoxyParams}


Implements \hyperlink{classTestSocket4TCP_a845bc535792885ac183e4c1d60266955}{TestSocket4TCP}.

\hypertarget{classTestSocket4TCPClient_a0b21affae82fb502000cda7b89b2baba}{
\index{TestSocket4TCPClient@{TestSocket4TCPClient}!start\_\-sending@{start\_\-sending}}
\index{start\_\-sending@{start\_\-sending}!TestSocket4TCPClient@{TestSocket4TCPClient}}
\subsubsection[{start\_\-sending}]{\setlength{\rightskip}{0pt plus 5cm}void TestSocket4TCPClient::start\_\-sending (
\begin{DoxyParamCaption}
\item[{uint32\_\-t}]{bytes, }
\item[{uint32\_\-t}]{ipg\_\-ms}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{classTestSocket4TCPClient_a0b21affae82fb502000cda7b89b2baba}


Start sending packets. 


\begin{DoxyParams}{Parameters}
{\em bytes} & size of each packet. \\
\hline
{\em ipg\_\-ms} & interpacket gap in milliseconds. \\
\hline
\end{DoxyParams}


Implements \hyperlink{classTestSocket4TCP}{TestSocket4TCP}.



The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/fea/tests/test\_\-xrl\_\-sockets4\_\-tcp.cc\end{DoxyCompactItemize}
