Network Services API  2.75.00.17
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_NoDelay_t
 The SlNetSock_NoDelay_t structure is used in SLNETSOCK_TCP_NODELAY TCP level option. More...
 
struct  SlNetSock_MaxSeg_t
 The SlNetSock_MaxSeg_t structure is used in SLNETSOCK_TCP_MAXSEG TCP level option. More...
 
struct  SlNetSock_NoPush_t
 The SlNetSock_NoPush_t structure is used in SLNETSOCK_TCP_NOPUSH TCP level option. More...
 
struct  SlNetSock_NoOpt_t
 The SlNetSock_NoOpt_t structure is used in SLNETSOCK_TCP_NOOPT TCP level option. More...
 
struct  SlNetSock_SackPermitted_t
 The SlNetSock_SackPermitted_t structure is used in SLNETSOCK_TCP_NOPUSH TCP level option. More...
 
struct  SlNetSock_MaxRtt_t
 The SlNetSock_MaxRtt_t structure is used in SLNETSOCK_TCP_MAXRTT TCP level option. 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_Broadcast_t
 The SlNetSock_Broadcast_t structure is used in SLNETSOCK_OPSOCK_BROADCAST 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 and SLNETSOCK_OPIP_DROP_MEMBERSHIP IP level option. More...
 
struct  SlNetSock_IpV6Mreq_t
 The SlNetSock_IpV6Mreq_t structure is used in SLNETSOCK_OPIPV6_ADD_MEMBERSHIP and 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_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_SockAddrStorage_t
 Generic socket address type to hold either IPv4 or IPv6 address. 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)
 
#define SLNETSOCK_AF_UNSPEC   (0)
 
#define SLNETSOCK_AF_INET   (2)
 
#define SLNETSOCK_AF_INET6   (3)
 
#define SLNETSOCK_AF_RF   (6)
 
#define SLNETSOCK_AF_PACKET   (17)
 
#define SLNETSOCK_PF_UNSPEC   SLNETSOCK_AF_UNSPEC
 
#define SLNETSOCK_PF_INET   SLNETSOCK_AF_INET
 
#define SLNETSOCK_PF_INET6   SLNETSOCK_AF_INET6
 
#define SLNETSOCK_SOCK_STREAM   (1)
 
#define SLNETSOCK_SOCK_DGRAM   (2)
 
#define SLNETSOCK_SOCK_RAW   (3)
 
#define SLNETSOCK_SOCK_RX_MTR   (4)
 
#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)
 
#define SLNETSOCK_PROTO_UDP   (17)
 
#define SLNETSOCK_PROTO_RAW   (255)
 
#define SLNETSOCK_PROTO_SECURE   (100)
 
#define SLNETSOCK_INADDR_ANY   (0)
 
#define SLNETSOCK_IN6ADDR_ANY   (0)
 
#define SLNETSOCK_LVL_SOCKET   (1)
 
#define SLNETSOCK_LVL_IP   (2)
 
#define SLNETSOCK_LVL_PHY   (3)
 
#define SLNETSOCK_OPSOCK_RCV_BUF   (8)
 
#define SLNETSOCK_OPSOCK_SND_BUF   (202)
 
#define SLNETSOCK_OPSOCK_RCV_TIMEO   (20)
 
#define SLNETSOCK_OPSOCK_SND_TIMEO   (21)
 
#define SLNETSOCK_OPSOCK_KEEPALIVE   (9)
 
#define SLNETSOCK_OPSOCK_KEEPALIVE_TIME   (37)
 
#define SLNETSOCK_OPSOCK_LINGER   (13)
 
#define SLNETSOCK_OPSOCK_NON_BLOCKING   (24)
 
#define SLNETSOCK_OPSOCK_NON_IP_BOUNDARY   (39)
 
#define SLNETSOCK_OPSOCK_ERROR   (58)
 
#define SLNETSOCK_OPSOCK_SLNETSOCKSD   (59)
 
#define SLNETSOCK_OPSOCK_BROADCAST   (200)
 
#define SLNETSOCK_OPSOCK_REUSEADDR   (201)
 
#define SLNETSOCK_OPSOCK_REUSEPORT   (203)
 
#define SLNETSOCK_OPIP_MULTICAST_TTL   (61)
 
#define SLNETSOCK_OPIP_ADD_MEMBERSHIP   (65)
 
#define SLNETSOCK_OPIP_DROP_MEMBERSHIP   (66)
 
#define SLNETSOCK_OPIP_HDRINCL   (67)
 
#define SLNETSOCK_OPIP_RAW_RX_NO_HEADER   (68)
 
#define SLNETSOCK_OPIP_RAW_IPV6_HDRINCL   (69)
 
#define SLNETSOCK_OPIPV6_ADD_MEMBERSHIP   (70)
 
#define SLNETSOCK_OPIPV6_DROP_MEMBERSHIP   (71)
 
#define SLNETSOCK_OPIPV6_MULTICAST_HOPS   (72)
 
#define SLNETSOCK_OPPHY_CHANNEL   (28)
 
#define SLNETSOCK_OPPHY_RATE   (100)
 
#define SLNETSOCK_OPPHY_TX_POWER   (101)
 
#define SLNETSOCK_OPPHY_NUM_FRAMES_TO_TX   (102)
 
#define SLNETSOCK_OPPHY_PREAMBLE   (103)
 
#define SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD   (104)
 
#define SLNETSOCK_OPPHY_TX_TIMEOUT   (105)
 
#define SLNETSOCK_OPPHY_ALLOW_ACKS   (106)
 
#define SLNETSOCK_TCP_NODELAY   (203)
 
#define SLNETSOCK_TCP_MAXSEG   (204)
 
#define SLNETSOCK_TCP_NOPUSH   (205)
 
#define SLNETSOCK_TCP_NOOPT   (206)
 
#define SLNETSOCK_TCP_SACKPERMITTED   (207)
 
#define SLNETSOCK_TCP_MAXRTT   (208)
 
#define SLNETSOCK_SEC_METHOD_SSLV3   (0)
 
#define SLNETSOCK_SEC_METHOD_TLSV1   (1)
 
#define SLNETSOCK_SEC_METHOD_TLSV1_1   (2)
 
#define SLNETSOCK_SEC_METHOD_TLSV1_2   (3)
 
#define SLNETSOCK_SEC_METHOD_SSLv3_TLSV1_2   (4)
 
#define SLNETSOCK_SEC_METHOD_DLSV1   (5)
 
#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_CIPHER_FULL_LIST   (0xFFFFFFFF)
 
#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)
 
#define SLNETSOCK_SEC_BIND_CONTEXT_ONLY   (1 << 1)
 
#define SLNETSOCK_SEC_IS_SERVER   (1 << 2)
 
#define SLNETSOCK_CREATE_IF_STATE_ENABLE   (1 << 0)
 
#define SLNETSOCK_CREATE_IF_STATUS_CONNECTED   (1 << 1)
 
#define SLNETSOCK_CREATE_ALLOW_PARTIAL_MATCH   (1 << 2)
 
#define SLNETSOCK_SHUT_RD   (0)
 
#define SLNETSOCK_SHUT_WR   (1)
 
#define SLNETSOCK_SHUT_RDWR   (2)
 
#define SLNETSOCK_INET6_ADDRSTRLEN   (46)
 
#define SLNETSOCK_INET_ADDRSTRLEN   (16)
 
#define SLNETSOCK_MSG_OOB   (0x0001)
 
#define SLNETSOCK_MSG_PEEK   (0x0002)
 
#define SLNETSOCK_MSG_WAITALL   (0x0004)
 
#define SLNETSOCK_MSG_DONTWAIT   (0x0008)
 
#define SLNETSOCK_MSG_DONTROUTE   (0x0010)
 
#define SLNETSOCK_MSG_NOSIGNAL   (0x0020)
 

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_NoDelay_t SlNetSock_NoDelay_t
 The SlNetSock_NoDelay_t structure is used in SLNETSOCK_TCP_NODELAY TCP level option. More...
 
typedef struct SlNetSock_MaxSeg_t SlNetSock_MaxSeg_t
 The SlNetSock_MaxSeg_t structure is used in SLNETSOCK_TCP_MAXSEG TCP level option. More...
 
typedef struct SlNetSock_NoPush_t SlNetSock_NoPush_t
 The SlNetSock_NoPush_t structure is used in SLNETSOCK_TCP_NOPUSH TCP level option. More...
 
typedef struct SlNetSock_NoOpt_t SlNetSock_NoOpt_t
 The SlNetSock_NoOpt_t structure is used in SLNETSOCK_TCP_NOOPT TCP level option. More...
 
typedef struct SlNetSock_SackPermitted_t SlNetSock_SackPermitted_t
 The SlNetSock_SackPermitted_t structure is used in SLNETSOCK_TCP_NOPUSH TCP level option. More...
 
typedef struct SlNetSock_MaxRtt_t SlNetSock_MaxRtt_t
 The SlNetSock_MaxRtt_t structure is used in SLNETSOCK_TCP_MAXRTT TCP level option. 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_Broadcast_t SlNetSock_Broadcast_t
 The SlNetSock_Broadcast_t structure is used in SLNETSOCK_OPSOCK_BROADCAST 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 and 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 and 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 struct timeval SlNetSock_Timeval_t
 The SlNetSock_Timeval_t structure is used in the SLNETSOCK_OPSOCK_RCV_TIMEO and SLNETSOCK_OPSOCK_SND_TIMEO socket level options. 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_SockAddrStorage_t SlNetSock_SockAddrStorage_t
 Generic socket address type to hold either IPv4 or IPv6 address. 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,
  SLNETSOCK_SEC_ATTRIB_DISABLE_CERT_STORE = 9
}
 The SlNetSockSecAttrib_e enumerations are used to declare security attribute objects in SlNetSock_secAttribSet(). 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_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. 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 attribute 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_UNSPEC

#define SLNETSOCK_AF_UNSPEC   (0)

Unspecified address family

§ 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_UNSPEC

#define SLNETSOCK_PF_UNSPEC   SLNETSOCK_AF_UNSPEC

§ 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_SND_BUF

#define SLNETSOCK_OPSOCK_SND_BUF   (202)

Sets or gets the maximum socket send buffer in bytes. - This option takes an int as a 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_SND_TIMEO

#define SLNETSOCK_OPSOCK_SND_TIMEO   (21)

Enable send 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   (37)

keepalive time out - This options takes uint32_t 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   (39)

connectionless socket disable rx boundary - This options takes SlNetSock_NonIpBoundary_t struct as parameter

§ SLNETSOCK_OPSOCK_ERROR

#define SLNETSOCK_OPSOCK_ERROR   (58)

Socket level error code

§ SLNETSOCK_OPSOCK_SLNETSOCKSD

#define SLNETSOCK_OPSOCK_SLNETSOCKSD   (59)

Used by the BSD layer in order to retrieve the slnetsock sd

§ SLNETSOCK_OPSOCK_BROADCAST

#define SLNETSOCK_OPSOCK_BROADCAST   (200)

Enable/disable broadcast signals - This option takes SlNetSock_Broadcast_t struct as parameters

§ SLNETSOCK_OPSOCK_REUSEADDR

#define SLNETSOCK_OPSOCK_REUSEADDR   (201)

Enable/disable allowing reuse of local addresses for bind calls - This option takes an int as a parameter

§ SLNETSOCK_OPSOCK_REUSEPORT

#define SLNETSOCK_OPSOCK_REUSEPORT   (203)

Enable/disable multiple sockets to be bound to an identical socket address. - This option takes an int as a parameter

§ SLNETSOCK_OPIP_MULTICAST_TTL

#define SLNETSOCK_OPIP_MULTICAST_TTL   (61)

Specify the TTL value to use for outgoing multicast packet. - This options takes uint8_t 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 uint32_t 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 uint32_t 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 uint32_t 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   (28)

This option is available only when transceiver started - This options takes uint32_t as channel number parameter

§ SLNETSOCK_OPPHY_RATE

#define SLNETSOCK_OPPHY_RATE   (100)

WLAN Transmit rate - This options takes uint32_t as parameter based on SlWlanRateIndex_e

§ SLNETSOCK_OPPHY_TX_POWER

#define SLNETSOCK_OPPHY_TX_POWER   (101)

TX Power level - This options takes uint32_t as parameter

§ SLNETSOCK_OPPHY_NUM_FRAMES_TO_TX

#define SLNETSOCK_OPPHY_NUM_FRAMES_TO_TX   (102)

Number of frames to transmit - This options takes uint32_t as parameter

§ SLNETSOCK_OPPHY_PREAMBLE

