SimpleLink CC3120/CC3220 Host Driver  Version 2.0.1.15
Simplifies the implementation of Internet connectivity
Socket

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

Functions

_i16 sl_Socket (_i16 Domain, _i16 Type, _i16 Protocol)
 Create an endpoint for communication. More...
 
_i16 sl_Close (_i16 sd)
 Gracefully close socket. More...
 
_i16 sl_Accept (_i16 sd, SlSockAddr_t *addr, SlSocklen_t *addrlen)
 Accept a connection on a socket. More...
 
_i16 sl_Bind (_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
 Assign a name to a socket. More...
 
_i16 sl_Listen (_i16 sd, _i16 backlog)
 Listen for connections on a socket. More...
 
_i16 sl_Connect (_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
 Initiate a connection on a socket. More...
 
_i16 sl_Select (_i16 nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *exceptsds, struct SlTimeval_t *timeout)
 Monitor socket activity. More...
 
_i16 sl_SetSockOpt (_i16 sd, _i16 level, _i16 optname, const void *optval, SlSocklen_t optlen)
 Set socket options-. More...
 
_i16 sl_GetSockOpt (_i16 sd, _i16 level, _i16 optname, void *optval, SlSocklen_t *optlen)
 Get socket options. More...
 
_i16 sl_Recv (_i16 sd, void *buf, _i16 len, _i16 flags)
 Read data from TCP socket. More...
 
_i16 sl_RecvFrom (_i16 sd, void *buf, _i16 len, _i16 flags, SlSockAddr_t *from, SlSocklen_t *fromlen)
 Read data from socket. More...
 
_i16 sl_Send (_i16 sd, const void *buf, _i16 len, _i16 flags)
 Write data to TCP socket. More...
 
_i16 sl_SendTo (_i16 sd, const void *buf, _i16 len, _i16 flags, const SlSockAddr_t *to, SlSocklen_t tolen)
 Write data to socket. More...
 
_u32 sl_Htonl (_u32 val)
 Reorder the bytes of a 32-bit unsigned value. More...
 
_u16 sl_Htons (_u16 val)
 Reorder the bytes of a 16-bit unsigned value. More...
 

Typedefs

typedef struct SlInAddr_t SlInAddr_t
 
typedef struct SlIn6Addr_t SlIn6Addr_t
 
typedef _i32 SlTime_t
 
typedef _i32 SlSuseconds_t
 
typedef struct SlTimeval_t SlTimeval_t
 
typedef _u16 SlSocklen_t
 
typedef struct SlSockAddr_t SlSockAddr_t
 
typedef struct SlSockAddrIn6_t SlSockAddrIn6_t
 
typedef struct SlSockAddrIn_t SlSockAddrIn_t
 
typedef struct SlFdSet_t SlFdSet_t
 

Enumerations

enum  SlTxInhibitThreshold_e {
  SL_TX_INHIBIT_THRESHOLD_MIN = 1,
  SL_TX_INHIBIT_THRESHOLD_LOW = 2,
  SL_TX_INHIBIT_THRESHOLD_DEFAULT = 3,
  SL_TX_INHIBIT_THRESHOLD_MED = 4,
  SL_TX_INHIBIT_THRESHOLD_HIGH = 5,
  SL_TX_INHIBIT_THRESHOLD_MAX = 6
}
 
enum  SlSockSecureSocketFilesIndex_e {
  SL_BSD_SECURED_PRIVATE_KEY_IDX = 0,
  SL_BSD_SECURED_CERTIFICATE_IDX,
  SL_BSD_SECURED_CA_IDX,
  SL_BSD_SECURED_DH_IDX
}
 

Detailed Description

Controls standard client/server sockets programming options and capabilities.

Function Documentation

_i16 sl_Accept ( _i16  sd,
SlSockAddr_t addr,
SlSocklen_t *  addrlen 
)

Accept a connection on a socket.

This 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 sl_Socket(), bound to a local address with sl_Bind(), and is listening for connections after a sl_Listen(). The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address family.
The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr, on return it will contain the actual length (in bytes) of the address returned.

Parameters
[in]sdSocket descriptor (handle)
[out]addrThe argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address
sockaddr:
- code for the address format. On this version only AF_INET is supported.
- 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 handle.
On a non-blocking accept a possible negative value is SL_EAGAIN.
On failure, negative error code.
SL_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
sl_Socket sl_Bind sl_Listen
Note
Belongs to server_side
Warning

Definition at line 683 of file sl_socket.c.

684 {
685  _SlSockAcceptMsg_u Msg;
686  _SlReturnVal_t RetVal;
687  SlSocketAddrResponse_u AsyncRsp;
688 
689  _u8 ObjIdx = MAX_CONCURRENT_ACTIONS;
690 
691  /* verify that this api is allowed. if not allowed then
692  ignore the API execution and return immediately with an error */
693  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
694 
695  Msg.Cmd.Sd = (_u8)sd;
696  Msg.Cmd.Family = (_u8)((sizeof(SlSockAddrIn_t) == *addrlen) ? SL_AF_INET : SL_AF_INET6);
697 
698  ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, ACCEPT_ID, (_u8)sd & SL_BSD_SOCKET_ID_MASK);
699 
700  if (MAX_CONCURRENT_ACTIONS == ObjIdx)
701  {
702  return SL_POOL_IS_EMPTY;
703  }
704 
705  /* send the command */
706  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlAcceptCmdCtrl, &Msg, NULL));
707  VERIFY_PROTOCOL(Msg.Rsp.Sd == (_u8)sd);
708 
709  RetVal = Msg.Rsp.StatusOrLen;
710 
711  if(SL_OS_RET_CODE_OK == RetVal)
712  {
713 #ifndef SL_TINY
714  /* in case socket is non-blocking one, the async event should be received immediately */
715  if( g_pCB->SocketNonBlocking & (1<<(sd & SL_BSD_SOCKET_ID_MASK) ))
716  {
717  SL_DRV_SYNC_OBJ_WAIT_TIMEOUT(&g_pCB->ObjPool[ObjIdx].SyncObj,
718  SL_DRIVER_TIMEOUT_SHORT,
719  SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE
720  );
721  }
722  else
723 #endif
724  {
725  /* wait for async and get Data Read parameters */
726  SL_DRV_SYNC_OBJ_WAIT_FOREVER(&g_pCB->ObjPool[ObjIdx].SyncObj);
727  }
728 
729  VERIFY_PROTOCOL(AsyncRsp.IpV4.Sd == (_u8)sd);
730 
731  RetVal = AsyncRsp.IpV4.StatusOrLen;
732  if( (NULL != addr) && (NULL != addrlen) )
733  {
734 #if 0 /* Kept for backup */
735  _SlSocketParseAddress(&AsyncRsp, addr, addrlen);
736 #else
737  addr->sa_family = AsyncRsp.IpV4.Family;
738 
739  if(SL_AF_INET == addr->sa_family)
740  {
741  if( *addrlen == (SlSocklen_t)sizeof( SlSockAddrIn_t ) )
742  {
743  ((SlSockAddrIn_t *)addr)->sin_port = AsyncRsp.IpV4.Port;
744  ((SlSockAddrIn_t *)addr)->sin_addr.s_addr = AsyncRsp.IpV4.Address;
745  }
746  else
747  {
748  *addrlen = 0;
749  }
750  }
751 #ifdef SL_SUPPORT_IPV6
752  else
753  {
754  if( *addrlen == sizeof( SlSockAddrIn6_t ) )
755  {
756  ((SlSockAddrIn6_t *)addr)->sin6_port = AsyncRsp.IpV6.Port ;
757  sl_Memcpy(((SlSockAddrIn6_t *)addr)->sin6_addr._S6_un._S6_u32, AsyncRsp.IpV6.Address, 16);
758  }
759  else
760  {
761  *addrlen = 0;
762  }
763  }
764 #endif
765 #endif
766  }
767  }
768 
769  _SlDrvReleasePoolObj(ObjIdx);
770  return (_i16)RetVal;
771 }
_i16 sl_Bind ( _i16  sd,
const SlSockAddr_t addr,
_i16  addrlen 
)

Assign a name to a socket.

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

