Network Services API  2.00.00.16
Data Structures | Macros | Typedefs | Enumerations | Functions
SlNetSock group

Controls standard client/server sockets options and capabilities. More...

Data Structures

struct  _SlNetSock_InAddr_t
 Internet address. More...
 
struct  _SlNetSock_In6Addr_t
 IpV6 or Ipv6 EUI64. More...
 
struct  _SlNetSock_Keepalive_t
 The SlNetSock_Keepalive_t structure is used in SLNETSOCK_OPSOCK_KEEPALIVE socket level option. More...
 
struct  _SlNetSock_NonIpBoundary_t
 The SlNetSock_NonIpBoundary_t structure is used in SLNETSOCK_OPSOCK_NON_IP_BOUNDARY socket level option. More...
 
struct  _SlNetSock_Winsize_t
 The SlNetSock_Winsize_t structure is used in SLNETSOCK_OPSOCK_RCV_BUF socket level option. More...
 
struct  _SlNetSock_Nonblocking_t
 The SlNetSock_Nonblocking_t structure is used in SLNETSOCK_OPSOCK_NON_BLOCKING socket level option. More...
 
struct  _SlNetSock_SecAttribNode_t
 Secure socket attribute context. More...
 
struct  _SlNetSock_SecureALPN_t
 Secure ALPN structure. More...
 
struct  _SlNetSock_SecureMask_t
 Secure Mask structure. More...
 
struct  _SlNetSock_SecureMethod_t
 Secure Method structure. More...
 
struct  _SlNetSock_IpMreq_t
 The SlNetSock_IpMreq_t structure is used in SLNETSOCK_OPIP_ADD_MEMBERSHIP/SLNETSOCK_OPIP_DROP_MEMBERSHIP IP level option. More...
 
struct  _SlNetSock_IpV6Mreq_t
 The SlNetSock_IpV6Mreq_t structure is used in SLNETSOCK_OPIPV6_ADD_MEMBERSHIP/SLNETSOCK_OPIPV6_DROP_MEMBERSHIP IP level option. More...
 
struct  _SlNetSock_linger_t
 The SlNetSock_linger_t structure is used in SLNETSOCK_OPSOCK_LINGER socket level option. More...
 
struct  _SlNetSock_Timeval_t
 The SlNetSock_Timeval_t structure is used in SLNETSOCK_OPSOCK_RCV_TIMEO socket level option. More...
 
struct  _SlNetSock_Addr_t
 IpV4 socket address. More...
 
struct  _SlNetSock_AddrIn6_t
 SlNetSock IPv6 address, Internet style. More...
 
struct  _SlNetSock_AddrIn_t
 SlNetSock IPv4 address, Internet style. More...
 
struct  _SlNetSock_SdSet_t
 The SlNetSock_SdSet_t structure holds the sd array for SlNetSock_select function. More...
 
struct  _SlNetSock_TransceiverRxOverHead_t
 The SlNetSock_TransceiverRxOverHead_t structure holds the data for Rx transceiver mode using a raw socket when using SlNetSock_recv function. More...
 

Macros

#define SLNETSOCK_MAX_CONCURRENT_SOCKETS   (32) /* Declares the maximum sockets that can be opened */
 
#define SLNETSOCK_AF_INET   (2) /* IPv4 socket (UDP, TCP, etc) */
 
#define SLNETSOCK_AF_INET6   (3) /* IPv6 socket (UDP, TCP, etc) */
 
#define SLNETSOCK_AF_RF   (6) /* data include RF parameter, All layer by user (Wifi could be disconnected) */
 
#define SLNETSOCK_AF_PACKET   (17) /* Network bypass */
 
#define SLNETSOCK_PF_INET   SLNETSOCK_AF_INET
 
#define SLNETSOCK_PF_INET6   SLNETSOCK_AF_INET6
 
#define SLNETSOCK_SOCK_STREAM   (1) /* TCP Socket */
 
#define SLNETSOCK_SOCK_DGRAM   (2) /* UDP Socket */
 
#define SLNETSOCK_SOCK_RAW   (3) /* Raw socket */
 
#define SLNETSOCK_SOCK_RX_MTR   (4) /* RX Metrics socket */
 
#define SLNETSOCK_SOCK_MAC_WITH_CCA   (5)
 
#define SLNETSOCK_SOCK_MAC_WITH_NO_CCA   (6)
 
#define SLNETSOCK_SOCK_BRIDGE   (7)
 
#define SLNETSOCK_SOCK_ROUTER   (8)
 
#define SLNETSOCK_PROTO_TCP   (6) /* TCP Raw Socket */
 
#define SLNETSOCK_PROTO_UDP   (17) /* UDP Raw Socket */
 
#define SLNETSOCK_PROTO_RAW   (255) /* Raw Socket */
 
#define SLNETSOCK_PROTO_SECURE   (100) /* Secured Socket Layer (SSL,TLS) */
 
#define SLNETSOCK_INADDR_ANY   (0)
 
#define SLNETSOCK_IN6ADDR_ANY   (0)
 
#define SLNETSOCK_LVL_SOCKET   (1) /* Define the socket option category. */
 
#define SLNETSOCK_LVL_IP   (2) /* Define the IP option category. */
 
#define SLNETSOCK_LVL_PHY   (3) /* Define the PHY option category. */
 
#define SLNETSOCK_OPSOCK_RCV_BUF   (8) /* Setting TCP receive buffer size (window size) - This options takes SlNetSock_Winsize_t struct as parameter */
 
#define SLNETSOCK_OPSOCK_RCV_TIMEO   (20) /* Enable receive timeout - This options takes SlNetSock_Timeval_t struct as parameter */
 
#define SLNETSOCK_OPSOCK_KEEPALIVE   (9) /* Connections are kept alive with periodic messages - This options takes SlNetSock_Keepalive_t struct as parameter */
 
#define SLNETSOCK_OPSOCK_KEEPALIVE_TIME   (36) /* keepalive time out - This options takes <b>uint32_t</b> as parameter */
 
#define SLNETSOCK_OPSOCK_LINGER   (13) /* Socket lingers on close pending remaining send/receive packets - This options takes SlNetSock_linger_t struct as parameter */
 
#define SLNETSOCK_OPSOCK_NON_BLOCKING   (24) /* Enable/disable nonblocking mode - This options takes SlNetSock_Nonblocking_t struct as parameter */
 
#define SLNETSOCK_OPSOCK_NON_IP_BOUNDARY   (38) /* connectionless socket disable rx boundary - This options takes SlNetSock_NonIpBoundary_t struct as parameter */
 
#define SLNETSOCK_OPSOCK_SLNETSOCKSD   (59) /* Used by the BSD layer in order to retrieve the slnetsock sd */
 
#define SLNETSOCK_OPIP_MULTICAST_TTL   (61) /* Specify the TTL value to use for outgoing multicast packet. - This options takes <b>uint8_t</b> as parameter */
 
#define SLNETSOCK_OPIP_ADD_MEMBERSHIP   (65) /* Join IPv4 multicast membership - This options takes SlNetSock_IpMreq_t struct as parameter */
 
#define SLNETSOCK_OPIP_DROP_MEMBERSHIP   (66) /* Leave IPv4 multicast membership - This options takes SlNetSock_IpMreq_t struct as parameter */
 
#define SLNETSOCK_OPIP_HDRINCL   (67) /* Raw socket IPv4 header included - This options takes <b>uint32_t</b> as parameter */
 
#define SLNETSOCK_OPIP_RAW_RX_NO_HEADER   (68) /* Proprietary socket option that does not includeIPv4/IPv6 header (and extension headers) on received raw sockets - This options takes <b>uint32_t</b> as parameter */
 
#define SLNETSOCK_OPIP_RAW_IPV6_HDRINCL   (69) /* Transmitted buffer over IPv6 socket contains IPv6 header - This options takes <b>uint32_t</b> as parameter */
 
#define SLNETSOCK_OPIPV6_ADD_MEMBERSHIP   (70) /* Join IPv6 multicast membership - This options takes SlNetSock_IpV6Mreq_t struct as parameter */
 
#define SLNETSOCK_OPIPV6_DROP_MEMBERSHIP   (71) /* Leave IPv6 multicast membership - This options takes SlNetSock_IpV6Mreq_t struct as parameter */
 
#define SLNETSOCK_OPIPV6_MULTICAST_HOPS   (72) /* Specify the hops value to use for outgoing multicast packet. */
 
#define SLNETSOCK_OPPHY_CHANNEL   (107) /* This option is available only when transceiver started - This options takes <b>uint32_t</b> as channel number parameter */
 
#define SLNETSOCK_OPPHY_RATE   (100) /* WLAN Transmit rate - This options takes <b>uint32_t</b> as parameter based on SlWlanRateIndex_e */
 
#define SLNETSOCK_OPPHY_TX_POWER   (101) /* TX Power level - This options takes <b>uint32_t</b> as parameter */
 
#define SLNETSOCK_OPPHY_NUM_FRAMES_TO_TX   (102) /* Number of frames to transmit - This options takes <b>uint32_t</b> as parameter */
 
