High level TAPI to work with sockets

Overview

Definition of test API for working with socket. More…

// global functions

rpc_tcp_state tapi_get_tcp_sock_state(struct rcf_rpc_server* pco, int s);
ssize_t tapi_sock_read_data(rcf_rpc_server* rpcs, int s, te_dbuf* read_data);
te_errno tapi_sock_raw_tcpv4_send(rcf_rpc_server* rpcs, rpc_iovec* iov, int iovlen, int ifindex, int raw_socket, bool remove_vlan_hdr);

// macros

#define TAPI_SOCK_SEND_FUNC_LIST
#define TEST_GET_SOCK_SEND_FUNC(_var_name)

Detailed Documentation

Definition of test API for working with socket.

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Global Functions

rpc_tcp_state tapi_get_tcp_sock_state(struct rcf_rpc_server* pco, int s)

Retrieve TCP state of a given socket.

Parameters:

pco

RPC server handle

s

Socket descriptor

Returns:

TCP socket state.

ssize_t tapi_sock_read_data(rcf_rpc_server* rpcs, int s, te_dbuf* read_data)

Read all the available data from a given socket and append it to a given te_dbuf.

Parameters:

rpcs

RPC server handle.

s

Socket.

read_data

Where to save read data.

Returns:

Length of read data on success or negative value in case of failure.

te_errno tapi_sock_raw_tcpv4_send(rcf_rpc_server* rpcs, rpc_iovec* iov, int iovlen, int ifindex, int raw_socket, bool remove_vlan_hdr)

Send a raw TCPv4 packet packet with full ethernet header.

The function uses an already opened raw socket. It should be created like this: rpc_socket(rpcs, RPC_AF_PACKET, RPC_SOCK_RAW, RPC_IPPROTO_RAW);

Parameters:

rpcs

RPC server handle.

iov

Data vector

iov_len

Actual data vector length

ifindex

Interface index to send packet

raw_socket

Raw socket for sending data

remove_vlan_hdr

Remove all VLAN headers if true

Returns:

Status code

Macros

#define TAPI_SOCK_SEND_FUNC_LIST

Transmitting functions list.