Parameters
[in]sdSocket descriptor (handle)
[in]addrSpecifies the destination addrs
sockaddr:
- code for the address format. On this version only SL_AF_INET is supported.
- socket address, the length depends on the code format
[in]addrlenContains the size of the structure pointed to by addr
Returns
Zero on success, or negative error code on failure
See also
sl_Socket sl_Accept sl_Listen
Note
belongs to basic_api
Warning

Definition at line 221 of file sl_socket.c.

222 {
223  _SlSockBindMsg_u Msg;
224  _SlCmdCtrl_t CmdCtrl = {0, 0, (_SlArgSize_t)sizeof(SlSocketResponse_t)};
225 
226  /* verify that this api is allowed. if not allowed then
227  ignore the API execution and return immediately with an error */
228  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
229 
230  switch(addr->sa_family)
231  {
232  case SL_AF_INET :
233  CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND;
234  CmdCtrl.TxDescLen = (_SlArgSize_t)sizeof(SlSocketAddrIPv4Command_t);
235  break;
236 #ifndef SL_TINY
237 #ifdef SL_SUPPORT_IPV6
238  case SL_AF_INET6:
239  CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND_V6;
240  CmdCtrl.TxDescLen = (_SlArgSize_t)sizeof(SlSocketAddrIPv6Command_t);
241  break;
242 #endif
243 #endif
244 
245  case SL_AF_RF :
246  default:
247  return SL_RET_CODE_INVALID_INPUT;
248  }
249 
250  Msg.Cmd.IpV4.LenOrPadding = 0;
251  Msg.Cmd.IpV4.Sd = (_u8)sd;
252 
253  _SlSocketBuildAddress(addr, &Msg.Cmd);
254  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
255 
256  return Msg.Rsp.StatusOrLen;
257 }
_i16 sl_Close ( _i16  sd)

Gracefully close socket.

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

Parameters
[in]sdSocket handle (received in sl_Socket)
Returns
Zero on success, or negative error code on failure
See also
sl_Socket
Note
belongs to ext_api
Warning

Definition at line 162 of file sl_socket.c.

163 {
164  _SlSockCloseMsg_u Msg;
165  _u8 ObjIdx = MAX_CONCURRENT_ACTIONS;
166  SlSocketResponse_t AsyncRsp;
167  _SlReturnVal_t RetVal;
168  _u8 bSocketInAction = FALSE;
169 
170  /* verify that this api is allowed. if not allowed then
171  ignore the API execution and return immediately with an error */
172  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
173 
174  Msg.Cmd.Sd = (_u8)sd;
175 
176  /* check if the socket has already action in progress */
177  bSocketInAction = !!(g_pCB->ActiveActionsBitmap & (1<<sd));
178 
179  if (bSocketInAction == FALSE)
180  {
181  ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, CLOSE_ID, (_u8)(sd & SL_BSD_SOCKET_ID_MASK));
182 
183  if (MAX_CONCURRENT_ACTIONS == ObjIdx)
184  {
185  return SL_POOL_IS_EMPTY;
186  }
187  }
188 
189  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSockCloseCmdCtrl, &Msg, NULL));
190 
191  RetVal = Msg.Rsp.StatusOrLen;
192 
193  if (bSocketInAction == FALSE)
194  {
195  if( SL_RET_CODE_OK == RetVal)
196  {
197  SL_DRV_SYNC_OBJ_WAIT_TIMEOUT(&g_pCB->ObjPool[ObjIdx].SyncObj,
198  SL_DRIVER_TIMEOUT_LONG,
199  SL_OPCODE_SOCKET_SOCKETCLOSEASYNCEVENT
200  );
201  RetVal = AsyncRsp.StatusOrLen;
202  }
203 
204  _SlDrvReleasePoolObj(ObjIdx);
205  }
206 
207  return RetVal;
208 }
_i16 sl_Connect ( _i16  sd,
const SlSockAddr_t addr,
_i16  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 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 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. On this version only AF_INET is supported.
- 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 handle.
On a non-blocking connect a possible negative value is SL_EALREADY. On failure, negative value.
SL_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
sl_Socket
Note
belongs to client_side
Warning

Definition at line 440 of file sl_socket.c.

441 {
442  _SlSockConnectMsg_u Msg;
443  _SlReturnVal_t RetVal;
444  _SlCmdCtrl_t CmdCtrl = {0, (_SlArgSize_t)0, (_SlArgSize_t)sizeof(SlSocketResponse_t)};
445  SlSocketResponse_t AsyncRsp;
446  _u8 ObjIdx = MAX_CONCURRENT_ACTIONS;
447 
448  /* verify that this api is allowed. if not allowed then
449  ignore the API execution and return immediately with an error */
450  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
451 
452  switch(addr->sa_family)
453  {
454  case SL_AF_INET :
455  CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT;
456  CmdCtrl.TxDescLen = (_SlArgSize_t)sizeof(SlSocketAddrIPv4Command_t);
457  /* Do nothing - cmd already initialized to this type */
458  break;
459 #ifdef SL_SUPPORT_IPV6
460  case SL_AF_INET6:
461  CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT_V6;
462  CmdCtrl.TxDescLen = (_SlArgSize_t)sizeof(SlSocketAddrIPv6Command_t);
463  break;
464 #endif
465  case SL_AF_RF:
466  default:
467  return SL_RET_CODE_INVALID_INPUT;
468  }
469 
470  Msg.Cmd.IpV4.LenOrPadding = 0;
471  Msg.Cmd.IpV4.Sd = (_u8)sd;
472 
473  _SlSocketBuildAddress(addr, &Msg.Cmd);
474 
475  ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, CONNECT_ID, (_u8)(sd & SL_BSD_SOCKET_ID_MASK));
476 
477  if (MAX_CONCURRENT_ACTIONS == ObjIdx)
478  {
479  return SL_POOL_IS_EMPTY;
480  }
481 
482  /* send the command */
483  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
484  VERIFY_PROTOCOL(Msg.Rsp.Sd == (_u8)sd);
485 
486  RetVal = Msg.Rsp.StatusOrLen;
487 
488  if(SL_RET_CODE_OK == RetVal)
489  {
490 #ifndef SL_TINY
491  /*In case socket is non-blocking one, the async event should be received immediately */
492  if( g_pCB->SocketNonBlocking & (1<<(sd & SL_BSD_SOCKET_ID_MASK) ))
493  {
494  SL_DRV_SYNC_OBJ_WAIT_TIMEOUT(&g_pCB->ObjPool[ObjIdx].SyncObj,
495  SL_DRIVER_TIMEOUT_SHORT,
496  SL_OPCODE_SOCKET_CONNECTASYNCRESPONSE
497  );
498  }
499  else
500 #endif
501  {
502 
503  /* wait for async and get Data Read parameters */
504  SL_DRV_SYNC_OBJ_WAIT_FOREVER(&g_pCB->ObjPool[ObjIdx].SyncObj);
505  }
506 
507  VERIFY_PROTOCOL(AsyncRsp.Sd == (_u8)sd);
508  RetVal = AsyncRsp.StatusOrLen;
509  }
510 
511  _SlDrvReleasePoolObj(ObjIdx);
512  return RetVal;
513 }
_i16 sl_GetSockOpt ( _i16  sd,
_i16  level,
_i16  optname,
void *  optval,
SlSocklen_t *  optlen 
)

Get socket options.

This 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 proto- col 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 optval - ues for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.

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

Definition at line 1005 of file sl_socket.c.

1006 {
1007  _SlGetSockOptMsg_u Msg;
1008  _SlCmdExt_t CmdExt;
1009 
1010  /* verify that this api is allowed. if not allowed then
1011  ignore the API execution and return immediately with an error */
1012  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
1013  if (*optlen == 0)
1014  {
1015  return SL_EZEROLEN;
1016  }
1017 
1018  _SlDrvResetCmdExt(&CmdExt);
1019  CmdExt.RxPayloadLen = (_i16)(*optlen);
1020  CmdExt.pRxPayload = optval;
1021 
1022  Msg.Cmd.Sd = (_u8)sd;
1023  Msg.Cmd.Level = (_u8)level;
1024  Msg.Cmd.OptionLen = (_u8)(*optlen);
1025  Msg.Cmd.OptionName = (_u8)optname;
1026 
1027  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlGetSockOptCmdCtrl, &Msg, &CmdExt));
1028 
1029  if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen)
1030  {
1031  *optlen = Msg.Rsp.OptionLen;
1032  return SL_ESMALLBUF;
1033  }
1034  else
1035  {
1036  *optlen = (_u8)CmdExt.ActualRxPayloadLen;
1037  }
1038  return (_i16)Msg.Rsp.Status;
1039 }
_u32 sl_Htonl ( _u32  val)

Reorder the bytes of a 32-bit unsigned value.

This function is used to Reorder the bytes of a 32-bit unsigned value from processor order to network order.

Parameters
[in]valVariable to reorder
Returns
Return the reorder variable,
See also
sl_SendTo sl_Bind sl_Connect sl_RecvFrom sl_Accept
Note
Belongs to send_api
Warning

Definition at line 778 of file sl_socket.c.

779 {
780  _u32 i = 1;
781  _i8 *p = (_i8 *)&i;
782  if (p[0] == 1) /* little endian */
783  {
784  p[0] = ((_i8* )&val)[3];
785  p[1] = ((_i8* )&val)[2];
786  p[2] = ((_i8* )&val)[1];
787  p[3] = ((_i8* )&val)[0];
788  return i;
789  }
790  else /* big endian */
791  {
792  return val;
793  }
794 }
_u16 sl_Htons ( _u16  val)

Reorder the bytes of a 16-bit unsigned value.

This function is used to Reorder the bytes of a 16-bit unsigned value from processor order to network order.

Parameters
[in]valVariable to reorder
Returns
Return the reorder variable,
See also
sl_SendTo sl_Bind sl_Connect sl_RecvFrom sl_Accept
Note
Belongs to send_api
Warning

Definition at line 799 of file sl_socket.c.

800 {
801  _i16 i = 1;
802  _i8 *p = (_i8 *)&i;
803  if (p[0] == 1) /* little endian */
804  {
805  p[0] = ((_i8* )&val)[1];
806  p[1] = ((_i8* )&val)[0];
807  return (_u16)i;
808  }
809  else /* big endian */
810  {
811  return val;
812  }
813 }
_i16 sl_Listen ( _i16  sd,
_i16  backlog 
)

Listen for connections on a socket.

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

Parameters
[in]sdSocket descriptor (handle)
[in]backlogSpecifies the listen queue depth.
Returns
Zero on success, or negative error code on failure
See also
sl_Socket sl_Accept sl_Bind
Note
Belongs to server_side
Warning

Definition at line 647 of file sl_socket.c.

648 {
649  _SlListenMsg_u Msg;
650 
651  /* verify that this api is allowed. if not allowed then
652  ignore the API execution and return immediately with an error */
653  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
654 
655  Msg.Cmd.Sd = (_u8)sd;
656  Msg.Cmd.Backlog = (_u8)backlog;
657 
658  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlListenCmdCtrl, &Msg, NULL));
659  return (_i16)Msg.Rsp.status;
660 }
_i16 sl_Recv ( _i16  sd,
void *  buf,
_i16  len,
_i16  flags 
)

Read data from TCP socket.

Function receives a message from a connection-mode socket

Parameters
[in]sdSocket 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 SL_EAGAIN.
SL_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
sl_RecvFrom
Note
Belongs to recv_api
Warning
Examples
  • Receiving data using TCP socket:
    1 SlSockAddrIn_t Addr;
    2 SlSockAddrIn_t LocalAddr;
    3 _i16 AddrSize = sizeof(SlSockAddrIn_t);
    4 _i16 SockID, newSockID;
    5 _i16 Status;
    6 _i8 Buf[RECV_BUF_LEN];
    7 
    8 LocalAddr.sin_family = SL_AF_INET;
    9 LocalAddr.sin_port = sl_Htons(5001);
    10 LocalAddr.sin_addr.s_addr = 0;
    11 
    12 Addr.sin_family = SL_AF_INET;
    13 Addr.sin_port = sl_Htons(5001);
    14 Addr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(10,1,1,200));
    15 
    16 SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
    17 Status = sl_Bind(SockID, (SlSockAddr_t *)&LocalAddr, AddrSize);
    18 Status = sl_Listen(SockID, 0);
    19 newSockID = sl_Accept(SockID, (SlSockAddr_t*)&Addr, (SlSocklen_t*) &AddrSize);
    20 Status = sl_Recv(newSockID, Buf, 1460, 0);

  • Rx transceiver mode using a raw socket:
    1 _i8 buffer[1536];
    2 _i16 sd;
    3 _u16 size;
    4 SlTransceiverRxOverHead_t *transHeader;
    5 sd = sl_Socket(SL_AF_RF,SL_SOCK_RAW,11); // channel 11
    6 while(1)
    7 {
    8  size = sl_Recv(sd,buffer,1536,0);
    9  transHeader = (SlTransceiverRxOverHead_t *)buffer;
    10  printf("RSSI is %d frame type is 0x%x size %d\n",transHeader->rssi,buffer[sizeof(SlTransceiverRxOverHead_t)],size);
    11 }

Definition at line 911 of file sl_socket.c.

912 {
913  _SlRecvMsg_u Msg;
914  _SlCmdExt_t CmdExt;
915  _SlReturnVal_t status;
916 
917  /* verify that this api is allowed. if not allowed then
918  ignore the API execution and return immediately with an error */
919  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
920 
921  _SlDrvResetCmdExt(&CmdExt);
922  CmdExt.RxPayloadLen = Len;
923  CmdExt.pRxPayload = (_u8 *)pBuf;
924 
925  Msg.Cmd.Sd = (_u8)sd;
926  Msg.Cmd.StatusOrLen = (_u16)Len;
927 
928  /* no size truncation in recv path */
929  CmdExt.RxPayloadLen = (_i16)Msg.Cmd.StatusOrLen;
930 
931  Msg.Cmd.FamilyAndFlags = (_u8)(flags & 0x0F);
932 
933  status = _SlDrvDataReadOp((_SlSd_t)sd, (_SlCmdCtrl_t *)&_SlRecvCmdCtrl, &Msg, &CmdExt);
934  if( status != SL_OS_RET_CODE_OK )
935  {
936  return status;
937  }
938 
939  /* if the Device side sends less than expected it is not the Driver's role */
940  /* the returned value could be smaller than the requested size */
941  return (_i16)Msg.Rsp.StatusOrLen;
942 }
_i16 sl_RecvFrom ( _i16  sd,
void *  buf,
_i16  len,
_i16  flags,
SlSockAddr_t from,
SlSocklen_t *  fromlen 
)

Read data from socket.

Function receives a message from a connection-mode or connectionless-mode socket

Parameters
[in]sdSocket 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. On this version only AF_INET is supported.
- 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 SL_EAGAIN. SL_RET_CODE_INVALID_INPUT (-2) will be returned if fromlen has incorrect length.
SL_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
sl_Recv
Note
Belongs to recv_api
Warning
Example
  • Receiving data:
    1 SlSockAddrIn_t Addr;
    2 SlSockAddrIn_t LocalAddr;
    3 _i16 AddrSize = sizeof(SlSockAddrIn_t);
    4 _i16 SockID;
    5 _i16 Status;
    6 _i8 Buf[RECV_BUF_LEN];
    7 
    8 LocalAddr.sin_family = SL_AF_INET;
    9 LocalAddr.sin_port = sl_Htons(5001);
    10 LocalAddr.sin_addr.s_addr = 0;
    11 
    12 SockID = sl_Socket(SL_AF_INET,SL_SOCK_DGRAM, 0);
    13 Status = sl_Bind(SockID, (SlSockAddr_t *)&LocalAddr, AddrSize);
    14 Status = sl_RecvFrom(SockID, Buf, 1472, 0, (SlSockAddr_t *)&Addr, (SlSocklen_t*)&AddrSize);

Definition at line 351 of file sl_socket.c.