#define SLNETSOCK_OPPHY_PREAMBLE   (103) /* Preamble for transmission - This options takes <b>uint32_t</b> as parameter */
 
#define SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD   (104) /* TX Inhibit Threshold (CCA) - This options takes <b>uint32_t</b> as parameter based on SlNetSockTxInhibitThreshold_e */
 
#define SLNETSOCK_OPPHY_TX_TIMEOUT   (105) /* TX timeout for Transceiver frames (lifetime) in miliseconds (max value is 100ms) - This options takes <b>uint32_t</b> as parameter */
 
#define SLNETSOCK_OPPHY_ALLOW_ACKS   (106) /* Enable sending ACKs in transceiver mode - This options takes <b>uint32_t</b> as parameter */
 
#define SLNETSOCK_SEC_METHOD_SSLV3   (0) /* security metohd SSL v3 */
 
#define SLNETSOCK_SEC_METHOD_TLSV1   (1) /* security metohd TLS v1 */
 
#define SLNETSOCK_SEC_METHOD_TLSV1_1   (2) /* security metohd TLS v1_1 */
 
#define SLNETSOCK_SEC_METHOD_TLSV1_2   (3) /* security metohd TLS v1_2 */
 
#define SLNETSOCK_SEC_METHOD_SSLv3_TLSV1_2   (4) /* use highest possible version from SSLv3 - TLS 1.2 */
 
#define SLNETSOCK_SEC_METHOD_DLSV1   (5) /* security metohd DTL v1 */
 
#define SLNETSOCK_SEC_CIPHER_SSL_RSA_WITH_RC4_128_SHA   (1 << 0)
 
#define SLNETSOCK_SEC_CIPHER_SSL_RSA_WITH_RC4_128_MD5   (1 << 1)
 
#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_CBC_SHA   (1 << 2)
 
#define SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_256_CBC_SHA   (1 << 3)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA   (1 << 4)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_RC4_128_SHA   (1 << 5)
 
#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_128_CBC_SHA256   (1 << 6)
 
#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_CBC_SHA256   (1 << 7)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256   (1 << 8)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256   (1 << 9)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA   (1 << 10)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA   (1 << 11)
 
#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_128_GCM_SHA256   (1 << 12)
 
#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_GCM_SHA384   (1 << 13)
 
#define SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256   (1 << 14)
 
#define SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384   (1 << 15)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256   (1 << 16)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384   (1 << 17)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256   (1 << 18)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384   (1 << 19)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256   (1 << 20)
 
#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256   (1 << 21)
 
#define SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256   (1 << 22)
 
#define SLNETSOCK_SEC_ALPN_H1   (1 << 0)
 
#define SLNETSOCK_SEC_ALPN_H2   (1 << 1)
 
#define SLNETSOCK_SEC_ALPN_H2C   (1 << 2)
 
#define SLNETSOCK_SEC_ALPN_H2_14   (1 << 3)
 
#define SLNETSOCK_SEC_ALPN_H2_16   (1 << 4)
 
#define SLNETSOCK_SEC_ALPN_FULL_LIST   ((SLNETSOCK_SEC_ALPN_H2_16 << 1 ) - 1)
 
#define SLNETSOCK_SEC_START_SECURITY_SESSION_ONLY   (1 << 0) /* Sends the command that will start the security session for a specific socket descriptor */
 
#define SLNETSOCK_SEC_BIND_CONTEXT_ONLY   (1 << 1) /* Binds the security context to a specific socket descriptor */
 
#define SLNETSOCK_SEC_IS_SERVER   (1 << 2) /* Used to define if the socket is client/server socket */
 
#define SLNETSOCK_CREATE_IF_STATE_ENABLE   (1 << 0) /* Creation of the socket will be on enabled state */
 
#define SLNETSOCK_CREATE_IF_STATUS_CONNECTED   (1 << 1) /* Creation of the socket will be on status connected */
 
#define SLNETSOCK_CREATE_ALLOW_PARTIAL_MATCH
 
#define SLNETSOCK_SHUT_RD   (0) /* Further receptions will be disallowed */
 
#define SLNETSOCK_SHUT_WR   (1) /* Further transmissions will be disallowed */
 
#define SLNETSOCK_SHUT_RDWR   (2) /* Further receptions and transmissions will be disallowed */
 
#define SLNETSOCK_INET6_ADDRSTRLEN   (40)
 
#define SLNETSOCK_INET_ADDRSTRLEN   (15)
 
#define SLNETSOCK_RECV_MSG_DONTWAIT   (1 << 0)
 

Typedefs

typedef struct _SlNetSock_InAddr_t SlNetSock_InAddr_t
 Internet address. More...
 
typedef struct _SlNetSock_In6Addr_t SlNetSock_In6Addr_t
 IpV6 or Ipv6 EUI64. More...
 
typedef struct _SlNetSock_Keepalive_t SlNetSock_Keepalive_t
 The SlNetSock_Keepalive_t structure is used in SLNETSOCK_OPSOCK_KEEPALIVE socket level option. More...
 
typedef struct _SlNetSock_NonIpBoundary_t SlNetSock_NonIpBoundary_t
 The SlNetSock_NonIpBoundary_t structure is used in SLNETSOCK_OPSOCK_NON_IP_BOUNDARY socket level option. More...
 
typedef struct _SlNetSock_Winsize_t SlNetSock_Winsize_t
 The SlNetSock_Winsize_t structure is used in SLNETSOCK_OPSOCK_RCV_BUF socket level option. More...
 
typedef struct _SlNetSock_Nonblocking_t SlNetSock_Nonblocking_t
 The SlNetSock_Nonblocking_t structure is used in SLNETSOCK_OPSOCK_NON_BLOCKING socket level option. More...
 
typedef struct _SlNetSock_SecAttribNode_t SlNetSock_SecAttribNode_t
 Secure socket attribute context. More...
 
typedef SlNetSock_SecAttribNode_tSlNetSockSecAttrib_t
 Secure socket attribute handler. More...
 
typedef struct _SlNetSock_SecureALPN_t SlNetSock_SecureALPN_t
 Secure ALPN structure. More...
 
typedef struct _SlNetSock_SecureMask_t SlNetSock_SecureMask_t
 Secure Mask structure. More...
 
typedef struct _SlNetSock_SecureMethod_t SlNetSock_SecureMethod_t
 Secure Method structure. More...
 
typedef struct _SlNetSock_IpMreq_t SlNetSock_IpMreq_t
 The SlNetSock_IpMreq_t structure is used in SLNETSOCK_OPIP_ADD_MEMBERSHIP/SLNETSOCK_OPIP_DROP_MEMBERSHIP IP level option. More...
 
typedef struct _SlNetSock_IpV6Mreq_t SlNetSock_IpV6Mreq_t
 The SlNetSock_IpV6Mreq_t structure is used in SLNETSOCK_OPIPV6_ADD_MEMBERSHIP/SLNETSOCK_OPIPV6_DROP_MEMBERSHIP IP level option. More...
 
typedef struct _SlNetSock_linger_t SlNetSock_linger_t
 The SlNetSock_linger_t structure is used in SLNETSOCK_OPSOCK_LINGER socket level option. More...
 
typedef int32_t SlNetSockTime_t
 The SlNetSockTime_t is used for setting/getting time in seconds. More...
 
typedef int32_t SlNetSockuseconds_t
 The SlNetSockuseconds_t is used for setting/getting time in micro-seconds. More...
 
typedef struct _SlNetSock_Timeval_t SlNetSock_Timeval_t
 The SlNetSock_Timeval_t structure is used in SLNETSOCK_OPSOCK_RCV_TIMEO socket level option. More...
 
typedef uint16_t SlNetSocklen_t
 The SlNetSocklen_t is used for declaring the socket length parameter. More...
 
typedef struct _SlNetSock_Addr_t SlNetSock_Addr_t
 IpV4 socket address. More...
 
typedef struct _SlNetSock_AddrIn6_t SlNetSock_AddrIn6_t
 SlNetSock IPv6 address, Internet style. More...
 
typedef struct _SlNetSock_AddrIn_t SlNetSock_AddrIn_t
 SlNetSock IPv4 address, Internet style. More...
 
typedef struct _SlNetSock_SdSet_t SlNetSock_SdSet_t
 The SlNetSock_SdSet_t structure holds the sd array for SlNetSock_select function. More...
 
typedef struct _SlNetSock_TransceiverRxOverHead_t SlNetSock_TransceiverRxOverHead_t
 The SlNetSock_TransceiverRxOverHead_t structure holds the data for Rx transceiver mode using a raw socket when using SlNetSock_recv function. More...
 

Enumerations

enum  SlNetSockTxInhibitThreshold_e {
  SLNETSOCK_TX_INHIBIT_THRESHOLD_MIN = 1,
  SLNETSOCK_TX_INHIBIT_THRESHOLD_LOW = 2,
  SLNETSOCK_TX_INHIBIT_THRESHOLD_DEFAULT = 3,
  SLNETSOCK_TX_INHIBIT_THRESHOLD_MED = 4,
  SLNETSOCK_TX_INHIBIT_THRESHOLD_HIGH = 5,
  SLNETSOCK_TX_INHIBIT_THRESHOLD_MAX = 6
}
 The SlNetSockTxInhibitThreshold_e enumerations is used in SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD PHY level option. More...
 
