:orphan: .. index:: pair: group; High level TAPI to work with sockets .. _doxid-group__ts__tapi__sockets: High level TAPI to work with sockets ==================================== .. toctree:: :hidden: Overview ~~~~~~~~ Definition of test API for working with socket. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block // global functions :ref:`rpc_tcp_state` :ref:`tapi_get_tcp_sock_state`(struct :ref:`rcf_rpc_server`* pco, int s); ssize_t :ref:`tapi_sock_read_data`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`te_dbuf`* read_data); :ref:`te_errno` :ref:`tapi_sock_raw_tcpv4_send`(:ref:`rcf_rpc_server`* rpcs, :ref:`rpc_iovec`* iov, int iovlen, int ifindex, int raw_socket, bool remove_vlan_hdr); // macros #define :ref:`TAPI_SOCK_SEND_FUNC_LIST` #define :target:`TEST_GET_SOCK_SEND_FUNC`(_var_name) .. _details-group__ts__tapi__sockets: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Definition of test API for working with socket. Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved. Global Functions ---------------- .. index:: pair: function; tapi_get_tcp_sock_state .. _doxid-group__ts__tapi__sockets_1ga3b2f87413faf8de02825c3ce8b88d767: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`rpc_tcp_state` tapi_get_tcp_sock_state(struct :ref:`rcf_rpc_server`* pco, int s) Retrieve TCP state of a given socket. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - pco - RPC server handle * - s - Socket descriptor .. rubric:: Returns: TCP socket state. .. index:: pair: function; tapi_sock_read_data .. _doxid-group__ts__tapi__sockets_1ga86fc6bd630a162220f6e23da3cf4e04c: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t tapi_sock_read_data(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`te_dbuf`* read_data) Read all the available data from a given socket and append it to a given :ref:`te_dbuf `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle. * - s - Socket. * - read_data - Where to save read data. .. rubric:: Returns: Length of read data on success or negative value in case of failure. .. index:: pair: function; tapi_sock_raw_tcpv4_send .. _doxid-group__ts__tapi__sockets_1gad7e292a8a183dc6afbee12d8808fb00f: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`te_errno` tapi_sock_raw_tcpv4_send(:ref:`rcf_rpc_server`* rpcs, :ref:`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); .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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`` .. rubric:: Returns: Status code Macros ------ .. index:: pair: define; TAPI_SOCK_SEND_FUNC_LIST .. _doxid-group__ts__tapi__sockets_1gae4508b0d3110fbafdb06ae2f26f9ef03: .. ref-code-block:: cpp :class: doxyrest-title-code-block #define TAPI_SOCK_SEND_FUNC_LIST Transmitting functions list.