SimpleLink CC3120/CC3220 Host Driver  Version 2.0.1.15
Simplifies the implementation of Internet connectivity
sl_socket.h
1 /*
2  * Copyright (C) 2016 Texas Instruments Incorporated
3  *
4  * All rights reserved. Property of Texas Instruments Incorporated.
5  * Restricted rights to use, duplicate or disclose this code are
6  * granted through contract.
7  *
8  * The program may not be used without the written permission of
9  * Texas Instruments Incorporated or against the terms and conditions
10  * stipulated in the agreement under which this program has been supplied,
11  * and under no circumstances can it be used with non-TI connectivity device.
12  *
13  */
14 
15 
16 /*****************************************************************************/
17 /* Include files */
18 /*****************************************************************************/
19 #include <ti/drivers/net/wifi/simplelink.h>
20 
21 #ifndef __SL_SOCKET_H__
22 #define __SL_SOCKET_H__
23 
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
41 /*****************************************************************************/
42 /* Macro declarations */
43 /*****************************************************************************/
44 #undef SL_FD_SETSIZE
45 #define SL_FD_SETSIZE SL_MAX_SOCKETS /* Number of sockets to select on - same is max sockets! */
46 #define SL_BSD_SOCKET_ID_MASK (0x1F) /* Index using the LBS 4 bits for socket id 0-7 */
47 
48 /* Define some BSD protocol constants. */
49 #define SL_SOCK_STREAM (1) /* TCP Socket */
50 #define SL_SOCK_DGRAM (2) /* UDP Socket */
51 #define SL_SOCK_RAW (3) /* Raw socket */
52 #define SL_IPPROTO_TCP (6) /* TCP Raw Socket */
53 #define SL_IPPROTO_UDP (17) /* UDP Raw Socket */
54 #define SL_IPPROTO_RAW (255) /* Raw Socket */
55 #define SL_SEC_SOCKET (100) /* Secured Socket Layer (SSL,TLS) */
56 
57 /* Address families. */
58 #define SL_AF_INET (2) /* IPv4 socket (UDP, TCP, etc) */
59 #define SL_AF_INET6 (3) /* IPv6 socket (UDP, TCP, etc) */
60 #define SL_AF_RF (6) /* data include RF parameter, All layer by user (Wifi could be disconnected) */
61 #define SL_AF_PACKET (17)
62 /* Protocol families, same as address families. */
63 #define SL_PF_INET AF_INET
64 #define SL_PF_INET6 AF_INET6
65 #define SL_INADDR_ANY (0) /* bind any address */
66 #define SL_IN6ADDR_ANY (0)
67 
68 
69 /* Max payload size by protocol */
70 #define SL_SOCKET_PAYLOAD_TYPE_MASK (0xF0) /*4 bits type, 4 bits sockets id */
71 #define SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER (0x80) /* 1536 bytes */
72 
73 
74 /* SL_SOCKET_EVENT_CLASS_BSD user events */
75 #define SL_SOCKET_TX_FAILED_EVENT (1)
76 #define SL_SOCKET_ASYNC_EVENT (2)
77 
78 
79 /* SL_SOCKET_EVENT_CLASS_BSD user trigger events */
80 #define SL_SOCKET_TRIGGER_EVENT_SELECT (1)
81 
82 #define SL_SOL_SOCKET (1) /* Define the socket option category. */
83 #define SL_IPPROTO_IP (2) /* Define the IP option category. */
84 #define SL_SOL_PHY_OPT (3) /* Define the PHY option category. */
85 
86 #define SL_SO_RCVBUF (8) /* Setting TCP receive buffer size */
87 #define SL_SO_KEEPALIVE (9) /* Connections are kept alive with periodic messages */
88 #define SL_SO_LINGER (13) /* Socket lingers on close pending remaining send/receive packets. */
89 #define SL_SO_RCVTIMEO (20) /* Enable receive timeout */
90 #define SL_SO_NONBLOCKING (24) /* Enable . disable nonblocking mode */
91 #define SL_SO_SECMETHOD (25) /* security metohd */
92 #define SL_SO_SECURE_MASK (26) /* security mask */
93 #define SL_SO_SECURE_FILES (27) /* security files */
94 #define SL_SO_CHANGE_CHANNEL (28) /* This option is available only when transceiver started */
95 #define SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME (30) /* This option used to configue secure file */
96 #define SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME (31) /* This option used to configue secure file */
97 #define SL_SO_SECURE_FILES_CA_FILE_NAME (32) /* This option used to configue secure file */
98 #define SL_SO_SECURE_FILES_PEER_CERT_OR_DH_KEY_FILE_NAME (33) /* This option used to configue secure file - in server mode DH params file, and in client mode peer cert for domain verification */
99 #define SL_SO_STARTTLS (35) /* initiate STARTTLS on non secure socket */
100 #define SL_SO_SSL_CONNECTION_PARAMS (36) /* retrieve by getsockopt the connection params of the current SSL connection in to SlSockSSLConnectionParams_t*/
101 #define SL_SO_KEEPALIVETIME (37) /* keepalive time out */
102 #define SL_SO_SECURE_DISABLE_CERTIFICATE_STORE (38) /* disable certificate store */
103 #define SL_SO_RX_NO_IP_BOUNDARY (39) /* connectionless socket disable rx boundary */
104 #define SL_SO_SECURE_ALPN (40) /* set the ALPN bitmap list */
105 #define SL_SO_SECURE_EXT_CLIENT_CHLNG_RESP (41) /*set external challange for client certificate */
106 #define SL_SO_SECURE_DOMAIN_NAME_VERIFICATION (42) /* set a domain name for verification */
107 
108 #define SL_IP_MULTICAST_IF (60) /* Specify outgoing multicast interface */
109 #define SL_IP_MULTICAST_TTL (61) /* Specify the TTL value to use for outgoing multicast packet. */
110 #define SL_IP_ADD_MEMBERSHIP (65) /* Join IPv4 multicast membership */
111 #define SL_IP_DROP_MEMBERSHIP (66) /* Leave IPv4 multicast membership */
112 #define SL_IP_HDRINCL (67) /* Raw socket IPv4 header included. */
113 #define SL_IP_RAW_RX_NO_HEADER (68) /* Proprietary socket option that does not includeIPv4/IPv6 header (and extension headers) on received raw sockets*/
114 #define SL_IP_RAW_IPV6_HDRINCL (69) /* Transmitted buffer over IPv6 socket contains IPv6 header. */
115 #define SL_IPV6_ADD_MEMBERSHIP (70) /* Join IPv6 multicast membership */
116 #define SL_IPV6_DROP_MEMBERSHIP (71) /* Leave IPv6 multicast membership */
117 #define SL_IPV6_MULTICAST_HOPS (72) /* Specify the hops value to use for outgoing multicast packet. */
118 
119 #define SL_SO_PHY_RATE (100) /* WLAN Transmit rate */
120 #define SL_SO_PHY_TX_POWER (101) /* TX Power level */
121 #define SL_SO_PHY_NUM_FRAMES_TO_TX (102) /* Number of frames to transmit */
122 #define SL_SO_PHY_PREAMBLE (103) /* Preamble for transmission */
123 #define SL_SO_PHY_TX_INHIBIT_THRESHOLD (104) /* TX Inhibit Threshold (CCA) */
124 #define SL_SO_PHY_TX_TIMEOUT (105) /* TX timeout for Transceiver frames (lifetime) in miliseconds (max value is 100ms) */
125 #define SL_SO_PHY_ALLOW_ACKS (106) /* Enable sending ACKs in transceiver mode */
126 
127 typedef enum
128 {
129  SL_TX_INHIBIT_THRESHOLD_MIN = 1,
130  SL_TX_INHIBIT_THRESHOLD_LOW = 2,
131  SL_TX_INHIBIT_THRESHOLD_DEFAULT = 3,
132  SL_TX_INHIBIT_THRESHOLD_MED = 4,
133  SL_TX_INHIBIT_THRESHOLD_HIGH = 5,
134  SL_TX_INHIBIT_THRESHOLD_MAX = 6
135 } SlTxInhibitThreshold_e;
136 
137 #define SL_SO_SEC_METHOD_SSLV3 (0) /* security metohd SSL v3*/
138 #define SL_SO_SEC_METHOD_TLSV1 (1) /* security metohd TLS v1*/
139 #define SL_SO_SEC_METHOD_TLSV1_1 (2) /* security metohd TLS v1_1*/
140 #define SL_SO_SEC_METHOD_TLSV1_2 (3) /* security metohd TLS v1_2*/
141 #define SL_SO_SEC_METHOD_SSLv3_TLSV1_2 (4) /* use highest possible version from SSLv3 - TLS 1.2*/
142 #define SL_SO_SEC_METHOD_DLSV1 (5) /* security metohd DTL v1 */
143 
144 #define SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA (1 << 0)
145 #define SL_SEC_MASK_SSL_RSA_WITH_RC4_128_MD5 (1 << 1)
146 #define SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA (1 << 2)
147 #define SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_CBC_SHA (1 << 3)
148 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (1 << 4)
149 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA (1 << 5)
150 #define SL_SEC_MASK_TLS_RSA_WITH_AES_128_CBC_SHA256 (1 << 6)
151 #define SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA256 (1 << 7)
152 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (1 << 8)
153 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (1 << 9)
154 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (1 << 10)
155 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (1 << 11)
156 #define SL_SEC_MASK_TLS_RSA_WITH_AES_128_GCM_SHA256 (1 << 12)
157 #define SL_SEC_MASK_TLS_RSA_WITH_AES_256_GCM_SHA384 (1 << 13)
158 #define SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (1 << 14)
159 #define SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (1 << 15)
160 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (1 << 16)
161 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (1 << 17)
162 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (1 << 18)
163 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (1 << 19)
164 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (1 << 20)
165 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (1 << 21)
166 #define SL_SEC_MASK_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (1 << 22)
167 
168 #define SL_SEC_MASK_SECURE_DEFAULT ((SL_SEC_MASK_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 << 1) - 1)
169 
170 #define SL_SECURE_ALPN_H1 (1 << 0)
171 #define SL_SECURE_ALPN_H2 (1 << 1)
172 #define SL_SECURE_ALPN_H2C (1 << 2)
173 #define SL_SECURE_ALPN_H2_14 (1 << 3)
174 #define SL_SECURE_ALPN_H2_16 (1 << 4)
175 #define SL_SECURE_ALPN_FULL_LIST ((SL_SECURE_ALPN_H2_16 << 1 ) - 1)
176 
177 
178 #define SL_MSG_DONTWAIT (0x00000008) /* Nonblocking IO */
179 
180 /* AP DHCP Server - IP Release reason code */
181 #define SL_IP_LEASE_PEER_RELEASE (0)
182 #define SL_IP_LEASE_PEER_DECLINE (1)
183 #define SL_IP_LEASE_EXPIRED (2)
184 
185 /* possible types when receiving SL_SOCKET_ASYNC_EVENT*/
186 #define SL_SSL_ACCEPT (0) /* accept failed due to ssl issue ( tcp pass) */
187 #define SL_RX_FRAGMENTATION_TOO_BIG (1) /* connection less mode, rx packet fragmentation > 16K, packet is being released */
188 #define SL_OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED (2) /* remote side down from secure to unsecure */
189 #define SL_SSL_NOTIFICATION_CONNECTED_SECURED (3) /* STARTTLS success */
190 #define SL_SSL_NOTIFICATION_HANDSHAKE_FAILED (4) /* STARTTLS handshake faild */
191 #define SL_SSL_NOTIFICATION_WRONG_ROOT_CA (5) /* Root CA configured is wrong, the name is in SocketAsyncEvent.EventData.extraInfo */
192 #define SL_SOCKET_ASYNC_EVENT_SSL_NOTIFICATION_WRONG_ROOT_CA (5)
193 #define SL_MAX_ISSUER_AND_SUBJECT_NAME_LEN (16)
194 
195 /*****************************************************************************/
196 /* Structure/Enum declarations */
197 /*****************************************************************************/
198 
199 /* Internet address */
200 typedef struct SlInAddr_t
201 {
202 #ifndef s_addr
203  _u32 s_addr; /* Internet address 32 bits */
204 #else
205  union S_un {
206  struct { _u8 s_b1,s_b2,s_b3,s_b4; } S_un_b;
207  struct { _u8 s_w1,s_w2; } S_un_w;
208  _u32 S_addr;
209  } S_un;
210 #endif
211 }SlInAddr_t;
212 
213 /* IpV6 or Ipv6 EUI64 */
214 typedef struct SlIn6Addr_t
215 {
216  union
217  {
218  _u8 _S6_u8[16];
219  _u32 _S6_u32[4];
220  } _S6_un;
221 }SlIn6Addr_t;
222 
223 
224 /* sockopt */
225 typedef struct
226 {
227  _u32 KeepaliveEnabled; /* 0 = disabled;1 = enabled; default = 1*/
229 
230 typedef struct
231 {
232  _u32 ReuseaddrEnabled; /* 0 = disabled; 1 = enabled; default = 1*/
234 
235 typedef struct
236 {
237  _i32 RxIpNoBoundaryEnabled; /* 0 = keep IP boundary; 1 = don`t keep ip boundary; default = 0; */
239 
240 
241 typedef struct
242 {
243  _u32 WinSize; /* receive window size for tcp sockets */
245 
246 typedef struct
247 {
248  _u32 NonBlockingEnabled;/* 0 = disabled;1 = enabled;default = 1*/
250 
251 typedef struct
252 {
253  _u8 Sd;
254  _u8 Type;
255  _i16 Val;
256  _i8 pExtraInfo[128];
258 
259 typedef struct
260 {
261  _i16 Status;
262  _u8 Sd;
263  _u8 Padding;
265 
266 
267 typedef union
268 {
269  SlSockTxFailEventData_t SockTxFailData;
270  SlSocketAsyncEvent_t SockAsyncData;
272 
273 
274 typedef struct
275 {
276  _u32 Event;
277  SlSockEventData_u SocketAsyncEvent;
278 } SlSockEvent_t;
279 
280 typedef struct
281 {
282  _u32 Event;
283  _u32 EventData;
285 
286 
287 typedef struct
288 {
289  _u32 SecureALPN;
291 
292 typedef struct
293 {
294  _u32 SecureMask;
296 
297 typedef struct
298 {
299  _u8 SecureMethod;
301 
302 typedef struct
303 {
304  _u16 SubjectNameXoredSha1;
305  _u16 IssuerNameXoredSha1;
306  _i8 FromDate[8];
307  _i8 ToDate[8];
308  _i8 SubjectName[SL_MAX_ISSUER_AND_SUBJECT_NAME_LEN];
309  _i8 IssuerName[SL_MAX_ISSUER_AND_SUBJECT_NAME_LEN];
310  _i8 SubjectNameLen;
311  _i8 IssuerNameLen;
312  _i8 Padding[2];
314 
315 
316 typedef struct
317 {
318  _u32 SecureVersion; /* what version of SSL decided in the handshake */
319  _u32 SecureCipherSuit; /* what Cipher Index was decided in the handshake */
320  _u32 SecureIsPeerValidated; /* was the other peer verified */
321  _u32 SecureALPNChosenProtocol; /* bit indicate one of the protocol defined above
322  SL_SECURE_ALPN_H1
323  SL_SECURE_ALPN_H2
324  SL_SECURE_ALPN_H2C
325  SL_SECURE_ALPN_H2_14
326  SL_SECURE_ALPN_H2_16
327  */
328  SlSockSSLCertInfo_t SecurePeerCertinfo;
330 
331 typedef enum
332 {
333  SL_BSD_SECURED_PRIVATE_KEY_IDX = 0,
334  SL_BSD_SECURED_CERTIFICATE_IDX,
335  SL_BSD_SECURED_CA_IDX,
336  SL_BSD_SECURED_DH_IDX
337 }SlSockSecureSocketFilesIndex_e;
338 
339 typedef struct
340 {
341  SlInAddr_t imr_multiaddr; /* The IPv4 multicast address to join */
342  SlInAddr_t imr_interface; /* The interface to use for this group */
344 
345 typedef struct{
346  SlIn6Addr_t ipv6mr_multiaddr; /* IPv6 multicast address of group */
347  _u32 ipv6mr_interface; /*should be 0 to choose the default multicast interface*/
349 
350 typedef struct
351 {
352  _u32 l_onoff; /* 0 = disabled; 1 = enabled; default = 0;*/
353  _u32 l_linger; /* linger time in seconds; default = 0;*/
355 
356 /* sockopt */
357 typedef _i32 SlTime_t;
358 typedef _i32 SlSuseconds_t;
359 
360 typedef struct SlTimeval_t
361 {
362  SlTime_t tv_sec; /* Seconds */
363  SlSuseconds_t tv_usec; /* Microseconds */
364 }SlTimeval_t;
365 
366 typedef _u16 SlSocklen_t;
367 
368 /* IpV4 socket address */
369 typedef struct SlSockAddr_t
370 {
371  _u16 sa_family; /* Address family (e.g. , AF_INET) */
372  _u8 sa_data[14]; /* Protocol- specific address information*/
373 }SlSockAddr_t;
374 
375 
376 typedef struct SlSockAddrIn6_t
377 {
378  _u16 sin6_family; /* AF_INET6 || AF_INET6_EUI_48*/
379  _u16 sin6_port; /* Transport layer port. */
380  _u32 sin6_flowinfo; /* IPv6 flow information. */
381  SlIn6Addr_t sin6_addr; /* IPv6 address. */
382  _u32 sin6_scope_id; /* set of interfaces for a scope. */
384 
385 /* Socket address, Internet style. */
386 
387 typedef struct SlSockAddrIn_t
388 {
389  _u16 sin_family; /* Internet Protocol (AF_INET). */
390  _u16 sin_port; /* Address port (16 bits). */
391  SlInAddr_t sin_addr; /* Internet address (32 bits). */
392  _i8 sin_zero[8]; /* Not used. */
394 
395 
396 typedef struct
397 {
398  _u8 SecureFiles[4];
400 
401 
402 typedef struct SlFdSet_t /* The select socket array manager */
403 {
404  _u32 fd_array[(SL_FD_SETSIZE + (_u8)31)/(_u8)32]; /* Bit map of SOCKET Descriptors */
405 } SlFdSet_t;
406 
407 typedef struct
408 {
409  _u8 Rate; /* Recevied Rate */
410  _u8 Channel; /* The received channel*/
411  _i8 Rssi; /* The computed RSSI value in db of current frame */
412  _u8 Padding; /* pad to align to 32 bits */
413  _u32 Timestamp; /* Timestamp in microseconds, */
415 
416 
417 
418 /*****************************************************************************/
419 /* Function prototypes */
420 /*****************************************************************************/
421 
471 #if _SL_INCLUDE_FUNC(sl_Socket)
472 _i16 sl_Socket(_i16 Domain, _i16 Type, _i16 Protocol);
473 #endif
474 
489 #if _SL_INCLUDE_FUNC(sl_Close)
490 _i16 sl_Close(_i16 sd);
491 #endif
492 
543 #if _SL_INCLUDE_FUNC(sl_Accept)
544 _i16 sl_Accept(_i16 sd, SlSockAddr_t *addr, SlSocklen_t *addrlen);
545 #endif
546 
573 #if _SL_INCLUDE_FUNC(sl_Bind)
574 _i16 sl_Bind(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen);
575 #endif
576 
597 #if _SL_INCLUDE_FUNC(sl_Listen)
598 _i16 sl_Listen(_i16 sd, _i16 backlog);
599 #endif
600 
639 #if _SL_INCLUDE_FUNC(sl_Connect)
640 _i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen);
641 #endif
642 
696 #if _SL_INCLUDE_FUNC(sl_Select)
697 _i16 sl_Select(_i16 nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *exceptsds, struct SlTimeval_t *timeout);
698 #endif
699 
709 void SL_SOCKET_FD_SET(_i16 fd, SlFdSet_t *fdset);
710 
716 void SL_SOCKET_FD_CLR(_i16 fd, SlFdSet_t *fdset);
717 
718 
727 _i16 SL_SOCKET_FD_ISSET(_i16 fd, SlFdSet_t *fdset);
728 
734 void SL_SOCKET_FD_ZERO(SlFdSet_t *fdset);
735 
1125 #if _SL_INCLUDE_FUNC(sl_SetSockOpt)
1126 _i16 sl_SetSockOpt(_i16 sd, _i16 level, _i16 optname, const void *optval, SlSocklen_t optlen);
1127 #endif
1128 
1168 #if _SL_INCLUDE_FUNC(sl_GetSockOpt)
1169 _i16 sl_GetSockOpt(_i16 sd, _i16 level, _i16 optname, void *optval, SlSocklen_t *optlen);
1170 #endif
1171 
1238 #if _SL_INCLUDE_FUNC(sl_Recv)
1239 _i16 sl_Recv(_i16 sd, void *buf, _i16 len, _i16 flags);
1240 #endif
1241 
1298 #if _SL_INCLUDE_FUNC(sl_RecvFrom)
1299 _i16 sl_RecvFrom(_i16 sd, void *buf, _i16 len, _i16 flags, SlSockAddr_t *from, SlSocklen_t *fromlen);
1300 #endif
1301 
1347 #if _SL_INCLUDE_FUNC(sl_Send )
1348 _i16 sl_Send(_i16 sd, const void *buf, _i16 len, _i16 flags);
1349 #endif
1350 
1400 #if _SL_INCLUDE_FUNC(sl_SendTo)
1401 _i16 sl_SendTo(_i16 sd, const void *buf, _i16 len, _i16 flags, const SlSockAddr_t *to, SlSocklen_t tolen);
1402 #endif
1403 
1417 #if _SL_INCLUDE_FUNC(sl_Htonl )
1418 _u32 sl_Htonl( _u32 val );
1419 
1420 #define sl_Ntohl sl_Htonl /* Reorder the bytes of a 16-bit unsigned value from network order to processor orde. */
1421 #endif
1422 
1436 #if _SL_INCLUDE_FUNC(sl_Htons )
1437 _u16 sl_Htons( _u16 val );
1438 
1439 #define sl_Ntohs sl_Htons /* Reorder the bytes of a 16-bit unsigned value from network order to processor orde. */
1440 #endif
1441 
1442 
1451 #ifdef __cplusplus
1452 }
1453 #endif /* __cplusplus */
1454 
1455 #endif /* __SOCKET_H__ */
1456 
1457 
_i16 sl_Bind(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
Assign a name to a socket.
Definition: sl_socket.c:221
_u32 sl_Htonl(_u32 val)
Reorder the bytes of a 32-bit unsigned value.
Definition: sl_socket.c:778
_i16 sl_Select(_i16 nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *exceptsds, struct SlTimeval_t *timeout)
Monitor socket activity.
Definition: sl_socket.c:1096
_i16 sl_SetSockOpt(_i16 sd, _i16 level, _i16 optname, const void *optval, SlSocklen_t optlen)
Set socket options-.
Definition: sl_socket.c:962
_u16 sl_Htons(_u16 val)
Reorder the bytes of a 16-bit unsigned value.
Definition: sl_socket.c:799
_i16 sl_Close(_i16 sd)
Gracefully close socket.
Definition: sl_socket.c:162
_i16 sl_Recv(_i16 sd, void *buf, _i16 len, _i16 flags)
Read data from TCP socket.
Definition: sl_socket.c:911
_i16 sl_GetSockOpt(_i16 sd, _i16 level, _i16 optname, void *optval, SlSocklen_t *optlen)
Get socket options.
Definition: sl_socket.c:1005
_i16 sl_Socket(_i16 Domain, _i16 Type, _i16 Protocol)
Create an endpoint for communication.
Definition: sl_socket.c:118
_i16 sl_RecvFrom(_i16 sd, void *buf, _i16 len, _i16 flags, SlSockAddr_t *from, SlSocklen_t *fromlen)
Read data from socket.
Definition: sl_socket.c:351
_i16 sl_Accept(_i16 sd, SlSockAddr_t *addr, SlSocklen_t *addrlen)
Accept a connection on a socket.
Definition: sl_socket.c:683
_i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
Initiate a connection on a socket.
Definition: sl_socket.c:440
_i16 sl_Listen(_i16 sd, _i16 backlog)
Listen for connections on a socket.
Definition: sl_socket.c:647
_i16 sl_SendTo(_i16 sd, const void *buf, _i16 len, _i16 flags, const SlSockAddr_t *to, SlSocklen_t tolen)
Write data to socket.
Definition: sl_socket.c:270
_i16 sl_Send(_i16 sd, const void *buf, _i16 len, _i16 flags)
Write data to TCP socket.
Definition: sl_socket.c:581