enum  SlNetSockSecAttrib_e {
  SLNETSOCK_SEC_ATTRIB_PRIVATE_KEY = 0,
  SLNETSOCK_SEC_ATTRIB_LOCAL_CERT = 1,
  SLNETSOCK_SEC_ATTRIB_PEER_ROOT_CA = 2,
  SLNETSOCK_SEC_ATTRIB_DH_KEY = 3,
  SLNETSOCK_SEC_ATTRIB_METHOD = 4,
  SLNETSOCK_SEC_ATTRIB_CIPHERS = 5,
  SLNETSOCK_SEC_ATTRIB_ALPN = 6,
  SLNETSOCK_SEC_ATTRIB_EXT_CLIENT_CHLNG_RESP = 7,
  SLNETSOCK_SEC_ATTRIB_DOMAIN_NAME = 8
}
 The SlNetSockSecAttrib_e enumerations is used for security attribute object in SlNetSock_secAttribSet function. More...
 

Functions

int32_t SlNetSock_init (int32_t flags)
 Initialize the slnetsock module. More...
 
int16_t SlNetSock_create (int16_t domain, int16_t type, int16_t protocol, uint32_t ifBitmap, int16_t flags)
 Create an endpoint for communication. More...
 
int32_t SlNetSock_close (int16_t sd)
 Gracefully close socket. More...
 
int32_t SlNetSock_shutdown (int16_t sd, int16_t how)
 Shutting down parts of a full-duplex connection. More...
 
int16_t SlNetSock_accept (int16_t sd, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen)
 Accept a connection on a socket. More...
 
int32_t SlNetSock_bind (int16_t sd, const SlNetSock_Addr_t *addr, int16_t addrlen)
 Assign a name to a socket. More...
 
int32_t SlNetSock_listen (int16_t sd, int16_t backlog)
 Listen for connections on a socket. More...
 
int32_t SlNetSock_connect (int16_t sd, const SlNetSock_Addr_t *addr, SlNetSocklen_t addrlen)
 Initiate a connection on a socket. More...
 
int32_t SlNetSock_connectUrl (int16_t sd, const char *url)
 Initiate a connection on a socket by URL. More...
 
int32_t SlNetSock_getPeerName (int16_t sd, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen)
 Return address info about the remote side of the connection. More...
 
int32_t SlNetSock_getSockName (int16_t sd, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen)
 Get local address info by socket descriptor
Returns the local address info of the socket descriptor. More...
 
int32_t SlNetSock_select (int16_t nsds, SlNetSock_SdSet_t *readsds, SlNetSock_SdSet_t *writesds, SlNetSock_SdSet_t *exceptsds, SlNetSock_Timeval_t *timeout)
 Monitor socket activity. More...
 
int32_t SlNetSock_sdsSet (int16_t sd, SlNetSock_SdSet_t *sdset)
 SlNetSock_select's SlNetSock_SdSet_t SET function. More...
 
int32_t SlNetSock_sdsClr (int16_t sd, SlNetSock_SdSet_t *sdset)
 SlNetSock_select's SlNetSock_SdSet_t CLR function. More...
 
int32_t SlNetSock_sdsClrAll (SlNetSock_SdSet_t *sdset)
 SlNetSock_select's SlNetSock_SdSet_t ZERO function. More...
 
int32_t SlNetSock_sdsIsSet (int16_t sd, SlNetSock_SdSet_t *sdset)
 SlNetSock_select's SlNetSock_SdSet_t ISSET function. More...
 
int32_t SlNetSock_setOpt (int16_t sd, int16_t level, int16_t optname, void *optval, SlNetSocklen_t optlen)
 Set socket options-. More...
 
int32_t SlNetSock_getOpt (int16_t sd, int16_t level, int16_t optname, void *optval, SlNetSocklen_t *optlen)
 Get socket options. More...
 
int32_t SlNetSock_recv (int16_t sd, void *buf, uint32_t len, uint32_t flags)
 Read data from TCP socket. More...
 
int32_t SlNetSock_recvFrom (int16_t sd, void *buf, uint32_t len, uint32_t flags, SlNetSock_Addr_t *from, SlNetSocklen_t *fromlen)
 Read data from socket. More...
 
int32_t SlNetSock_send (int16_t sd, const void *buf, uint32_t len, uint32_t flags)
 Write data to TCP socket. More...
 
int32_t SlNetSock_sendTo (int16_t sd, const void *buf, uint32_t len, uint32_t flags, const SlNetSock_Addr_t *to, SlNetSocklen_t tolen)
 Write data to socket. More...
 
int32_t SlNetSock_getIfID (uint16_t sd)
 Get interface ID from socket descriptor (sd) More...
 
SlNetSockSecAttrib_tSlNetSock_secAttribCreate (void)
 Creates a security attributes object. More...
 
int32_t SlNetSock_secAttribDelete (SlNetSockSecAttrib_t *secAttrib)
 Deletes a security attributes object. More...
 
int32_t SlNetSock_secAttribSet (SlNetSockSecAttrib_t *secAttrib, SlNetSockSecAttrib_e attribName, void *val, uint16_t len)
 set a security attributes More...
 
int32_t SlNetSock_startSec (int16_t sd, SlNetSockSecAttrib_t *secAttrib, uint8_t flags)
 Start a security session on an opened socket. More...
 

Detailed Description

Controls standard client/server sockets options and capabilities.

Macro Definition Documentation

§ SLNETSOCK_MAX_CONCURRENT_SOCKETS

#define SLNETSOCK_MAX_CONCURRENT_SOCKETS   (32) /* Declares the maximum sockets that can be opened */

§ SLNETSOCK_AF_INET

#define SLNETSOCK_AF_INET   (2) /* IPv4 socket (UDP, TCP, etc) */

§ SLNETSOCK_AF_INET6

#define SLNETSOCK_AF_INET6   (3) /* IPv6 socket (UDP, TCP, etc) */

§ SLNETSOCK_AF_RF

#define SLNETSOCK_AF_RF   (6) /* data include RF parameter, All layer by user (Wifi could be disconnected) */

§ SLNETSOCK_AF_PACKET

#define SLNETSOCK_AF_PACKET   (17) /* Network bypass */

§ SLNETSOCK_PF_INET

#define SLNETSOCK_PF_INET   SLNETSOCK_AF_INET

§ SLNETSOCK_PF_INET6

#define SLNETSOCK_PF_INET6   SLNETSOCK_AF_INET6

§ SLNETSOCK_SOCK_STREAM

#define SLNETSOCK_SOCK_STREAM   (1) /* TCP Socket */

§ SLNETSOCK_SOCK_DGRAM

#define SLNETSOCK_SOCK_DGRAM   (2) /* UDP Socket */

§ SLNETSOCK_SOCK_RAW

#define SLNETSOCK_SOCK_RAW   (3) /* Raw socket */

§ SLNETSOCK_SOCK_RX_MTR

#define SLNETSOCK_SOCK_RX_MTR   (4) /* RX Metrics socket */

§ SLNETSOCK_SOCK_MAC_WITH_CCA

#define SLNETSOCK_SOCK_MAC_WITH_CCA   (5)

§ SLNETSOCK_SOCK_MAC_WITH_NO_CCA

#define SLNETSOCK_SOCK_MAC_WITH_NO_CCA   (6)

§ SLNETSOCK_SOCK_BRIDGE

#define SLNETSOCK_SOCK_BRIDGE   (7)

§ SLNETSOCK_SOCK_ROUTER

#define SLNETSOCK_SOCK_ROUTER   (8)

§ SLNETSOCK_PROTO_TCP

#define SLNETSOCK_PROTO_TCP   (6) /* TCP Raw Socket */

§ SLNETSOCK_PROTO_UDP

#define SLNETSOCK_PROTO_UDP   (17) /* UDP Raw Socket */

§ SLNETSOCK_PROTO_RAW

#define SLNETSOCK_PROTO_RAW   (255) /* Raw Socket */

§ SLNETSOCK_PROTO_SECURE

#define SLNETSOCK_PROTO_SECURE   (100) /* Secured Socket Layer (SSL,TLS) */

§ SLNETSOCK_INADDR_ANY

#define SLNETSOCK_INADDR_ANY   (0)

§ SLNETSOCK_IN6ADDR_ANY

#define SLNETSOCK_IN6ADDR_ANY   (0)

§ SLNETSOCK_LVL_SOCKET

#define SLNETSOCK_LVL_SOCKET   (1) /* Define the socket option category. */

§ SLNETSOCK_LVL_IP

#define SLNETSOCK_LVL_IP   (2) /* Define the IP option category. */

§ SLNETSOCK_LVL_PHY

#define SLNETSOCK_LVL_PHY   (3) /* Define the PHY option category. */

§ SLNETSOCK_OPSOCK_RCV_BUF

