Silicon Labs socket API (deprecated)#

Silicon Labs socket API is deprecated. This component is provided as a temporary solution to maintain a compatility with v1.7 and older.

Functions#

sl_status_t
sl_wisun_open_socket(sl_wisun_socket_protocol_t protocol, sl_wisun_socket_id_t *socket_id) SL_DEPRECATED_API_SDK_4_4

Open a socket.

sl_status_t
sl_wisun_close_socket(sl_wisun_socket_id_t socket_id) SL_DEPRECATED_API_SDK_4_4

Close a socket.

sl_status_t
sl_wisun_sendto_on_socket(sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t *remote_address, uint16_t remote_port, uint16_t data_length, const uint8_t *data) SL_DEPRECATED_API_SDK_4_4

Write data to an unconnected socket.

sl_status_t
sl_wisun_listen_on_socket(sl_wisun_socket_id_t socket_id) SL_DEPRECATED_API_SDK_4_4

Set a TCP socket to listening state.

sl_status_t
sl_wisun_accept_on_socket(sl_wisun_socket_id_t socket_id, sl_wisun_socket_id_t *remote_socket_id, sl_wisun_ip_address_t *remote_address, uint16_t *remote_port) SL_DEPRECATED_API_SDK_4_4

Accept a pending connection request on a TCP socket.

sl_status_t
sl_wisun_connect_socket(sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t *remote_address, uint16_t remote_port) SL_DEPRECATED_API_SDK_4_4

Initiate a connection from a socket to a remote peer socket.

sl_status_t
sl_wisun_bind_socket(sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t *local_address, uint16_t local_port) SL_DEPRECATED_API_SDK_4_4

Bind a socket to a specific local address and/or a port number.

sl_status_t
sl_wisun_send_on_socket(sl_wisun_socket_id_t socket_id, uint16_t data_length, const uint8_t *data) SL_DEPRECATED_API_SDK_4_4

Write data to a connected socket.

sl_status_t
sl_wisun_receive_on_socket(sl_wisun_socket_id_t socket_id, sl_wisun_ip_address_t *remote_address, uint16_t *remote_port, uint16_t *data_length, uint8_t *data) SL_DEPRECATED_API_SDK_4_4

Read data from a socket.

sl_status_t
sl_wisun_set_socket_option(sl_wisun_socket_id_t socket_id, sl_wisun_socket_option_t option, const sl_wisun_socket_option_data_t *option_data) SL_DEPRECATED_API_SDK_4_4

Set a socket option.

sl_status_t
sl_wisun_get_socket_option(sl_wisun_socket_id_t socket_id, sl_wisun_socket_option_t option, sl_wisun_socket_option_data_t *option_data) SL_DEPRECATED_API_SDK_4_4

Get a socket option.

Function Documentation#

sl_wisun_open_socket#

sl_status_t sl_wisun_open_socket (sl_wisun_socket_protocol_t protocol, sl_wisun_socket_id_t *socket_id) SL_DEPRECATED_API_SDK_4_4

Open a socket.

Parameters
[in]protocol

Protocol type of the socket

[out]socket_id

ID of the opened socket

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function opens a socket. Up to 10 sockets may be open at any given time, including those opened implicitly via sl_wisun_accept_on_socket().

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See socket() for a replacement.


Definition at line 55 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_close_socket#

sl_status_t sl_wisun_close_socket (sl_wisun_socket_id_t socket_id) SL_DEPRECATED_API_SDK_4_4

Close a socket.

Parameters
[in]socket_id

ID of the socket

Returns

  • SL_STATUS_OK if successful, an error code otherwise

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See close() for a replacement.


Definition at line 67 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_sendto_on_socket#

sl_status_t sl_wisun_sendto_on_socket (sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t *remote_address, uint16_t remote_port, uint16_t data_length, const uint8_t *data) SL_DEPRECATED_API_SDK_4_4

Write data to an unconnected socket.

Parameters
[in]socket_id

ID of the socket

[in]remote_address

IP address of the remote peer

[in]remote_port

Port number of the remote peer

[in]data_length

Amount of data to write

[in]data

Pointer to the data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function initiates a data transmission to a remote peer and can only be used on an unconnected UDP or ICMP socket. Completion of the transmission is indicated with a SL_WISUN_MSG_SOCKET_DATA_SENT_IND_ID event. The function takes a copy of the data, so the caller may free the resource when the function returns.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See sendto() for a replacement.


Definition at line 88 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_listen_on_socket#

sl_status_t sl_wisun_listen_on_socket (sl_wisun_socket_id_t socket_id) SL_DEPRECATED_API_SDK_4_4

Set a TCP socket to listening state.

Parameters
[in]socket_id

ID of the socket

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets a TCP socket to listening state, allowing it to act as a server socket, i.e., to receive connection requests from clients. Connection requests are indicated with SL_WISUN_MSG_SOCKET_CONNECTION_AVAILABLE_IND_ID events and accepted using sl_wisun_accept_on_socket(). This function can only be used on an unconnected TCP socket.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See listen() for a replacement.


Definition at line 110 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_accept_on_socket#