352 {
353  _SlRecvfromMsg_u Msg;
354  _SlCmdExt_t CmdExt;
355  _i16 RetVal;
356 
357  /* verify that this api is allowed. if not allowed then
358  ignore the API execution and return immediately with an error */
359  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
360 
361  /* RAW transceiver use only sl_Recv */
362  if ((sd & SL_SOCKET_PAYLOAD_TYPE_MASK) == SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER)
363  {
364  return SL_ERROR_BSD_SOC_ERROR;
365  }
366 
367  _SlDrvResetCmdExt(&CmdExt);
368  CmdExt.RxPayloadLen = Len;
369  CmdExt.pRxPayload = (_u8 *)buf;
370 
371  Msg.Cmd.Sd = (_u8)sd;
372  Msg.Cmd.StatusOrLen = (_u16)Len;
373 
374  /* no size truncation in recv path */
375  CmdExt.RxPayloadLen = (_i16)Msg.Cmd.StatusOrLen;
376 
377  Msg.Cmd.FamilyAndFlags = (_u8)(flags & 0x0F);
378 
379  if(sizeof(SlSockAddrIn_t) == *fromlen)
380  {
381  Msg.Cmd.FamilyAndFlags |= (SL_AF_INET << 4);
382  }
383  else if (sizeof(SlSockAddrIn6_t) == *fromlen)
384  {
385  Msg.Cmd.FamilyAndFlags |= (SL_AF_INET6 << 4);
386  }
387  else
388  {
389  return SL_RET_CODE_INVALID_INPUT;
390  }
391 
392  RetVal = _SlDrvDataReadOp((_SlSd_t)sd, (_SlCmdCtrl_t *)&_SlRecvfomCmdCtrl, &Msg, &CmdExt);
393  if( RetVal != SL_OS_RET_CODE_OK )
394  {
395  return RetVal;
396  }
397 
398  RetVal = Msg.Rsp.IpV4.StatusOrLen;
399 
400  if(RetVal >= 0)
401  {
402  VERIFY_PROTOCOL(sd == (_i16)Msg.Rsp.IpV4.Sd);
403 #if 0
404  _SlSocketParseAddress(&Msg.Rsp, from, fromlen);
405 #else
406  from->sa_family = Msg.Rsp.IpV4.Family;
407  if(SL_AF_INET == from->sa_family)
408  {
409  ((SlSockAddrIn_t *)from)->sin_port = Msg.Rsp.IpV4.Port;
410  ((SlSockAddrIn_t *)from)->sin_addr.s_addr = Msg.Rsp.IpV4.Address;
411  *fromlen = (SlSocklen_t)sizeof(SlSockAddrIn_t);
412  }
413 #ifdef SL_SUPPORT_IPV6
414  else if(SL_AF_INET6 == from->sa_family)
415  {
416  VERIFY_PROTOCOL(*fromlen >= sizeof(SlSockAddrIn6_t));
417 
418  ((SlSockAddrIn6_t *)from)->sin6_port = Msg.Rsp.IpV6.Port;
419  sl_Memcpy(((SlSockAddrIn6_t *)from)->sin6_addr._S6_un._S6_u32, Msg.Rsp.IpV6.Address, 16);
420  *fromlen = sizeof(SlSockAddrIn6_t);
421  }
422 #endif
423 #endif
424  }
425 
426  return (_i16)RetVal;
427 }
_i16 sl_Select ( _i16  nfds,
SlFdSet_t readsds,
SlFdSet_t writesds,
SlFdSet_t exceptsds,
struct SlTimeval_t timeout 
)

Monitor socket activity.

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 fdset is the one that retreived in the first triggerd call. To enable the trigger mode, an handler must be statically registered to the slcb_SocketTriggerEventHandler (user.h)

Parameters
[in]nfdsThe highest-numbered file descriptor in any of the three sets, plus 1.
[out]readsdsSocket descriptors list for read monitoring and accept monitoring
[out]writesdsSocket descriptors list for connect monitoring only, write monitoring is not supported
[out]exceptsdsSocket descriptors list for exception monitoring, not supported.
[in]timeoutIs an upper bound on the amount of time elapsed before 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 timout fields must be set to zero.
Returns
On success, 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 readfds, writefds, exceptfds) 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.
SL_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
sl_Socket
Note
If the timeout value set to less than 10ms it will automatically set to 10ms to prevent overload of the system
Belongs to basic_api

Only one sl_Select can be handled at a time.Calling this API while the same command is called from another thread, may result in one of the following scenarios:

  1. The command will wait (internal) until the previous command finish, and then be executed.
  2. There are not enough resources and SL_POOL_IS_EMPTY error will return. In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try again later to issue the command.
  3. In case there is already a triggered sl_Select in progress, the following call will return with SL_RET_CODE_SOCKET_SELECT_IN_PROGRESS_ERROR.
Warning

Definition at line 1096 of file sl_socket.c.

