xorp

TestSocket4TCPClient Class Reference

Inheritance diagram for TestSocket4TCPClient:
TestSocket4TCP XrlTestSocket4TargetBase

List of all members.

Public Member Functions

 TestSocket4TCPClient (EventLoop &e, const string &fea_target_name, IPv4 finder_host, uint16_t finder_port)
bool closed () const
bool connected () const
bool bind_connect (IPv4 local_addr, uint16_t local_port, IPv4 remote_addr, uint16_t remote_port)
 Bind to interface and port, and connect to remote address and port.
bool close ()
 Request closure of the client socket.
bool send_data (uint32_t bytes)
 Send data to the server through the client socket.
void start_sending (uint32_t bytes, uint32_t ipg_ms)
 Start sending packets.

Protected Member Functions

void bind_connect_cb (const XrlError &e, const string *psockid)
void close_cb (const XrlError &e)
void send_data_cb (const XrlError &e)
XrlCmdError socket4_user_0_1_recv_event (const string &sockid, const string &if_name, const string &vif_name, const IPv4 &src_host, const uint32_t &src_port, const vector< uint8_t > &data)
 Pure-virtual function that needs to be implemented to:
XrlCmdError socket4_user_0_1_inbound_connect_event (const string &, const IPv4 &, const uint32_t &, const string &, bool &)
 Pure-virtual function that needs to be implemented to:
XrlCmdError socket4_user_0_1_outgoing_connect_event (const string &sockid)
 Pure-virtual function that needs to be implemented to:
XrlCmdError socket4_user_0_1_error_event (const string &sockid, const string &error, const bool &fatal)
 Pure-virtual function that needs to be implemented to:
XrlCmdError socket4_user_0_1_disconnect_event (const string &sockid)
 Pure-virtual function that needs to be implemented to:

Private Attributes

string _sockid
bool _closed
bool _connected

Member Function Documentation

bool TestSocket4TCPClient::bind_connect ( IPv4  local_addr,
uint16_t  local_port,
IPv4  remote_addr,
uint16_t  remote_port 
) [inline]

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

Subsequently, if the request is successful _sockid is set to a valid socket identifier, and _closed set to false. If unsuccessful the number of xrl errors is bumped by one.

bool TestSocket4TCPClient::close ( ) [inline]

Request closure of the client socket.

On success _sockid is cleared. On failure the number xrl errors is bumped by one.

bool TestSocket4TCPClient::send_data ( uint32_t  bytes) [inline, virtual]

Send data to the server through the client socket.

For implementation, see TestSocket4TCP::send_data.

Implements TestSocket4TCP.

XrlCmdError TestSocket4TCPClient::socket4_user_0_1_disconnect_event ( const string &  sockid) [inline, protected, virtual]

Pure-virtual function that needs to be implemented to:

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

Parameters:
sockidthe identifier associated with socket where the event occurred.

Implements TestSocket4TCP.

XrlCmdError TestSocket4TCPClient::socket4_user_0_1_error_event ( const string &  sockid,
const string &  error,
const bool &  fatal 
) [inline, protected, virtual]

Pure-virtual function that needs to be implemented to:

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

Parameters:
sockidthe identifier associated with socket where the event occurred.
errora textual description of the error.
fatalindication of whether socket is shutdown because of error.

Implements TestSocket4TCP.

XrlCmdError TestSocket4TCPClient::socket4_user_0_1_inbound_connect_event ( const string &  sockid,
const IPv4 src_host,
const uint32_t &  src_port,
const string &  new_sockid,
bool &  accept 
) [inline, protected, virtual]

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 IPv4 source. It applies only to TCP sockets.

Parameters:
sockidthe identifier associated with socket where the event occurred.
src_hostthe connecting host.
src_portthe connecting IP port.
new_sockidthe identifier associated with the new socket that has been created to handle the new connection.
acceptif true, the connection request has been accepted, otherwise it has been rejected.

Implements TestSocket4TCP.

XrlCmdError TestSocket4TCPClient::socket4_user_0_1_outgoing_connect_event ( const string &  sockid) [inline, protected, virtual]

Pure-virtual function that needs to be implemented to:

Method invoked by target implementing socket4/0.1 when an outgoing connection request originated by the local host is completed. It applies only to TCP sockets. Note that if the connection failed, the error_event will be dispatched instead.

Parameters:
sockidthe identifier associated with socket where the event occurred.

Implements TestSocket4TCP.

XrlCmdError TestSocket4TCPClient::socket4_user_0_1_recv_event ( const string &  sockid,
const string &  if_name,
const string &  vif_name,
const IPv4 src_host,
const uint32_t &  src_port,
const vector< uint8_t > &  data 
) [inline, protected, virtual]

Pure-virtual function that needs to be implemented to:

Method invoked by target implementing socket4/0.1 when a packet arrives from an IPv4 source.

Parameters:
sockidthe identifier associated with socket where the event occurred.
if_namethe interface name the packet arrived on, if known. If unknown, then it is an empty string.
vif_namethe vif name the packet arrived on, if known. If unknown, then it is an empty string.
src_hostthe originating host.
src_portthe originating IP port.
datathe data received.

Implements TestSocket4TCP.

void TestSocket4TCPClient::start_sending ( uint32_t  bytes,
uint32_t  ipg_ms 
) [inline, virtual]

Start sending packets.

Parameters:
bytessize of each packet.
ipg_msinterpacket gap in milliseconds.

Implements TestSocket4TCP.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations