SimpleLink CC3120/CC3220 Host Driver  Version 2.0.1.22
Simplifies the implementation of Internet connectivity
sl_socket.h
1 /*
2  * sl_socket.h - CC31xx/CC32xx Host Driver Implementation
3  *
4  * Copyright (C) 2017 Texas Instruments Incorporated - https://www.ti.com/
5  *
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35 */
36 
37 /*****************************************************************************/
38 /* Include files */
39 /*****************************************************************************/
40 #include <ti/drivers/net/wifi/simplelink.h>
41 
42 #ifndef __SL_SOCKET_H__
43 #define __SL_SOCKET_H__
44 
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
62 /*****************************************************************************/
63 /* Macro declarations */
64 /*****************************************************************************/
65 #undef SL_FD_SETSIZE
66 #define SL_FD_SETSIZE SL_MAX_SOCKETS /* Number of sockets to select on - same is max sockets! */
67 #define SL_BSD_SOCKET_ID_MASK (0x1F) /* Index using the LBS 4 bits for socket id 0-7 */
68 
69 /* Define some BSD protocol constants. */
70 #define SL_SOCK_STREAM (1) /* TCP Socket */
71 #define SL_SOCK_DGRAM (2) /* UDP Socket */
72 #define SL_SOCK_RAW (3) /* Raw socket */
73 #define SL_IPPROTO_TCP (6) /* TCP Raw Socket */
74 #define SL_IPPROTO_UDP (17) /* UDP Raw Socket */
75 #define SL_IPPROTO_RAW (255) /* Raw Socket */
76 #define SL_SEC_SOCKET (100) /* Secured Socket Layer (SSL,TLS) */
77 
78 /* Address families. */
79 #define SL_AF_INET (2) /* IPv4 socket (UDP, TCP, etc) */
80 #define SL_AF_INET6 (3) /* IPv6 socket (UDP, TCP, etc) */
81 #define SL_AF_RF (6) /* data include RF parameter, All layer by user (Wifi could be disconnected) */
82 #define SL_AF_PACKET (17)
83 /* Protocol families, same as address families. */
84 #define SL_PF_INET AF_INET
85 #define SL_PF_INET6 AF_INET6
86 #define SL_INADDR_ANY (0) /* bind any address */
87 #define SL_IN6ADDR_ANY (0)
88 
89 
90 /* Max payload size by protocol */
91 #define SL_SOCKET_PAYLOAD_TYPE_MASK (0xF0) /*4 bits type, 4 bits sockets id */
92 #define SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER (0x80) /* 1536 bytes */
93 
94 
95 /* SL_SOCKET_EVENT_CLASS_BSD user events */
96 #define SL_SOCKET_TX_FAILED_EVENT (1)
97 #define SL_SOCKET_ASYNC_EVENT (2)
98 
99 
100 /* SL_SOCKET_EVENT_CLASS_BSD user trigger events */
101 #define SL_SOCKET_TRIGGER_EVENT_SELECT (1)
102 
103 #define SL_SOL_SOCKET (1) /* Define the socket option category. */
104 #define SL_IPPROTO_IP (2) /* Define the IP option category. */
105 #define SL_SOL_PHY_OPT (3) /* Define the PHY option category. */
106 
107 #define SL_SO_RCVBUF (8) /* Setting TCP receive buffer size */
108 #define SL_SO_KEEPALIVE (9) /* Connections are kept alive with periodic messages */
109 #define SL_SO_LINGER (13) /* Socket lingers on close pending remaining send/receive packets. */
110 #define SL_SO_RCVTIMEO (20) /* Enable receive timeout */
111 #define SL_SO_NONBLOCKING (24) /* Enable . disable nonblocking mode */
112 #define SL_SO_SECMETHOD (25) /* security metohd */
113 #define SL_SO_SECURE_MASK (26) /* security mask */
114 #define SL_SO_SECURE_FILES (27) /* security files */
115 #define SL_SO_CHANGE_CHANNEL (28) /* This option is available only when transceiver started */
116 #define SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME (30) /* This option used to configue secure file */
117 #define SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME (31) /* This option used to configue secure file */
118 #define SL_SO_SECURE_FILES_CA_FILE_NAME (32) /* This option used to configue secure file */
119 #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 */
120 #define SL_SO_STARTTLS (35) /* initiate STARTTLS on non secure socket */
121 #define SL_SO_SSL_CONNECTION_PARAMS (36) /* retrieve by getsockopt the connection params of the current SSL connection in to SlSockSSLConnectionParams_t*/
122 #define SL_SO_KEEPALIVETIME (37) /* keepalive time out */
123 #define SL_SO_SECURE_DISABLE_CERTIFICATE_STORE (38) /* disable certificate store */
124 #define SL_SO_RX_NO_IP_BOUNDARY (39) /* connectionless socket disable rx boundary */
125 #define SL_SO_SECURE_ALPN (40) /* set the ALPN bitmap list */
126 #define SL_SO_SECURE_EXT_CLIENT_CHLNG_RESP (41) /*set external challange for client certificate */
127 #define SL_SO_SECURE_DOMAIN_NAME_VERIFICATION (42) /* set a domain name for verification */
128 
129 #define SL_IP_MULTICAST_IF (60) /* Specify outgoing multicast interface */
130 #define SL_IP_MULTICAST_TTL (61) /* Specify the TTL value to use for outgoing multicast packet. */
131 #define SL_IP_ADD_MEMBERSHIP (65) /* Join IPv4 multicast membership */
132 #define SL_IP_DROP_MEMBERSHIP (66) /* Leave IPv4 multicast membership */
133 #define SL_IP_HDRINCL (67) /* Raw socket IPv4 header included. */
134 #define SL_IP_RAW_RX_NO_HEADER (68) /* Proprietary socket option that does not includeIPv4/IPv6 header (and extension headers) on received raw sockets*/
135 #define SL_IP_RAW_IPV6_HDRINCL (69) /* Transmitted buffer over IPv6 socket contains IPv6 header. */
136 #define SL_IPV6_ADD_MEMBERSHIP (70) /* Join IPv6 multicast membership */
137 #define SL_IPV6_DROP_MEMBERSHIP (71) /* Leave IPv6 multicast membership */
138 #define SL_IPV6_MULTICAST_HOPS (72) /* Specify the hops value to use for outgoing multicast packet. */
139 
140 #define SL_SO_PHY_RATE (100) /* WLAN Transmit rate */
141 #define SL_SO_PHY_TX_POWER (101) /* TX Power level */
142 #define SL_SO_PHY_NUM_FRAMES_TO_TX (102) /* Number of frames to transmit */
143 #define SL_SO_PHY_PREAMBLE (103) /* Preamble for transmission */
144 #define SL_SO_PHY_TX_INHIBIT_THRESHOLD (104) /* TX Inhibit Threshold (CCA) */
145 #define SL_SO_PHY_TX_TIMEOUT (105) /* TX timeout for Transceiver frames (lifetime) in miliseconds (max value is 100ms) */
146 #define SL_SO_PHY_ALLOW_ACKS (106) /* Enable sending ACKs in transceiver mode */
147 
148 typedef enum
149 {
150  SL_TX_INHIBIT_THRESHOLD_MIN = 1,
151  SL_TX_INHIBIT_THRESHOLD_LOW = 2,
152  SL_TX_INHIBIT_THRESHOLD_DEFAULT = 3,
153  SL_TX_INHIBIT_THRESHOLD_MED = 4,
154  SL_TX_INHIBIT_THRESHOLD_HIGH = 5,
155  SL_TX_INHIBIT_THRESHOLD_MAX = 6
156 } SlTxInhibitThreshold_e;
157 
158 #define SL_SO_SEC_METHOD_SSLV3 (0) /* security metohd SSL v3*/
159 #define SL_SO_SEC_METHOD_TLSV1 (1) /* security metohd TLS v1*/
160 #define SL_SO_SEC_METHOD_TLSV1_1 (2) /* security metohd TLS v1_1*/
161 #define SL_SO_SEC_METHOD_TLSV1_2 (3) /* security metohd TLS v1_2*/
162 #define SL_SO_SEC_METHOD_SSLv3_TLSV1_2 (4) /* use highest possible version from SSLv3 - TLS 1.2*/
163 #define SL_SO_SEC_METHOD_DLSV1 (5) /* security metohd DTL v1 */
164 
165 #define SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA (1 << 0)
166 #define SL_SEC_MASK_SSL_RSA_WITH_RC4_128_MD5 (1 << 1)
167 #define SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA (1 << 2)
168 #define SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_CBC_SHA (1 << 3)
169 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (1 << 4)
170 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA (1 << 5)
171 #define SL_SEC_MASK_TLS_RSA_WITH_AES_128_CBC_SHA256 (1 << 6)
172 #define SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA256 (1 << 7)
173 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (1 << 8)
174 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (1 << 9)
175 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (1 << 10)
176 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (1 << 11)
177 #define SL_SEC_MASK_TLS_RSA_WITH_AES_128_GCM_SHA256 (1 << 12)
178 #define SL_SEC_MASK_TLS_RSA_WITH_AES_256_GCM_SHA384 (1 << 13)
179 #define SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (1 << 14)
180 #define SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (1 << 15)
181 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (1 << 16)
182 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (1 << 17)
183 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (1 << 18)
184 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (1 << 19)
185 #define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (1 << 20)
186 #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (1 << 21)
187 #define SL_SEC_MASK_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (1 << 22)
188 
189 #define SL_SEC_MASK_SECURE_DEFAULT ((SL_SEC_MASK_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 << 1) - 1)
190 
191 #define SL_SECURE_ALPN_H1 (1 << 0)
192 #define SL_SECURE_ALPN_H2 (1 << 1)
193 #define SL_SECURE_ALPN_H2C (1 << 2)
194 #define SL_SECURE_ALPN_H2_14 (1 << 3)
195 #define SL_SECURE_ALPN_H2_16 (1 << 4)
196 #define SL_SECURE_ALPN_FULL_LIST ((SL_SECURE_ALPN_H2_16 << 1 ) - 1)
197 
198 
199 #define SL_MSG_DONTWAIT (0x00000008) /* Nonblocking IO */
200 
201 /* AP DHCP Server - IP Release reason code */
202 #define SL_IP_LEASE_PEER_RELEASE (0)
203 #define SL_IP_LEASE_PEER_DECLINE (1)
204 #define SL_IP_LEASE_EXPIRED (2)
205 
206 /* possible types when receiving SL_SOCKET_ASYNC_EVENT*/
207 #define SL_SSL_ACCEPT (0) /* accept failed due to ssl issue ( tcp pass) */
208 #define SL_RX_FRAGMENTATION_TOO_BIG (1) /* connection less mode, rx packet fragmentation > 16K, packet is being released */
209 #define SL_OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED (2) /* remote side down from secure to unsecure */
210 #define SL_SSL_NOTIFICATION_CONNECTED_SECURED (3) /* STARTTLS success */
211 #define SL_SSL_NOTIFICATION_HANDSHAKE_FAILED (4) /* STARTTLS handshake faild */
212 #define SL_SSL_NOTIFICATION_WRONG_ROOT_CA (5) /* Root CA configured is wrong, the name is in SocketAsyncEvent.EventData.extraInfo */
213 #define SL_SOCKET_ASYNC_EVENT_SSL_NOTIFICATION_WRONG_ROOT_CA (5)
214 #define SL_MAX_ISSUER_AND_SUBJECT_NAME_LEN (16)
215 
216 /*****************************************************************************/
217 /* Structure/Enum declarations */
218 /*****************************************************************************/
219 
220 /* Internet address */
221 typedef struct SlInAddr_t
222 {
223 #ifndef s_addr
224  _u32 s_addr; /* Internet address 32 bits */
225 #else
226  union S_un {
227  struct { _u8 s_b1,s_b2,s_b3,s_b4; } S_un_b;
228  struct { _u16 s_w1,s_w2; } S_un_w;
229  _u32 S_addr;
230  } S_un;
231 #endif
232 }SlInAddr_t;
233 
234 /* IpV6 or Ipv6 EUI64 */
235 typedef struct SlIn6Addr_t
236 {
237  union
238  {
239  _u8 _S6_u8[16];
240  _u32 _S6_u32[4];
241  } _S6_un;
242 }SlIn6Addr_t;
243 
244 
245 /* sockopt */
246 typedef struct
247 {
248  _u32 KeepaliveEnabled; /* 0 = disabled;1 = enabled; default = 1*/
250 
251 typedef struct
252 {
253  _u32 ReuseaddrEnabled; /* 0 = disabled; 1 = enabled; default = 1*/
255 
256 typedef struct
257 {
258  _i32 RxIpNoBoundaryEnabled; /* 0 = keep IP boundary; 1 = don`t keep ip boundary; default = 0; */
260 
261 
262 typedef struct
263 {
264  _u32 WinSize; /* receive window size for tcp sockets */
266 
267 typedef struct
268 {
269  _u32 NonBlockingEnabled;/* 0 = disabled;1 = enabled;default = 1*/
271 
272 typedef struct
273 {
274  _u8 Sd;
275  _u8 Type;
276  _i16 Val;
277  _i8 pExtraInfo[128];
279 
280 typedef struct
281 {
282  _i16 Status;
283  _u8 Sd;
284  _u8 Padding;
286 
287 
288 typedef union
289 {
290  SlSockTxFailEventData_t SockTxFailData;
291  SlSocketAsyncEvent_t SockAsyncData;
293 
294 
295 typedef struct
296 {
297  _u32 Event;
298  SlSockEventData_u SocketAsyncEvent;
299 } SlSockEvent_t;
300 
301 typedef struct
302 {
303  _u32 Event;
304  _u32 EventData;
306 
307 
308 typedef struct
309 {
310  _u32 SecureALPN;
312 
313 typedef struct
314 {
315  _u32 SecureMask;
317 
318 typedef struct
319 {
320  _u8 SecureMethod;
322 
323 typedef struct
324 {
325  _u16 SubjectNameXoredSha1;
326  _u16 IssuerNameXoredSha1;
327  _i8 FromDate[8];
328  _i8 ToDate[8];
329  _i8 SubjectName[SL_MAX_ISSUER_AND_SUBJECT_NAME_LEN];
330  _i8 IssuerName[SL_MAX_ISSUER_AND_SUBJECT_NAME_LEN];
331  _i8 SubjectNameLen;
332  _i8 IssuerNameLen;
333  _i8 Padding[2];
335 
336 
337 typedef struct
338 {
339  _u32 SecureVersion; /* what version of SSL decided in the handshake */
340  _u32 SecureCipherSuit; /* what Cipher Index was decided in the handshake */
341  _u32 SecureIsPeerValidated; /* was the other peer verified */
342  _u32 SecureALPNChosenProtocol; /* bit indicate one of the protocol defined above
343  SL_SECURE_ALPN_H1
344  SL_SECURE_ALPN_H2
345  SL_SECURE_ALPN_H2C
346  SL_SECURE_ALPN_H2_14
347  SL_SECURE_ALPN_H2_16
348  */
349  SlSockSSLCertInfo_t SecurePeerCertinfo;
351 
352 typedef enum
353 {
354  SL_BSD_SECURED_PRIVATE_KEY_IDX = 0,
355  SL_BSD_SECURED_CERTIFICATE_IDX,
356  SL_BSD_SECURED_CA_IDX,
357  SL_BSD_SECURED_DH_IDX
358 }SlSockSecureSocketFilesIndex_e;
359 
360 typedef struct
361 {
362  SlInAddr_t imr_multiaddr; /* The IPv4 multicast address to join */
363  SlInAddr_t imr_interface; /* The interface to use for this group */
365 
366 typedef struct{
367  SlIn6Addr_t ipv6mr_multiaddr; /* IPv6 multicast address of group */
368  _u32 ipv6mr_interface; /*should be 0 to choose the default multicast interface*/
370 
371 typedef struct
372 {
373  _u32 l_onoff; /* 0 = disabled; 1 = enabled; default = 0;*/
374  _u32 l_linger; /* linger time in seconds; default = 0;*/
376 
377 /* sockopt */
378 typedef _i32 SlTime_t;
379 typedef _i32 SlSuseconds_t;
380 
381 typedef struct SlTimeval_t
382 {
383  SlTime_t tv_sec; /* Seconds */
384  SlSuseconds_t tv_usec; /* Microseconds */
385 }SlTimeval_t;
386 
387 typedef _u16 SlSocklen_t;
388 
389 /* IpV4 socket address */
390 typedef struct SlSockAddr_t
391 {
392  _u16 sa_family; /* Address family (e.g. , AF_INET) */
393  _u8 sa_data[14]; /* Protocol- specific address information*/
394 }SlSockAddr_t;
395 
396 
397 typedef struct SlSockAddrIn6_t
398 {
399  _u16 sin6_family; /* AF_INET6 || AF_INET6_EUI_48*/
400  _u16 sin6_port; /* Transport layer port. */
401  _u32 sin6_flowinfo; /* IPv6 flow information. */
402  SlIn6Addr_t sin6_addr; /* IPv6 address. */
403  _u32 sin6_scope_id; /* set of interfaces for a scope. */
405 
406 /* Socket address, Internet style. */
407 
408 typedef struct SlSockAddrIn_t
409 {
410  _u16 sin_family; /* Internet Protocol (AF_INET). */
411  _u16 sin_port; /* Address port (16 bits). */
412  SlInAddr_t sin_addr; /* Internet address (32 bits). */
413  _i8 sin_zero[8]; /* Not used. */
415 
416 
417 typedef struct
418 {
419  _u8 SecureFiles[4];
421 
422 
423 typedef struct SlFdSet_t /* The select socket array manager */
424 {
425  _u32 fd_array[(SL_FD_SETSIZE + (_u8)31)/(_u8)32]; /* Bit map of SOCKET Descriptors */
426 } SlFdSet_t;
427 
428 typedef struct
429 {
430  _u8 Rate; /* Recevied Rate */
431  _u8 Channel; /* The received channel*/
432  _i8 Rssi; /* The computed RSSI value in db of current frame */
433  _u8 Padding; /* pad to align to 32 bits */
434  _u32 Timestamp; /* Timestamp in microseconds, */
436 
437 
438 
439 /*****************************************************************************/
440 /* Function prototypes */
441 /*****************************************************************************/
442 
492 #if _SL_INCLUDE_FUNC(sl_Socket)
493 _i16 sl_Socket(_i16 Domain, _i16 Type, _i16 Protocol);
494 #endif
495 
510 #if _SL_INCLUDE_FUNC(sl_Close)
511 _i16 sl_Close(_i16 sd);
512 #endif
513 
564 #if _SL_INCLUDE_FUNC(sl_Accept)
565 _i16 sl_Accept(_i16 sd, SlSockAddr_t *addr, SlSocklen_t *addrlen);
566 #endif
567 
594 #if _SL_INCLUDE_FUNC(sl_Bind)
595 _i16 sl_Bind(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen);
596 #endif
597 
618 #if _SL_INCLUDE_FUNC(sl_Listen)
619 _i16 sl_Listen(_i16 sd, _i16 backlog);
620 #endif
621 
660 #if _SL_INCLUDE_FUNC(sl_Connect)
661 _i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen);
662 #endif
663 
721 #if _SL_INCLUDE_FUNC(sl_Select)
722 _i16 sl_Select(_i16 nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *exceptsds, struct SlTimeval_t *timeout);
723 #endif
724 
734 void SL_SOCKET_FD_SET(_i16 fd, SlFdSet_t *fdset);
735 
741 void SL_SOCKET_FD_CLR(_i16 fd, SlFdSet_t *fdset);
742 
743 
752 _i16 SL_SOCKET_FD_ISSET(_i16 fd, SlFdSet_t *fdset);
753 
759 void SL_SOCKET_FD_ZERO(SlFdSet_t *fdset);
760 
1150 #if _SL_INCLUDE_FUNC(sl_SetSockOpt)
1151 _i16 sl_SetSockOpt(_i16 sd, _i16 level, _i16 optname, const void *optval, SlSocklen_t optlen);
1152 #endif
1153 
1193 #if _SL_INCLUDE_FUNC(sl_GetSockOpt)
1194 _i16 sl_GetSockOpt(_i16 sd, _i16 level, _i16 optname, void *optval, SlSocklen_t *optlen);
1195 #endif
1196 
1263 #if _SL_INCLUDE_FUNC(sl_Recv)
1264 _i16 sl_Recv(_i16 sd, void *buf, _i16 len, _i16 flags);
1265 #endif
1266 
1323 #if _SL_INCLUDE_FUNC(sl_RecvFrom)
1324 _i16 sl_RecvFrom(_i16 sd, void *buf, _i16 len, _i16 flags, SlSockAddr_t *from, SlSocklen_t *fromlen);
1325 #endif
1326 
1372 #if _SL_INCLUDE_FUNC(sl_Send )
1373 _i16 sl_Send(_i16 sd, const void *buf, _i16 len, _i16 flags);
1374 #endif
1375 
1425 #if _SL_INCLUDE_FUNC(sl_SendTo)
1426 _i16 sl_SendTo(_i16 sd, const void *buf, _i16 len, _i16 flags, const SlSockAddr_t *to, SlSocklen_t tolen);
1427 #endif
1428 
1442 #if _SL_INCLUDE_FUNC(sl_Htonl )
1443 _u32 sl_Htonl( _u32 val );
1444 
1445 #define sl_Ntohl sl_Htonl /* Reorder the bytes of a 16-bit unsigned value from network order to processor orde. */
1446 #endif
1447 
1461 #if _SL_INCLUDE_FUNC(sl_Htons )
1462 _u16 sl_Htons( _u16 val );
1463 
1464 #define sl_Ntohs sl_Htons /* Reorder the bytes of a 16-bit unsigned value from network order to processor orde. */
1465 #endif
1466 
1467 
1476 #ifdef __cplusplus
1477 }
1478 #endif /* __cplusplus */
1479 
1480 #endif /* __SOCKET_H__ */
1481 
1482 
_i16 sl_Bind(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
Assign a name to a socket.
Definition: sl_socket.c:247
_u32 sl_Htonl(_u32 val)
Reorder the bytes of a 32-bit unsigned value.
Definition: sl_socket.c:813
_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:1728
_i16 sl_SetSockOpt(_i16 sd, _i16 level, _i16 optname, const void *optval, SlSocklen_t optlen)
Set socket options-.
Definition: sl_socket.c:943
_u16 sl_Htons(_u16 val)
Reorder the bytes of a 16-bit unsigned value.
Definition: sl_socket.c:834
_i16 sl_Close(_i16 sd)
Gracefully close socket.
Definition: sl_socket.c:187
_i16 sl_Recv(_i16 sd, void *buf, _i16 len, _i16 flags)
Read data from TCP socket.
Definition: sl_socket.c:892
_i16 sl_GetSockOpt(_i16 sd, _i16 level, _i16 optname, void *optval, SlSocklen_t *optlen)
Get socket options.
Definition: sl_socket.c:986
_i16 sl_Socket(_i16 Domain, _i16 Type, _i16 Protocol)
Create an endpoint for communication.
Definition: sl_socket.c:143
_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:375
_i16 sl_Accept(_i16 sd, SlSockAddr_t *addr, SlSocklen_t *addrlen)
Accept a connection on a socket.
Definition: sl_socket.c:708
_i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
Initiate a connection on a socket.
Definition: sl_socket.c:464
_i16 sl_Listen(_i16 sd, _i16 backlog)
Listen for connections on a socket.
Definition: sl_socket.c:672
_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:296
_i16 sl_Send(_i16 sd, const void *buf, _i16 len, _i16 flags)
Write data to TCP socket.
Definition: sl_socket.c:606