1097 {
1098  _SlSelectMsg_u Msg;
1099  SlSelectAsyncResponse_t AsyncRsp;
1100  _u8 ObjIdx = MAX_CONCURRENT_ACTIONS;
1101 #if ((defined(SL_RUNTIME_EVENT_REGISTERATION) || defined(slcb_SocketTriggerEventHandler)))
1102  _u8 IsNonBlocking = FALSE;
1103 #endif
1104 
1105  /* verify that this API is allowed. if not allowed then
1106  ignore the API execution and return immediately with an error */
1107  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
1108 
1109 #if ((defined(SL_RUNTIME_EVENT_REGISTERATION) || defined(slcb_SocketTriggerEventHandler)))
1110  if(1 == _SlIsEventRegistered(SL_EVENT_HDL_SOCKET_TRIGGER))
1111  {
1112  if( NULL != timeout )
1113  {
1114  /* Set that we are in Non-Blocking mode */
1115  if ( (0 == timeout->tv_sec) && (0 == timeout->tv_usec) )
1116  {
1117  IsNonBlocking = TRUE;
1118  }
1119  else
1120  {
1121  SL_DRV_PROTECTION_OBJ_LOCK_FOREVER();
1122 
1123  /* If there is a trigger select running in the progress abort the new blocking request */
1124  if (g_pCB->SocketTriggerSelect.Info.State > SOCK_TRIGGER_READY)
1125  {
1126  SL_DRV_PROTECTION_OBJ_UNLOCK();
1127  return SL_RET_CODE_SOCKET_SELECT_IN_PROGRESS_ERROR;
1128  }
1129 
1130  SL_DRV_PROTECTION_OBJ_UNLOCK();
1131  }
1132 
1133  if (IsNonBlocking == TRUE)
1134  {
1135  /* return EAGAIN if we alreay have select trigger in progress */
1136  if (g_pCB->SocketTriggerSelect.Info.State == SOCK_TRIGGER_WAITING_FOR_RESP)
1137  {
1138  return SL_ERROR_BSD_EAGAIN;
1139  }
1140  /* return the stored response if already received */
1141  else if (g_pCB->SocketTriggerSelect.Info.State == SOCK_TRIGGER_RESP_RECEIVED)
1142  {
1143 
1144  if( ((_i16)g_pCB->SocketTriggerSelect.Resp.Status) >= 0 )
1145  {
1146  if( readsds )
1147  {
1148  readsds->fd_array[0] = g_pCB->SocketTriggerSelect.Resp.ReadFds;
1149  }
1150  if( writesds )
1151  {
1152  writesds->fd_array[0] = g_pCB->SocketTriggerSelect.Resp.WriteFds;
1153  }
1154  }
1155 
1156  /* Now relaese the pool object */
1157  _SlDrvReleasePoolObj(g_pCB->SocketTriggerSelect.Info.ObjPoolIdx);
1158 
1159  g_pCB->SocketTriggerSelect.Info.ObjPoolIdx = MAX_CONCURRENT_ACTIONS;
1160 
1161  /* Reset the socket select trigger object */
1162  g_pCB->SocketTriggerSelect.Info.State = SOCK_TRIGGER_READY;
1163 
1164  return (_i16)g_pCB->SocketTriggerSelect.Resp.Status;
1165  }
1166  }
1167  }
1168  }
1169 #endif
1170 
1171  Msg.Cmd.Nfds = (_u8)nfds;
1172  Msg.Cmd.ReadFdsCount = 0;
1173  Msg.Cmd.WriteFdsCount = 0;
1174 
1175  Msg.Cmd.ReadFds = 0;
1176  Msg.Cmd.WriteFds = 0;
1177 
1178 
1179  if( readsds )
1180  {
1181  Msg.Cmd.ReadFds = (_u16)readsds->fd_array[0];
1182  }
1183  if( writesds )
1184  {
1185  Msg.Cmd.WriteFds = (_u16)writesds->fd_array[0];
1186  }
1187  if( NULL == timeout )
1188  {
1189  Msg.Cmd.tv_sec = 0xffff;
1190  Msg.Cmd.tv_usec = 0xffff;
1191  }
1192  else
1193  {
1194  if( 0xffff <= timeout->tv_sec )
1195  {
1196  Msg.Cmd.tv_sec = 0xffff;
1197  }
1198  else
1199  {
1200  Msg.Cmd.tv_sec = (_u16)timeout->tv_sec;
1201  }
1202 
1203  /* convert to milliseconds */
1204  timeout->tv_usec = timeout->tv_usec >> 10;
1205 
1206  if( 0xffff <= timeout->tv_usec )
1207  {
1208  Msg.Cmd.tv_usec = 0xffff;
1209  }
1210  else
1211  {
1212  Msg.Cmd.tv_usec = (_u16)timeout->tv_usec;
1213  }
1214 
1215  }
1216 
1217  /* Use Obj to issue the command, if not available try later */
1218  ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, SELECT_ID, SL_MAX_SOCKETS);
1219 
1220  if (MAX_CONCURRENT_ACTIONS == ObjIdx)
1221  {
1222  return SL_POOL_IS_EMPTY;
1223  }
1224 
1225  /* send the command */
1226  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSelectCmdCtrl, &Msg, NULL));
1227 
1228  if(SL_OS_RET_CODE_OK == (_i16)Msg.Rsp.status)
1229  {
1230  SL_DRV_SYNC_OBJ_WAIT_FOREVER(&g_pCB->ObjPool[ObjIdx].SyncObj);
1231 
1232  Msg.Rsp.status = (_i16)AsyncRsp.Status;
1233 
1234  /* this code handles the socket trigger mode case */
1235 #if((defined(SL_RUNTIME_EVENT_REGISTERATION) || defined(slcb_SocketTriggerEventHandler)))
1236  if(1 == _SlIsEventRegistered(SL_EVENT_HDL_SOCKET_TRIGGER))
1237  {
1238  /* if no data returned and we are in trigger mode,
1239  send another select cmd but now with timeout infinite,
1240  and return immediately with EAGAIN to the user */
1241  if ((IsNonBlocking == TRUE) && (AsyncRsp.Status == 0))
1242  {
1243  /* set the select trigger-in-progress bit */
1244  g_pCB->SocketTriggerSelect.Info.State = SOCK_TRIGGER_WAITING_FOR_RESP;
1245 
1246  Msg.Cmd.tv_sec = 0xffff;
1247  Msg.Cmd.tv_usec = 0xffff;
1248 
1249  /* Release pool object and try to take another call */
1250  _SlDrvReleasePoolObj(ObjIdx);
1251 
1252  /* Use Obj to issue the command, if not available try later */
1253  ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&g_pCB->SocketTriggerSelect.Resp, SELECT_ID, SL_MAX_SOCKETS);
1254 
1255  if (MAX_CONCURRENT_ACTIONS == ObjIdx)
1256  {
1257  return SL_POOL_IS_EMPTY;
1258  }
1259 
1260  /* Save the pool index to be released only after the user read the response */
1261  g_pCB->SocketTriggerSelect.Info.ObjPoolIdx = ObjIdx;
1262 
1263  /* send the command */
1264  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSelectCmdCtrl, &Msg, NULL));
1265  return SL_ERROR_BSD_EAGAIN;
1266 
1267  }
1268  }
1269 #endif
1270 
1271  if( ((_i16)Msg.Rsp.status) >= 0 )
1272  {
1273  if( readsds )
1274  {
1275  readsds->fd_array[0] = AsyncRsp.ReadFds;
1276  }
1277  if( writesds )
1278  {
1279  writesds->fd_array[0] = AsyncRsp.WriteFds;
1280  }
1281  }
1282  }
1283 
1284  _SlDrvReleasePoolObj(ObjIdx);
1285  return (_i16)Msg.Rsp.status;
1286 }
void slcb_SocketTriggerEventHandler(SlSockTriggerEvent_t *pSlSockTriggerEvent)
Socket trigger routine. This routine will notify the application that a netwrok activity has been com...
_i16 sl_Send ( _i16  sd,
const void *  buf,
_i16  len,
_i16  flags 
)

Write data to TCP socket.

This 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 SL_SOCKET_TX_FAILED_EVENT is going to be received.
In case of a RAW socket (transceiver mode), extra 4 bytes should be reserved at the end of the frame data buffer for WLAN FCS

Parameters
[in]sdSocket handle
[in]bufPoints to a buffer containing the message to be sent
[in]lenMessage size in bytes. Range: 1-1460 bytes
[in]flagsSpecifies the type of message transmission. On this version, this parameter is not supported for TCP. For transceiver mode, the SL_WLAN_RAW_RF_TX_PARAMS macro can be used to determine transmission parameters (channel,rate,tx_power,preamble)
Returns
Zero on success, or negative error code on failure
See also
sl_SendTo
Note
Belongs to send_api
Warning
Example
  • Sending data:
    1 SlSockAddrIn_t Addr;
    2 _i16 AddrSize = sizeof(SlSockAddrIn_t);
    3 _i16 SockID;
    4 _i16 Status;
    5 _i8 Buf[SEND_BUF_LEN];
    6 
    7 Addr.sin_family = SL_AF_INET;
    8 Addr.sin_port = sl_Htons(5001);
    9 Addr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(10,1,1,200));
    10 
    11 SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
    12 Status = sl_Connect(SockID, (SlSockAddr_t *)&Addr, AddrSize);
    13 Status = sl_Send(SockID, Buf, 1460, 0 );

Definition at line 581 of file sl_socket.c.

582 {
583  _SlSendMsg_u Msg;
584  _SlCmdExt_t CmdExt;
585  _i16 RetVal;
586  _u32 tempVal;
587 
588  /* verify that this api is allowed. if not allowed then
589  ignore the API execution and return immediately with an error */
590  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
591 
592  _SlDrvResetCmdExt(&CmdExt);
593  CmdExt.TxPayload1Len = (_u16)Len;
594  CmdExt.pTxPayload1 = (_u8 *)pBuf;
595 
596  /* Only for RAW transceiver type socket, relay the flags parameter in the 2 bytes (4 byte aligned) before the actual payload */
597  if ((sd & SL_SOCKET_PAYLOAD_TYPE_MASK) == SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER)
598  {
599  tempVal = (_u32)flags;
600  CmdExt.pRxPayload = (_u8 *)&tempVal;
601  CmdExt.RxPayloadLen = -4; /* the (-) sign is used to mark the rx buff as output buff as well*/
602  }
603  else
604  {
605  CmdExt.pRxPayload = NULL;
606  if (Len < 1)
607  {
608  /* ignore */
609  return 0;
610  }
611  }
612 
613  Msg.Cmd.StatusOrLen = Len;
614  Msg.Cmd.Sd = (_u8)sd;
615  Msg.Cmd.FamilyAndFlags |= flags & 0x0F;
616 
617  RetVal = _SlDrvDataWriteOp((_u8)sd, (_SlCmdCtrl_t *)&_SlSendCmdCtrl, &Msg, &CmdExt);
618  if(SL_OS_RET_CODE_OK != RetVal)
619  {
620  return RetVal;
621  }
622 
623  return (_i16)Len;
624 }
_i16 sl_SendTo ( _i16  sd,
const void *  buf,
_i16  len,
_i16  flags,
const SlSockAddr_t to,
SlSocklen_t  tolen 
)

Write data to socket.

This function is used to transmit a message to another socket (connection less socket SOCK_DGRAM, SOCK_RAW).
Returns immediately after sending data to device.
In case of transmission failure an async event SL_SOCKET_TX_FAILED_EVENT is going to be received.

Parameters
[in]sdSocket handle
[in]bufPoints to a buffer containing the message to be sent
[in]lenmessage size in bytes. Range: 1-1460 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. On this version only AF_INET is supported.
- socket address, the length depends on the code format
[in]tolenDestination address structure size
Returns
Zero on success, or negative error code on failure
See also
sl_Send
Note
Belongs to send_api
Warning
Example
  • Sending data:
    1 SlSockAddrIn_t Addr;
    2 _i16 AddrSize = sizeof(SlSockAddrIn_t);
    3 _i16 SockID;
    4 _i16 Status;
    5 _i8 Buf[SEND_BUF_LEN];
    6 
    7 Addr.sin_family = SL_AF_INET;
    8 Addr.sin_port = sl_Htons(5001);
    9 Addr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(10,1,1,200));
    10 
    11 SockID = sl_Socket(SL_AF_INET,SL_SOCK_DGRAM, 0);
    12 Status = sl_SendTo(SockID, Buf, 1472, 0, (SlSockAddr_t *)&Addr, AddrSize);

