xorp

TestSocket4TCP Class Reference

Inheritance diagram for TestSocket4TCP:
XrlTestSocket4TargetBase TestSocket4TCPClient TestSocket4TCPServer

List of all members.

Public Member Functions

 TestSocket4TCP (EventLoop &e, const string &fea_target_name, IPv4 finder_host, uint16_t finder_port)
uint32_t bytes_received () const
uint32_t bytes_sent () const
uint32_t packets_received () const
uint32_t packets_sent () const
uint32_t xrl_errors () const
void stop_sending ()
 Stop sending packets.
bool send_data (string &sockid, uint32_t bytes)
 Send the specified number of bytes of data through the given socket.
virtual void start_sending (uint32_t bytes, uint32_t ipg_ms)=0

Protected Member Functions

virtual bool send_data (uint32_t bytes)=0
virtual void send_data_cb (const XrlError &e)=0
XrlCmdError common_0_1_get_target_name (string &name)
 Pure-virtual function that needs to be implemented to:
XrlCmdError common_0_1_get_version (string &version)
 Pure-virtual function that needs to be implemented to:
XrlCmdError common_0_1_get_status (uint32_t &status, string &reason)
 Pure-virtual function that needs to be implemented to:
XrlCmdError common_0_1_shutdown ()
 Pure-virtual function that needs to be implemented to:
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)=0
 Pure-virtual function that needs to be implemented to:
XrlCmdError 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)=0
 Pure-virtual function that needs to be implemented to:
XrlCmdError socket4_user_0_1_outgoing_connect_event (const string &sockid)=0
 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)=0
 Pure-virtual function that needs to be implemented to:
XrlCmdError socket4_user_0_1_disconnect_event (const string &sockid)=0
 Pure-virtual function that needs to be implemented to:

Protected Attributes

EventLoop_e
XrlRouter_r
string _fea_target_name
uint32_t _p_snd
uint32_t _p_rcv
uint32_t _b_snd
uint32_t _b_rcv
uint32_t _x_err
XorpTimer _t_snd

Member Function Documentation

XrlCmdError TestSocket4TCP::common_0_1_get_status ( uint32_t &  status,
string &  reason 
) [inline, protected, virtual]

Pure-virtual function that needs to be implemented to:

Get status of Xrl Target

Implements XrlTestSocket4TargetBase.

XrlCmdError TestSocket4TCP::common_0_1_get_target_name ( string &  name) [inline, protected, virtual]

Pure-virtual function that needs to be implemented to:

Get name of Xrl Target

Implements XrlTestSocket4TargetBase.

XrlCmdError TestSocket4TCP::common_0_1_get_version ( string &  version) [inline, protected, virtual]

Pure-virtual function that needs to be implemented to:

Get version string from Xrl Target

Implements XrlTestSocket4TargetBase.

XrlCmdError TestSocket4TCP::common_0_1_shutdown ( ) [inline, protected, virtual]

Pure-virtual function that needs to be implemented to:

Request clean shutdown of Xrl Target

Implements XrlTestSocket4TargetBase.

bool TestSocket4TCP::send_data ( string &  sockid,
uint32_t  bytes 
) [inline]

Send the specified number of bytes of data through the given socket.

On success, the number of sent bytes and packets is bumped up accordingly, and true is returned. On failure the number of xrl errors is bumped by one, and the sending timer stopped.

XrlCmdError TestSocket4TCP::socket4_user_0_1_disconnect_event ( const string &  sockid) [protected, pure 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 XrlTestSocket4TargetBase.

Implemented in TestSocket4TCPServer, and TestSocket4TCPClient.

XrlCmdError TestSocket4TCP::socket4_user_0_1_error_event ( const string &  sockid,
const string &  error,
const bool &  fatal 
) [protected, pure 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 XrlTestSocket4TargetBase.

Implemented in TestSocket4TCPServer, and TestSocket4TCPClient.

XrlCmdError TestSocket4TCP::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 
) [protected, pure 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 XrlTestSocket4TargetBase.

Implemented in TestSocket4TCPServer, and TestSocket4TCPClient.

XrlCmdError TestSocket4TCP::socket4_user_0_1_outgoing_connect_event ( const string &  sockid) [protected, pure 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 XrlTestSocket4TargetBase.

Implemented in TestSocket4TCPServer, and TestSocket4TCPClient.

XrlCmdError TestSocket4TCP::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 
) [protected, pure 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 XrlTestSocket4TargetBase.

Implemented in TestSocket4TCPServer, and TestSocket4TCPClient.


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