Socket

Overview

Declarations of TAPI methods for raw-TCP CSAP. More…

// global functions

te_errno tapi_tcp_server_csap_create(const char* ta_name, int sid, const struct sockaddr* sa, csap_handle_t* tcp_csap);
te_errno tapi_tcp_client_csap_create(const char* ta_name, int sid, const struct sockaddr* loc, const struct sockaddr* rem, csap_handle_t* tcp_csap);
te_errno tapi_tcp_socket_csap_create(const char* ta_name, int sid, int socket, csap_handle_t* tcp_csap);
te_errno tapi_tcp_server_recv(const char* ta_name, int sid, csap_handle_t tcp_csap, unsigned int timeout, int* socket);
te_errno tapi_socket_recv(const char* ta_name, int sid, csap_handle_t csap, unsigned int timeout, csap_handle_t forward, bool exact, uint8_t* buf, size_t* length);
te_errno tapi_socket_send(const char* ta_name, int sid, csap_handle_t csap, uint8_t* buf, size_t length);
te_errno tapi_socket_csap_create(const char* ta_name, int sid, int type, const struct sockaddr* loc, const struct sockaddr* rem, csap_handle_t* csap);
te_errno tapi_udp_csap_create(const char* ta_name, int sid, const struct sockaddr* loc, const struct sockaddr* rem, csap_handle_t* udp_csap);

Detailed Documentation

Declarations of TAPI methods for raw-TCP CSAP.

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

Global Functions

te_errno tapi_tcp_server_csap_create(const char* ta_name, int sid, const struct sockaddr* sa, csap_handle_t* tcp_csap)

Creates ‘data.tcp.ip4’ CSAP, ‘server’ mode: listening for incoming connections.

Parameters:

ta_name

Test Agent name

sid

RCF SID

sa

Local address and port

tcp_csap

Location for the IPv4 CSAP handle (OUT)

Returns:

Status of the operation

te_errno tapi_tcp_client_csap_create(const char* ta_name, int sid, const struct sockaddr* loc, const struct sockaddr* rem, csap_handle_t* tcp_csap)

Creates ‘socket’ CSAP, ‘TCP client’ mode. Connects to remote TCP server.

Parameters:

ta_name

Test Agent name

sid

RCF SID

loc

Local address and port

rem

Remote address and port

tcp_csap

Location for the IPv4 CSAP handle (OUT)

Returns:

Status of the operation

te_errno tapi_tcp_socket_csap_create(const char* ta_name, int sid, int socket, csap_handle_t* tcp_csap)

Creates ‘data.tcp.ip4’ CSAP, ‘socket’ mode, over socket, accepted on TA from some ‘server’ CSAP.

Parameters:

ta_name

Test Agent name

sid

RCF SID

socket

socket fd on TA

tcp_csap

Location for the TCP CSAP handle (OUT)

Returns:

Status of the operation

te_errno tapi_tcp_server_recv(const char* ta_name, int sid, csap_handle_t tcp_csap, unsigned int timeout, int* socket)

Wait new one connection from ‘server’ TCP CSAP.

Parameters:

ta_name

Test Agent name

sid

RCF SID

tcp_csap

TCP CSAP handle

timeout

timeout in milliseconds

socket

location for accepted socket fd on TA (OUT)

Returns:

Status of the operation

te_errno tapi_socket_recv(const char* ta_name, int sid, csap_handle_t csap, unsigned int timeout, csap_handle_t forward, bool exact, uint8_t* buf, size_t* length)

Wait some data on connected (i.e. non-server) ‘socket’ CSAP.

CSAP can wait for any non-zero amount of bytes or for exactly specified number; use ‘exact’ argument to manage it.

For UDP socket parameter ‘exact’ is ignored, since UDP socket receives data by datagrams.

Parameters:

ta_name

Test Agent name

sid

RCF SID

tcp_csap

CSAP handle

timeout

timeout in milliseconds

forward

id of CSAP to which forward received messages, may be CSAP_INVALID_HANDLE for disabled forward

exact

boolean flag: whether CSAP have to wait all specified number of bytes or not

buf

location for received data, may be NULL if received data is not wanted on test (OUT)

length

location with/for buffer/data length (IN/OUT)

Returns:

Status of the operation

te_errno tapi_socket_send(const char* ta_name, int sid, csap_handle_t csap, uint8_t* buf, size_t length)

Send data via connected (non-server) ‘socket’ CSAP.

Parameters:

ta_name

Test Agent name

sid

RCF SID

tcp_csap

CSAP handle

buf

pointer to the data to be send

length

length of data

Returns:

Status of the operation

te_errno tapi_socket_csap_create(const char* ta_name, int sid, int type, const struct sockaddr* loc, const struct sockaddr* rem, csap_handle_t* csap)

Creates usual ‘socket’ CSAP of some network type.

Parameters:

ta_name

Test Agent name

sid

RCF SID

type

String, type of socket: should be either NDN_TAG_SOCKET_TYPE_UDP or NDN_TAG_SOCKET_TYPE_TCP_CLIENT.

loc

Local address and port

rem

Remote address and port

csap

Identifier of an SNMP CSAP (OUT)

Returns:

Zero on success or error code.

te_errno tapi_udp_csap_create(const char* ta_name, int sid, const struct sockaddr* loc, const struct sockaddr* rem, csap_handle_t* udp_csap)

Creates usual ‘socket’ CSAP of UDP type on specified Test Agent

Parameters:

ta_name

Test Agent name

sid

RCF SID

loc

Local address and port

rem

Remote address and port

udp_csap

Identifier of an SNMP CSAP (OUT)

Returns:

Zero on success or error code.