Public Member Functions | Public Attributes | List of all members
eip::socket::TestSocket Class Reference

#include <test_socket.h>

Inheritance diagram for eip::socket::TestSocket:
Inheritance graph
[legend]

Public Member Functions

void clearTxBuffer ()
 
virtual void close ()
 
virtual void open (string hostname, string port)
 
virtual size_t receive (mutable_buffer buf)
 
virtual size_t send (const_buffer buf)
 
 TestSocket ()
 
 TestSocket (const_buffer rbuf)
 
- Public Member Functions inherited from eip::socket::Socket
virtual size_t send (const Serializable &msg)
 
virtual ~Socket ()
 

Public Attributes

string hostname
 Hostname given at open. More...
 
bool is_open
 Whether the socket has been opened. More...
 
string port
 Port given at open. More...
 
const_buffer rx_buffer
 Characters to return on calls to receive() More...
 
size_t rx_count
 Number of characters requested by client by calling receive() More...
 
unsigned char tx_buffer [4096]
 Characters passed in during send() More...
 
size_t tx_count
 Number of characters sent via send() More...
 

Detailed Description

Fake socket for testing

Definition at line 44 of file test_socket.h.

Constructor & Destructor Documentation

eip::socket::TestSocket::TestSocket ( )
inline

Definition at line 67 of file test_socket.h.

eip::socket::TestSocket::TestSocket ( const_buffer  rbuf)
inline

Definition at line 69 of file test_socket.h.

Member Function Documentation

void eip::socket::TestSocket::clearTxBuffer ( )
inline

Helper to clear out the TX buffer between tests

Definition at line 119 of file test_socket.h.

virtual void eip::socket::TestSocket::close ( )
inlinevirtual

Close the socket

Implements eip::socket::Socket.

Definition at line 86 of file test_socket.h.

virtual void eip::socket::TestSocket::open ( string  hostname,
string  port 
)
inlinevirtual

Open the socket to connect to the given hostname and port

Parameters
hostnameHostname to connect to
portName or number of port to connect to

Implements eip::socket::Socket.

Definition at line 76 of file test_socket.h.

virtual size_t eip::socket::TestSocket::receive ( mutable_buffer  buf)
inlinevirtual

Receive bytes from the socket

Parameters
bufBuffer into which to store received data
Returns
number of bytes read

Implements eip::socket::Socket.

Definition at line 108 of file test_socket.h.

virtual size_t eip::socket::TestSocket::send ( const_buffer  buf)
inlinevirtual

Send the contents of the buffer out the socket

Parameters
bufData to send out the socket
Returns
number of bytes written

Implements eip::socket::Socket.

Definition at line 96 of file test_socket.h.

Member Data Documentation

string eip::socket::TestSocket::hostname

Hostname given at open.

Definition at line 52 of file test_socket.h.

bool eip::socket::TestSocket::is_open

Whether the socket has been opened.

Definition at line 49 of file test_socket.h.

string eip::socket::TestSocket::port

Port given at open.

Definition at line 55 of file test_socket.h.

const_buffer eip::socket::TestSocket::rx_buffer

Characters to return on calls to receive()

Definition at line 63 of file test_socket.h.

size_t eip::socket::TestSocket::rx_count

Number of characters requested by client by calling receive()

Definition at line 65 of file test_socket.h.

unsigned char eip::socket::TestSocket::tx_buffer[4096]

Characters passed in during send()

Definition at line 58 of file test_socket.h.

size_t eip::socket::TestSocket::tx_count

Number of characters sent via send()

Definition at line 60 of file test_socket.h.


The documentation for this class was generated from the following file:


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Mon Jun 10 2019 14:00:16