Definition at line 270 of file sl_socket.c.

271 {
272  _SlSendtoMsg_u Msg;
273  _SlCmdCtrl_t CmdCtrl = {0, 0, 0};
274  _SlCmdExt_t CmdExt;
275  _i16 RetVal;
276 
277  /* verify that this api is allowed. if not allowed then
278  ignore the API execution and return immediately with an error */
279  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
280  /* RAW transceiver use only sl_Send */
281  if ((sd & SL_SOCKET_PAYLOAD_TYPE_MASK) == SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER)
282  {
283  return SL_ERROR_BSD_SOC_ERROR;
284  }
285  else
286  {
287  if (Len < 1)
288  {
289  /* ignore */
290  return 0;
291  }
292  }
293 
294  _SlDrvResetCmdExt(&CmdExt);
295  CmdExt.TxPayload1Len = (_u16)Len;
296  CmdExt.pTxPayload1 = (_u8 *)pBuf;
297 
298  switch(to->sa_family)
299  {
300  case SL_AF_INET:
301  CmdCtrl.Opcode = SL_OPCODE_SOCKET_SENDTO;
302  CmdCtrl.TxDescLen = (_SlArgSize_t)sizeof(SlSocketAddrIPv4Command_t);
303  break;
304 #ifndef SL_TINY
305 #ifdef SL_SUPPORT_IPV6
306  case SL_AF_INET6:
307  CmdCtrl.Opcode = SL_OPCODE_SOCKET_SENDTO_V6;
308  CmdCtrl.TxDescLen = (_SlArgSize_t)sizeof(SlSocketAddrIPv6Command_t);
309  break;
310 #endif
311 #endif
312  case SL_AF_RF:
313  default:
314  return SL_RET_CODE_INVALID_INPUT;
315  }
316 
317  Msg.Cmd.IpV4.LenOrPadding = Len;
318  Msg.Cmd.IpV4.Sd = (_u8)sd;
319  _SlSocketBuildAddress(to, &Msg.Cmd);
320  Msg.Cmd.IpV4.FamilyAndFlags |= flags & 0x0F;
321 
322  RetVal = _SlDrvDataWriteOp((_SlSd_t)sd, &CmdCtrl, &Msg, &CmdExt);
323  if(SL_OS_RET_CODE_OK != RetVal)
324  {
325  return RetVal;
326  }
327 
328  return (_i16)Len;
329 }
_i16 sl_SetSockOpt ( _i16  sd,
_i16  level,
_i16  optname,
const void *  optval,
SlSocklen_t  optlen 
)

Set socket options-.

This 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 proto- col 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 optval - ues for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.

Parameters
[in]sdSocket handle
[in]levelDefines the protocol level for this option
  • SL_SOL_SOCKET Socket level configurations (L4, transport layer)
  • SL_IPPROTO_IP IP level configurations (L3, network layer)
  • SL_SOL_PHY_OPT Link level configurations (L2, link layer)
[in]optnameDefines the option name to interrogate
  • SL_SOL_SOCKET
  • SL_SO_KEEPALIVE
    Enable/Disable periodic keep alive. Keeps TCP connections active by enabling the periodic transmission of messages
    Timeout is 5 minutes.
    Default: Enabled
    This options takes SlSockKeepalive_t struct as parameter
    • SL_SO_KEEPALIVETIME
      Set keep alive timeout. Value is in seconds
      Default: 5 minutes
    • SL_SO_RX_NO_IP_BOUNDARY
      Enable/Disable rx ip boundary. In connectionless socket (udp/raw), unread data is dropped (when recvfrom len parameter < data size), Enable this option in order to read the left data on the next recvfrom iteration Default: Disabled, IP boundary kept,
      This options takes SlSockRxNoIpBoundary_t struct as parameter
    • SL_SO_RCVTIMEO
      Sets the timeout value that specifies the maximum amount of time an input function waits until it completes.
      Default: No timeout
      This options takes SlTimeval_t struct as parameter
    • SL_SO_RCVBUF
      Sets tcp max recv window size.
      This options takes SlSockWinsize_t struct as parameter
    • SL_SO_NONBLOCKING
      Sets socket to non-blocking operation Impacts: connect, accept, send, sendto, recv and recvfrom.
      Default: Blocking. This options takes SlSockNonblocking_t struct as parameter
    • SL_SO_SECMETHOD
      Sets method to tcp secured socket (SL_SEC_SOCKET)
      Default: SL_SO_SEC_METHOD_SSLv3_TLSV1_2
      This options takes SlSockSecureMethod_t struct as parameter
    • SL_SO_SECURE_MASK
      Sets specific cipher to tcp secured socket (SL_SEC_SOCKET)
      Default: "Best" cipher suitable to method
      This options takes SlSockSecureMask_t struct as parameter
    • SL_SO_SECURE_FILES_CA_FILE_NAME
      Map secured socket to CA file by name
      This options takes _u8 buffer as parameter
    • SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME
      Map secured socket to private key by name
      This options takes _u8 buffer as parameter
    • SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME
      Map secured socket to certificate file by name
      This options takes _u8 buffer as parameter
    • SL_SO_SECURE_FILES_DH_KEY_FILE_NAME
      Map secured socket to Diffie Hellman file by name
      This options takes _u8 buffer as parameter
    • SL_SO_CHANGE_CHANNEL
      Sets channel in transceiver mode. This options takes _u32 as channel number parameter
    • SL_SO_SECURE_ALPN
      Sets the ALPN list. the parameter is a bit map consist of or of the following values - SL_SECURE_ALPN_H1 SL_SECURE_ALPN_H2 SL_SECURE_ALPN_H2C SL_SECURE_ALPN_H2_14 SL_SECURE_ALPN_H2_16 SL_SECURE_ALPN_FULL_LIST
  • SL_IPPROTO_IP
    • SL_IP_MULTICAST_TTL
      Set the time-to-live value of outgoing multicast packets for this socket.
      This options takes _u8 as parameter
    • SL_IP_ADD_MEMBERSHIP
      UDP socket, Join a multicast group.
      This options takes SlSockIpMreq_t struct as parameter
    • SL_IP_DROP_MEMBERSHIP
      UDP socket, Leave a multicast group
      This options takes SlSockIpMreq_t struct as parameter
    • SL_IP_RAW_RX_NO_HEADER
      Raw socket remove IP header from received data.
      Default: data includes ip header
      This options takes _u32 as parameter
    • SL_IP_HDRINCL
      RAW socket only, the IPv4 layer generates an IP header when sending a packet unless
      the IP_HDRINCL socket option is enabled on the socket.
      When it is enabled, the packet must contain an IP header.
      Default: disabled, IPv4 header generated by Network Stack
      This options takes _u32 as parameter
    • SL_IP_RAW_IPV6_HDRINCL (inactive)
      RAW socket only, the IPv6 layer generates an IP header when sending a packet unless
      the IP_HDRINCL socket option is enabled on the socket. When it is enabled, the packet must contain an IP header
      Default: disabled, IPv4 header generated by Network Stack
      This options takes _u32 as parameter
  • SL_SOL_PHY_OPT
    • SL_SO_PHY_RATE
      RAW socket, set WLAN PHY transmit rate
      The values are based on SlWlanRateIndex_e
      This options takes _u32 as parameter
    • SL_SO_PHY_TX_POWER
      RAW socket, set WLAN PHY TX power
      Valid rage is 1-15
      This options takes _u32 as parameter
    • SL_SO_PHY_NUM_FRAMES_TO_TX
      RAW socket, set number of frames to transmit in transceiver mode. Default: 1 packet This options takes _u32 as parameter
    • SL_SO_PHY_PREAMBLE
      RAW socket, set WLAN PHY preamble for Long/Short
      This options takes _u32 as parameter
    • SL_SO_PHY_TX_INHIBIT_THRESHOLD
      RAW socket, set WLAN Tx – Set CCA threshold.
      The values are based on SlTxInhibitThreshold_e
      This options takes _u32 as parameter
    • SL_SO_PHY_TX_TIMEOUT
      RAW socket, set WLAN Tx – changes the TX timeout (lifetime) of transceiver frames.
      Value in Ms, maximum value is 10ms
      This options takes _u32 as parameter
    • SL_SO_PHY_ALLOW_ACKS
      RAW socket, set WLAN Tx – Enable sending ACKs in transceiver mode
      0 = disabled / 1 = enabled
      This options takes _u32 as parameter
    • SL_SO_LINGER
      Socket lingers on close pending remaining send/receive packetst
    • SL_SO_SECURE_EXT_CLIENT_CHLNG_RESP
      Set with no parameter to indicate that the client uses external signature using netapp requesrt.
      needs netapp request handler
    • SL_SO_SECURE_DOMAIN_NAME_VERIFICATION
      Set a domain name, to check in ssl client connection.
[in]optvalSpecifies a value for the option
[in]optlenSpecifies the length of the option value
Returns
Zero on success, or negative error code on failure
Persistent
All params are Non- Persistent
See also
sl_getsockopt
Note
Belongs to basic_api
Warning
Examples
  • SL_SO_KEEPALIVE (disable Keepalive):
    1 SlSockKeepalive_t enableOption;
    2 enableOption.KeepaliveEnabled = 0;
    3 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_KEEPALIVE, (_u8 *)&enableOption,sizeof(enableOption));

  • SL_SO_KEEPALIVETIME (Set Keepalive timeout):
    1 _i16 Status;
    2 _u32 TimeOut = 120;
    3 sl_SetSockOpt(Sd, SL_SOL_SOCKET, SL_SO_KEEPALIVETIME,( _u8*) &TimeOut, sizeof(TimeOut));

  • SL_SO_RX_NO_IP_BOUNDARY (disable boundary):
    1 SlSockRxNoIpBoundary_t enableOption;
    2 enableOption.RxIpNoBoundaryEnabled = 1;
    3 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_RX_NO_IP_BOUNDARY, (_u8 *)&enableOption,sizeof(enableOption));

  • SL_SO_RCVTIMEO:
    1 struct SlTimeval_t timeVal;
    2 timeVal.tv_sec = 1; // Seconds
    3 timeVal.tv_usec = 0; // Microseconds. 10000 microseconds resolution
    4 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_RCVTIMEO, (_u8 *)&timeVal, sizeof(timeVal)); // Enable receive timeout

  • SL_SO_RCVBUF:
    1 SlSockWinsize_t size;
    2 size.Winsize = 3000; // bytes
    3 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_RCVBUF, (_u8 *)&size, sizeof(size));

  • SL_SO_NONBLOCKING:
    1 SlSockNonblocking_t enableOption;
    2 enableOption.NonblockingEnabled = 1;
    3 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_NONBLOCKING, (_u8 *)&enableOption,sizeof(enableOption)); // Enable/disable nonblocking mode

  • SL_SO_SECMETHOD:
    1 SlSockSecureMethod_t method;
    2 method.SecureMethod = SL_SO_SEC_METHOD_SSLV3; // security method we want to use
    3 SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, SL_SEC_SOCKET);
    4 sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_SECMETHOD, (_u8 *)&method, sizeof(method));

  • SL_SO_SECURE_MASK:
    1 SlSockSecureMask_t cipher;
    2 cipher.SecureMask = SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA; // cipher type
    3 SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, SL_SEC_SOCKET);
    4 sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_SECURE_MASK,(_u8 *)&cipher, sizeof(cipher));

  • SL_SO_SECURE_FILES_CA_FILE_NAME:
    1 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_CA_FILE_NAME,"exuifaxCaCert.der",strlen("exuifaxCaCert.der"));

  • SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME;
    1 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME,"myPrivateKey.der",strlen("myPrivateKey.der"));

  • SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME:
    1 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME,"myCertificate.der",strlen("myCertificate.der"));

  • SL_SO_SECURE_FILES_DH_KEY_FILE_NAME:
    1 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_DH_KEY_FILE_NAME,"myDHinServerMode.der",strlen("myDHinServerMode.der"));

  • SL_IP_MULTICAST_TTL:
    1 _u8 ttl = 20;
    2 sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_MULTICAST_TTL, &ttl, sizeof(ttl));

  • SL_IP_ADD_MEMBERSHIP:
    1 SlSockIpMreq_t mreq;
    2 sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));

  • SL_IP_DROP_MEMBERSHIP:
    1 SlSockIpMreq_t mreq;
    2 sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq));

  • SL_SO_CHANGE_CHANNEL:
    1 _u32 newChannel = 6; // range is 1-13
    2 sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_CHANGE_CHANNEL, &newChannel, sizeof(newChannel));

  • SL_SO_SECURE_ALPN:
    1 SlSockSecureALPN_t alpn;
    2 alpn.SecureALPN = SL_SECURE_ALPN_H2 | SL_SECURE_ALPN_H2_14;
    3 sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_SECURE_ALPN, &alpn, sizeof(SlSockSecureALPN_t));

  • SL_IP_RAW_RX_NO_HEADER:
    1 _u32 header = 1; // remove ip header
    2 sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_RAW_RX_NO_HEADER, &header, sizeof(header));

  • SL_IP_HDRINCL:
    1 _u32 header = 1;
    2 sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_HDRINCL, &header, sizeof(header));

  • SL_IP_RAW_IPV6_HDRINCL:
    1 _u32 header = 1;
    2 sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_RAW_IPV6_HDRINCL, &header, sizeof(header));

  • SL_SO_PHY_RATE:
    1 _u32 rate = 6; // see wlan.h SlWlanRateIndex_e for values
    2 sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_RATE, &rate, sizeof(rate));

  • SL_SO_PHY_TX_POWER:
    1 _u32 txpower = 1; // valid range is 1-15
    2 sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_TX_POWER, &txpower, sizeof(txpower));

  • SL_SO_PHY_NUM_FRAMES_TO_TX:
    1 _u32 numframes = 1;
    2 sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_NUM_FRAMES_TO_TX, &numframes, sizeof(numframes));

  • SL_SO_PHY_PREAMBLE:
    1 _u32 preamble = 1;
    2 sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_PREAMBLE, &preamble, sizeof(preamble));

  • SL_SO_PHY_TX_INHIBIT_THRESHOLD:
    1 _u32 thrshld = SL_TX_INHIBIT_THRESHOLD_MED;
    2 sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_TX_INHIBIT_THRESHOLD , &thrshld, sizeof(thrshld));

  • SL_SO_PHY_TX_TIMEOUT:
    1 _u32 timeout = 50;
    2 sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_TX_TIMEOUT , &timeout, sizeof(timeout));

  • SL_SO_PHY_ALLOW_ACKS:
    1 _u32 acks = 1; // 0 = disabled / 1 = enabled
    2 sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_ALLOW_ACKS, &acks, sizeof(acks));

  • SL_SO_LINGER:
    1 SlSocklinger_t linger;
    2 linger.l_onoff = 1;
    3 linger.l_linger = 10;
    4 sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_LINGER, &linger, sizeof(linger));

  • SL_SO_SECURE_EXT_CLIENT_CHLNG_RESP:
    1 int dummy;
    2 sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_SECURE_EXT_CLIENT_CHLNG_RESP, &dummy, sizeof(dummy));

  • SL_SO_SECURE_DOMAIN_NAME_VERIFICATION:
    1 sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_DOMAIN_NAME_VERIFICATION,"www.google.co.il",strlen("www.google.co.il"));

Definition at line 962 of file sl_socket.c.

963 {
964  _SlSetSockOptMsg_u Msg;
965  _SlCmdExt_t CmdExt;
966 
967  /* verify that this api is allowed. if not allowed then
968  ignore the API execution and return immediately with an error */
969  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
970 
971  _SlDrvResetCmdExt(&CmdExt);
972  CmdExt.TxPayload1Len = optlen;
973  CmdExt.pTxPayload1 = (_u8 *)optval;
974 
975  Msg.Cmd.Sd = (_u8)sd;
976  Msg.Cmd.Level = (_u8)level;
977  Msg.Cmd.OptionLen = (_u8)optlen;
978  Msg.Cmd.OptionName = (_u8)optname;
979 
980  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSetSockOptCmdCtrl, &Msg, &CmdExt));
981 
982  return (_i16)Msg.Rsp.StatusOrLen;
983 }
_i16 sl_Socket ( _i16  Domain,
_i16  Type,
_i16  Protocol 
)

Create an endpoint for communication.

The socket 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 handle.

Parameters
[in]DomainSpecifies the protocol family of the created socket. For example:
  • SL_AF_INET for network protocol IPv4
  • SL_AF_INET6 for network protocol IPv6
  • SL_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 communication semantic, one of:
  • SL_SOCK_STREAM (reliable stream-oriented service or Stream Sockets)
  • SL_SOCK_DGRAM (datagram service or Datagram Sockets)
  • SL_SOCK_RAW (raw protocols atop the network layer)
  • when used with AF_RF:
    • SL_SOCK_DGRAM - L2 socket
    • SL_SOCK_RAW - L1 socket - bypass WLAN CCA (Clear Channel Assessment)
[in]Protocolspecifies a particular transport to be used with the socket.
The most common are
  • SL_IPPROTO_TCP
  • SL_IPPROTO_UDP The value 0 may be used to select a default protocol from the selected domain and type
Returns
On success, socket handle that is used for consequent socket operations.
A successful return code should be a positive number (int16)
On error, a negative (int16) value will be returned specifying the error code.
  • SL_EAFNOSUPPORT - illegal domain parameter
  • SL_EPROTOTYPE - illegal type parameter
  • SL_EACCES - permission denied
  • SL_ENSOCK - exceeded maximal number of socket
  • SL_ENOMEM - memory allocation error
  • SL_EINVAL - error in socket configuration
  • SL_EPROTONOSUPPORT - illegal protocol parameter
  • SL_EOPNOTSUPP - illegal combination of protocol and type parameters
See also
sl_Close
Note
belongs to basic_api
Warning

Definition at line 118 of file sl_socket.c.

119 {
120  _SlSockSocketMsg_u Msg;
121 
122  Msg.Cmd.Domain = (_u8)Domain;
123  Msg.Cmd.Type = (_u8)Type;
124  Msg.Cmd.Protocol = (_u8)Protocol;
125 
126  /* verify that this api is allowed. if not allowed then
127  ignore the API execution and return immediately with an error */
128  VERIFY_API_ALLOWED(SL_OPCODE_SILO_SOCKET);
129 
130  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSockSocketCmdCtrl, &Msg, NULL));
131 
132  if( Msg.Rsp.StatusOrLen < 0 )
133  {
134  return ( Msg.Rsp.StatusOrLen);
135  }
136  else
137  {
138  return (_i16)((_u8)Msg.Rsp.Sd);
139  }
140 }

Data Structure Documentation

struct SlInAddr_t

Definition at line 200 of file sl_socket.h.

Data Fields
_u32 s_addr
union S_un S_un
union SlInAddr_t::S_un

Definition at line 205 of file sl_socket.h.

Data Fields
_u32 S_addr
struct S_un S_un_b
struct S_un S_un_w
struct SlInAddr_t::S_un.S_un_b

Definition at line 206 of file sl_socket.h.

Data Fields
_u8 s_b1
_u8 s_b2
_u8 s_b3
_u8 s_b4
struct SlInAddr_t::S_un.S_un_w

Definition at line 207 of file sl_socket.h.

Data Fields
_u8 s_w1
_u8 s_w2
struct SlIn6Addr_t

Definition at line 214 of file sl_socket.h.

Data Fields
union SlIn6Addr_t _S6_un
union SlIn6Addr_t._S6_un

Definition at line 216 of file sl_socket.h.

Data Fields
_u32 _S6_u32[4]
_u8 _S6_u8[16]
struct SlSockKeepalive_t

Definition at line 225 of file sl_socket.h.

Data Fields
_u32 KeepaliveEnabled
struct SlSockReuseaddr_t

Definition at line 230 of file sl_socket.h.

Data Fields
_u32 ReuseaddrEnabled
struct SlSockRxNoIpBoundary_t

Definition at line 235 of file sl_socket.h.

Data Fields
_i32 RxIpNoBoundaryEnabled
struct SlSockWinsize_t

Definition at line 241 of file sl_socket.h.

Data Fields
_u32 WinSize
struct SlSockNonblocking_t

Definition at line 246 of file sl_socket.h.

Data Fields
_u32 NonBlockingEnabled
struct SlSocketAsyncEvent_t

Definition at line 251 of file sl_socket.h.

Data Fields
_i8 pExtraInfo[128]
_u8 Sd
_u8 Type
_i16 Val
struct SlSockTxFailEventData_t

Definition at line 259 of file sl_socket.h.

Data Fields
_u8 Padding
_u8 Sd
_i16 Status
union SlSockEventData_u

Definition at line 267 of file sl_socket.h.

Data Fields
SlSocketAsyncEvent_t SockAsyncData
SlSockTxFailEventData_t SockTxFailData
struct SlSockEvent_t

Definition at line 274 of file sl_socket.h.

Data Fields
_u32 Event
SlSockEventData_u SocketAsyncEvent
struct SlSockTriggerEvent_t

Definition at line 280 of file sl_socket.h.

Data Fields
_u32 Event
_u32 EventData
struct SlSockSecureALPN_t

Definition at line 287 of file sl_socket.h.

Data Fields
_u32 SecureALPN
struct SlSockSecureMask_t

Definition at line 292 of file sl_socket.h.

Data Fields
_u32 SecureMask
struct SlSockSecureMethod_t

Definition at line 297 of file sl_socket.h.

Data Fields
_u8 SecureMethod
struct SlSockSSLCertInfo_t

Definition at line 302 of file sl_socket.h.

Data Fields
_i8 FromDate[8]
_i8 IssuerName[SL_MAX_ISSUER_AND_SUBJECT_NAME_LEN]
_i8 IssuerNameLen
_u16 IssuerNameXoredSha1
_i8 Padding[2]
_i8 SubjectName[SL_MAX_ISSUER_AND_SUBJECT_NAME_LEN]
_i8 SubjectNameLen
_u16 SubjectNameXoredSha1
_i8 ToDate[8]
struct SlSockSSLConnectionParams_t

Definition at line 316 of file sl_socket.h.

Data Fields
_u32 SecureALPNChosenProtocol
_u32 SecureCipherSuit
_u32 SecureIsPeerValidated
SlSockSSLCertInfo_t SecurePeerCertinfo
_u32 SecureVersion
struct SlSockIpMreq_t

Definition at line 339 of file sl_socket.h.

Data Fields
SlInAddr_t imr_interface
SlInAddr_t imr_multiaddr
struct SlSockIpV6Mreq_t

Definition at line 345 of file sl_socket.h.

Data Fields
_u32 ipv6mr_interface
SlIn6Addr_t ipv6mr_multiaddr
struct SlSocklinger_t

Definition at line 350 of file sl_socket.h.

Data Fields
_u32 l_linger
_u32 l_onoff
struct SlTimeval_t

Definition at line 360 of file sl_socket.h.

Data Fields
SlTime_t tv_sec
SlSuseconds_t tv_usec
struct SlSockAddr_t

Definition at line 369 of file sl_socket.h.

Data Fields
_u8 sa_data[14]
_u16 sa_family
struct SlSockAddrIn6_t

Definition at line 376 of file sl_socket.h.

Data Fields
SlIn6Addr_t sin6_addr
_u16 sin6_family
_u32 sin6_flowinfo
_u16 sin6_port
_u32 sin6_scope_id
struct SlSockAddrIn_t

Definition at line 387 of file sl_socket.h.

Data Fields
SlInAddr_t sin_addr
_u16 sin_family
_u16 sin_port
_i8 sin_zero[8]
struct SlSockSecureFiles_t

Definition at line 396 of file sl_socket.h.

Data Fields
_u8 SecureFiles[4]
struct SlFdSet_t

Definition at line 402 of file sl_socket.h.

Data Fields
_u32 fd_array[(SL_FD_SETSIZE+(_u8) 31)/(_u8) 32]
struct SlTransceiverRxOverHead_t

Definition at line 407 of file sl_socket.h.

Data Fields
_u8 Channel
_u8 Padding
_u8 Rate
_i8 Rssi
_u32 Timestamp