#define SLNETSOCK_OPSOCK_RCV_BUF   (8) /* Setting TCP receive buffer size (window size) - This options takes SlNetSock_Winsize_t struct as parameter */

§ SLNETSOCK_OPSOCK_RCV_TIMEO

#define SLNETSOCK_OPSOCK_RCV_TIMEO   (20) /* Enable receive timeout - This options takes SlNetSock_Timeval_t struct as parameter */

§ SLNETSOCK_OPSOCK_KEEPALIVE

#define SLNETSOCK_OPSOCK_KEEPALIVE   (9) /* Connections are kept alive with periodic messages - This options takes SlNetSock_Keepalive_t struct as parameter */

§ SLNETSOCK_OPSOCK_KEEPALIVE_TIME

#define SLNETSOCK_OPSOCK_KEEPALIVE_TIME   (36) /* keepalive time out - This options takes <b>uint32_t</b> as parameter */

§ SLNETSOCK_OPSOCK_LINGER

#define SLNETSOCK_OPSOCK_LINGER   (13) /* Socket lingers on close pending remaining send/receive packets - This options takes SlNetSock_linger_t struct as parameter */

§ SLNETSOCK_OPSOCK_NON_BLOCKING

#define SLNETSOCK_OPSOCK_NON_BLOCKING   (24) /* Enable/disable nonblocking mode - This options takes SlNetSock_Nonblocking_t struct as parameter */

§ SLNETSOCK_OPSOCK_NON_IP_BOUNDARY

#define SLNETSOCK_OPSOCK_NON_IP_BOUNDARY   (38) /* connectionless socket disable rx boundary - This options takes SlNetSock_NonIpBoundary_t struct as parameter */

§ SLNETSOCK_OPSOCK_SLNETSOCKSD

#define SLNETSOCK_OPSOCK_SLNETSOCKSD   (59) /* Used by the BSD layer in order to retrieve the slnetsock sd */

§ SLNETSOCK_OPIP_MULTICAST_TTL

#define SLNETSOCK_OPIP_MULTICAST_TTL   (61) /* Specify the TTL value to use for outgoing multicast packet. - This options takes <b>uint8_t</b> as parameter */

§ SLNETSOCK_OPIP_ADD_MEMBERSHIP

#define SLNETSOCK_OPIP_ADD_MEMBERSHIP   (65) /* Join IPv4 multicast membership - This options takes SlNetSock_IpMreq_t struct as parameter */

§ SLNETSOCK_OPIP_DROP_MEMBERSHIP

#define SLNETSOCK_OPIP_DROP_MEMBERSHIP   (66) /* Leave IPv4 multicast membership - This options takes SlNetSock_IpMreq_t struct as parameter */

§ SLNETSOCK_OPIP_HDRINCL

#define SLNETSOCK_OPIP_HDRINCL   (67) /* Raw socket IPv4 header included - This options takes <b>uint32_t</b> as parameter */

§ SLNETSOCK_OPIP_RAW_RX_NO_HEADER

#define SLNETSOCK_OPIP_RAW_RX_NO_HEADER   (68) /* Proprietary socket option that does not includeIPv4/IPv6 header (and extension headers) on received raw sockets - This options takes <b>uint32_t</b> as parameter */

§ SLNETSOCK_OPIP_RAW_IPV6_HDRINCL

#define SLNETSOCK_OPIP_RAW_IPV6_HDRINCL   (69) /* Transmitted buffer over IPv6 socket contains IPv6 header - This options takes <b>uint32_t</b> as parameter */

§ SLNETSOCK_OPIPV6_ADD_MEMBERSHIP

#define SLNETSOCK_OPIPV6_ADD_MEMBERSHIP   (70) /* Join IPv6 multicast membership - This options takes SlNetSock_IpV6Mreq_t struct as parameter */

§ SLNETSOCK_OPIPV6_DROP_MEMBERSHIP

#define SLNETSOCK_OPIPV6_DROP_MEMBERSHIP   (71) /* Leave IPv6 multicast membership - This options takes SlNetSock_IpV6Mreq_t struct as parameter */

§ SLNETSOCK_OPIPV6_MULTICAST_HOPS

#define SLNETSOCK_OPIPV6_MULTICAST_HOPS   (72) /* Specify the hops value to use for outgoing multicast packet. */

§ SLNETSOCK_OPPHY_CHANNEL

#define SLNETSOCK_OPPHY_CHANNEL   (107) /* This option is available only when transceiver started - This options takes <b>uint32_t</b> as channel number parameter */

§ SLNETSOCK_OPPHY_RATE

#define SLNETSOCK_OPPHY_RATE   (100) /* WLAN Transmit rate - This options takes <b>uint32_t</b> as parameter based on SlWlanRateIndex_e */

§ SLNETSOCK_OPPHY_TX_POWER

#define SLNETSOCK_OPPHY_TX_POWER   (101) /* TX Power level - This options takes <b>uint32_t</b> as parameter */

§ SLNETSOCK_OPPHY_NUM_FRAMES_TO_TX

#define SLNETSOCK_OPPHY_NUM_FRAMES_TO_TX   (102) /* Number of frames to transmit - This options takes <b>uint32_t</b> as parameter */

§ SLNETSOCK_OPPHY_PREAMBLE

#define SLNETSOCK_OPPHY_PREAMBLE   (103) /* Preamble for transmission - This options takes <b>uint32_t</b> as parameter */

§ SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD

#define SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD   (104) /* TX Inhibit Threshold (CCA) - This options takes <b>uint32_t</b> as parameter based on SlNetSockTxInhibitThreshold_e */

§ SLNETSOCK_OPPHY_TX_TIMEOUT

#define SLNETSOCK_OPPHY_TX_TIMEOUT   (105) /* TX timeout for Transceiver frames (lifetime) in miliseconds (max value is 100ms) - This options takes <b>uint32_t</b> as parameter */

§ SLNETSOCK_OPPHY_ALLOW_ACKS

#define SLNETSOCK_OPPHY_ALLOW_ACKS   (106) /* Enable sending ACKs in transceiver mode - This options takes <b>uint32_t</b> as parameter */

§ SLNETSOCK_SEC_METHOD_SSLV3

#define SLNETSOCK_SEC_METHOD_SSLV3   (0) /* security metohd SSL v3 */

§ SLNETSOCK_SEC_METHOD_TLSV1

#define SLNETSOCK_SEC_METHOD_TLSV1   (1) /* security metohd TLS v1 */

§ SLNETSOCK_SEC_METHOD_TLSV1_1

#define SLNETSOCK_SEC_METHOD_TLSV1_1   (2) /* security metohd TLS v1_1 */

§ SLNETSOCK_SEC_METHOD_TLSV1_2

#define SLNETSOCK_SEC_METHOD_TLSV1_2   (3) /* security metohd TLS v1_2 */

§ SLNETSOCK_SEC_METHOD_SSLv3_TLSV1_2

#define SLNETSOCK_SEC_METHOD_SSLv3_TLSV1_2   (4) /* use highest possible version from SSLv3 - TLS 1.2 */

§ SLNETSOCK_SEC_METHOD_DLSV1

#define SLNETSOCK_SEC_METHOD_DLSV1   (5) /* security metohd DTL v1 */

§ SLNETSOCK_SEC_CIPHER_SSL_RSA_WITH_RC4_128_SHA

#define SLNETSOCK_SEC_CIPHER_SSL_RSA_WITH_RC4_128_SHA   (1 << 0)

§ SLNETSOCK_SEC_CIPHER_SSL_RSA_WITH_RC4_128_MD5

#define SLNETSOCK_SEC_CIPHER_SSL_RSA_WITH_RC4_128_MD5   (1 << 1)

§ SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_CBC_SHA

#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_CBC_SHA   (1 << 2)

§ SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_256_CBC_SHA

#define SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_256_CBC_SHA   (1 << 3)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA   (1 << 4)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_RC4_128_SHA

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_RC4_128_SHA   (1 << 5)

§ SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_128_CBC_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_128_CBC_SHA256   (1 << 6)

§ SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_CBC_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_CBC_SHA256   (1 << 7)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256   (1 << 8)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256   (1 << 9)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA   (1 << 10)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA   (1 << 11)

§ SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_128_GCM_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_128_GCM_SHA256   (1 << 12)

§ SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_GCM_SHA384

#define SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_GCM_SHA384   (1 << 13)

§ SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256   (1 << 14)

§ SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384

#define SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384   (1 << 15)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256   (1 << 16)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384   (1 << 17)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256   (1 << 18)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384   (1 << 19)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256   (1 << 20)

§ SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256   (1 << 21)

§ SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256

#define SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256   (1 << 22)

§ SLNETSOCK_SEC_ALPN_H1

#define SLNETSOCK_SEC_ALPN_H1   (1 << 0)

§ SLNETSOCK_SEC_ALPN_H2

#define SLNETSOCK_SEC_ALPN_H2   (1 << 1)

§ SLNETSOCK_SEC_ALPN_H2C

#define SLNETSOCK_SEC_ALPN_H2C   (1 << 2)

§ SLNETSOCK_SEC_ALPN_H2_14

#define SLNETSOCK_SEC_ALPN_H2_14   (1 << 3)

