xorp

IoTcpUdpDummy Class Reference

A base class for I/O TCP/UDP Dummy communication. More...

#include <io_tcpudp_dummy.hh>

Inheritance diagram for IoTcpUdpDummy:
IoTcpUdp

List of all members.

Public Member Functions

 IoTcpUdpDummy (FeaDataPlaneManager &fea_data_plane_manager, const IfTree &iftree, int family, bool is_tcp)
 Constructor for a given address family.
virtual ~IoTcpUdpDummy ()
 Virtual destructor.
int start (string &error_msg)
 Start operation.
int stop (string &error_msg)
 Stop operation.
int tcp_open (string &error_msg)
 Open a TCP socket.
int udp_open (string &error_msg)
 Open an UDP socket.
int tcp_open_and_bind (const IPvX &local_addr, uint16_t local_port, string &error_msg)
 Create a bound TCP socket.
int udp_open_and_bind (const IPvX &local_addr, uint16_t local_port, const string &local_dev, int reuse, string &error_msg)
 Create a bound UDP socket.
int udp_open_bind_join (const IPvX &local_addr, uint16_t local_port, const IPvX &mcast_addr, uint8_t ttl, bool reuse, string &error_msg)
 Create a bound UDP multicast socket.
int tcp_open_bind_connect (const IPvX &local_addr, uint16_t local_port, const IPvX &remote_addr, uint16_t remote_port, string &error_msg)
 Create a bound and connected TCP socket.
int udp_open_bind_connect (const IPvX &local_addr, uint16_t local_port, const IPvX &remote_addr, uint16_t remote_port, string &error_msg)
 Create a bound and connected UDP socket.
int udp_open_bind_broadcast (const string &ifname, const string &vifname, uint16_t local_port, uint16_t remote_port, bool reuse, bool limited, bool connected, string &error_msg)
 Create a bound, and optionally connected, UDP broadcast socket.
int bind (const IPvX &local_addr, uint16_t local_port, string &error_msg)
 Bind a socket.
int udp_join_group (const IPvX &mcast_addr, const IPvX &join_if_addr, string &error_msg)
 Join multicast group on already bound socket.
int udp_leave_group (const IPvX &mcast_addr, const IPvX &leave_if_addr, string &error_msg)
 Leave multicast group on already bound socket.
int close (string &error_msg)
 Close socket.
int tcp_listen (uint32_t backlog, string &error_msg)
 Listen for inbound connections on socket.
int udp_enable_recv (string &error_msg)
 Enable a UDP socket for datagram reception.
int send (const vector< uint8_t > &data, string &error_msg)
 Send data on socket.
int send_to (const IPvX &remote_addr, uint16_t remote_port, const vector< uint8_t > &data, string &error_msg)
 Send data on socket to a given destination.
int send_from_multicast_if (const IPvX &group_addr, uint16_t group_port, const IPvX &ifaddr, const vector< uint8_t > &data, string &error_msg)
 Send data on socket to a given multicast group from a given interface.
int set_socket_option (const string &optname, uint32_t optval, string &error_msg)
 Set a named socket option with an integer value.
int set_socket_option (const string &optname, const string &optval, string &error_msg)
 Set a named socket option with a text value.
int accept_connection (bool is_accepted, string &error_msg)
 Accept or reject a pending connection.

Detailed Description

A base class for I/O TCP/UDP Dummy communication.


Constructor & Destructor Documentation

IoTcpUdpDummy::IoTcpUdpDummy ( FeaDataPlaneManager fea_data_plane_manager,
const IfTree iftree,
int  family,
bool  is_tcp 
)

Constructor for a given address family.

Parameters:
fea_data_plane_managerthe corresponding data plane manager (FeaDataPlaneManager).
iftreethe interface tree to use.
familythe address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively).
is_tcpif true this is TCP entry, otherwise UDP.

Member Function Documentation

int IoTcpUdpDummy::accept_connection ( bool  is_accepted,
string &  error_msg 
) [virtual]

Accept or reject a pending connection.

Parameters:
is_acceptedif true, the connection is accepted, otherwise is rejected.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::bind ( const IPvX local_addr,
uint16_t  local_port,
string &  error_msg 
) [virtual]

Bind a socket.

Parameters:
local_addrthe interface address to bind socket to.
local_portthe port to bind socket to.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::close ( string &  error_msg) [virtual]

Close socket.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::send ( const vector< uint8_t > &  data,
string &  error_msg 
) [virtual]

Send data on socket.

Parameters:
datablock of data to be sent.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::send_from_multicast_if ( const IPvX group_addr,
uint16_t  group_port,
const IPvX ifaddr,
const vector< uint8_t > &  data,
string &  error_msg 
) [virtual]

Send data on socket to a given multicast group from a given interface.