sl_status_t sl_wisun_accept_on_socket (sl_wisun_socket_id_t socket_id, sl_wisun_socket_id_t *remote_socket_id, sl_wisun_ip_address_t *remote_address, uint16_t *remote_port) SL_DEPRECATED_API_SDK_4_4

Accept a pending connection request on a TCP socket.

Parameters
[in]socket_id

ID of the socket on listening state

[out]remote_socket_id

ID of the new connected socket

[out]remote_address

IP address of the remote peer

[out]remote_port

Port number of the remote peer

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function accepts a pending connection request from a remote peer and creates a new connected TCP socket for the connection. To decline a connection request, the request must be accepted and then closed using sl_wisun_close_socket(). The function can only be used on a TCP socket in listening state.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See accept() for a replacement.


Definition at line 130 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_connect_socket#

sl_status_t sl_wisun_connect_socket (sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t *remote_address, uint16_t remote_port) SL_DEPRECATED_API_SDK_4_4

Initiate a connection from a socket to a remote peer socket.

Parameters
[in]socket_id

ID of the socket

[in]remote_address

IP address of the remote peer

[in]remote_port

Port number of the remote peer

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function initiates a connection from a local socket to to a remote peer socket. The result of the connection is indicated with a SL_WISUN_MSG_SOCKET_CONNECTED_IND_ID event. Connecting a socket is mandatory for TCP client sockets but may be also used on other types of sockets. A connected socket can only receive and transmit data with the designated peer. This function can only be used on an unconnected TCP or UDP socket.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See connect() for a replacement.


Definition at line 154 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_bind_socket#

sl_status_t sl_wisun_bind_socket (sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t *local_address, uint16_t local_port) SL_DEPRECATED_API_SDK_4_4

Bind a socket to a specific local address and/or a port number.

Parameters
[in]socket_id

ID of the socket

[in]local_address

Local IP address to use on the socket. NULL if not bound.

[in]local_port

Local port number to use on the socket. Zero if not bound.

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function binds the local address and/or the port of a socket. When the local address is bound, the socket will only accept traffic sent to the specified address and the transmitted packets will use the address as the source address. If not bound, the socket will accept data sent to any valid address of the device. The source address is selected by the stack. Binding the local port number sets the port number for received and transmitted packets. If not bound, the stack will select a port number automatically. This function can only be used on an unconnected TCP or UDP socket. Once bound to a specific address and/or port, the value cannot be changed.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See bind() for a replacement.


Definition at line 180 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_send_on_socket#

sl_status_t sl_wisun_send_on_socket (sl_wisun_socket_id_t socket_id, uint16_t data_length, const uint8_t *data) SL_DEPRECATED_API_SDK_4_4

Write data to a connected socket.

Parameters
[in]socket_id

ID of the socket

[in]data_length

Amount of data to write

[in]data

Pointer to the data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function initiates transmission of data to a connected remote peer and can only be used on a connected socket. Completion of the transmission is indicated with a SL_WISUN_MSG_SOCKET_DATA_SENT_IND_ID event. The function takes a copy of the data, so the caller may free the resource when the function returns.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See send() for a replacement.


Definition at line 201 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_receive_on_socket#

sl_status_t sl_wisun_receive_on_socket (sl_wisun_socket_id_t socket_id, sl_wisun_ip_address_t *remote_address, uint16_t *remote_port, uint16_t *data_length, uint8_t *data) SL_DEPRECATED_API_SDK_4_4

Read data from a socket.

Parameters
[in]socket_id

ID of the socket

[out]remote_address

IP address of the remote peer

[out]remote_port

Port number of the remote peer

[inout]data_length

Amount of data to read on input, amount of data read on output

[in]data

Pointer to where the read data is stored

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function reads buffered data from a socket. When reading data from a UDP or ICMP socket, the entire packet must be read. Any data left unread is discarded after this call. TCP sockets allow reading only a part of the buffered data.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See recvfrom() for a replacement.


Definition at line 223 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_set_socket_option#

sl_status_t sl_wisun_set_socket_option (sl_wisun_socket_id_t socket_id, sl_wisun_socket_option_t option, const sl_wisun_socket_option_data_t *option_data) SL_DEPRECATED_API_SDK_4_4

Set a socket option.

Parameters
[in]socket_id

ID of the socket

[in]option

Socket option to set

[in]option_data

Socket option specific data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See setsockopt() for a replacement.


Definition at line 246 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h

sl_wisun_get_socket_option#

sl_status_t sl_wisun_get_socket_option (sl_wisun_socket_id_t socket_id, sl_wisun_socket_option_t option, sl_wisun_socket_option_data_t *option_data) SL_DEPRECATED_API_SDK_4_4

Get a socket option.

Parameters
[in]socket_id

ID of the socket

[in]option

Socket option to get

[out]option_data

Socket option specific data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function retrieves the value of a socket option.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See getsockopt() for a replacement.


Definition at line 264 of file /mnt/raid/workspaces/ws.3mvRcZlJ0/overlay/gsdk/protocol/wisun/plugin/sl_wisun_legacy_socket_wrapper.h