§ SLNETSOCK_SEC_ALPN_H2_16

#define SLNETSOCK_SEC_ALPN_H2_16   (1 << 4)

§ SLNETSOCK_SEC_ALPN_FULL_LIST

#define SLNETSOCK_SEC_ALPN_FULL_LIST   ((SLNETSOCK_SEC_ALPN_H2_16 << 1 ) - 1)

§ SLNETSOCK_SEC_START_SECURITY_SESSION_ONLY

#define SLNETSOCK_SEC_START_SECURITY_SESSION_ONLY   (1 << 0) /* Sends the command that will start the security session for a specific socket descriptor */

§ SLNETSOCK_SEC_BIND_CONTEXT_ONLY

#define SLNETSOCK_SEC_BIND_CONTEXT_ONLY   (1 << 1) /* Binds the security context to a specific socket descriptor */

§ SLNETSOCK_SEC_IS_SERVER

#define SLNETSOCK_SEC_IS_SERVER   (1 << 2) /* Used to define if the socket is client/server socket */

§ SLNETSOCK_CREATE_IF_STATE_ENABLE

#define SLNETSOCK_CREATE_IF_STATE_ENABLE   (1 << 0) /* Creation of the socket will be on enabled state */

§ SLNETSOCK_CREATE_IF_STATUS_CONNECTED

#define SLNETSOCK_CREATE_IF_STATUS_CONNECTED   (1 << 1) /* Creation of the socket will be on status connected */

§ SLNETSOCK_CREATE_ALLOW_PARTIAL_MATCH

#define SLNETSOCK_CREATE_ALLOW_PARTIAL_MATCH
Value:
(1 << 2) /* Creation of the socket will be on the interface with
the highest priority if the other flags will fail */

§ SLNETSOCK_SHUT_RD

#define SLNETSOCK_SHUT_RD   (0) /* Further receptions will be disallowed */

§ SLNETSOCK_SHUT_WR

#define SLNETSOCK_SHUT_WR   (1) /* Further transmissions will be disallowed */

§ SLNETSOCK_SHUT_RDWR

#define SLNETSOCK_SHUT_RDWR   (2) /* Further receptions and transmissions will be disallowed */

§ SLNETSOCK_INET6_ADDRSTRLEN

#define SLNETSOCK_INET6_ADDRSTRLEN   (40)

§ SLNETSOCK_INET_ADDRSTRLEN

#define SLNETSOCK_INET_ADDRSTRLEN   (15)

§ SLNETSOCK_RECV_MSG_DONTWAIT

#define SLNETSOCK_RECV_MSG_DONTWAIT   (1 << 0)

Typedef Documentation

§ SlNetSock_InAddr_t

Internet address.

§ SlNetSock_In6Addr_t

IpV6 or Ipv6 EUI64.

§ SlNetSock_Keepalive_t

The SlNetSock_Keepalive_t structure is used in SLNETSOCK_OPSOCK_KEEPALIVE socket level option.

§ SlNetSock_NonIpBoundary_t

The SlNetSock_NonIpBoundary_t structure is used in SLNETSOCK_OPSOCK_NON_IP_BOUNDARY socket level option.

§ SlNetSock_Winsize_t

The SlNetSock_Winsize_t structure is used in SLNETSOCK_OPSOCK_RCV_BUF socket level option.

§ SlNetSock_Nonblocking_t

The SlNetSock_Nonblocking_t structure is used in SLNETSOCK_OPSOCK_NON_BLOCKING socket level option.

§ SlNetSock_SecAttribNode_t

Secure socket attribute context.

§ SlNetSockSecAttrib_t

Secure socket attribute handler.

§ SlNetSock_SecureALPN_t

Secure ALPN structure.

§ SlNetSock_SecureMask_t

Secure Mask structure.

§ SlNetSock_SecureMethod_t

Secure Method structure.

§ SlNetSock_IpMreq_t

The SlNetSock_IpMreq_t structure is used in SLNETSOCK_OPIP_ADD_MEMBERSHIP/SLNETSOCK_OPIP_DROP_MEMBERSHIP IP level option.

§ SlNetSock_IpV6Mreq_t

The SlNetSock_IpV6Mreq_t structure is used in SLNETSOCK_OPIPV6_ADD_MEMBERSHIP/SLNETSOCK_OPIPV6_DROP_MEMBERSHIP IP level option.

§ SlNetSock_linger_t

The SlNetSock_linger_t structure is used in SLNETSOCK_OPSOCK_LINGER socket level option.

§ SlNetSockTime_t

typedef int32_t SlNetSockTime_t

The SlNetSockTime_t is used for setting/getting time in seconds.

§ SlNetSockuseconds_t

typedef int32_t SlNetSockuseconds_t

The SlNetSockuseconds_t is used for setting/getting time in micro-seconds.

§ SlNetSock_Timeval_t

The SlNetSock_Timeval_t structure is used in SLNETSOCK_OPSOCK_RCV_TIMEO socket level option.

§ SlNetSocklen_t

typedef uint16_t SlNetSocklen_t

The SlNetSocklen_t is used for declaring the socket length parameter.

§ SlNetSock_Addr_t

IpV4 socket address.

§ SlNetSock_AddrIn6_t

SlNetSock IPv6 address, Internet style.

§ SlNetSock_AddrIn_t

SlNetSock IPv4 address, Internet style.

§ SlNetSock_SdSet_t

The SlNetSock_SdSet_t structure holds the sd array for SlNetSock_select function.

§ SlNetSock_TransceiverRxOverHead_t

The SlNetSock_TransceiverRxOverHead_t structure holds the data for Rx transceiver mode using a raw socket when using SlNetSock_recv function.

Enumeration Type Documentation

§ SlNetSockTxInhibitThreshold_e

The SlNetSockTxInhibitThreshold_e enumerations is used in SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD PHY level option.

Enumerator
SLNETSOCK_TX_INHIBIT_THRESHOLD_MIN 
SLNETSOCK_TX_INHIBIT_THRESHOLD_LOW 
SLNETSOCK_TX_INHIBIT_THRESHOLD_DEFAULT 
SLNETSOCK_TX_INHIBIT_THRESHOLD_MED 
SLNETSOCK_TX_INHIBIT_THRESHOLD_HIGH 
SLNETSOCK_TX_INHIBIT_THRESHOLD_MAX 

§ SlNetSockSecAttrib_e

The SlNetSockSecAttrib_e enumerations is used for security attribute object in SlNetSock_secAttribSet function.

Enumerator
SLNETSOCK_SEC_ATTRIB_PRIVATE_KEY 
SLNETSOCK_SEC_ATTRIB_LOCAL_CERT 
SLNETSOCK_SEC_ATTRIB_PEER_ROOT_CA 
SLNETSOCK_SEC_ATTRIB_DH_KEY 
SLNETSOCK_SEC_ATTRIB_METHOD 
SLNETSOCK_SEC_ATTRIB_CIPHERS 
SLNETSOCK_SEC_ATTRIB_ALPN 
SLNETSOCK_SEC_ATTRIB_EXT_CLIENT_CHLNG_RESP 
SLNETSOCK_SEC_ATTRIB_DOMAIN_NAME 

Function Documentation

§ SlNetSock_init()

int32_t SlNetSock_init ( int32_t  flags)

Initialize the slnetsock module.

The SlNetSock_init function Initialize the slnetsock module, create a mutex and initialize the global parameters.

Parameters
[in]flagsFor future usage, The value 0 may be used in order to run the default flags
Returns
Zero on success, or negative error code on failure
See also
Note
Warning

§ SlNetSock_create()

int16_t SlNetSock_create ( int16_t  domain,
int16_t  type,
int16_t  protocol,
uint32_t  ifBitmap,
int16_t  flags 
)

Create an endpoint for communication.

The SlNetSock_create function creates a new socket of a certain socket type, identified by an integer number, and allocates system resources to it.
This function is called by the application layer to obtain a socket descriptor (handle).

Parameters
[in]domainSpecifies the protocol family of the created socket. For example:
  • SLNETSOCK_AF_INET for network protocol IPv4
  • SLNETSOCK_AF_INET6 for network protocol IPv6
  • SLNETSOCK_AF_RF for starting transceiver mode. Notes:
    • sending and receiving any packet overriding 802.11 header
    • for optimized power consumption the socket will be started in TX only mode until receive command is activated
[in]typeSpecifies the socket type, which determines the semantics of communication over the socket. The socket types supported by the system are implementation-dependent. Possible socket types include:
  • SLNETSOCK_SOCK_STREAM (reliable stream-oriented service or Stream Sockets)
  • SLNETSOCK_SOCK_DGRAM (datagram service or Datagram Sockets)
  • SLNETSOCK_SOCK_RAW (raw protocols atop the network layer)
  • when used with AF_RF:
    • SLNETSOCK_SOCK_RX_MTR
    • SLNETSOCK_SOCK_MAC_WITH_CCA
    • SLNETSOCK_SOCK_MAC_WITH_NO_CCA
    • SLNETSOCK_SOCK_BRIDGE
    • SLNETSOCK_SOCK_ROUTER
[in]protocolSpecifies a particular transport to be used with the socket.
The most common are
  • SLNETSOCK_PROTO_TCP
  • SLNETSOCK_PROTO_UDP
  • SLNETSOCK_PROTO_RAW
  • SLNETSOCK_PROTO_SECURE The value 0 may be used to select a default protocol from the selected domain and type
[in]ifBitmapSpecifies the interfaces which the socket will be create on according to the priority until one of them will return an answer.
Value 0 is used in order to choose automatic interfaces selection according to the priority interface list. Value can be combination of interfaces by OR'ing multiple interfaces bit identifiers (SLNETIFC_IDENT_ defined in slnetif.h) Note: interface identifier bit must be configured prior to this socket creation using SlNetIf_add function.
[in]flagsSpecifies flags.
  • SLNETSOCK_CREATE_IF_STATE_ENABLE - Creation of the socket will be on enabled state
  • SLNETSOCK_CREATE_IF_STATUS_CONNECTED - Creation of the socket will be on status connected
  • SLNETSOCK_CREATE_ALLOW_PARTIAL_MATCH - Creation of the socket will be on the interface with the highest priority if the other flags will fail The value 0 may be used in order to run the default flags:
  • SLNETSOCK_CREATE_IF_STATE_ENABLE
  • SLNETSOCK_CREATE_IF_STATUS_CONNECTED
Returns
On success, socket descriptor (handle) that is used for consequent socket operations.
A successful return code should be a positive number (int16)
On error, a negative value will be returned specifying the error code.
  • SLNETERR_BSD_EAFNOSUPPORT - illegal domain parameter
  • SLNETERR_BSD_EPROTOTYPE - illegal type parameter
  • SLNETERR_BSD_EACCES - permission denied
  • SLNETERR_BSD_ENSOCK - exceeded maximal number of socket
  • SLNETERR_BSD_ENOMEM - memory allocation error
  • SLNETERR_BSD_EINVAL - error in socket configuration
  • SLNETERR_BSD_EPROTONOSUPPORT - illegal protocol parameter
  • SLNETERR_BSD_EOPNOTSUPP - illegal combination of protocol and type parameters
See also
SlNetSock_close
Note
Warning

§ SlNetSock_close()

int32_t SlNetSock_close ( int16_t  sd)

Gracefully close socket.

The SlNetSock_close function causes the system to release resources allocated to a socket.
In case of TCP, the connection is terminated.

Parameters
[in]sdSocket descriptor (handle), received in SlNetSock_create
Returns
Zero on success, or negative error code on failure
See also
SlNetSock_create
Note
Warning

§ SlNetSock_shutdown()

int32_t SlNetSock_shutdown ( int16_t  sd,
int16_t  how 
)

Shutting down parts of a full-duplex connection.

The SlNetSock_shutdown Shuts down parts of a full-duplex connection according to how parameter.

Parameters
[in]sdSocket descriptor (handle), received in SlNetSock_create
[in]howSpecifies which part of a full-duplex connection to shutdown.
The options are
  • SLNETSOCK_SHUT_RD - further receptions will be disallowed
  • SLNETSOCK_SHUT_WR - further transmissions will be disallowed
  • SLNETSOCK_SHUT_RDWR - further receptions and transmissions will be disallowed
Returns
Zero on success, or negative error code on failure
See also
SlNetSock_create SlNetSock_connect SlNetSock_accept
Note
Warning

§ SlNetSock_accept()

int16_t SlNetSock_accept ( int16_t  sd,
SlNetSock_Addr_t addr,
SlNetSocklen_t addrlen 
)

Accept a connection on a socket.

The SlNetSock_accept function is used with connection-based socket types (SOCK_STREAM).
It extracts the first connection request on the queue of pending connections, creates a new connected socket, and returns a new file descriptor referring to that socket.
The newly created socket is not in the listening state. The original socket sd is unaffected by this call.
The argument sd is a socket that has been created with SlNetSock_create(), bound to a local address with SlNetSock_bind(), and is listening for connections after a SlNetSock_listen().
The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer.
The exact format of the address returned addr is determined by the socket's address family.
The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr, on return it will contain the actual length (in bytes) of the address returned.

Parameters
[in]sdSocket descriptor (handle)
[out]addrThe argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address
sockaddr:
- code for the address format.
- socket address, the length depends on the code format
[out]addrlenThe addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr
Returns
On success, a socket descriptor.
On a non-blocking accept a possible negative value is SLNETERR_BSD_EAGAIN.
On failure, negative error code.
SLNETERR_BSD_ENOMEM may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
SlNetSock_create SlNetSock_bind SlNetSock_listen
Note
Warning

§ SlNetSock_bind()

int32_t SlNetSock_bind ( int16_t  sd,
const SlNetSock_Addr_t addr,
int16_t  addrlen 
)

Assign a name to a socket.

This SlNetSock_bind function gives the socket the local address addr. addr is addrlen bytes long.
Traditionally, this is called When a socket is created with socket, it exists in a name space (address family) but has no name assigned.
It is necessary to assign a local address before a SOCK_STREAM socket may receive connections.

Parameters
[in]sdSocket descriptor (handle)
[in]addrSpecifies the destination addrs
sockaddr:
- code for the address format.
- socket address, the length depends on the code format
[in]addrlenContains the size of the structure pointed to by addr
Returns
Zero on success, or negative error code on failure
See also
SlNetSock_create SlNetSock_accept SlNetSock_listen
Note
Warning

§ SlNetSock_listen()

int32_t SlNetSock_listen ( int16_t  sd,
int16_t  backlog 
)

Listen for connections on a socket.

The willingness to accept incoming connections and a queue limit for incoming connections are specified with SlNetSock_listen(), and then the connections are accepted with SlNetSock_accept().
The SlNetSock_listen() call applies only to sockets of type SOCK_STREAM The backlog parameter defines the maximum length the queue of pending connections may grow to.

Parameters
[in]sdSocket descriptor (handle)
[in]backlogSpecifies the listen queue depth.
Returns
Zero on success, or negative error code on failure
See also
SlNetSock_create SlNetSock_accept SlNetSock_bind
Note
Warning

§ SlNetSock_connect()

int32_t SlNetSock_connect ( int16_t  sd,
const SlNetSock_Addr_t addr,
SlNetSocklen_t  addrlen 
)

Initiate a connection on a socket.

Function connects the socket referred to by the socket descriptor sd, to the address specified by addr.
The addrlen argument specifies the size of addr.
The format of the address in addr is determined by the address space of the socket.
If it is of type SLNETSOCK_SOCK_DGRAM, this call specifies the peer with which the socket is to be associated; this address is that to which datagrams are to be sent, and the only address from which datagrams are to be received.
If the socket is of type SLNETSOCK_SOCK_STREAM, this call attempts to make a connection to another socket.
The other socket is specified by address, which is an address in the communications space of the socket.

Parameters
[in]sdSocket descriptor (handle)
[in]addrSpecifies the destination addr
sockaddr:
- code for the address format.
- socket address, the length depends on the code format
[in]addrlenContains the size of the structure pointed to by addr
Returns
On success, a socket descriptor (handle).
On a non-blocking connect a possible negative value is NETSCOK_EALREADY. On failure, negative value.
NETSCOK_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
SlNetSock_create
Note
Warning

§ SlNetSock_connectUrl()

int32_t SlNetSock_connectUrl ( int16_t  sd,
const char *  url 
)

Initiate a connection on a socket by URL.

Function connects the socket referred to by the socket descriptor sd, to a specified URL. The URL could contain a domain name or formatted IP address.

Parameters
[in]sdSocket descriptor (handle)
[in]urlSpecifies the destination url
Returns
On success, a socket descriptor (handle).
On a non-blocking connect a possible negative value is NETSCOK_EALREADY. On failure, negative value.
NETSCOK_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
SlNetSock_create
Note
Warning

§ SlNetSock_getPeerName()

int32_t SlNetSock_getPeerName ( int16_t  sd,
SlNetSock_Addr_t addr,
SlNetSocklen_t addrlen 
)

Return address info about the remote side of the connection.

SlNetSock_getpeername simply returns a struct SlNetSock_AddrIn_t filled with information about the peer device that is connected on the other side of the socket descriptor.

Parameters
[in]sdSocket descriptor (handle)
[out]addrreturns the struct addr
SlNetSockAddrIn filled with information about the peer device:
- code for the address format.
- socket address, the length depends on the code format
[out]addrlenContains the size of the structure pointed to by addr
Returns
Zero on success, or negative error code on failure
See also
SlNetSock_accept SlNetSock_connect
Note
Warning

§ SlNetSock_getSockName()

int32_t SlNetSock_getSockName ( int16_t  sd,
SlNetSock_Addr_t addr,
SlNetSocklen_t addrlen 
)

Get local address info by socket descriptor
Returns the local address info of the socket descriptor.

