Network Services API
2.00.00.16
|
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_t * | SlNetSockSecAttrib_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_t * | SlNetSock_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... | |
Controls standard client/server sockets options and capabilities.
#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) |
typedef struct _SlNetSock_InAddr_t SlNetSock_InAddr_t |
Internet address.
typedef struct _SlNetSock_In6Addr_t SlNetSock_In6Addr_t |
IpV6 or Ipv6 EUI64.
typedef struct _SlNetSock_Keepalive_t SlNetSock_Keepalive_t |
The SlNetSock_Keepalive_t structure is used in SLNETSOCK_OPSOCK_KEEPALIVE socket level option.
typedef struct _SlNetSock_NonIpBoundary_t SlNetSock_NonIpBoundary_t |
The SlNetSock_NonIpBoundary_t structure is used in SLNETSOCK_OPSOCK_NON_IP_BOUNDARY socket level option.
typedef struct _SlNetSock_Winsize_t SlNetSock_Winsize_t |
The SlNetSock_Winsize_t structure is used in SLNETSOCK_OPSOCK_RCV_BUF socket level option.
typedef struct _SlNetSock_Nonblocking_t SlNetSock_Nonblocking_t |
The SlNetSock_Nonblocking_t structure is used in SLNETSOCK_OPSOCK_NON_BLOCKING socket level option.
typedef struct _SlNetSock_SecAttribNode_t SlNetSock_SecAttribNode_t |
Secure socket attribute context.
Secure socket attribute handler.
typedef struct _SlNetSock_SecureALPN_t SlNetSock_SecureALPN_t |
Secure ALPN structure.
typedef struct _SlNetSock_SecureMask_t SlNetSock_SecureMask_t |
Secure Mask structure.
typedef struct _SlNetSock_SecureMethod_t SlNetSock_SecureMethod_t |
Secure Method structure.
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.
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.
typedef struct _SlNetSock_linger_t SlNetSock_linger_t |
The SlNetSock_linger_t structure is used in SLNETSOCK_OPSOCK_LINGER socket level option.
typedef int32_t SlNetSockTime_t |
The SlNetSockTime_t is used for setting/getting time in seconds.
typedef int32_t SlNetSockuseconds_t |
The SlNetSockuseconds_t is used for setting/getting time in micro-seconds.
typedef struct _SlNetSock_Timeval_t SlNetSock_Timeval_t |
The SlNetSock_Timeval_t structure is used in SLNETSOCK_OPSOCK_RCV_TIMEO socket level option.
typedef uint16_t SlNetSocklen_t |
The SlNetSocklen_t is used for declaring the socket length parameter.
typedef struct _SlNetSock_Addr_t SlNetSock_Addr_t |
IpV4 socket address.
typedef struct _SlNetSock_AddrIn6_t SlNetSock_AddrIn6_t |
SlNetSock IPv6 address, Internet style.
typedef struct _SlNetSock_AddrIn_t SlNetSock_AddrIn_t |
SlNetSock IPv4 address, Internet style.
typedef struct _SlNetSock_SdSet_t SlNetSock_SdSet_t |
The SlNetSock_SdSet_t structure holds the sd array for SlNetSock_select function.
The SlNetSock_TransceiverRxOverHead_t structure holds the data for Rx transceiver mode using a raw socket when using SlNetSock_recv function.
The SlNetSockTxInhibitThreshold_e enumerations is used in SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD PHY level option.
enum SlNetSockSecAttrib_e |
The SlNetSockSecAttrib_e enumerations is used for security attribute object in SlNetSock_secAttribSet function.
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.
[in] | flags | For future usage, The value 0 may be used in order to run the default flags |
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).
[in] | domain | Specifies the protocol family of the created socket. For example:
|
[in] | type | Specifies 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] | protocol | Specifies a particular transport to be used with the socket. The most common are
|
[in] | ifBitmap | Specifies 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] | flags | Specifies flags.
|
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.
[in] | sd | Socket descriptor (handle), received in SlNetSock_create |
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.
[in] | sd | Socket descriptor (handle), received in SlNetSock_create |
[in] | how | Specifies which part of a full-duplex connection to shutdown. The options are
|
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.
[in] | sd | Socket descriptor (handle) |
[out] | addr | 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 sockaddr: - code for the address format. - socket address, the length depends on the code format |
[out] | addrlen | The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr |
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.
[in] | sd | Socket descriptor (handle) |
[in] | addr | Specifies the destination addrs sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | addrlen | Contains the size of the structure pointed to by addr |
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.
[in] | sd | Socket descriptor (handle) |
[in] | backlog | Specifies the listen queue depth. |
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.
[in] | sd | Socket descriptor (handle) |
[in] | addr | Specifies the destination addr sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | addrlen | Contains the size of the structure pointed to by addr |
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.
[in] | sd | Socket descriptor (handle) |
[in] | url | Specifies the destination url |
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.
[in] | sd | Socket descriptor (handle) |
[out] | addr | returns 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] | addrlen | Contains the size of the structure pointed to by addr |
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.
[in] | sd | Socket descriptor (handle) |
[out] | addr | The 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] | addrlen | The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr |
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)
[in] | nsds | The highest-numbered file descriptor in any of the three sets, plus 1. |
[in,out] | readsds | Socket descriptors list for read monitoring and accept monitoring |
[in,out] | writesds | Socket descriptors list for connect monitoring only, write monitoring is not supported |
[in,out] | exceptsds | Socket descriptors list for exception monitoring, not supported. |
[in] | timeout | Is 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. |
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
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
int32_t SlNetSock_sdsClrAll | ( | SlNetSock_SdSet_t * | sdset | ) |
SlNetSock_select's SlNetSock_SdSet_t ZERO function.
Clears all socket descriptors from SlNetSock_SdSet_t
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)
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.
[in] | sd | Socket descriptor (handle) |
[in] | level | Defines the protocol level for this option
|
[in] | optname | Defines the option name to interrogate
|
[in] | optval | Specifies a value for the option |
[in] | optlen | Specifies the length of the option value |
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.
[in] | sd | Socket descriptor (handle) |
[in] | level | Defines the protocol level for this option |
[in] | optname | defines the option name to interrogate |
[out] | optval | Specifies a value for the option |
[out] | optlen | Specifies the length of the option value |
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
[in] | sd | Socket descriptor (handle) |
[out] | buf | Points to the buffer where the message should be stored. |
[in] | len | Specifies the length in bytes of the buffer pointed to by the buffer argument. Range: 1-16000 bytes |
[in] | flags | Specifies the type of message reception. On this version, this parameter is not supported. |
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
[in] | sd | Socket descriptor (handle) |
[out] | buf | Points to the buffer where the message should be stored. |
[in] | len | Specifies the length in bytes of the buffer pointed to by the buffer argument. Range: 1-16000 bytes |
[in] | flags | Specifies the type of message reception. On this version, this parameter is not supported |
[in] | from | Pointer to an address structure indicating the source address. sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | fromlen | Source address structure size. This parameter MUST be set to the size of the structure pointed to by addr. |
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
[in] | sd | Socket descriptor (handle) |
[in] | buf | Points to a buffer containing the message to be sent |
[in] | len | Message size in bytes. |
[in] | flags | Specifies 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) |
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.
[in] | sd | Socket descriptor (handle) |
[in] | buf | Points to a buffer containing the message to be sent |
[in] | len | message size in bytes. |
[in] | flags | Specifies the type of message transmission. On this version, this parameter is not supported |
[in] | to | Pointer to an address structure indicating the destination address. sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | tolen | Destination address structure size |
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.
[in] | sd | Specifies the socket descriptor which its interface identifier needs to be retrieved. |
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.
int32_t SlNetSock_secAttribDelete | ( | SlNetSockSecAttrib_t * | secAttrib | ) |
Deletes a security attributes object.
The SlNetSock_secAttribDelete function is used to release a security attributes object.
[in] | secAttrib | Secure attribute handle |
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.
[in] | secAttrib | Secure attribute handle |
[in] | attribName | Define the actual attribute to set. Applicable values:
|
[in] | val | |
[in] | len |
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.
[in] | sd | Socket descriptor (handle) |
[in] | secAttrib | Secure attribute handle |
[in] | flags | Specifies flags. The available flags are:
|