Portable interface#
Modules#
Enumerations#
iPerf socket IP protocol type definition enum
Typedefs#
iPerf socket IP protocol type definition enum
Socket address type definition wrapper.
Raw ip address byes.
iPerf time data type definition
iPerf timestamp millisecond data type deifinition
Variables#
Anyaddress constant.
Functions#
iPerf millisec delay
Get socket address.
Get IP address bytes from iPerf address structure.
Get port number of iperf address structure.
Get millisec timestamp.
Convert IPv4 and IPv6 addresses from binary to text form.
Convert addresses from text to binary form.
Join multicast group.
Leave multicast group.
iPerf host to network long
iPerf host to network short
Check network connection.
iPerf network to host long
iPerf network to host short
Init iPerf Network Interface.
Set iPerf socket address.
Set iPerf socket address family.
Set IP address bytes in iPerf address structure.
Set port in iperf address structure.
Accept a connection on a socket.
Bind a name to an iPerf socket.
Close socket.
Initiate a connection on a socket.
Create iPerf socket.
Get socket option.
Listen for connections on an iPerf socket.
Receive a message from a socket.
Receive messages from a socket.
Send a message on a socket,.
Send a message on a socket.
Set socket option.
Macros#
Assert socket address length macro function.
Size definition of IPv6 address.
Define network api ERROR value.
Enumeration Documentation#
sl_iperf_protocol#
sl_iperf_protocol
iPerf socket IP protocol type definition enum
Enumerator | |
---|---|
SL_IPERF_IPROTOV6_UDP | UDP IPv6 protocol. |
SL_IPERF_IPROTOV6_TCP | TCP IPv6 protocol. |
SL_IPERF_IPROTOV4_UDP | UDP IPv4 protocol. |
SL_IPERF_IPROTOV4_TCP | TCP IPv4 protocol. |
99
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
Typedef Documentation#
sl_iperf_protocol_t#
typedef enum sl_iperf_protocol sl_iperf_protocol_t
iPerf socket IP protocol type definition enum
108
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_addr_t#
typedef struct sl_iperf_socket_addr sl_iperf_socket_addr_t
Socket address type definition wrapper.
120
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_in6addr_t#
typedef struct sl_iperf_socket_in6addr sl_iperf_socket_in6addr_t
Raw ip address byes.
114
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_time_t#
typedef struct sl_iperf_time sl_iperf_time_t
iPerf time data type definition
96
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_ts_ms_t#
typedef uint64_t sl_iperf_ts_ms_t
iPerf timestamp millisecond data type deifinition
88
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
Variable Documentation#
sl_iperf_socket_inaddr_any#
const sl_iperf_socket_in6addr_t sl_iperf_socket_inaddr_any
Anyaddress constant.
134
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
Function Documentation#
sl_iperf_delay_ms#
void sl_iperf_delay_ms (const uint32_t ms)
iPerf millisec delay
[in] | ms | Millisec value |
Customizable delay function
375
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_get_socket_addr#
__STATIC_INLINE void sl_iperf_get_socket_addr (const sl_iperf_socket_addr_t *const src_addr, void *const dest_addr)
Get socket address.
[in] | src_addr | Source address (iPerf type) |
[inout] | dest_addr | Destination address (custom type) |
Create a full copy from iperf source address into the custom destination address.
438
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_get_socket_addr_ip#
void sl_iperf_get_socket_addr_ip (const sl_iperf_socket_addr_t *const addr, void *const ip)
Get IP address bytes from iPerf address structure.
[in] | addr | iPerf address |
[out] | ip | IP address destination buffer |
Getter function of IP address
321
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_get_socket_addr_port#
uint16_t sl_iperf_get_socket_addr_port (const sl_iperf_socket_addr_t *const addr)
Get port number of iperf address structure.
[in] | addr | iPerf address |
Getter function of port property Returns
uint16_t Port number
305
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_get_timestamp_ms#
sl_iperf_ts_ms_t sl_iperf_get_timestamp_ms (void )
Get millisec timestamp.
N/A |
Get CPU tick convert to millisec Returns
sl_iperf_ts_ms_t Timestamp in millisec
368
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_inet_ntop#
const char * sl_iperf_inet_ntop (const sl_iperf_socket_addr_t *const src_addr, char *const dst_str, const size_t size)
Convert IPv4 and IPv6 addresses from binary to text form.
[in] | src_addr | Source address in byte form |
[out] | dst_str | Destination buffer ptr |
[in] | size | Size of the destination buffer. |
Converts the network address structure src in the af address family into a character string. Returns
It returns a non-null pointer to dst. NULL is returned if there was an error
397
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_inet_pton#
int32_t sl_iperf_inet_pton (const char * src_str, sl_iperf_socket_addr_t *const dst_addr)
Convert addresses from text to binary form.
[in] | src_str | Source string |
[out] | dst_addr | Destination address pointer |
It converts the character string src into a network address structure. Returns
1 on succes, -1 on error (POSIX described the 0 value too)
384
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_join_multicast_group#
int32_t sl_iperf_join_multicast_group (const int32_t sockid, const sl_iperf_socket_addr_t *const multicast_addr)
Join multicast group.
[in] | sockid | Socket ID to join |
[in] | multicast_addr | Multicast groupt address |
Join socket to multicast group to get packets on group address Returns
int32_t
408
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_leave_multicast_group#
int32_t sl_iperf_leave_multicast_group (const int32_t sockid, const sl_iperf_socket_addr_t *const multicast_addr)
Leave multicast group.
[in] | sockid | Socket ID to join |
[in] | multicast_addr | Multicast groupt address |
Remove socket from multicast group Returns
int32_t
418
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_network_htonl#
uint32_t sl_iperf_network_htonl (uint32_t val)
iPerf host to network long
[in] | val | Value |
htonl implementation for iPerf Returns
uint32_t Converted value
353
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_network_htons#
uint16_t sl_iperf_network_htons (uint16_t val)
iPerf host to network short
[in] | val | Value |
htons implementation for iPerf Returns
uint16_t Converted value
337
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_network_is_connected#
bool sl_iperf_network_is_connected (void )
Check network connection.
N/A |
Checking the connection status. Returns
true Network is connected
false Network is NOT connected
329
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_network_ntohl#
uint32_t sl_iperf_network_ntohl (uint32_t val)
iPerf network to host long
[in] | val | Value |
ntohl implementatino for iPerf Returns
uint32_t Converted value
361
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_network_ntohs#
uint16_t sl_iperf_network_ntohs (uint16_t val)
iPerf network to host short
[in] | val | Value |
ntohs implementation for iPerf Returns
uint16_t Converted value
345
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_nw_interface_init#
void sl_iperf_nw_interface_init (void )
Init iPerf Network Interface.
N/A |
Initialize network interface
144
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_set_socket_addr#
__STATIC_INLINE void sl_iperf_set_socket_addr (sl_iperf_socket_addr_t *const dest_addr, const void *const src_addr)
Set iPerf socket address.
[inout] | dest_addr | Destination address (custom type) |
[in] | src_addr | Source address (iPerf type) |
Cerate a full copy of custom source address to the destination iperf address.
427
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_set_socket_addr_family#
void sl_iperf_set_socket_addr_family (sl_iperf_socket_addr_t *const addr)
Set iPerf socket address family.
[out] | addr | Socket address structure |
Set address family in socket address structure
289
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_set_socket_addr_ip#
void sl_iperf_set_socket_addr_ip (sl_iperf_socket_addr_t *const addr, const void *const ip)
Set IP address bytes in iPerf address structure.
[inout] | addr | iPerf address |
[in] | ip | IP address source buffer |
Setter function of IP address
313
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_set_socket_addr_port#
void sl_iperf_set_socket_addr_port (sl_iperf_socket_addr_t *const addr, const uint16_t port)
Set port in iperf address structure.
[inout] | addr | iPerf address |
[out] | port | Port number |
Setter function of port property
297
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_accept#
int32_t sl_iperf_socket_accept (int32_t sockid, sl_iperf_socket_addr_t * addr)
Accept a connection on a socket.
[in] | sockid | socket id |
[inout] | addr | Is filled in with the address of the peer (remote) socket In Wi-SUN case, it shouldn't be NULL ptr, but for external sockets should be. |
It is used with connection-based socket types (TCP). It extracts the first connection request on the queue of pending connections for the listening socket. Returns
On success, return with the socket id for accepted socket, on error -1 is returned.
196
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_bind#
int32_t sl_iperf_socket_bind (int32_t sockid, const sl_iperf_socket_addr_t * addr)
Bind a name to an iPerf socket.
[in] | sockid | socket id |
[in] | addr | address structure ptr |
Assigns the address specified by addr to the socket referred to by the socket id. It is normally necessary to assign a local address using bind() before a SOCK_STREAM socket may receive connections Returns
On success, zero is returned. On error, -1 is returned
171
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_close#
int32_t sl_iperf_socket_close (int32_t sockid)
Close socket.
[in] | sockid | socket id |
Close socket and remove from the socket handler storage Returns
if any error occurred, return with -1, otherwise return with the socket id
160
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_connect#
int32_t sl_iperf_socket_connect (int32_t sockid, const sl_iperf_socket_addr_t * addr)
Initiate a connection on a socket.
[in] | sockid | socket id |
[in] | addr | If the socket sockid is of type SOCK_DGRAM, then addr is the address to which datagrams are sent by default, and the only address from which datagrams are received. If the socket is of type SOCK_STREAM, this call attempts to make a connection to the socket that is bound to the address specified by addr. |
Connects the socket referred to by the socketid to the address specified by addr. Returns
If the connection or binding succeeds, zero is returned. On error, -1 is returned.
209
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_create#
int32_t sl_iperf_socket_create (sl_iperf_protocol_t protocol)
Create iPerf socket.
[in] | protocol | Protocol |
Create a socket by selected protocol and return with the socket ID Returns
int32_t Socket ID
152
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_getsockopt#
int32_t sl_iperf_socket_getsockopt (int32_t sockid, int32_t level, int32_t optname, void * optval, size_t * optlen)
Get socket option.
[in] | sockid | socket id |
[in] | level | Not used in Wi-SUN domain. |
[in] | optname | Option name. |
[out] | optval | Destination option value pointer |
[in] | optlen | Must be the size of sl_wisun_socket_option_data_t union |
The function gets socket option by optname, and copy option data to optval ptr Returns
Return 0 on success, other wise -1
281
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_listen#
int32_t sl_iperf_socket_listen (int32_t sockid, int32_t backlog)
Listen for connections on an iPerf socket.
[in] | sockid | socket id |
[in] | backlog | Argument defines the maximum length to which the queue of pending connections for sockid may grow. Not implemented for Wi-SUN, the connection queue size is always 1 |
Marks the socket referred to by sockid as a passive socket, that is, as a socket that will be used to accept incoming connection requests using accept Returns
On success, zero is returned. On error, -1 is returned
184
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_recv#
int32_t sl_iperf_socket_recv (int32_t sockid, void * buff, size_t len)
Receive a message from a socket.
[in] | sockid | socket id |
[out] | buff | destination buffer ptr |
[in] | len | length of data to read |
It should be used for connection-oriented protocol (TCP) Returns
return the number of bytes received, or -1 if an error occurred
240
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_recvfrom#
int32_t sl_iperf_socket_recvfrom (int32_t sockid, void * buf, uint32_t len, sl_iperf_socket_addr_t * src_addr)
Receive messages from a socket.
[in] | sockid | socket id |
[out] | buf | destination buffer ptr |
[in] | len | length of data to read |
[in] | src_addr | Source address |
It can be used to receive data on a socket whether or not it is connection-oriented. Returns
return the number of bytes received, or -1 if an error occurred
251
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_send#
int32_t sl_iperf_socket_send (int32_t sockid, const void * buff, size_t len)
Send a message on a socket,.
[in] | sockid | socket id |
[in] | buff | buffer pointer to send |
[in] | len | length of buffer to send |
It is preferred with connection-oriented sockets (TCP). Returns
On success, these calls return the number of bytes sent. On error, -1 is returned
219
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_sendto#
int32_t sl_iperf_socket_sendto (int32_t sockid, const void * buff, uint32_t len, const sl_iperf_socket_addr_t * dest_addr)
Send a message on a socket.
[in] | sockid | socket id |
[in] | buff | buffer pointer to send |
[in] | len | length of buffer to send |
[in] | dest_addr | destination address ptr, the structure must be prepared for UDP sockets |
It is preferred in datagram mode (UDP). Returns
On success, these calls return the number of bytes sent. On error, -1 is returned
230
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
sl_iperf_socket_setsockopt#
int32_t sl_iperf_socket_setsockopt (int32_t sockid, int32_t level, int32_t optname, const void * optval, size_t optlen)
Set socket option.
[in] | sockid | socket id |
[in] | level | Not used in Wi-SUN domain. |
[in] | optname | Option name. |
[in] | optval | Option value structure pointer. For Wi-SUN it is casted to sl_wisun_socket_option_t |
[in] | optlen | Must be the size of sl_wisun_socket_option_data_t union |
This function can set socket properties. There are some limitation in Wi-SUN domain: optlen and level args are not used. optname and optval are casted to the corresponding Wi-SUN types: sl_wisun_socket_option_t and sl_wisun_socket_option_data_t. sl_wisun_socket_option_data_t is a union type to include all of implemented Wi-SUN socket options Returns
Return 0 on succes, other wise -1
268
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
Macro Definition Documentation#
sl_iperf_assert_sock_addr_len#
#define sl_iperf_assert_sock_addr_lenValue:
(__type)
Assert socket address length macro function.
123
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
SL_IPERF_IN6ADDR_SIZE#
#define SL_IPERF_IN6ADDR_SIZEValue:
(16U)
Size definition of IPv6 address.
85
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h
SL_IPERF_NW_API_ERROR#
#define SL_IPERF_NW_API_ERRORValue:
(-1)
Define network api ERROR value.
127
of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_network_interface.h