Parameters
[in]sdSocket descriptor (handle)
[out]addrThe argument addr is a pointer to a SlNetSock_Addr_t structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address
SlNetSock_Addr_t:
- code for the address format.
- socket address, the length depends on the code format
[out]addrlenThe addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr
Returns
Zero on success, or negative on failure.
See also
SlNetSock_create SlNetSock_bind
Note
If the provided buffer is too small the returned address will be truncated and the addrlen will contain the actual size of the socket address
Warning

§ SlNetSock_select()

int32_t SlNetSock_select ( int16_t  nsds,
SlNetSock_SdSet_t readsds,
SlNetSock_SdSet_t writesds,
SlNetSock_SdSet_t exceptsds,
SlNetSock_Timeval_t timeout 
)

Monitor socket activity.

SlNetSock_select allow a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become "ready" for some class of I/O operation. If trigger mode is enabled the active sdset is the one that retrieved in the first triggered call. To enable the trigger mode, an handler must be statically registered to the slcb_SocketTriggerEventHandler (user.h)

Parameters
[in]nsdsThe highest-numbered file descriptor in any of the three sets, plus 1.
[in,out]readsdsSocket descriptors list for read monitoring and accept monitoring
[in,out]writesdsSocket descriptors list for connect monitoring only, write monitoring is not supported
[in,out]exceptsdsSocket descriptors list for exception monitoring, not supported.
[in]timeoutIs an upper bound on the amount of time elapsed before SlNetSock_select() returns. Null or above 0xffff seconds means infinity timeout. The minimum timeout is 10 milliseconds, less than 10 milliseconds will be set automatically to 10 milliseconds. Max microseconds supported is 0xfffc00. In trigger mode the timeout fields must be set to zero.
Returns
On success, SlNetSock_select() returns the number of file descriptors contained in the three returned descriptor sets (that is, the total number of bits that are set in readsds, writesds, exceptsds) which may be zero if the timeout expires before anything interesting happens.
On error, a negative value is returned. readsds - return the sockets on which Read request will return without delay with valid data.
writesds - return the sockets on which Write request will return without delay.
exceptsds - return the sockets closed recently.
SLNETERR_BSD_ENOMEM may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
SlNetSock_create
Note
If the timeout value set to less than 10ms it will automatically set to 10ms to prevent overload of the system
Only one SlNetSock_select can be handled at a time. Calling this API while the same command is called from another thread, may result in one of the following scenarios:
  1. The command will wait (internal) until the previous command finish, and then be executed.
  2. There are not enough resources and SLNETERR_BSD_ENOMEM error will return. In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try again later to issue the command.
  3. In case there is already a triggered SlNetSock_select in progress, the following call will return with SLNETSOCK_RET_CODE_SOCKET_SELECT_IN_PROGRESS_ERROR.
Warning

§ SlNetSock_sdsSet()

int32_t SlNetSock_sdsSet ( int16_t  sd,
SlNetSock_SdSet_t sdset 
)

SlNetSock_select's SlNetSock_SdSet_t SET function.

Sets current socket descriptor on SlNetSock_SdSet_t container

§ SlNetSock_sdsClr()

int32_t SlNetSock_sdsClr ( int16_t  sd,
SlNetSock_SdSet_t sdset 
)

SlNetSock_select's SlNetSock_SdSet_t CLR function.

Clears current socket descriptor on SlNetSock_SdSet_t container

§ SlNetSock_sdsClrAll()

int32_t SlNetSock_sdsClrAll ( SlNetSock_SdSet_t sdset)

SlNetSock_select's SlNetSock_SdSet_t ZERO function.

Clears all socket descriptors from SlNetSock_SdSet_t

§ SlNetSock_sdsIsSet()

int32_t SlNetSock_sdsIsSet ( int16_t  sd,
SlNetSock_SdSet_t sdset 
)

SlNetSock_select's SlNetSock_SdSet_t ISSET function.

Checks if current socket descriptor is set (true/false)

Returns
Returns true if set, false if unset

§ SlNetSock_setOpt()

int32_t SlNetSock_setOpt ( int16_t  sd,
int16_t  level,
int16_t  optname,
void *  optval,
SlNetSocklen_t  optlen 
)

Set socket options-.

The SlNetSock_setOpt function manipulate the options associated with a socket.
Options may exist at multiple protocol levels; they are always present at the uppermost socket level.
When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP;
The parameters optval and optlen are used to access opt_values for SlNetSock_setOpt(). For SlNetSock_getOpt() they identify a buffer in which the value for the requested option(s) are to be returned. For SlNetSock_getOpt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.

Parameters
[in]sdSocket descriptor (handle)
[in]levelDefines the protocol level for this option
  • SLNETSOCK_LVL_SOCKET Socket level configurations (L4, transport layer)
  • SLNETSOCK_LVL_IP IP level configurations (L3, network layer)
  • SLNETSOCK_LVL_PHY Link level configurations (L2, link layer)
[in]optnameDefines the option name to interrogate
  • SLNETSOCK_LVL_SOCKET
    • SLNETSOCK_OPSOCK_RCV_BUF
      Sets tcp max recv window size.
      This options takes SlNetSock_Winsize_t struct as parameter
    • SLNETSOCK_OPSOCK_RCV_TIMEO
      Sets the timeout value that specifies the maximum amount of time an input function waits until it completes.
      Default: No timeout
      This options takes SlNetSock_Timeval_t struct as parameter
    • SLNETSOCK_OPSOCK_KEEPALIVE
      Enable or Disable periodic keep alive. Keeps TCP connections active by enabling the periodic transmission of messages
      Timeout is 5 minutes.
      Default: Enabled
      This options takes SlNetSock_Keepalive_t struct as parameter
    • SLNETSOCK_OPSOCK_KEEPALIVE_TIME
      Set keep alive timeout. Value is in seconds
      Default: 5 minutes
    • SLNETSOCK_OPSOCK_LINGER
      Socket lingers on close pending remaining send/receive packets
    • SLNETSOCK_OPSOCK_NON_BLOCKING
      Sets socket to non-blocking operation Impacts: connect, accept, send, sendto, recv and recvfrom.
      Default: Blocking. This options takes SlNetSock_Nonblocking_t struct as parameter
    • SLNETSOCK_OPSOCK_NON_IP_BOUNDARY
      Enable or Disable rx ip boundary. In connectionless socket (udp/raw), unread data is dropped (when SlNetSock_recvfrom len parameter < data size), Enable this option in order to read the left data on the next SlNetSock_recvfrom iteration Default: Disabled, IP boundary kept,
      This options takes SlNetSock_NonIpBoundary_t struct as parameter
  • SLNETSOCK_LVL_IP
    • SLNETSOCK_OPIP_MULTICAST_TTL
      Set the time-to-live value of outgoing multicast packets for this socket.
      This options takes uint8_t as parameter
    • SLNETSOCK_OPIP_ADD_MEMBERSHIP
      UDP socket, Join a multicast group.
      This options takes SlNetSock_IpMreq_t struct as parameter
    • SLNETSOCK_OPIP_DROP_MEMBERSHIP
      UDP socket, Leave a multicast group
      This options takes SlNetSock_IpMreq_t struct as parameter
    • SLNETSOCK_OPIP_HDRINCL
      RAW socket only, the IPv4 layer generates an IP header when sending a packet unless
      the IP_HDRINCL socket option is enabled on the socket.
      When it is enabled, the packet must contain an IP header.
      Default: disabled, IPv4 header generated by Network Stack
      This options takes uint32_t as parameter
    • SLNETSOCK_OPIP_RAW_RX_NO_HEADER
      Raw socket remove IP header from received data.
      Default: data includes ip header
      This options takes uint32_t as parameter
    • SLNETSOCK_OPIP_RAW_IPV6_HDRINCL (inactive)
      RAW socket only, the IPv6 layer generates an IP header when sending a packet unless
      the IP_HDRINCL socket option is enabled on the socket. When it is enabled, the packet must contain an IP header
      Default: disabled, IPv4 header generated by Network Stack
      This options takes uint32_t as parameter
  • SLNETSOCK_LVL_PHY
    • SLNETSOCK_OPPHY_CHANNEL
      Sets channel in transceiver mode. This options takes uint32_t as channel number parameter
    • SLNETSOCK_OPPHY_RATE
      RAW socket, set WLAN PHY transmit rate
      The values are based on SlWlanRateIndex_e
      This options takes uint32_t as parameter
    • SLNETSOCK_OPPHY_TX_POWER
      RAW socket, set WLAN PHY TX power
      Valid rage is 1-15
      This options takes uint32_t as parameter
    • SLNETSOCK_OPPHY_NUM_FRAMES_TO_TX
      RAW socket, set number of frames to transmit in transceiver mode. Default: 1 packet This options takes uint32_t as parameter
    • SLNETSOCK_OPPHY_PREAMBLE
      RAW socket, set WLAN PHY preamble for Long/Short
      This options takes uint32_t as parameter
    • SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD
      RAW socket, set WLAN Tx - Set CCA threshold.
      The values are based on SlNetSockTxInhibitThreshold_e
      This options takes uint32_t as parameter
    • SLNETSOCK_OPPHY_TX_TIMEOUT
      RAW socket, set WLAN Tx - changes the TX timeout (lifetime) of transceiver frames.
      Value in Ms, maximum value is 10ms
      This options takes uint32_t as parameter
    • SLNETSOCK_OPPHY_ALLOW_ACKS
      RAW socket, set WLAN Tx - Enable or Disable sending ACKs in transceiver mode
      0 = disabled / 1 = enabled
      This options takes uint32_t as parameter