Parameters:
group_addrdestination address for data.
group_portdestination port for data.
ifaddrinterface address.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::send_to ( const IPvX remote_addr,
uint16_t  remote_port,
const vector< uint8_t > &  data,
string &  error_msg 
) [virtual]

Send data on socket to a given destination.

The packet is not routed as the forwarding engine sending the packet may not have access to the full routing table.

Parameters:
remote_addrdestination address for data.
remote_portdestination port for data.
datablock of data to be sent.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::set_socket_option ( const string &  optname,
const string &  optval,
string &  error_msg 
) [virtual]

Set a named socket option with a text value.

Parameters:
optnamename of option to be set. All values are ignored.
optvalvalue of option to be set.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::set_socket_option ( const string &  optname,
uint32_t  optval,
string &  error_msg 
) [virtual]

Set a named socket option with an integer value.

Parameters:
optnamename of option to be set. Valid values are: "onesbcast" (IPv4 only) "receive_broadcast" (IPv4 only) "reuseport" "send_broadcast" (IPv4 only) "tos" (IPv4 only) "ttl" "multicast_loopback" "multicast_ttl"
optvalvalue of option to be set. If value is logically boolean then zero represents false and any non-zero value true.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::start ( string &  error_msg) [virtual]

Start operation.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::stop ( string &  error_msg) [virtual]

Stop operation.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::tcp_listen ( uint32_t  backlog,
string &  error_msg 
) [virtual]

Listen for inbound connections on socket.

When a connection request is received the socket creator will receive notification.

Parameters:
backlogthe maximum number of pending connections.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::tcp_open ( string &  error_msg) [virtual]

Open a TCP socket.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::tcp_open_and_bind ( const IPvX local_addr,
uint16_t  local_port,
string &  error_msg 
) [virtual]

Create a bound TCP socket.

Parameters:
local_addrthe interface address to bind socket to.
local_portthe port to bind socket to.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::tcp_open_bind_connect ( const IPvX local_addr,
uint16_t  local_port,
const IPvX remote_addr,
uint16_t  remote_port,
string &  error_msg 
) [virtual]

Create a bound and connected TCP socket.

Parameters:
local_addrthe interface address to bind socket to.
local_portthe port to bind socket to.
remote_addrthe address to connect to.
remote_portthe remote port to connect to.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::udp_enable_recv ( string &  error_msg) [virtual]

Enable a UDP socket for datagram reception.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::udp_join_group ( const IPvX mcast_addr,
const IPvX join_if_addr,
string &  error_msg 
) [virtual]

Join multicast group on already bound socket.

Parameters:
mcast_addrgroup to join.
join_if_addrinterface address to perform join on.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::udp_leave_group ( const IPvX mcast_addr,
const IPvX leave_if_addr,
string &  error_msg 
) [virtual]

Leave multicast group on already bound socket.

Parameters:
mcast_addrgroup to leave.
leave_if_addrinterface address to perform leave on.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::udp_open ( string &  error_msg) [virtual]

Open an UDP socket.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::udp_open_and_bind ( const IPvX local_addr,
uint16_t  local_port,
const string &  local_dev,
int  reuse,
string &  error_msg 
) [virtual]

Create a bound UDP socket.

Parameters:
local_addrthe interface address to bind socket to.
local_portthe port to bind socket to.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::udp_open_bind_broadcast ( const string &  ifname,
const string &  vifname,
uint16_t  local_port,
uint16_t  remote_port,
bool  reuse,
bool  limited,
bool  connected,
string &  error_msg 
) [virtual]

Create a bound, and optionally connected, UDP broadcast socket.

Parameters:
ifnamethe interface name to bind socket to.
vifnamethe vif to bind socket to.
local_portthe port to bind socket to.
remote_portthe remote port to connect to.
reuseallow other sockets to bind to same port.
limitedset the socket up for transmission to the limited broadcast address 255.255.255.255.
connectedconnect the socket for use with send() not sendto().
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::udp_open_bind_connect ( const IPvX local_addr,
uint16_t  local_port,
const IPvX remote_addr,
uint16_t  remote_port,
string &  error_msg 
) [virtual]

Create a bound and connected UDP socket.

Parameters:
local_addrthe interface address to bind socket to.
local_portthe port to bind socket to.
remote_addrthe address to connect to.
remote_portthe remote port to connect to.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.

int IoTcpUdpDummy::udp_open_bind_join ( const IPvX local_addr,
uint16_t  local_port,
const IPvX mcast_addr,
uint8_t  ttl,
bool  reuse,
string &  error_msg 
) [virtual]

Create a bound UDP multicast socket.

Parameters:
local_addrthe interface address to bind socket to.
local_portthe port to bind socket to.
mcast_addrthe multicast group address to join.
ttlthe TTL to use for this multicast socket.
reuseallow other sockets to bind to same multicast group.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements IoTcpUdp.


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