:orphan: .. index:: pair: group; TAPI for socket API remote calls .. _doxid-group__te__lib__rpc__socket: TAPI for socket API remote calls ================================ .. toctree:: :hidden: enum_rpc_msg_flags_mode.rst enum_rpc_msghdr_field_mode.rst struct_rpc_mmsghdr.rst struct_rpc_msghdr.rst struct_rpc_tcp_info.rst union_rpc_sockopt_value.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block // typedefs typedef enum :ref:`rpc_msg_flags_mode` :ref:`rpc_msg_flags_mode`; typedef enum :ref:`rpc_msghdr_field_mode` :ref:`rpc_msghdr_field_mode`; typedef struct :ref:`rpc_msghdr` :ref:`rpc_msghdr`; typedef struct :ref:`rpc_tcp_info` :target:`rpc_tcp_info`; typedef union :ref:`rpc_sockopt_value` :ref:`rpc_sockopt_value`; // enums enum :ref:`rpc_msg_flags_mode`; enum :ref:`rpc_msghdr_field_mode`; // structs struct :ref:`rpc_mmsghdr`; struct :ref:`rpc_msghdr`; struct :ref:`rpc_tcp_info`; // unions union :ref:`rpc_sockopt_value`; // global functions static int :ref:`socket_domain_by_af`(int af); static :ref:`rpc_socket_domain` :ref:`rpc_socket_domain_by_af`(int af); static :ref:`rpc_socket_domain` :ref:`rpc_socket_domain_by_addr`(const struct sockaddr* addr); int :ref:`rpc_socket`(:ref:`rcf_rpc_server`* rpcs, :ref:`rpc_socket_domain` domain, :ref:`rpc_socket_type` type, :ref:`rpc_socket_proto` protocol); int :ref:`rpc_shutdown`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_shut_how` how); ssize_t :ref:`rpc_send`(:ref:`rcf_rpc_server`* rpcs, int s, const void* buf, size_t len, :ref:`rpc_send_recv_flags` flags); ssize_t :ref:`rpc_sendto`(:ref:`rcf_rpc_server`* rpcs, int s, const void* buf, size_t len, :ref:`rpc_send_recv_flags` flags, const struct sockaddr* to); ssize_t :target:`rpc_sendto_raw`(:ref:`rcf_rpc_server`* rpcs, int s, const void* buf, size_t len, :ref:`rpc_send_recv_flags` flags, const struct sockaddr* to, socklen_t tolen); ssize_t :ref:`rpc_recv_gen`(:ref:`rcf_rpc_server`* rpcs, int s, void* buf, size_t len, :ref:`rpc_send_recv_flags` flags, size_t rbuflen); static ssize_t :ref:`rpc_recv`(:ref:`rcf_rpc_server`* rpcs, int s, void* buf, size_t len, :ref:`rpc_send_recv_flags` flags); ssize_t :ref:`rpc_recvfrom_gen`(:ref:`rcf_rpc_server`* rpcs, int s, void* buf, size_t len, :ref:`rpc_send_recv_flags` flags, struct sockaddr* from, socklen_t* fromlen, size_t rbuflen, socklen_t rfrombuflen); static ssize_t :ref:`rpc_recvfrom`(:ref:`rcf_rpc_server`* rpcs, int s, void* buf, size_t len, :ref:`rpc_send_recv_flags` flags, struct sockaddr* from, socklen_t* fromlen); const char* :ref:`msghdr_rpc2str`(const :ref:`rpc_msghdr`* rpc_msg, :ref:`te_string`* str); const char* :ref:`mmsghdrs_rpc2str`(const struct :ref:`rpc_mmsghdr`* rpc_mmsgs, unsigned int num, :ref:`te_string`* str); struct cmsghdr* :ref:`rpc_cmsg_firsthdr`(:ref:`rpc_msghdr`* rpc_msg); struct cmsghdr* :ref:`rpc_cmsg_nxthdr`(:ref:`rpc_msghdr`* rpc_msg, struct cmsghdr* cmsg); static int :ref:`tapi_send_recv_flags_rand`(void); void :ref:`tapi_rpc_msghdr_msg_flags_init_check`(bool enable); ssize_t :ref:`rpc_sendmsg`(:ref:`rcf_rpc_server`* rpcs, int s, const struct :ref:`rpc_msghdr`* msg, :ref:`rpc_send_recv_flags` flags); ssize_t :ref:`rpc_recvmsg`(:ref:`rcf_rpc_server`* rpcs, int s, struct :ref:`rpc_msghdr`* msg, :ref:`rpc_send_recv_flags` flags); ssize_t :ref:`rpc_sendbuf_gen`(:ref:`rcf_rpc_server`* rpcs, int s, rpc_ptr buf, size_t buf_off, size_t len, :ref:`rpc_send_recv_flags` flags); static ssize_t :target:`rpc_sendbuf`(:ref:`rcf_rpc_server`* rpcs, int s, rpc_ptr buf, size_t len, :ref:`rpc_send_recv_flags` flags); static ssize_t :target:`rpc_sendbuf_off`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_ptr_off`* buf, size_t len, :ref:`rpc_send_recv_flags` flags); ssize_t :ref:`rpc_send_msg_more`(:ref:`rcf_rpc_server`* rpcs, int s, rpc_ptr buf, size_t first_len, size_t second_len); ssize_t :ref:`rpc_send_msg_more_ext`(:ref:`rcf_rpc_server`* rpcs, int s, rpc_ptr buf, size_t first_len, size_t second_len, tarpc_send_function first_func, tarpc_send_function second_func, bool set_nodelay); ssize_t :ref:`rpc_send_one_byte_many`(:ref:`rcf_rpc_server`* rpcs, int s, int duration); :ref:`tarpc_ssize_t` :ref:`rpc_recvbuf_gen`(:ref:`rcf_rpc_server`* rpcs, int fd, rpc_ptr buf, size_t buf_off, size_t count, :ref:`rpc_send_recv_flags` flags); static :ref:`tarpc_ssize_t` :target:`rpc_recvbuf`(:ref:`rcf_rpc_server`* rpcs, int fd, rpc_ptr buf, size_t count, :ref:`rpc_send_recv_flags` flags); static :ref:`tarpc_ssize_t` :target:`rpc_recvbuf_off`(:ref:`rcf_rpc_server`* rpcs, int fd, :ref:`rpc_ptr_off`* buf, size_t count, :ref:`rpc_send_recv_flags` flags); int :ref:`rpc_cmsg_data_parse_ip_pktinfo`(:ref:`rcf_rpc_server`* rpcs, uint8_t* data, uint32_t data_len, struct in_addr* ipi_spec_dst, struct in_addr* ipi_addr, int* ipi_ifindex); int :ref:`rpc_bind`(:ref:`rcf_rpc_server`* rpcs, int s, const struct sockaddr* my_addr); int :ref:`rpc_bind_len`(:ref:`rcf_rpc_server`* rpcs, int s, const struct sockaddr* my_addr, socklen_t addrlen); int :target:`rpc_bind_raw`(:ref:`rcf_rpc_server`* rpcs, int s, const struct sockaddr* my_addr, socklen_t addrlen); int :ref:`rpc_check_port_is_free`(:ref:`rcf_rpc_server`* rpcs, uint16_t port); int :ref:`rpc_connect`(:ref:`rcf_rpc_server`* rpcs, int s, const struct sockaddr* addr); int :target:`rpc_connect_raw`(:ref:`rcf_rpc_server`* rpcs, int s, const struct sockaddr* addr, socklen_t addrlen); int :ref:`rpc_listen`(:ref:`rcf_rpc_server`* rpcs, int s, int backlog); int :ref:`rpc_accept_gen`(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* addr, socklen_t* addrlen, socklen_t raddrlen); int :ref:`rpc_accept4_gen`(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* addr, socklen_t* addrlen, socklen_t raddrlen, int flags); static int :ref:`rpc_accept`(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* addr, socklen_t* addrlen); static int :ref:`rpc_accept4`(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* addr, socklen_t* addrlen, int flags); int :ref:`rpc_getsockopt_gen`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_socklevel` level, :ref:`rpc_sockopt` optname, void* optval, void* raw_optval, socklen_t* raw_optlen, socklen_t raw_roptlen); static int :target:`rpc_getsockopt_raw`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, void* raw_optval, socklen_t* raw_optlen); static int :ref:`rpc_getsockopt`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, void* optval); int :ref:`rpc_setsockopt_gen`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_socklevel` level, :ref:`rpc_sockopt` optname, const void* optval, const void* raw_optval, socklen_t raw_optlen, socklen_t raw_roptlen); static int :ref:`rpc_setsockopt_raw`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, const void* raw_optval, socklen_t raw_optlen); static int :ref:`rpc_setsockopt`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, const void* optval); static int :ref:`rpc_setsockopt_int`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, int optval); int :ref:`rpc_setsockopt_check_int`(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, int optval); int :ref:`rpc_getsockname_gen`(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* name, socklen_t* namelen, socklen_t rnamelen); static int :ref:`rpc_getsockname`(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* name, socklen_t* namelen); int :ref:`rpc_getpeername_gen`(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* name, socklen_t* namelen, socklen_t rnamelen); static int :ref:`rpc_getpeername`(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* name, socklen_t* namelen); int :ref:`rpc_recvmmsg_alt`(:ref:`rcf_rpc_server`* rpcs, int fd, struct :ref:`rpc_mmsghdr`* mmsg, unsigned int vlen, :ref:`rpc_send_recv_flags` flags, struct :ref:`tarpc_timespec`* timeout); int :ref:`rpc_sendmmsg_alt`(:ref:`rcf_rpc_server`* rpcs, int fd, struct :ref:`rpc_mmsghdr`* mmsg, unsigned int vlen, :ref:`rpc_send_recv_flags` flags); int :target:`rpc_socket_connect_close`(:ref:`rcf_rpc_server`* rpcs, :ref:`rpc_socket_domain` domain, const struct sockaddr* addr, uint32_t time2run); int :target:`rpc_socket_listen_close`(:ref:`rcf_rpc_server`* rpcs, :ref:`rpc_socket_domain` domain, const struct sockaddr* addr, uint32_t time2run); void :ref:`tapi_rpc_provoke_arp_resolution`(:ref:`rcf_rpc_server`* rpcs, const struct sockaddr* addr); // macros #define :ref:`RPC_CMSG_FIRSTHDR`(_rpc_msg) #define :ref:`RPC_CMSG_NXTHDR`(_rpc_msg, _cmsg) .. _details-group__te__lib__rpc__socket: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Typedefs -------- .. index:: pair: typedef; rpc_msg_flags_mode .. _doxid-group__te__lib__rpc__socket_1ga29f3cf1f0e41d6e92e94f36e923be84f: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef enum :ref:`rpc_msg_flags_mode` rpc_msg_flags_mode Flags set which determines behavior of **msg_flags** processing. In general default value is ``0`` in this case a random value is passed in msg_flags field and then returned value will be checked: * for recvmsg()-like functions returned value has to be zero unless the cases when some flags are really expected; * for sendmsg()-like functions the field must be unchanged. .. index:: pair: typedef; rpc_msghdr_field_mode .. _doxid-group__te__lib__rpc__socket_1ga2ae90e308a81701a82cdf80a56f89beb: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef enum :ref:`rpc_msghdr_field_mode` rpc_msghdr_field_mode Processing mode for :ref:`rpc_msghdr ` fields .. index:: pair: typedef; rpc_msghdr .. _doxid-group__te__lib__rpc__socket_1gacad8ee7c6d71a3d6747780d60a63828f: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct :ref:`rpc_msghdr` rpc_msghdr Store information about message .. index:: pair: typedef; rpc_sockopt_value .. _doxid-group__te__lib__rpc__socket_1ga71bb713cc6112e2b48000c155a633b27: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef union :ref:`rpc_sockopt_value` rpc_sockopt_value Storage sufficient for any fixed-size socket option value Global Functions ---------------- .. index:: pair: function; socket_domain_by_af .. _doxid-group__te__lib__rpc__socket_1ga378f22d51df5d589f4a1b8142af8396b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int socket_domain_by_af(int af) Get socket domain native for the address family. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - af - An address family .. rubric:: Returns: Domain .. index:: pair: function; rpc_socket_domain_by_af .. _doxid-group__te__lib__rpc__socket_1gad80fca665134588a77df41974c76a614: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`rpc_socket_domain` rpc_socket_domain_by_af(int af) Get RPC socket domain native for the address family. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - af - An address family .. rubric:: Returns: RPC domain .. index:: pair: function; rpc_socket_domain_by_addr .. _doxid-group__te__lib__rpc__socket_1gad36393adb7e109dbd39688b30889cd09: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`rpc_socket_domain` rpc_socket_domain_by_addr(const struct sockaddr* addr) Get RPC socket domain native for the address. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - addr - An address .. rubric:: Returns: RPC domain .. index:: pair: function; rpc_socket .. _doxid-group__te__lib__rpc__socket_1ga177bde5d0e8dfe41e430473ca3b38a1c: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_socket(:ref:`rcf_rpc_server`* rpcs, :ref:`rpc_socket_domain` domain, :ref:`rpc_socket_type` type, :ref:`rpc_socket_proto` protocol) Create an endpoint for communication on the RPC server side. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - domain - communication domain. Select the protocol family used for communication supported protocol families are difined in ``te_rpc_sys_socket.h`` * - type - defines the semantic of communication. Current defined types can be found in ``te_rpc_sys_socket.h`` * - protocol - specifies the protocol to be used. If **protocol** is set to RPC_PROTO_DEF, the system selects the default protocol number for the socket domain and type specified. .. rubric:: Returns: The socket descriptor to be used. Otherwise -1 is returned when error occurred .. index:: pair: function; rpc_shutdown .. _doxid-group__te__lib__rpc__socket_1gac40863008e934787523f2652f856d137: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_shutdown(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_shut_how` how) End communication on socket descriptor **s** in one or both directions on RPC server side. For more information about **shutdown()** see its corresponding manual page .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - how - specifies the shutdown condition and can be specified in the following ways: * RPC_SHUT_RD receiving not allowed anymore * RPC_SHUT_WR sending not allowed anymore * RPC_SHUT_RDWR receiving and sending not allowed anymore .. rubric:: Returns: 0 on success -1 on error and error code is set appropriately to **RPC_XXX** where **XXX** - standard errno for **shutdown()** .. index:: pair: function; rpc_send .. _doxid-group__te__lib__rpc__socket_1ga2ff6808d9aa00f7712665462542c6f76: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_send(:ref:`rcf_rpc_server`* rpcs, int s, const void* buf, size_t len, :ref:`rpc_send_recv_flags` flags) Transmit a message to socket descriptor s on RPC server side. See **send()** manual page for more information .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - buf - pointer to buffer containing the message to be sent * - len - length of the message in bytes * - flags - bitwise OR of zero or more of the following flags: * MSG_OOB send out-of-band data if supported. * MSG_DONTWAIT enable non-blocking operation. See **send()** manual page for more information about all supported flags. .. rubric:: Returns: number of bytes actually sent, otherwise -1. .. index:: pair: function; rpc_sendto .. _doxid-group__te__lib__rpc__socket_1gaa531a113b093222ea0e11a9bcd819fa6: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_sendto(:ref:`rcf_rpc_server`* rpcs, int s, const void* buf, size_t len, :ref:`rpc_send_recv_flags` flags, const struct sockaddr* to) Transmit a message to descriptor **s**. This operation takes place on RPC server side. See **sendto()** manual page for more information about flags and error code set when this routine failed. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - buf - pointer to buffer containing message to be sent * - len - message length in bytes * - flags - bitwise OR of zero or more of the following flags: * RPC_MSG_OOB send out-of-band data if supported. * RPC_MSG_DONTWAIT enable non-blocking operation. Other supported flags can be found in ``te_rpc_sys_socket.h``. * - to - target address .. rubric:: Returns: Number of bytes sent, otherwise -1. .. index:: pair: function; rpc_recv_gen .. _doxid-group__te__lib__rpc__socket_1ga609a06fcb6a721932a984e46834c2494: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_recv_gen(:ref:`rcf_rpc_server`* rpcs, int s, void* buf, size_t len, :ref:`rpc_send_recv_flags` flags, size_t rbuflen) Generic routine for receiving messages and store them in the buffer **buf** of length **len**. This operation takes place on RPC server side. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - buf - pointer to buffer which store received messages * - len - buffer length passed to recv() * - flags - bitwise OR of zero or more of the following flags: * RPC_MSG_OOB send out-of-band data if supported. * RPC_MSG_DONTWAIT enable non-blocking operation. Other supported flags can be found in ``te_rpc_sys_socket.h`` * - rbuflen - size of the buffer **buf** .. rubric:: Returns: Number of bytes received, otherwise -1 .. index:: pair: function; rpc_recv .. _doxid-group__te__lib__rpc__socket_1ga6c43ba0d24ca25c5bd46ff81bf55a900: .. ref-code-block:: cpp :class: doxyrest-title-code-block static ssize_t rpc_recv(:ref:`rcf_rpc_server`* rpcs, int s, void* buf, size_t len, :ref:`rpc_send_recv_flags` flags) Receive messages and store them in the buffer **buf** of length **len**. This operation takes place on RPC server side. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - buf - pointer to buffer which store received messages * - len - size of the buffer **buf** * - flags - bitwise OR of zero or more of the following flags: * RPC_MSG_OOB send out-of-band data if supported. * RPC_MSG_DONTWAIT enable non-blocking operation. Other supported flags can be found in ``te_rpc_sys_socket.h`` .. rubric:: Returns: Number of bytes received, otherwise -1 when error occurred .. index:: pair: function; rpc_recvfrom_gen .. _doxid-group__te__lib__rpc__socket_1ga158ce0d4807101d44c5a4edff3cbd6a1: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_recvfrom_gen(:ref:`rcf_rpc_server`* rpcs, int s, void* buf, size_t len, :ref:`rpc_send_recv_flags` flags, struct sockaddr* from, socklen_t* fromlen, size_t rbuflen, socklen_t rfrombuflen) Generic routine for receiving data from a connected or non-connected socket. This operation takes place on RPC server side. Behavior of this routine depends on specified RPC operation: ``RCF_RPC_CALL`` - return immediately without waiting for remote procedure to complete (non-blocking call). ``RCF_RPC_WAIT`` - wait for non-blocking call to complete ``RCF_RPC_CALL_WAIT`` - wait for remote procedure to complete before returning (blocking call) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - Socket descriptor * - buf - pointer to buffer which store received data * - len - size of the buffer **buf** * - flags - bitwise OR of zero or more of the following flags: * RPC_MSG_OOB send out-of-band data if supported. * RPC_MSG_DONTWAIT enable non-blocking operation. Other supported flags can be found in ``te_rpc_sys_socket.h`` * - from - pointer to source address of the message or NULL (OUT) * - fromlen - size of source address **from** * - rbuflen - number of bytes to be received. * - rfrombuflen - size of source address **from** (if not NULL) .. rubric:: Returns: Number of bytes received, otherwise -1 .. index:: pair: function; rpc_recvfrom .. _doxid-group__te__lib__rpc__socket_1ga915c579d8637292814841bb1c89544e9: .. ref-code-block:: cpp :class: doxyrest-title-code-block static ssize_t rpc_recvfrom(:ref:`rcf_rpc_server`* rpcs, int s, void* buf, size_t len, :ref:`rpc_send_recv_flags` flags, struct sockaddr* from, socklen_t* fromlen) Receive data from a connected or non-connected socket. This operation takes place on RPC server side. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - Socket descriptor * - buf - pointer to buffer which store received data * - len - size of the buffer **buf** * - flags - bitwise OR of zero or more of the following flags: * RPC_MSG_OOB send out-of-band data if supported. * RPC_MSG_DONTWAIT enable non-blocking operation. Other supported flags can be found in ``te_rpc_sys_socket.h`` * - from - pointer to source address of the message or NULL (OUT) * - fromlen - size of source address **from**. .. rubric:: Returns: Number of bytes received, otherwise -1 .. index:: pair: function; msghdr_rpc2str .. _doxid-group__te__lib__rpc__socket_1ga2bea166442509cffb56b3f6a06fd2559: .. ref-code-block:: cpp :class: doxyrest-title-code-block const char* msghdr_rpc2str(const :ref:`rpc_msghdr`* rpc_msg, :ref:`te_string`* str) Append :ref:`rpc_msghdr ` string representation to string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpc_msg - Pointer to :ref:`rpc_msghdr ` structure. * - str - Pointer to :ref:`te_string `. .. rubric:: Returns: Pointer to updated character string. .. index:: pair: function; mmsghdrs_rpc2str .. _doxid-group__te__lib__rpc__socket_1gaee77b399a57d8182db761e7a19ba8095: .. ref-code-block:: cpp :class: doxyrest-title-code-block const char* mmsghdrs_rpc2str(const struct :ref:`rpc_mmsghdr`* rpc_mmsgs, unsigned int num, :ref:`te_string`* str) Append string representation of array of :ref:`rpc_mmsghdr ` structures to string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpc_mmsgs - Pointer to array of :ref:`rpc_mmsghdr ` structures. * - num - Number of elements in the array. * - str - Pointer to :ref:`te_string `. .. rubric:: Returns: Pointer to updated character string. .. index:: pair: function; rpc_cmsg_firsthdr .. _doxid-group__te__lib__rpc__socket_1gad13010ac2e6c2b70795991a8ff69d412: .. ref-code-block:: cpp :class: doxyrest-title-code-block struct cmsghdr* rpc_cmsg_firsthdr(:ref:`rpc_msghdr`* rpc_msg) Get the first cmsghdr from control data stored in :ref:`rpc_msghdr `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpc_msg - Pointer to :ref:`rpc_msghdr ` structure. .. rubric:: Returns: Pointer to the first cmsghdr. .. index:: pair: function; rpc_cmsg_nxthdr .. _doxid-group__te__lib__rpc__socket_1ga3450d7a1d118dc4f8c08a85b1c13822e: .. ref-code-block:: cpp :class: doxyrest-title-code-block struct cmsghdr* rpc_cmsg_nxthdr(:ref:`rpc_msghdr`* rpc_msg, struct cmsghdr* cmsg) Get the next cmsghdr from control data stored in :ref:`rpc_msghdr `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpc_msg - Pointer to :ref:`rpc_msghdr ` structure. * - cmsg - Pointer to the current cmsghdr structure. .. rubric:: Returns: Pointer to the next cmsghdr. .. index:: pair: function; tapi_send_recv_flags_rand .. _doxid-group__te__lib__rpc__socket_1ga6484cf14a522e619a458bb9d328d9bf7: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int tapi_send_recv_flags_rand(void) Generate a random value in range [0, RPC_MSG_UNKNOWN) for **msg_flags** initialization. .. index:: pair: function; tapi_rpc_msghdr_msg_flags_init_check .. _doxid-group__te__lib__rpc__socket_1gae17c65ec586cca46d7c7f5f87d1e56a2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void tapi_rpc_msghdr_msg_flags_init_check(bool enable) Enable/disable :ref:`rpc_msghdr.msg_flags ` flags value initialization and check inside RPCs. The function can be used in the test body to control behavior. It does not require any rollback actions. By default the flags value is initialized and checked in all RPCs where **rpc_msg** is used. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - enable - Set ``true`` to enable init and check .. index:: pair: function; rpc_sendmsg .. _doxid-group__te__lib__rpc__socket_1ga28da4f7c4d5d49f7a4f3666f9e1edba6: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_sendmsg(:ref:`rcf_rpc_server`* rpcs, int s, const struct :ref:`rpc_msghdr`* msg, :ref:`rpc_send_recv_flags` flags) Send message to a connected or non-connected socket. This operation takes place on RPC server side. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - msg - pointer to a :ref:`rpc_msghdr ` structure that hold the message to be sent * - flags - bitwise OR of zero or more of the following flags: * **RPC_MSG_OOB** send out-of-band data if supported. * **RPC_MSG_DONTWAIT** enable non-blocking operation. * **RPC_MSG_PEEK** do not remove data from the queue. * **RPC_MSG_DONTROUTE** send to directly connected network. * **RPC_MSG_WAITALL** block until full request is specified. * **RPC_MSG_NOSIGNAL** turn off raising of SIGPIPE. * **RPC_MSG_TRUNC** return the real length of the packet. * **RPC_MSG_CTRUNC** control data lost before delivery. * **RPC_MSG_ERRQUEUE** queued errors should be received from the socket error queue. * **RPC_MSG_MCAST** datagram was received as a link-layer multicast. * **RPC_MSG_BCAST** datagram was received as a link-layer broadcast. .. rubric:: Returns: Length of message, otherwise -1 is returned when an error occurred .. index:: pair: function; rpc_recvmsg .. _doxid-group__te__lib__rpc__socket_1ga5b052864240be48ac55caf942c6498ee: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_recvmsg(:ref:`rcf_rpc_server`* rpcs, int s, struct :ref:`rpc_msghdr`* msg, :ref:`rpc_send_recv_flags` flags) Receive data from connected or non-connected socket This operation takes place on RPC server side. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - msg - pointer to a :ref:`rpc_msghdr ` structure that hold the received message * - flags - bitwise OR of zero or more of the flags; see **rpc_recv** for more information .. rubric:: Returns: Length of received data, otherwise -1 when an error occurred. .. index:: pair: function; rpc_sendbuf_gen .. _doxid-group__te__lib__rpc__socket_1ga78c6dbd08c1c0158a1eb0a4ee848df27: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_sendbuf_gen(:ref:`rcf_rpc_server`* rpcs, int s, rpc_ptr buf, size_t buf_off, size_t len, :ref:`rpc_send_recv_flags` flags) Transmit a message to socket descriptor s on RPC server side. This operation takes place on RPC server side and buffer is stored on the same side. See **send()** manual page for more information .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - buf - RPC pointer to buffer containing the message to be sent * - buf_off - offset in the buffer above * - len - length of the message in bytes * - flags - bitwise OR of zero or more of the flags; see **rpc_send** for more information .. rubric:: Returns: number of bytes actually sent, otherwise -1. .. index:: pair: function; rpc_send_msg_more .. _doxid-group__te__lib__rpc__socket_1ga3b49b6ecaaf16edaf29f01d34bfaae15: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_send_msg_more(:ref:`rcf_rpc_server`* rpcs, int s, rpc_ptr buf, size_t first_len, size_t second_len) Call send() two times to send two data portions, first time - with ``MSG_MORE`` flag, the second time - without it. See **send()** manual page for more information .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - Socket descriptor * - buf - RPC pointer to buffer containing data to be sent * - first_len - Length of the first portion of data (to be sent with ``MSG_MORE``) * - second_len - Length of the second portion of data (to be sent without ``MSG_MORE``) .. rubric:: Returns: On success, number of bytes actually sent, otherwise ``-1``. .. index:: pair: function; rpc_send_msg_more_ext .. _doxid-group__te__lib__rpc__socket_1ga0005ef09733dcb7fe736012388d32ea2: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_send_msg_more_ext(:ref:`rcf_rpc_server`* rpcs, int s, rpc_ptr buf, size_t first_len, size_t second_len, tarpc_send_function first_func, tarpc_send_function second_func, bool set_nodelay) Call a sending function two times to send two data portions, the first time - with ``MSG_MORE`` flag, the second time - without it. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle. * - s - Socket descriptor. * - buf - RPC pointer to buffer containing data to be sent. * - first_len - Length of the first portion of data (to be sent with ``MSG_MORE``). * - second_len - Length of the second portion of data (to be sent without ``MSG_MORE``). * - first_func - Sending function for the first data portion. * - second_func - Sending function for the second data portion. * - set_nodelay - If ``true``, set ``TCP_NODELAY`` socket option after sending the first data portion. .. rubric:: Returns: On success, number of bytes actually sent, otherwise ``-1``. .. index:: pair: function; rpc_send_one_byte_many .. _doxid-group__te__lib__rpc__socket_1gad2d8cda8339785fe3a162b129edb3512: .. ref-code-block:: cpp :class: doxyrest-title-code-block ssize_t rpc_send_one_byte_many(:ref:`rcf_rpc_server`* rpcs, int s, int duration) Transmit many 1-byte messages to socket descriptor **s** on RPC server side by using send(``MSG_DONTWAIT``) calls. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - duration - Duration of the loop (in seconds) .. rubric:: Returns: On succes, number of bytes actually sent, otherwise -1. .. index:: pair: function; rpc_recvbuf_gen .. _doxid-group__te__lib__rpc__socket_1gaa7ff956efa58d28e6babb2e188b8b4f5: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`tarpc_ssize_t` rpc_recvbuf_gen(:ref:`rcf_rpc_server`* rpcs, int fd, rpc_ptr buf, size_t buf_off, size_t count, :ref:`rpc_send_recv_flags` flags) Receive messages and store them in the buffer **buf** of length **len**. This operation takes place on RPC server side and buffer is stored on the same side. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - fd - socket descriptor * - buf - RPC pointer to buffer which store received messages * - buf_off - size of the buffer **buf** * - flags - bitwise OR of zero or more of the following flags: * RPC_MSG_OOB send out-of-band data if supported. * RPC_MSG_DONTWAIT enable non-blocking operation. Other supported flags can be found in ``te_rpc_sys_socket.h`` .. rubric:: Returns: Number of bytes received, otherwise -1 when error occurred .. index:: pair: function; rpc_cmsg_data_parse_ip_pktinfo .. _doxid-group__te__lib__rpc__socket_1ga6954831ad34a552b714e8025bbf1a8dc: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_cmsg_data_parse_ip_pktinfo(:ref:`rcf_rpc_server`* rpcs, uint8_t* data, uint32_t data_len, struct in_addr* ipi_spec_dst, struct in_addr* ipi_addr, int* ipi_ifindex) Parse TA-dependent in_pktinfo structure type data returned in msg_control data field of :ref:`rpc_msghdr ` during :ref:`rpc_recvmsg() ` call in case when IP_PKTINFO option is enabled on socket. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - data - msg_control data * - data_len - msg_control data length * - ipi_spec_dst - ipi_spec_dst value of in_pktinfo type data (OUT) * - ipi_addr - ipi_addr value of in_pktinfo type data (OUT) * - ipi_ifindex - ipi_ifindex value of in_pktinfo type data (OUT) .. rubric:: Returns: Status code .. index:: pair: function; rpc_bind .. _doxid-group__te__lib__rpc__socket_1gab6be386c2e91c5cf21ee2276aaafa5c5: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_bind(:ref:`rcf_rpc_server`* rpcs, int s, const struct sockaddr* my_addr) Assign a name to an unnamed socket. When o socket is created, it exists in an address family, but it does not have a name assigned to it. Servers use **bind()** to associate themselves with a well-known port. This operation takes place on RPC server side. See **bind** manual page for more infrormation. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - my_addr - pointer to a **sockaddr** structure .. rubric:: Returns: 0 on success or -1 on failure .. index:: pair: function; rpc_bind_len .. _doxid-group__te__lib__rpc__socket_1ga285e2553c49b5571e10a967b16ed697a: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_bind_len(:ref:`rcf_rpc_server`* rpcs, int s, const struct sockaddr* my_addr, socklen_t addrlen) The same as :ref:`rpc_bind() `, but there is *addrlen* parameter. It is used to specify length to be passed to bind(). .. index:: pair: function; rpc_check_port_is_free .. _doxid-group__te__lib__rpc__socket_1ga7e7432627bcb13ee88637656f130f402: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_check_port_is_free(:ref:`rcf_rpc_server`* rpcs, uint16_t port) Check that given ``port`` is free on the given ``pco``. .. index:: pair: function; rpc_connect .. _doxid-group__te__lib__rpc__socket_1ga01c8cfeb6ee0f92d6406c9cdeb288933: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_connect(:ref:`rcf_rpc_server`* rpcs, int s, const struct sockaddr* addr) Attempt to associate a socket descriptor **s** with a peer process at address **addr**. This operation takes place on RPC server side. See **connect** manual page for more information .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - addr - peer address to which the socket has to be connected .. rubric:: Returns: 0 on success or -1 on failure .. index:: pair: function; rpc_listen .. _doxid-group__te__lib__rpc__socket_1ga4900ebdb05baf7a6cb61afb3eda3bbd5: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_listen(:ref:`rcf_rpc_server`* rpcs, int s, int backlog) Try to listen for incoming connections for connection oriented sockets This operation takes place on RPC server side. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - listening socket descriptor * - backlog - maximum number of connections waiting to be accepted .. rubric:: Returns: 0 on success or -1 on failure .. index:: pair: function; rpc_accept_gen .. _doxid-group__te__lib__rpc__socket_1ga96b412aec1d09f62f52538957ad2b60b: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_accept_gen(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* addr, socklen_t* addrlen, socklen_t raddrlen) This generic routine extract the first connection request of the queue of pending connections, allocate a new descriptor for the connected socket. This operation takes place on RPC server side. The behavior of this routine depends on specified RPC operation: ``RCF_RPC_CALL`` - return immediately without waiting for remote procedure to complete (non-blocking call). ``RCF_RPC_WAIT`` - wait for non-blocking call to complete ``RCF_RPC_CALL_WAIT`` - wait for remote procedure to complete before returning (blocking call) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - listening socket descriptor * - addr - pointer to a sockaddr structure * - addrlen - pointer to size of structure pointed by **addr**. On return contain the actual size of the returned in **addr** address * - raddrlen - real size of **addr** .. rubric:: Returns: Socket for new connection or -1 .. index:: pair: function; rpc_accept4_gen .. _doxid-group__te__lib__rpc__socket_1ga2572e3cdc345edee894ea6eeb6b3f686: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_accept4_gen(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* addr, socklen_t* addrlen, socklen_t raddrlen, int flags) This function does the same thing as rpc_gen_accept() but also take flags parameter (where SOCK_CLOEXEC and/or SOCK_NONBLOCK flags can be set). This operation takes place on RPC server side. The behavior of this routine depends on specified RPC operation: ``RCF_RPC_CALL`` - return immediately without waiting for remote procedure to complete (non-blocking call). ``RCF_RPC_WAIT`` - wait for non-blocking call to complete ``RCF_RPC_CALL_WAIT`` - wait for remote procedure to complete before returning (blocking call) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - listening socket descriptor * - addr - pointer to a sockaddr structure * - addrlen - pointer to size of structure pointed by **addr**. On return contain the actual size of the returned in **addr** address * - raddrlen - real size of **addr** * - flags - RPC_SOCK_NONBCLOCK, RPC_SOCK_CLOEXEC flags can be set .. rubric:: Returns: Socket for new connection or -1 .. index:: pair: function; rpc_accept .. _doxid-group__te__lib__rpc__socket_1ga70c46c69ea4ca4be7b5ae309e656437e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int rpc_accept(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* addr, socklen_t* addrlen) Extract the first connection request of the queue of pending connections, allocate a new descriptor for the connected socket This operation takes place on RPC server side. The behavior of this routine depends on specified RPC operation: ``RCF_RPC_CALL`` - return immediately without waiting for remote procedure to complete (non-blocking call). ``RCF_RPC_WAIT`` - wait for non-blocking call to complete ``RCF_RPC_CALL_WAIT`` - wait for remote procedure to complete before returning (blocking call) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - listening socket descriptor * - addr - pointer to a sockaddr structure * - addrlen - contain size of structure pointed by **addr**. On return contain the actual size of the returned in **addr** address .. rubric:: Returns: Socket for new connection or -1 .. index:: pair: function; rpc_accept4 .. _doxid-group__te__lib__rpc__socket_1gaece2d76d73af2b49115f7ec2cfde48fa: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int rpc_accept4(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* addr, socklen_t* addrlen, int flags) This function does the same thing as rpc_gen_accept() but also take flags parameter (where SOCK_CLOEXEC and/or SOCK_NONBLOCK flags can be set). This operation takes place on RPC server side. The behavior of this routine depends on specified RPC operation: ``RCF_RPC_CALL`` - return immediately without waiting for remote procedure to complete (non-blocking call). ``RCF_RPC_WAIT`` - wait for non-blocking call to complete ``RCF_RPC_CALL_WAIT`` - wait for remote procedure to complete before returning (blocking call) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - listening socket descriptor * - addr - pointer to a sockaddr structure * - addrlen - contain size of structure pointed by **addr**. On return contain the actual size of the returned in **addr** address * - flags - RPC_SOCK_NONBLOCK and/or RPC_SOCK_CLOEXEC .. rubric:: Returns: Socket for new connection or -1 .. index:: pair: function; rpc_getsockopt_gen .. _doxid-group__te__lib__rpc__socket_1ga9656872134097ffc2e418bed1535ec7f: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_getsockopt_gen(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_socklevel` level, :ref:`rpc_sockopt` optname, void* optval, void* raw_optval, socklen_t* raw_optlen, socklen_t raw_roptlen) This generic routine gets options associated with a socket. This operation takes place on RPC server side. For more information about supported option level, see ``te_rpc_sys_socket.h``. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - level - protocol level at which the option resides. Following values can be specified: * **RPC_SOL_SOCKET** socket level * **RPC_SOL_IP** IPPROTO_IP level * **RPC_SOL_IPV6** IPPROTO_IPV6 level * **RPC_SOL_TCP** IPPROTO_TCP level * - optname - option name * - optval - pointer to a buffer containing the value associated with the selected option. * - raw_optlen - initially points to the length of supplied buffer. On return contain the actual size of the buffer. * - raw_roptlen - maximal length of the buffer or zero .. rubric:: Returns: 0 on success or -1 on failure .. index:: pair: function; rpc_getsockopt .. _doxid-group__te__lib__rpc__socket_1ga650bd08ecba8d476de310f24d1c06175: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int rpc_getsockopt(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, void* optval) Query options associated with a socket. This operation takes place on RPC server side. The function should be used for fixed-size options when valid option level is required. RPC socket option name is unambiguously mapped to socket option level (see :ref:`rpc_sockopt2level() `). For more information about supported option level, see ``te_rpc_sys_socket.h``. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - Socket descriptor * - optname - Option name * - optval - Location for option value value (size of location depends on option name and assumed to be sufficient) .. rubric:: Returns: 0 on success or -1 on failure .. rubric:: See also: :ref:`rpc_getsockopt_gen() ` .. index:: pair: function; rpc_setsockopt_gen .. _doxid-group__te__lib__rpc__socket_1gaf52799eed0bb7d37c463c41462a35c15: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_setsockopt_gen(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_socklevel` level, :ref:`rpc_sockopt` optname, const void* optval, const void* raw_optval, socklen_t raw_optlen, socklen_t raw_roptlen) Set option on socket opened on RPC server. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - Socket descriptor * - level - Protocol level at which the option resides * - optname - Option name * - optval - Pointer to option value to be set or NULL (length is defined by option name) * - raw_optval - Pointer to option value as sequence of bytes (if *optval* is not NULL, *raw_optval* goes after binary representation of *optval*) * - raw_optlen - Size of the *raw_optval* specified in call * - raw_roptlen - Real size of the *raw_optval* .. rubric:: Returns: 0 on success or -1 on failure .. rubric:: See also: :ref:`rpc_setsockopt() `, :ref:`rpc_setsockopt_raw() ` .. index:: pair: function; rpc_setsockopt_raw .. _doxid-group__te__lib__rpc__socket_1ga4ca7bcb022eaf01c8594c50c4a4cdd9b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int rpc_setsockopt_raw(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, const void* raw_optval, socklen_t raw_optlen) Set option on socket opened on RPC server using raw option value representation. See :ref:`rpc_setsockopt_gen() ` for parameters description. *level* is derived from *optname* using :ref:`rpc_sockopt2level() ` function. .. rubric:: Returns: 0 on success or -1 on failure .. rubric:: See also: :ref:`rpc_setsockopt_gen() ` .. index:: pair: function; rpc_setsockopt .. _doxid-group__te__lib__rpc__socket_1ga88ea4c24883e17a9d1710f479b3e2a39: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int rpc_setsockopt(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, const void* optval) Set option on socket opened on RPC server using convered value only. See :ref:`rpc_setsockopt_gen() ` for parameters description. *level* is derived from *optname* using :ref:`rpc_sockopt2level() ` function. *raw_optval* and *raw_optlen* are passed as ``NULL`` and ``0`` correspondingly. .. rubric:: Returns: 0 on success or -1 on failure .. rubric:: See also: :ref:`rpc_setsockopt_gen() ` .. index:: pair: function; rpc_setsockopt_int .. _doxid-group__te__lib__rpc__socket_1ga95b2b430d12a37f62529ada0178ce84e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int rpc_setsockopt_int(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, int optval) Wrapper function to set int socket option. See :ref:`rpc_setsockopt_gen() ` for parameters description. *level* is derived from *optname* using :ref:`rpc_sockopt2level() ` function. *raw_optval* and *raw_optlen* are passed as ``NULL`` and ``0`` correspondingly. .. rubric:: Returns: Status code .. rubric:: See also: :ref:`rpc_setsockopt_gen() ` .. index:: pair: function; rpc_setsockopt_check_int .. _doxid-group__te__lib__rpc__socket_1ga7283a3654f99b8c7e74f09438ca537ec: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_setsockopt_check_int(:ref:`rcf_rpc_server`* rpcs, int s, :ref:`rpc_sockopt` optname, int optval) Wrapper function to set int socket option with reading and checking new value. See :ref:`rpc_setsockopt_gen() ` for parameters description. *level* is derived from *optname* using :ref:`rpc_sockopt2level() ` function. *raw_optval* and *raw_optlen* are passed as ``NULL`` and ``0`` correspondingly. .. rubric:: Returns: Status code .. rubric:: See also: :ref:`rpc_setsockopt_gen() ` .. index:: pair: function; rpc_getsockname_gen .. _doxid-group__te__lib__rpc__socket_1gac0ab50d810b7f2661147ee4ae5cc80f3: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_getsockname_gen(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* name, socklen_t* namelen, socklen_t rnamelen) Query the current name of the specified socket on RPC server side, store this address in the **sockaddr** structure ponited by **name**, and store the length of this address to the object pointed by **namelen**. See **getsockname** manual page for more information .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - Socket descriptor whose name is requested * - name - pointer to a **sockaddr** structure that should contain the requested name * - namelen - pointer to the size of the **sockaddr** structure * - rnamelen - real size of the sockaddr structure .. rubric:: Returns: 0 on success, otherwise -1 is returned on failure .. index:: pair: function; rpc_getsockname .. _doxid-group__te__lib__rpc__socket_1ga9f0c7f4182aa1207ec3ec9cd67eed740: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int rpc_getsockname(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* name, socklen_t* namelen) Query the name associated with a specified socket. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - name - pointer to a **struct** sockaddr which on return contain the name of the socket. * - namelen - initially indicate the size of the parameter **name**. On return it contains the actual size of the socket name .. rubric:: Returns: 0 on success or -1 when failed. .. index:: pair: function; rpc_getpeername_gen .. _doxid-group__te__lib__rpc__socket_1ga2339d827400a15c4304fea95d0b82459: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_getpeername_gen(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* name, socklen_t* namelen, socklen_t rnamelen) Query the peer name of a specified socket on RPC server side, store this address in the **sockaddr** structure ponited by **name**, and store the length of this address to the object pointed by **namelen**. See **getpeername** manual page for more information .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - Socket descriptor whose peer name is requested * - name - pointer to a **sockaddr** structure that should contain the requested peer name * - namelen - pointer to the size of the **sockaddr** structure * - rnamelen - real size of the **sockaddr** structure .. rubric:: Returns: 0 on success, otherwise -1 is returned on failure .. index:: pair: function; rpc_getpeername .. _doxid-group__te__lib__rpc__socket_1gaf9b40e5ddcd4407522f61c4b08ebb37b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int rpc_getpeername(:ref:`rcf_rpc_server`* rpcs, int s, struct sockaddr* name, socklen_t* namelen) Query the peer name of a specified socket. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - s - socket descriptor * - name - pointer to a buffer which on return contains the name of the peer socket. * - namelen - Initially indicate the size of the parameter **name**. On return it contains the actual size of the socket name .. rubric:: Returns: 0 on success otherwise returns -1 on failure .. index:: pair: function; rpc_recvmmsg_alt .. _doxid-group__te__lib__rpc__socket_1gaaa94172cedbe015aba375664a7173b98: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_recvmmsg_alt(:ref:`rcf_rpc_server`* rpcs, int fd, struct :ref:`rpc_mmsghdr`* mmsg, unsigned int vlen, :ref:`rpc_send_recv_flags` flags, struct :ref:`tarpc_timespec`* timeout) Receive data from connected or non-connected socket This operation takes place on RPC server side. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - fd - file descriptor * - mmsg - array of :ref:`rpc_mmsghdr ` structures that holds the received messages * - vlen - length of mmsg array * - flags - bitwise OR of zero or more of the flags; see **rpc_recv** for more information * - timeout - Timeout for receiving .. rubric:: Returns: Number of received packets, otherwise -1 when an error occurred. .. index:: pair: function; rpc_sendmmsg_alt .. _doxid-group__te__lib__rpc__socket_1ga1b7c2f9037ed395c5ed242be346f3813: .. ref-code-block:: cpp :class: doxyrest-title-code-block int rpc_sendmmsg_alt(:ref:`rcf_rpc_server`* rpcs, int fd, struct :ref:`rpc_mmsghdr`* mmsg, unsigned int vlen, :ref:`rpc_send_recv_flags` flags) Send data from connected or non-connected socket with help of sendmmsg() function. This operation takes place on RPC server side. msg_len field of each message will be set to number of actually sent bytes .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle * - fd - file descriptor * - mmsg - array of :ref:`rpc_mmsghdr ` structures that holds the messages to be sent * - vlen - length of mmsg array * - flags - bitwise OR of zero or more of the flags; see **rpc_send** for more information .. rubric:: Returns: Number of sent packets, otherwise -1 when an error occurred. .. index:: pair: function; tapi_rpc_provoke_arp_resolution .. _doxid-group__te__lib__rpc__socket_1ga5eab295de21937b2d40baf04dc4417f2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void tapi_rpc_provoke_arp_resolution(:ref:`rcf_rpc_server`* rpcs, const struct sockaddr* addr) Send ICMPv4 or ICMPv6 ECHO request packet to ``addr`` to provoke ARP resolution (for IPv4) or neigbour discovery (for IPv6) from both sides. ICMP version depends on the ``addr`` family. The function jumps to **cleanup** in case of failure. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - rpcs - RPC server handle. * - addr - Destination address. Macros ------ .. index:: pair: define; RPC_CMSG_FIRSTHDR .. _doxid-group__te__lib__rpc__socket_1ga5d1d882723d53c1219736fdf57980ad2: .. ref-code-block:: cpp :class: doxyrest-title-code-block #define RPC_CMSG_FIRSTHDR(_rpc_msg) Get the first cmsghdr from control data stored in :ref:`rpc_msghdr `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - _rpc_msg - Pointer to :ref:`rpc_msghdr ` structure. .. index:: pair: define; RPC_CMSG_NXTHDR .. _doxid-group__te__lib__rpc__socket_1gad23575d89b3c88687b1fb863776caa4e: .. ref-code-block:: cpp :class: doxyrest-title-code-block #define RPC_CMSG_NXTHDR(_rpc_msg, _cmsg) Get the next cmsghdr from control data stored in :ref:`rpc_msghdr `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - _rpc_msg - Pointer to :ref:`rpc_msghdr ` structure. * - _cmsg - Pointer to the current cmsghdr structure.