#define SLNETSOCK_OPPHY_PREAMBLE   (103)

Preamble for transmission - This options takes uint32_t as parameter

§ SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD

#define SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD   (104)

TX Inhibit Threshold (CCA) - This options takes uint32_t 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 uint32_t as parameter

§ SLNETSOCK_OPPHY_ALLOW_ACKS

#define SLNETSOCK_OPPHY_ALLOW_ACKS   (106)

Enable sending ACKs in transceiver mode - This options takes uint32_t as parameter

§ SLNETSOCK_TCP_NODELAY

#define SLNETSOCK_TCP_NODELAY   (203)

Disables TCP send delay/coalesce algorithm - This option takes SLNetSock_NoDelay_t struct as a parameter

§ SLNETSOCK_TCP_MAXSEG

#define SLNETSOCK_TCP_MAXSEG   (204)

Set the maximum TCP segment size - This option takes SLNetSock_MaxSeg_t struct as a parameter

§ SLNETSOCK_TCP_NOPUSH

#define SLNETSOCK_TCP_NOPUSH   (205)

Do not send data just to finish a data block (attempt to coalesce). - This option takes SLNetSock_NoPush_t struct as a parameter

§ SLNETSOCK_TCP_NOOPT

#define SLNETSOCK_TCP_NOOPT   (206)

Do not use TCP options. - This option takes SLNetSock_NoOpt_t struct as a parameter

§ SLNETSOCK_TCP_SACKPERMITTED

#define SLNETSOCK_TCP_SACKPERMITTED   (207)

Permit RFC-2018 Selective Acknowledgment(SACK) conformant connection - This option takes SLNetSock_SackPermitted_t struct as a parameter

§ SLNETSOCK_TCP_MAXRTT

#define SLNETSOCK_TCP_MAXRTT   (208)

The maximum TCP Round Trip Time value allowed in the determination of the estimated TCP RTT - This option takes SLNetSock_MaxRtt_t struct as a parameter

§ SLNETSOCK_SEC_METHOD_SSLV3

#define SLNETSOCK_SEC_METHOD_SSLV3   (0)

security method SSL v3

§ SLNETSOCK_SEC_METHOD_TLSV1

#define SLNETSOCK_SEC_METHOD_TLSV1   (1)

security method TLS v1

§ SLNETSOCK_SEC_METHOD_TLSV1_1

#define SLNETSOCK_SEC_METHOD_TLSV1_1   (2)

security method TLS v1_1

§ SLNETSOCK_SEC_METHOD_TLSV1_2

#define SLNETSOCK_SEC_METHOD_TLSV1_2   (3)

security method 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 method 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_CIPHER_FULL_LIST

#define SLNETSOCK_SEC_CIPHER_FULL_LIST   (0xFFFFFFFF)

