SimpleLink CC31xx/CC32xx Host Driver
Version 3.0.1.71
Simplifies the implementation of Internet connectivity
|
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... | |
_i16 | sl_StartTLS (_i16 sd) |
Initiate TLS connection on a 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... | |
int32_t | slNetIfWifi_connEnable (void *ifContext) |
Create and maintains a wifi connection to the local network. More... | |
int16_t | slNetIfWifi_connDisable (void *ifContext) |
Gracefully close connection. More... | |
int16_t | SlNetIfWifi_socket (void *ifContext, int16_t Domain, int16_t Type, int16_t Protocol, void **sdContext) |
Create an endpoint for communication. More... | |
int32_t | SlNetIfWifi_close (int16_t sd, void *sdContext) |
Gracefully close socket. More... | |
int16_t | SlNetIfWifi_accept (int16_t sd, void *sdContext, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen, uint8_t flags, void **acceptedSdContext) |
Accept a connection on a socket. More... | |
int32_t | SlNetIfWifi_bind (int16_t sd, void *sdContext, const SlNetSock_Addr_t *addr, int16_t addrlen) |
Assign a name to a socket. More... | |
int32_t | SlNetIfWifi_listen (int16_t sd, void *sdContext, int16_t backlog) |
Listen for connections on a socket. More... | |
int32_t | SlNetIfWifi_connect (int16_t sd, void *sdContext, const SlNetSock_Addr_t *addr, SlNetSocklen_t addrlen, uint8_t flags) |
Initiate a connection on a socket. More... | |
int32_t | SlNetIfWifi_getSockName (int16_t sd, void *sdContext, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen) |
Get local address info by socket descriptor Returns the local address info of the socket descriptor. More... | |
int32_t | SlNetIfWifi_select (void *ifContext, int16_t nfds, SlNetSock_SdSet_t *readsds, SlNetSock_SdSet_t *writesds, SlNetSock_SdSet_t *exceptsds, SlNetSock_Timeval_t *timeout) |
Monitor socket activity. More... | |
int32_t | SlNetIfWifi_setSockOpt (int16_t sd, void *sdContext, int16_t level, int16_t optname, void *optval, SlNetSocklen_t optlen) |
Set socket options-. More... | |
int32_t | SlNetIfWifi_getSockOpt (int16_t sd, void *sdContext, int16_t level, int16_t optname, void *optval, SlNetSocklen_t *optlen) |
Get socket options. More... | |
int32_t | SlNetIfWifi_recv (int16_t sd, void *sdContext, void *buf, uint32_t len, uint32_t flags) |
Read data from TCP socket. More... | |
int32_t | SlNetIfWifi_recvFrom (int16_t sd, void *sdContext, void *buf, uint32_t len, uint32_t flags, SlNetSock_Addr_t *from, SlNetSocklen_t *fromlen) |
Read data from socket. More... | |
int32_t | SlNetIfWifi_send (int16_t sd, void *sdContext, const void *buf, uint32_t len, uint32_t flags) |
Write data to TCP socket. More... | |
int32_t | SlNetIfWifi_sendTo (int16_t sd, void *sdContext, const void *buf, uint32_t len, uint32_t flags, const SlNetSock_Addr_t *to, SlNetSocklen_t tolen) |
Write data to socket. More... | |
int32_t | SlNetIfWifi_sockstartSec (int16_t sd, void *sdContext, SlNetSockSecAttrib_t *secAttrib, uint8_t flags) |
Start a security session on an opened socket. More... | |
int32_t | SlNetIfWifi_getHostByName (void *ifContext, char *name, const uint16_t nameLen, uint32_t *ipAddr, uint16_t *ipAddrLen, const uint8_t family) |
Get host IP by name Obtain the IP Address of machine on network, by machine name. More... | |
uint32_t | SlNetIfWifi_ping (void *ifContext, const SlNetSock_Addr_t *addr, SlNetSocklen_t addrLen, uint32_t attempts, uint16_t timeout, uint16_t interval, uint16_t packetSize, int16_t flags) |
Performs a ping. More... | |
int32_t | SlNetIfWifi_getIPAddr (void *ifContext, SlNetIfAddressType_e addrType, uint16_t *addrConfig, uint32_t *ipAddr) |
Get IP Address of specific interface. More... | |
int32_t | SlNetIfWifi_getConnectionStatus (void *ifContext) |
Get interface connection status. More... | |
int32_t | SlNetIfWifi_loadSecObj (void *ifContext, uint16_t objType, char *objName, int16_t objNameLen, uint8_t *objBuff, int16_t objBuffLen) |
Load secured buffer to the network stack. More... | |
int32_t | SlNetIfWifi_CreateContext (uint16_t ifID, const char *ifName, void **ifContext, SlNetIf_Event_t ifCallback) |
Allocate and store interface data. Registers to interface event handlers. More... | |
int32_t | SlNetIfWifi_DeleteContext (uint16_t ifID, void **ifContext) |
Free allocations of interface data. Remove registration of interface event handlers. 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 |
Variables | |
SlNetIf_Config_t | SlNetIfConfigWifi |
Controls standard client/server sockets programming options and capabilities.
_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.
[in] | sd | Socket descriptor (handle) |
[out] | addr | The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address sockaddr: - code for the address format. - socket address, the length depends on the code format |
[out] | addrlen | The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr |
Definition at line 692 of file sl_socket.c.
_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.
[in] | sd | Socket descriptor (handle) |
[in] | addr | Specifies the destination addrs sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | addrlen | Contains the size of the structure pointed to by addr |
Definition at line 237 of file sl_socket.c.
_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.
[in] | sd | Socket handle (received in sl_Socket) |
Definition at line 176 of file sl_socket.c.
_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.
[in] | sd | Socket descriptor (handle) |
[in] | addr | Specifies the destination addr sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | addrlen | Contains the size of the structure pointed to by addr |
Definition at line 449 of file sl_socket.c.
_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 protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP;
The parameters optval and optlen are used to access optvalues 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.
[in] | sd | Socket handle |
[in] | level | Defines the protocol level for this option |
[in] | optname | defines the option name to interrogate |
[out] | optval | Specifies a value for the option |
[out] | optlen | Specifies the length of the option value |
Definition at line 975 of file sl_socket.c.
_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.
[in] | val | Variable to reorder |
Definition at line 806 of file sl_socket.c.
_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.
[in] | val | Variable to reorder |
Definition at line 827 of file sl_socket.c.
_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.
[in] | sd | Socket descriptor (handle) |
[in] | backlog | Specifies the listen queue depth. |
Definition at line 658 of file sl_socket.c.
_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
[in] | sd | Socket handle |
[out] | buf | Points to the buffer where the message should be stored. |
[in] | len | Specifies the length in bytes of the buffer pointed to by the buffer argument. Range: 1-16000 bytes |
[in] | flags | Specifies the type of message reception. On this version, this parameter is not supported. |
Definition at line 881 of file sl_socket.c.
_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
[in] | sd | Socket handle |
[out] | buf | Points to the buffer where the message should be stored. |
[in] | len | Specifies the length in bytes of the buffer pointed to by the buffer argument. Range: 1-16000 bytes |
[in] | flags | Specifies the type of message reception. On this version, this parameter is not supported. |
[in] | from | Pointer to an address structure indicating the source address. sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | fromlen | Source address structure size. This parameter MUST be set to the size of the structure pointed to by addr. |
Definition at line 360 of file sl_socket.c.
_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 was retrieved in the first triggered call. To enable the trigger mode, an handler must be statically registered as slcb_SocketTriggerEventHandler in user.h
[in] | nfds | The highest-numbered file descriptor in any of the three sets, plus 1. |
[out] | readsds | Socket descriptors list for read monitoring and accept monitoring |
[out] | writesds | Socket descriptors list for connect monitoring only, write monitoring is not supported |
[out] | exceptsds | Socket descriptors list for exception monitoring, not supported. |
[in] | timeout | Is 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. |
Several threads can call sl_Select at the same time.Calling this API while the same command is called from another thread, may result in one of the following scenarios:
In case all the user sockets are open, sl_Select will exhibit the behavior mentioned in (2) This is due to the fact sl_select supports multiple callers by utilizing one user socket internally. User who wish to ensure multiple select calls at any given time, must reserve one socket out of the 16 given.
Definition at line 1762 of file sl_socket.c.
_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
[in] | sd | Socket handle |
[in] | buf | Points to a buffer containing the message to be sent |
[in] | len | Message size in bytes. |
[in] | flags | Specifies the type of message transmission. On this version, this parameter is not supported for TCP. For transceiver mode, the SL_WLAN_RAW_RF_TX_PARAMS macro can be used to determine transmission parameters (channel,rate,tx_power,preamble) -rate need to be define using slSockTransceiverTXRateTable_e |
Definition at line 594 of file sl_socket.c.
_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.
[in] | sd | Socket handle |
[in] | buf | Points to a buffer containing the message to be sent |
[in] | len | message size in bytes. |
[in] | flags | Specifies the type of message transmission. On this version, this parameter is not supported |
[in] | to | Pointer to an address structure indicating the destination address. sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | tolen | Destination address structure size |
Definition at line 283 of file sl_socket.c.
_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.
[in] | sd | Socket handle |
[in] | level | Defines the protocol level for this option
|
[in] | optname | Defines the option name to interrogate
|
[in] | optval | Specifies a value for the option |
[in] | optlen | Specifies the length of the option value |
Definition at line 932 of file sl_socket.c.
_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.
[in] | Domain | Specifies the protocol family of the created socket. For example:
|
[in] | Type | specifies the communication semantic, one of:
|
[in] | Protocol | specifies a particular transport to be used with the socket. The most common are
|
Definition at line 133 of file sl_socket.c.
_i16 sl_StartTLS | ( | _i16 | sd | ) |
Initiate TLS connection on a socket.
Function Initiate TLS connection on the socket referred to by the socket descriptor sd. This function will works on blocking mode until the TLS handshake success or fails.
[in] | sd | Socket descriptor (handle) |
Definition at line 1972 of file sl_socket.c.
int16_t SlNetIfWifi_accept | ( | int16_t | sd, |
void * | sdContext, | ||
SlNetSock_Addr_t * | addr, | ||
SlNetSocklen_t * | addrlen, | ||
uint8_t | flags, | ||
void ** | acceptedSdContext | ||
) |
Accept a connection on a socket.
The SlNetIfWifi_accept function is used with connection-based socket types (SOCK_STREAM).
It extracts the first connection request on the queue of pending connections, creates a new connected socket, and returns a new file descriptor referring to that socket.
The newly created socket is not in the listening state. The original socket sd is unaffected by this call.
The argument sd is a socket that has been created with SlNetIfWifi_socket(), bound to a local address with SlNetIfWifi_bind(), and is listening for connections after a SlNetIfWifi_listen().
The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer.
The exact format of the address returned addr is determined by the socket's address family.
The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr, on return it will contain the actual length (in bytes) of the address returned.
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[out] | addr | The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address sockaddr: - code for the address format. - socket address, the length depends on the code format |
[out] | addrlen | The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr |
[in] | flags | Specifies socket descriptor flags. The available flags are:
|
[in] | acceptedSdContext | Allocate and store data for the new socket if needed in other to use it in other slnetwifi socket functions |
Definition at line 186 of file slnetifwifi.c.
int32_t SlNetIfWifi_bind | ( | int16_t | sd, |
void * | sdContext, | ||
const SlNetSock_Addr_t * | addr, | ||
int16_t | addrlen | ||
) |
Assign a name to a socket.
This SlNetIfWifi_bind function gives the socket the local address addr. addr is addrlen bytes long.
Traditionally, this is called When a socket is created with socket, it exists in a name space (address family) but has no name assigned.
It is necessary to assign a local address before a SOCK_STREAM socket may receive connections.
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[in] | addr | Specifies the destination addrs sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | addrlen | Contains the size of the structure pointed to by addr |
Definition at line 197 of file slnetifwifi.c.
int32_t SlNetIfWifi_close | ( | int16_t | sd, |
void * | sdContext | ||
) |
Gracefully close socket.
The SlNetIfWifi_close function causes the system to release resources allocated to a socket.
In case of TCP, the connection is terminated.
[in] | sd | Socket descriptor (handle), received in SlNetIfWifi_socket |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
Definition at line 174 of file slnetifwifi.c.
int16_t slNetIfWifi_connDisable | ( | void * | ifContext | ) |
Gracefully close connection.
The slNetIfWifi_disconnect function close wifi connection by.
This function is called by the connection manager library layer to obtain disconnect.
Definition at line 147 of file slnetifwifi.c.
int32_t SlNetIfWifi_connect | ( | int16_t | sd, |
void * | sdContext, | ||
const SlNetSock_Addr_t * | addr, | ||
SlNetSocklen_t | addrlen, | ||
uint8_t | flags | ||
) |
Initiate a connection on a socket.
Function connects the socket referred to by the socket descriptor sd, to the address specified by addr.
The addrlen argument specifies the size of addr.
The format of the address in addr is determined by the address space of the socket.
If it is of type SLNETSOCK_SOCK_DGRAM, this call specifies the peer with which the socket is to be associated; this address is that to which datagrams are to be sent, and the only address from which datagrams are to be received.
If the socket is of type SLNETSOCK_SOCK_STREAM, this call attempts to make a connection to another socket.
The other socket is specified by address, which is an address in the communications space of the socket.
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[in] | addr | Specifies the destination addr sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | addrlen | Contains the size of the structure pointed to by addr |
[in] | flags | Specifies socket descriptor flags. The available flags are:
|
Definition at line 219 of file slnetifwifi.c.
int32_t slNetIfWifi_connEnable | ( | void * | ifContext | ) |
Create and maintains a wifi connection to the local network.
The slNetIfWifi_enabelIf function creates wifi connection by provisioning process.
This function is called by the connection manager library layer to obtain connection.
[in] | connContext | Allocate and store connection data if needed for using in other slnetwifi connection functions |
Definition at line 133 of file slnetifwifi.c.
int32_t SlNetIfWifi_CreateContext | ( | uint16_t | ifID, |
const char * | ifName, | ||
void ** | ifContext, | ||
SlNetIf_Event_t | ifCallback | ||
) |
Allocate and store interface data. Registers to interface event handlers.
The SlNetIfWifi_CreateContext function stores interface related data.
[in] | ifID | Specifies the interface which its configuration needs to be retrieved. The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h |
[in] | ifName | Specifies the interface which its interface identifier needs to be retrieved. |
[in] | ifContext | Specifies the interface data if needed. |
[in] | ifCallback | Specifies the interface callback function. |
Definition at line 694 of file slnetifwifi.c.
int32_t SlNetIfWifi_DeleteContext | ( | uint16_t | ifID, |
void ** | ifContext | ||
) |
Free allocations of interface data. Remove registration of interface event handlers.
[in] | ifID | Specifies the interface which its configuration needs to be remove. The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h |
[in] | ifContext | Specifies the interface data which needs to be remove. |
Definition at line 710 of file slnetifwifi.c.
int32_t SlNetIfWifi_getConnectionStatus | ( | void * | ifContext | ) |
Get interface connection status.
The SlNetIfWifi_getConnectionStatus function gets the connection status of the interface (connected Or disconnected).
[in] | ifContext | Stores interface data if CreateContext function supported and implemented. Can be used in all SlNetIf_Config_t functions |
Definition at line 603 of file slnetifwifi.c.
int32_t SlNetIfWifi_getHostByName | ( | void * | ifContext, |
char * | name, | ||
const uint16_t | nameLen, | ||
uint32_t * | ipAddr, | ||
uint16_t * | ipAddrLen, | ||
const uint8_t | family | ||
) |
Get host IP by name
Obtain the IP Address of machine on network, by machine name.
[in] | ifContext | Stores interface data if CreateContext function supported and implemented. Can be used in all SlNetIf_Config_t functions |
[in] | ifBitmap | Specifies the interfaces which the host ip needs to be retrieved from (according to the priority until one of them will return an answer). The values of the interface identifiers is defined with the prefix SLNETIF_ID_ which defined in slnetif.h |
[in] | name | Host name |
[in] | nameLen | Name length |
[out] | ipAddr | This parameter is filled in with host IP addresses. In case that host name is not resolved, out_ip_addr is zero. |
[in,out] | ipAddrLen | Holds the size of the ipAddr array, when function successful, the ipAddrLen parameter will be updated with the number of the IP addresses found. |
[in] | family | Protocol family |
Definition at line 444 of file slnetifwifi.c.
int32_t SlNetIfWifi_getIPAddr | ( | void * | ifContext, |
SlNetIfAddressType_e | addrType, | ||
uint16_t * | addrConfig, | ||
uint32_t * | ipAddr | ||
) |
Get IP Address of specific interface.
The SlNetIfWifi_getIPAddr function retrieve the IP address of a specific interface according to the Address Type, IPv4, IPv6 LOCAL or IPv6 GLOBAL.
[in] | ifContext | Stores interface data if CreateContext function supported and implemented. Can be used in all SlNetIf_Config_t functions |
[in] | ifID | Specifies the interface which its connection state needs to be retrieved. The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h |
[in] | addrType | Address type:
|
[out] | addrConfig | Address config:
|
[out] | ipAddr | IP Address according to the Address Type |
Definition at line 572 of file slnetifwifi.c.
int32_t SlNetIfWifi_getSockName | ( | int16_t | sd, |
void * | sdContext, | ||
SlNetSock_Addr_t * | addr, | ||
SlNetSocklen_t * | addrlen | ||
) |
Get local address info by socket descriptor
Returns the local address info of the socket descriptor.
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[out] | addr | The argument addr is a pointer to a SlNetSock_Addr_t structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address SlNetSock_Addr_t: - code for the address format. - socket address, the length depends on the code format |
[out] | addrlen | The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr |
Definition at line 231 of file slnetifwifi.c.
int32_t SlNetIfWifi_getSockOpt | ( | int16_t | sd, |
void * | sdContext, | ||
int16_t | level, | ||
int16_t | optname, | ||
void * | optval, | ||
SlNetSocklen_t * | optlen | ||
) |
Get socket options.
The SlNetIfWifi_getSockOpt function gets the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level.
The parameters optval and optlen identify a buffer in which the value for the requested option(s) are to be returned. optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[in] | level | Defines the protocol level for this option |
[in] | optname | defines the option name to interrogate |
[out] | optval | Specifies a value for the option |
[out] | optlen | Specifies the length of the option value |
Definition at line 301 of file slnetifwifi.c.
int32_t SlNetIfWifi_listen | ( | int16_t | sd, |
void * | sdContext, | ||
int16_t | backlog | ||
) |
Listen for connections on a socket.
The willingness to accept incoming connections and a queue limit for incoming connections are specified with SlNetIfWifi_listen(), and then the connections are accepted with SlNetIfWifi_accept().
The SlNetIfWifi_listen() call applies only to sockets of type SOCK_STREAM The backlog parameter defines the maximum length the queue of pending connections may grow to.
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[in] | backlog | Specifies the listen queue depth. |
Definition at line 208 of file slnetifwifi.c.
int32_t SlNetIfWifi_loadSecObj | ( | void * | ifContext, |
uint16_t | objType, | ||
char * | objName, | ||
int16_t | objNameLen, | ||
uint8_t * | objBuff, | ||
int16_t | objBuffLen | ||
) |
Load secured buffer to the network stack.
The SlNetSock_secLoadObj function loads buffer/files into the inputted network stack for future usage of the socket SSL/TLS connection. This option is relevant for network stacks with file system and also for network stacks that lack file system that can store the secured files.
[in] | ifContext | Stores interface data if CreateContext function supported and implemented. Can be used in all SlNetIf_Config_t functions |
[in] | objType | Specifies the security object type which could be one of the following:
|
[in] | objName | Specifies the name/input identifier of the secured buffer loaded for file systems - this can be the file name for plain text buffer loading this can be the name of the object |
[in] | objNameLen | Specifies the buffer name length to be loaded. |
[in] | objBuff | Specifies the pointer to the secured buffer to be loaded. |
[in] | objBuffLen | Specifies the buffer length to be loaded. |
Definition at line 630 of file slnetifwifi.c.
uint32_t SlNetIfWifi_ping | ( | void * | ifContext, |
const SlNetSock_Addr_t * | addr, | ||
SlNetSocklen_t | addrLen, | ||
uint32_t | attempts, | ||
uint16_t | timeout, | ||
uint16_t | interval, | ||
uint16_t | packetSize, | ||
int16_t | flags | ||
) |
Performs a ping.
This functions is used to perform a ping request and check its response.
[in] | ifContext | Stores interface data if CreateContext function supported and implemented. Can be used in all SlNetIf_Config_t functions |
[in] | addr | Specifies the destination addrs sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | addrLen | Contains the size of the structure pointed to by addr. |
[in] | attempts | Specifies the number of ping request attempts. |
[in] | timeout | Specifies the timeout to wait for a ping response |
[in] | interval | Specifies the interval between subsequent ping attempts |
[in] | packetSize | Ping packet size in bytes including ICMP header, therefore must be greater than 8 |
[in] | flags | Reserved |
Definition at line 467 of file slnetifwifi.c.
int32_t SlNetIfWifi_recv | ( | int16_t | sd, |
void * | sdContext, | ||
void * | buf, | ||
uint32_t | len, | ||
uint32_t | flags | ||
) |
Read data from TCP socket.
The SlNetIfWifi_recv function receives a message from a connection-mode socket
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[out] | buf | Points to the buffer where the message should be stored. |
[in] | len | Specifies the length in bytes of the buffer pointed to by the buffer argument. Range: 1-16000 bytes |
[in] | flags | Upper 8 bits specifies the security flags Lower 24 bits specifies the type of message reception. On this version, the lower 24 bits are not supported |
Definition at line 358 of file slnetifwifi.c.
int32_t SlNetIfWifi_recvFrom | ( | int16_t | sd, |
void * | sdContext, | ||
void * | buf, | ||
uint32_t | len, | ||
uint32_t | flags, | ||
SlNetSock_Addr_t * | from, | ||
SlNetSocklen_t * | fromlen | ||
) |
Read data from socket.
SlNetIfWifi_recvFrom function receives a message from a connection-mode or connectionless-mode socket
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[out] | buf | Points to the buffer where the message should be stored. |
[in] | len | Specifies the length in bytes of the buffer pointed to by the buffer argument. Range: 1-16000 bytes |
[in] | flags | Upper 8 bits specifies the security flags Lower 24 bits specifies the type of message reception. On this version, the lower 24 bits are not supported |
[in] | from | Pointer to an address structure indicating the source address. sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | fromlen | Source address structure size. This parameter MUST be set to the size of the structure pointed to by addr. |
Definition at line 370 of file slnetifwifi.c.
int32_t SlNetIfWifi_select | ( | void * | ifContext, |
int16_t | nfds, | ||
SlNetSock_SdSet_t * | readsds, | ||
SlNetSock_SdSet_t * | writesds, | ||
SlNetSock_SdSet_t * | exceptsds, | ||
SlNetSock_Timeval_t * | timeout | ||
) |
Monitor socket activity.
SlNetIfWifi_send allow a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become "ready" for some class of I/O operation. If trigger mode is enabled the active sdset is the one that retrieved in the first triggered call. To enable the trigger mode, an handler must be statically registered to the slcb_SocketTriggerEventHandler (user.h)
[in] | ifContext | Stores interface data if CreateContext function supported and implemented. Can be used in all SlNetIf_Config_t functions |
[in] | nsds | The highest-numbered file descriptor in any of the three sets, plus 1. |
[in,out] | readsds | Socket descriptors list for read monitoring and accept monitoring |
[in,out] | writesds | Socket descriptors list for connect monitoring only, write monitoring is not supported |
[in,out] | exceptsds | Socket descriptors list for exception monitoring, not supported. |
[in] | timeout | Is an upper bound on the amount of time elapsed before SlNetIfWifi_send() returns. Null or above 0xffff seconds means infinity timeout. The minimum timeout is 10 milliseconds, less than 10 milliseconds will be set automatically to 10 milliseconds. Max microseconds supported is 0xfffc00. In trigger mode the timeout fields must be set to zero. |
Definition at line 243 of file slnetifwifi.c.
int32_t SlNetIfWifi_send | ( | int16_t | sd, |
void * | sdContext, | ||
const void * | buf, | ||
uint32_t | len, | ||
uint32_t | flags | ||
) |
Write data to TCP socket.
The SlNetIfWifi_send function is used to transmit a message to another socket. Returns immediately after sending data to device. In case of TCP failure an async event SLNETSOCK_SOCKET_TX_FAILED_EVENT is going to be received.
In case of a RAW socket (transceiver mode), extra 4 bytes should be reserved at the end of the frame data buffer for WLAN FCS
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[in] | buf | Points to a buffer containing the message to be sent |
[in] | len | Message size in bytes. Range: 1-1460 bytes |
[in] | flags | Upper 8 bits specifies the security flags Lower 24 bits specifies the type of message reception. On this version, the lower 24 bits are not supported for TCP. For transceiver mode, the SLNETSOCK_WLAN_RAW_RF_TX_PARAMS macro can be used to determine transmission parameters (channel,rate,tx_power,preamble) |
Definition at line 382 of file slnetifwifi.c.
int32_t SlNetIfWifi_sendTo | ( | int16_t | sd, |
void * | sdContext, | ||
const void * | buf, | ||
uint32_t | len, | ||
uint32_t | flags, | ||
const SlNetSock_Addr_t * | to, | ||
SlNetSocklen_t | tolen | ||
) |
Write data to socket.
The SlNetIfWifi_sendTo function is used to transmit a message on a connectionless socket (connection less socket SLNETSOCK_SOCK_DGRAM, SLNETSOCK_SOCK_RAW).
Returns immediately after sending data to device.
In case of transmission failure an async event SLNETSOCK_SOCKET_TX_FAILED_EVENT is going to be received.
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[in] | buf | Points to a buffer containing the message to be sent |
[in] | len | message size in bytes. Range: 1-1460 bytes |
[in] | flags | Upper 8 bits specifies the security flags Lower 24 bits specifies the type of message reception. On this version, the lower 24 bits are not supported |
[in] | to | Pointer to an address structure indicating the destination address. sockaddr: - code for the address format. - socket address, the length depends on the code format |
[in] | tolen | Destination address structure size |
Definition at line 394 of file slnetifwifi.c.
int32_t SlNetIfWifi_setSockOpt | ( | int16_t | sd, |
void * | sdContext, | ||
int16_t | level, | ||
int16_t | optname, | ||
void * | optval, | ||
SlNetSocklen_t | optlen | ||
) |
Set socket options-.
The SlNetIfWifi_setSockOpt function manipulate the options associated with a socket.
Options may exist at multiple protocol levels; they are always present at the uppermost socket level.
When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP;
The parameters optval and optlen are used to access opt_values for SlNetIfWifi_setSockOpt(). For SlNetIfWifi_getSockOpt() they identify a buffer in which the value for the requested option(s) are to be returned. For SlNetIfWifi_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.
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[in] | level | Defines the protocol level for this option
|
[in] | optname | Defines the option name to interrogate
|
[in] | optval | Specifies a value for the option |
[in] | optlen | Specifies the length of the option value |
Definition at line 260 of file slnetifwifi.c.
int16_t SlNetIfWifi_socket | ( | void * | ifContext, |
int16_t | Domain, | ||
int16_t | Type, | ||
int16_t | Protocol, | ||
void ** | sdContext | ||
) |
Create an endpoint for communication.
The SlNetIfWifi_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 descriptor (handle).
[in] | ifContext | Stores interface data if CreateContext function supported and implemented. |
[in] | domain | Specifies the protocol family of the created socket. For example:
|
[in] | type | Specifies the socket type, which determines the semantics of communication over the socket. The socket types supported by the system are implementation-dependent. Possible socket types include:
|
[in] | protocol | Specifies a particular transport to be used with the socket. The most common are
|
[in] | sdContext | Allocate and store socket data if needed for using in other slnetwifi socket functions |
Definition at line 161 of file slnetifwifi.c.
int32_t SlNetIfWifi_sockstartSec | ( | int16_t | sd, |
void * | sdContext, | ||
SlNetSockSecAttrib_t * | secAttrib, | ||
uint8_t | flags | ||
) |
Start a security session on an opened socket.
The SlNetIfWifi_sockstartSec function is used start a security session on an opened socket. If the security handle is NULL the session would be started with the default security settings.
[in] | sd | Socket descriptor (handle) |
[in] | sdContext | May store socket data if implemented in the SlNetIfWifi_socket function. |
[in] | secAttrib | Secure attribute handle |
[in] | flags | Specifies flags. The available flags are:
|
Definition at line 406 of file slnetifwifi.c.
struct SlInAddr_t |
Definition at line 224 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | s_addr | |
union S_un | S_un |
struct SlIn6Addr_t |
Definition at line 238 of file sl_socket.h.
Data Fields | ||
---|---|---|
union SlIn6Addr_t | _S6_un |
union SlIn6Addr_t._S6_un |
Definition at line 240 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | _S6_u32[4] | |
_u8 | _S6_u8[16] |
struct SlSockKeepalive_t |
Definition at line 249 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | KeepaliveEnabled |
struct SlSockReuseaddr_t |
Definition at line 254 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | ReuseaddrEnabled |
struct SlSockRxNoIpBoundary_t |
Definition at line 259 of file sl_socket.h.
Data Fields | ||
---|---|---|
_i32 | RxIpNoBoundaryEnabled |
struct SlSockWinsize_t |
Definition at line 264 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | WinSize |
struct SlSockNonblocking_t |
Definition at line 269 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | NonBlockingEnabled |
struct SlSocketAsyncEvent_t |
Definition at line 274 of file sl_socket.h.
Data Fields | ||
---|---|---|
_i8 | pExtraInfo[128] | |
_u8 | Sd | |
_u8 | Type | |
_i16 | Val |
struct SlSockTxFailEventData_t |
Definition at line 282 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u8 | Padding | |
_u8 | Sd | |
_i16 | Status |
union SlSockEventData_u |
Definition at line 290 of file sl_socket.h.
Data Fields | ||
---|---|---|
SlSocketAsyncEvent_t | SockAsyncData | |
SlSockTxFailEventData_t | SockTxFailData |
struct SlSockEvent_t |
Definition at line 297 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | Event | |
SlSockEventData_u | SocketAsyncEvent |
struct SlSockTriggerEvent_t |
Definition at line 303 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | Event | |
_u32 | EventData |
struct SlSockSecureALPN_t |
Definition at line 310 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | SecureALPN |
struct SlSockSecureMask_t |
Definition at line 315 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | SecureMask |
struct SlSockSecureMethod_t |
Definition at line 320 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u8 | SecureMethod |
struct SlSockSSLCertInfo_t |
Definition at line 325 of file sl_socket.h.
struct SlSockSSLConnectionParams_t |
Definition at line 339 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | SecureALPNChosenProtocol | |
_u32 | SecureCipherSuit | |
_u32 | SecureIsPeerValidated | |
SlSockSSLCertInfo_t | SecurePeerCertinfo | |
_u32 | SecureVersion |
struct SlRxMetrics_TLV_t |
Definition at line 355 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u16 | length | |
_u16 | type |
struct SlSockIpMreq_t |
Definition at line 422 of file sl_socket.h.
Data Fields | ||
---|---|---|
SlInAddr_t | imr_interface | |
SlInAddr_t | imr_multiaddr |
struct SlSockIpV6Mreq_t |
Definition at line 428 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | ipv6mr_interface | |
SlIn6Addr_t | ipv6mr_multiaddr |
struct SlSocklinger_t |
Definition at line 433 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | l_linger | |
_u32 | l_onoff |
struct SlTimeval_t |
Definition at line 443 of file sl_socket.h.
Data Fields | ||
---|---|---|
SlTime_t | tv_sec | |
SlSuseconds_t | tv_usec |
struct SlSockAddr_t |
Definition at line 452 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u8 | sa_data[14] | |
_u16 | sa_family |
struct SlSockAddrIn6_t |
Definition at line 458 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 469 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 477 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u8 | SecureFiles[4] |
struct SlFdSet_t |
Definition at line 482 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | fd_array[(SL_FD_SETSIZE+(_u8) 31)/(_u8) 32] |
struct SlTransceiverRxOverHead_t |
Definition at line 487 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u8 | Channel | |
_u8 | Padding | |
_u8 | Rate | |
_i8 | Rssi | |
_u32 | Timestamp |
struct SlRxMetricsEnableDisableRXOnBSS_t |
Definition at line 496 of file sl_socket.h.
Data Fields | ||
---|---|---|
_u32 | enableDisable |
SlNetIf_Config_t SlNetIfConfigWifi |
SlNetIfConfigWifi structure contains all the function callbacks that are expected to be filled by the relevant network stack interface Each interface has different capabilities, so not all the API's must be supported. Interface that is not supporting a non-mandatory API are set to NULL
Definition at line 68 of file slnetifwifi.c.