[in]optvalSpecifies a value for the option
[in]optlenSpecifies the length of the option value
Returns
Zero on success, or negative error code on failure
Persistent
All params are Non- Persistent
See also
SlNetSock_getOpt
Note
Warning
Examples

§ SlNetSock_getOpt()

int32_t SlNetSock_getOpt ( int16_t  sd,
int16_t  level,
int16_t  optname,
void *  optval,
SlNetSocklen_t optlen 
)

Get socket options.

The SlNetSock_getOpt function gets the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level.
The parameters optval and optlen identify a buffer in which the value for the requested option(s) are to be returned. optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.

Parameters
[in]sdSocket descriptor (handle)
[in]levelDefines the protocol level for this option
[in]optnamedefines the option name to interrogate
[out]optvalSpecifies a value for the option
[out]optlenSpecifies the length of the option value
Returns
Zero on success, or negative error code on failure
See also
SlNetSock_setOpt
Note
Warning

§ SlNetSock_recv()

int32_t SlNetSock_recv ( int16_t  sd,
void *  buf,
uint32_t  len,
uint32_t  flags 
)

Read data from TCP socket.

The SlNetSock_recv function receives a message from a connection-mode socket

Parameters
[in]sdSocket descriptor (handle)
[out]bufPoints to the buffer where the message should be stored.
[in]lenSpecifies the length in bytes of the buffer pointed to by the buffer argument. Range: 1-16000 bytes
[in]flagsSpecifies the type of message reception. On this version, this parameter is not supported.
Returns
Return the number of bytes received, or a negative value if an error occurred.
Using a non-blocking recv a possible negative value is SLNETERR_BSD_EAGAIN.
SLNETERR_BSD_ENOMEM may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
SlNetSock_recvFrom
Note
Warning
Examples

§ SlNetSock_recvFrom()

int32_t SlNetSock_recvFrom ( int16_t  sd,
void *  buf,
uint32_t  len,
uint32_t  flags,
SlNetSock_Addr_t from,
SlNetSocklen_t fromlen 
)

Read data from socket.

SlNetSock_recvFrom function receives a message from a connection-mode or connectionless-mode socket

Parameters
[in]sdSocket descriptor (handle)
[out]bufPoints to the buffer where the message should be stored.
[in]lenSpecifies the length in bytes of the buffer pointed to by the buffer argument. Range: 1-16000 bytes
[in]flagsSpecifies the type of message reception. On this version, this parameter is not supported
[in]fromPointer to an address structure indicating the source address.
sockaddr:
- code for the address format.
- socket address, the length depends on the code format
[in]fromlenSource address structure size. This parameter MUST be set to the size of the structure pointed to by addr.
Returns
Return the number of bytes received, or a negative value if an error occurred.
Using a non-blocking recv a possible negative value is SLNETERR_BSD_EAGAIN. SLNETSOCK_RET_CODE_INVALID_INPUT (-2) will be returned if fromlen has incorrect length.
SLNETERR_BSD_ENOMEM may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
SlNetSock_recv
Note
Warning
Example

§ SlNetSock_send()

int32_t SlNetSock_send ( int16_t  sd,
const void *  buf,
uint32_t  len,
uint32_t  flags 
)

Write data to TCP socket.

The SlNetSock_send function is used to transmit a message to another socket. Returns immediately after sending data to device. In case of TCP failure an async event SLNETSOCK_SOCKET_TX_FAILED_EVENT is going to be received.
In case of a RAW socket (transceiver mode), extra 4 bytes should be reserved at the end of the frame data buffer for WLAN FCS

Parameters
[in]sdSocket descriptor (handle)
[in]bufPoints to a buffer containing the message to be sent
[in]lenMessage size in bytes.
[in]flagsSpecifies the type of message transmission. On this version, this parameter is not supported for TCP. For transceiver mode, the SLNETSOCK_WLAN_RAW_RF_TX_PARAMS macro can be used to determine transmission parameters (channel,rate,tx_power,preamble)
Returns
Return the number of bytes sent, or a negative value if an error occurred.
See also
SlNetSock_sendTo
Note
Warning
Example

§ SlNetSock_sendTo()

int32_t SlNetSock_sendTo ( int16_t  sd,
const void *  buf,
uint32_t  len,
uint32_t  flags,
const SlNetSock_Addr_t to,
SlNetSocklen_t  tolen 
)

Write data to socket.

The SlNetSock_sendTo function is used to transmit a message on a connectionless socket (connection less socket SLNETSOCK_SOCK_DGRAM, SLNETSOCK_SOCK_RAW).
Returns immediately after sending data to device.
In case of transmission failure an async event SLNETSOCK_SOCKET_TX_FAILED_EVENT is going to be received.

Parameters
[in]sdSocket descriptor (handle)
[in]bufPoints to a buffer containing the message to be sent
[in]lenmessage size in bytes.
[in]flagsSpecifies the type of message transmission. On this version, this parameter is not supported
[in]toPointer to an address structure indicating the destination address.
sockaddr:
- code for the address format.
- socket address, the length depends on the code format
[in]tolenDestination address structure size
Returns
Return the number of bytes sent, or a negative value if an error occurred.
See also
SlNetSock_Send
Note
Warning
Example

§ SlNetSock_getIfID()

int32_t SlNetSock_getIfID ( uint16_t  sd)

Get interface ID from socket descriptor (sd)

The SlNetSock_getIfID function retrieves the priority of the requested interface.

Parameters
[in]sdSpecifies the socket descriptor which its interface identifier needs to be retrieved.
Returns
The interface identifier value of the interface on success, or negative error code on failure The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
See also
SlNetIf_add SlNetIf_getIDByName
Note
Warning
Examples
int16_t InterfaceID;


§ SlNetSock_secAttribCreate()

SlNetSockSecAttrib_t* SlNetSock_secAttribCreate ( void  )

Creates a security attributes object.

The SlNetSock_secAttribCreate function is used to create a security attribute, which is required in order to start a secure session The function dynamically allocate the object and the function SlNetSock_secAttribDelete must be called when the object is no longer in use.
The same security object is not bounded to a communication session and can be used to initiate several secure sessions, if all of them have the same attributes.

Returns
See also
Note
Warning
Example
  • Create security attributes

§ SlNetSock_secAttribDelete()

int32_t SlNetSock_secAttribDelete ( SlNetSockSecAttrib_t secAttrib)

Deletes a security attributes object.

The SlNetSock_secAttribDelete function is used to release a security attributes object.

Parameters
[in]secAttribSecure attribute handle
Returns
Zero on success, or negative error code on failure
See also
SlNetSock_secAttribCreate , SlNetSock_secAttribSet , SlNetSock_startSec
Note
Warning
Example
  • Delete security attributes

§ SlNetSock_secAttribSet()

int32_t SlNetSock_secAttribSet ( SlNetSockSecAttrib_t secAttrib,
SlNetSockSecAttrib_e  attribName,
void *  val,
uint16_t  len 
)

set a security attributes

The SlNetSock_secAttribSet function is used to set a security attribute of a security attributes object.

Parameters
[in]secAttribSecure attribute handle
[in]attribNameDefine the actual attribute to set. Applicable values:
  • SLNETSOCK_SEC_ATTRIB_PRIVATE_KEY
  • SLNETSOCK_SEC_ATTRIB_LOCAL_CERT
  • SLNETSOCK_SEC_ATTRIB_PEER_ROOT_CA
  • SLNETSOCK_SEC_ATTRIB_METHOD
  • SLNETSOCK_SEC_ATTRIB_CIPHERS
  • SLNETSOCK_SEC_ATTRIB_ALPN
  • SLNETSOCK_SEC_ATTRIB_EXT_CLIENT_CHLNG_RESP
  • SLNETSOCK_SEC_ATTRIB_DOMAIN_NAME
[in]val
[in]len
Returns
Zero on success, or negative error code on failure
See also
Note
Warning
Example
  • Sent root certificate name:

§ SlNetSock_startSec()

int32_t SlNetSock_startSec ( int16_t  sd,
SlNetSockSecAttrib_t secAttrib,
uint8_t  flags 
)

Start a security session on an opened socket.

The SlNetSock_startSec function is used start a security session on an opened socket. If the security handle is NULL the session would be started with the default security settings.

Parameters
[in]sdSocket descriptor (handle)
[in]secAttribSecure attribute handle
[in]flagsSpecifies flags.
The available flags are:
  • SLNETSOCK_SEC_START_SECURITY_SESSION_ONLY
  • SLNETSOCK_SEC_BIND_CONTEXT_ONLY
  • SLNETSOCK_SEC_IS_SERVER
Returns
Zero on success, or negative error code on failure
See also
Note
Warning
Example
  • start security session on an opened socket:
Copyright 2017, Texas Instruments Incorporated