§ 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   (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   (46)

§ SLNETSOCK_INET_ADDRSTRLEN

#define SLNETSOCK_INET_ADDRSTRLEN   (16)

§ SLNETSOCK_MSG_OOB

#define SLNETSOCK_MSG_OOB   (0x0001)

§ SLNETSOCK_MSG_PEEK

#define SLNETSOCK_MSG_PEEK   (0x0002)

§ SLNETSOCK_MSG_WAITALL

#define SLNETSOCK_MSG_WAITALL   (0x0004)

§ SLNETSOCK_MSG_DONTWAIT

#define SLNETSOCK_MSG_DONTWAIT   (0x0008)

§ SLNETSOCK_MSG_DONTROUTE

#define SLNETSOCK_MSG_DONTROUTE   (0x0010)

§ SLNETSOCK_MSG_NOSIGNAL

#define SLNETSOCK_MSG_NOSIGNAL   (0x0020)

Typedef Documentation

§ SlNetSock_InAddr_t

Internet address.

§ SlNetSock_In6Addr_t

IpV6 or Ipv6 EUI64.

§ SlNetSock_NoDelay_t

The SlNetSock_NoDelay_t structure is used in SLNETSOCK_TCP_NODELAY TCP level option.

§ SlNetSock_MaxSeg_t

The SlNetSock_MaxSeg_t structure is used in SLNETSOCK_TCP_MAXSEG TCP level option.

§ SlNetSock_NoPush_t

The SlNetSock_NoPush_t structure is used in SLNETSOCK_TCP_NOPUSH TCP level option.

§ SlNetSock_NoOpt_t

The SlNetSock_NoOpt_t structure is used in SLNETSOCK_TCP_NOOPT TCP level option.

§ SlNetSock_SackPermitted_t

The SlNetSock_SackPermitted_t structure is used in SLNETSOCK_TCP_NOPUSH TCP level option.

§ SlNetSock_MaxRtt_t

The SlNetSock_MaxRtt_t structure is used in SLNETSOCK_TCP_MAXRTT TCP level option.

§ 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_Broadcast_t

The SlNetSock_Broadcast_t structure is used in SLNETSOCK_OPSOCK_BROADCAST 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

§ SlNetSock_IpV6Mreq_t

§ SlNetSock_linger_t

The SlNetSock_linger_t structure is used in SLNETSOCK_OPSOCK_LINGER socket level option.

§ SlNetSock_Timeval_t

typedef struct timeval SlNetSock_Timeval_t

The SlNetSock_Timeval_t structure is used in the SLNETSOCK_OPSOCK_RCV_TIMEO and SLNETSOCK_OPSOCK_SND_TIMEO socket level options.

Remarks
Note that SlNetSock_Timeval_t is intentionally defined to be equivalent to the POSIX-defined struct timeval data type.

§ 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_SockAddrStorage_t

Generic socket address type to hold either IPv4 or IPv6 address.

§ SlNetSock_SdSet_t

The SlNetSock_SdSet_t structure holds the sd array for SlNetSock_select function.

< The select socket array manager

§ 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 are used to declare security attribute objects in SlNetSock_secAttribSet().

See also
SlNetSock_secAttribSet()
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 
SLNETSOCK_SEC_ATTRIB_DISABLE_CERT_STORE 

SLNETSOCK_SEC_ATTRIB_DISABLE_CERT_STORE is currently only supported on CC3xxx devices.

The certificate store is a file, provided by TI, containing a list of known and trusted root CAs by TI. For more information, see the CC3xxx documentation.

The certificate store is used only in client mode. Servers use a proprietary root CA to authenticate clients, and therefore cannot use the certificate store.

Using this attribute allows using root CA which isn't a part of the provided certificate store.

Function Documentation

§ SlNetSock_init()

int32_t SlNetSock_init ( int32_t  flags)

Initialize the SlNetSock module.

Parameters
[in]flagsReserved
Returns
Zero on success, or negative error code on failure
Examples
int32_t retval;
retval = SlNetSock_init(0);

§ 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.

SlNetSock_create() 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:
[in]protocolSpecifies a particular transport to be used with the socket.
The most common are
[in]ifBitmapSpecifies the interface(s) which the socket will be created on according to 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 a 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().
[in]flagsSpecifies flags.
Returns
On success, socket descriptor (handle) that is used for consequent socket operations.
A successful return code should be a positive number
On error, a negative value will be returned specifying the error code.
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Remarks
Not all platforms support all options.
A protocol value of zero can be used to select the default protocol from the selected domain and type.
SlNetSock_create() uses the highest priority interface from the ifBitmap, subject to the constraints specified in the flags parameter. An interface that does not satisfy the constraints is ignored, without regards to its priority level.
Examples
/* create IPv4 TCP socket */
int16_t ipv4_tcp_socket;
/* create IPv6 TCP socket */
int16_t ipv6_tcp_socket;
/* create IPv4 UDP socket */
int16_t ipv4_udp_socket;
See also
SlNetSock_close()

§ SlNetSock_close()

int32_t SlNetSock_close ( int16_t  sd)

Gracefully close socket.

Release resources allocated to a socket.

Parameters
[in]sdSocket descriptor (handle), received in SlNetSock_create()
Returns
Zero on success, or negative error code on failure
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Remarks
In the case of TCP, the connection is terminated.
After this function returns there is no way to access the socket identified by sd. The SlNetSock socket is closed regardless of the status of the underlying interface's socket.
Examples
int32_t retval;
retval = SlNetSock_close(ipv4_tcp_socket);
See also
SlNetSock_create()

§ SlNetSock_shutdown()

int32_t SlNetSock_shutdown ( int16_t  sd,
int16_t  how 
)

Shutting down parts of a full-duplex connection.

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
Returns
Zero on success, or negative error code on failure
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
See also
SlNetSock_create()
SlNetSock_connect()
SlNetSock_accept()

§ 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 (SLNETSOCK_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.

addrlen 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
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
See also
SlNetSock_create()
SlNetSock_bind()
SlNetSock_listen()

§ 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 SLNETSOCK_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
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
See also
SlNetSock_create()
SlNetSock_accept()
SlNetSock_listen()

§ 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().

Parameters
[in]sdSocket descriptor (handle)
[in]backlogSpecifies the listen queue depth.
Returns
Zero on success, or negative error code on failure
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Remarks
The SlNetSock_listen() call applies only to sockets of type SLNETSOCK_SOCK_STREAM.
The backlog parameter defines the maximum length the queue of pending connections may grow to.
See also
SlNetSock_create()
SlNetSock_accept()
SlNetSock_bind()

§ 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 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 failure, negative value.
On a non-blocking connect a possible negative value is SLNETERR_BSD_EALREADY. SLNETERR_POOL_IS_EMPTY may be returned in case there are no resources in the system
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
See also
SlNetSock_create()

§ 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.

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
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
See also
SlNetSock_accept()
SlNetSock_connect()

§ 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.
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Remarks
If the provided buffer is too small the returned address will be truncated and addrlen will contain the actual size of the socket address.
See also
SlNetSock_create()
SlNetSock_bind()

§ 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.

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
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Remarks
If timeout is set to less than 10ms it will automatically set to 10ms to prevent overload of the system
See also
SlNetSock_create()

§ 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.

SlNetSock_setOpt() manipulates 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 SLNETSOCK_LVL_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.

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, optval may be NULL.

Parameters
[in]sdSocket descriptor (handle)
[in]levelDefines the protocol level for this option
[in]optnameDefines the option name to interrogate
[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
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Examples
See also
slNetSock_create()
SlNetSock_getOpt()

§ 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, optval 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
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
See also
SlNetSock_create()
SlNetSock_setOpt()

§ 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
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Examples
int32_t bytes;
int8_t buf[RECV_BUF_LEN];
bytes = SlNetSock_recv(sock, buf, RECV_BUF_LEN, 0);
See also
SlNetSock_create()
SlNetSock_recvFrom()

§ 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. SLNETERR_RET_CODE_INVALID_INPUT will be returned if fromlen has incorrect length.
SLNETERR_BSD_ENOMEM may be return in case there are no resources in the system
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Example
SlNetSocklen_t addrSize = sizeof(addr);
int32_t bytes;
int8_t buf[RECV_BUF_LEN];
bytes = SlNetSock_recvFrom(sock, buf, RECV_BUF_LEN, 0,
(SlNetSock_Addr_t *)&addr, &addrSize);
See also
SlNetSock_create()
SlNetSock_recv()

§ SlNetSock_send()

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

Write data to TCP socket.

Transmits a message to another socket. Returns immediately after sending data to device. 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.
Returns
Return the number of bytes sent, or a negative value if an error occurred.
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Example
int32_t bytes;
int8_t buf[SEND_BUF_LEN];
bytes = SlNetSock_send(sock, buf, SEND_BUF_LEN, 0);
See also
SlNetSock_create()
SlNetSock_sendTo()

§ 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.

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.
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Example
int32_t bytes;
int8_t buf[SEND_BUF_LEN];
bytes = SlNetSock_sendTo(sock, buf, SEND_BUF_LEN, 0,
(SlNetSock_Addr_t *)&addr, sizeof(addr));
See also
SlNetSock_create()
SlNetSock_send()

§ SlNetSock_getIfID()

int32_t SlNetSock_getIfID ( uint16_t  sd)

Get interface ID from socket descriptor (sd)

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_ in slnetif.h.
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Examples
int32_t ifID;
ifID = SlNetSock_getIfID(sock);
See also
SlNetSock_create()
SlNetIf_add()
SlNetIf_getIDByName()

§ SlNetSock_secAttribCreate()

SlNetSockSecAttrib_t* SlNetSock_secAttribCreate ( void  )

Creates a security attributes object.

Create a security attribute, which is required in order to start a secure session.

Remarks
When the security attributes object is no longer needed, call SlNetSock_secAttribDelete() to destroy it.
A single security object can be used to initiate several secure sessions (provided they all have the same security attributes).
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
See also
SlNetSock_startSec()
SlNetSock_secAttribDelete()

§ SlNetSock_secAttribDelete()

int32_t SlNetSock_secAttribDelete ( SlNetSockSecAttrib_t secAttrib)

Deletes a security attributes object.

Parameters
[in]secAttribSecure attribute handle
Returns
Zero on success, or negative error code on failure
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Remarks
secAttrib must be created using SlNetSock_secAttribCreate()
See also
SlNetSock_secAttribCreate()
SlNetSock_secAttribSet()
SlNetSock_startSec()

§ SlNetSock_secAttribSet()

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

set a security attribute

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

Parameters
[in]secAttribSecure attribute handle
[in]attribNameDefine the actual attribute to set. Applicable values:
  • SLNETSOCK_SEC_ATTRIB_PRIVATE_KEY
    Sets the private key corresponding to the local certificate
    This attribute takes the name of security object containing the private key and the name's length (including the NULL terminating character) as parameters
  • SLNETSOCK_SEC_ATTRIB_LOCAL_CERT
    Sets the local certificate chain
    This attribute takes the name of the security object containing the certificate and the name's length (including the NULL terminating character) as parameters
    For certificate chains, each certificate in the chain can be added via a separate call to SlNetSock_secAttribSet, starting with the root certificate of the chain
  • SLNETSOCK_SEC_ATTRIB_PEER_ROOT_CA
    Sets the root CA certificate
    This attribute takes the name of the security object containing the certificate and the name's length (including the NULL terminating character) as parameters
  • SLNETSOCK_SEC_ATTRIB_DH_KEY
    Sets the DH Key
    This attribute takes the name of the security object containing the DH Key and the name's length (including the NULL terminating character) as parameters
  • SLNETSOCK_SEC_ATTRIB_METHOD
    Sets the TLS protocol version
    This attribute takes a SLNETSOCK_SEC_METHOD_* option and sizeof(uint8_t) as parameters
  • SLNETSOCK_SEC_ATTRIB_CIPHERS
    Sets the ciphersuites to be used for the connection
    This attribute takes a bit mask formed using SLNETSOCK_SEC_CIPHER_* options and sizeof(uint32_t) as parameters
  • SLNETSOCK_SEC_ATTRIB_ALPN
    Sets the ALPN
    This attribute takes a bit mask formed using SLNETSOCK_SEC_ALPN_* options and sizeof(uint32_t) as parameters
  • SLNETSOCK_SEC_ATTRIB_EXT_CLIENT_CHLNG_RESP
    Sets the EXT CLIENT CHLNG RESP
    Format TBD
  • SLNETSOCK_SEC_ATTRIB_DOMAIN_NAME
    Sets the domain name for verification during connection
    This attribute takes a string with the domain name and the string's length (including the NULL-terminating character) as parameters
  • SLNETSOCK_SEC_ATTRIB_DISABLE_CERT_STORE
    Sets whether to disable the certificate store
    This attribute takes 1 (disable) or 0 (enable) and sizeof(uint32_t) as parameters
[in]val
[in]len
Returns
Zero on success, or negative error code on failure
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Note
Once an attribute is set, it cannot be unset or set to something different. Doing so may result in undefined behavior. Instead, SlNetSock_secAttribDelete() should be called on the existing object, and a new security object should be created with the new attribute set.
The SLNETSOCK_SEC_ATTRIB_DISABLE_CERT_STORE value is currently being evaluated, and may be removed in a future release. It is currently only supported on CC3xxx devices.
Examples
See also
SlNetSock_secAttribCreate()

§ SlNetSock_startSec()

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

Start a security session on an opened socket.

Parameters
[in]sdSocket descriptor (handle)
[in]secAttribSecure attribute handle. This can be NULL only if the SLNETSOCK_SEC_BIND_CONTEXT_ONLY flag is not thrown.
[in]flagsSpecifies flags.
The available flags are:
Returns
Zero on success, or negative error code on failure
Precondition
As with all SlNetSock API's, SlNetSock_init() must have previously been called.
Remarks
If the return value indicates failure, the socket should be closed.
If secAttrib is NULL, the session will be started with default security settings.
See also
SlNetSock_create()
SlNetSock_secAttribCreate()
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale