A version of LWIP, provided for backwards compatibility.
Dependents: AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more
Sockets BSD-Like API module. More...
Go to the source code of this file.
Functions | |
static void | event_callback (struct netconn *conn, enum netconn_evt evt, u16_t len) |
Callback registered in the netconn layer for each socket-netconn. | |
void | lwip_socket_init (void) |
Initialize this module. | |
static struct lwip_socket * | get_socket (int s) |
Map a externally used socket index to the internal socket representation. | |
static int | alloc_socket (struct netconn *newconn) |
Allocate a new socket for a given netconn. | |
int | lwip_listen (int s, int backlog) |
Set a socket into listen mode. | |
static int | lwip_selscan (int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset) |
Go through the readset and writeset lists and see which socket of the sockets set in the sets has events. | |
int | lwip_select (int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, struct timeval *timeout) |
Processing exceptset is not yet implemented. | |
int | lwip_shutdown (int s, int how) |
Unimplemented: Close one end of a full-duplex connection. | |
Variables | |
static struct lwip_socket | sockets [NUM_SOCKETS] |
The global array of available sockets. | |
static struct lwip_select_cb * | select_cb_list |
The global list of tasks waiting for select. | |
static sys_sem_t | socksem |
Semaphore protecting the sockets array. | |
static sys_sem_t | selectsem |
Semaphore protecting select_cb_list. | |
static const int | err_to_errno_table [] |
Table to quickly map an lwIP error (err_t) to a socket error by using -err as an index. |
Detailed Description
Sockets BSD-Like API module.
Definition in file 0.5/lwIP/api/sockets.c.
Function Documentation
static int alloc_socket | ( | struct netconn * | newconn ) | [static] |
Allocate a new socket for a given netconn.
- Parameters:
-
newconn the netconn for which to allocate a socket
- Returns:
- the index of the new socket; -1 on error
Definition at line 214 of file 0.5/lwIP/api/sockets.c.
static void event_callback | ( | struct netconn * | conn, |
enum netconn_evt | evt, | ||
u16_t | len | ||
) | [static] |
Callback registered in the netconn layer for each socket-netconn.
Processes recvevent (data available) and wakes up tasks waiting for select.
Definition at line 995 of file 0.5/lwIP/api/sockets.c.
static struct lwip_socket* get_socket | ( | int | s ) | [static, read] |
Map a externally used socket index to the internal socket representation.
- Parameters:
-
s externally used socket index
- Returns:
- struct lwip_socket for the socket or NULL if not found
Definition at line 186 of file 0.5/lwIP/api/sockets.c.
int lwip_listen | ( | int | s, |
int | backlog | ||
) |
Set a socket into listen mode.
The socket may not have been used for another connection previously.
- Parameters:
-
s the socket to set to listening mode backlog (ATTENTION: need TCP_LISTEN_BACKLOG=1)
- Returns:
- 0 on success, non-zero on failure
Definition at line 429 of file 0.5/lwIP/api/sockets.c.
int lwip_select | ( | int | maxfdp1, |
fd_set * | readset, | ||
fd_set * | writeset, | ||
fd_set * | exceptset, | ||
struct timeval * | timeout | ||
) |
Processing exceptset is not yet implemented.
Definition at line 846 of file 0.5/lwIP/api/sockets.c.
static int lwip_selscan | ( | int | maxfdp1, |
fd_set * | readset, | ||
fd_set * | writeset, | ||
fd_set * | exceptset | ||
) | [static] |
Go through the readset and writeset lists and see which socket of the sockets set in the sets has events.
On return, readset, writeset and exceptset have the sockets enabled that had events.
exceptset is not used for now!!!
- Parameters:
-
maxfdp1 the highest socket index in the sets readset in: set of sockets to check for read events; out: set of sockets that had read events writeset in: set of sockets to check for write events; out: set of sockets that had write events exceptset not yet implemented
- Returns:
- number of sockets that had events (read+write)
Definition at line 802 of file 0.5/lwIP/api/sockets.c.
int lwip_shutdown | ( | int | s, |
int | how | ||
) |
Unimplemented: Close one end of a full-duplex connection.
Currently, the full connection is closed.
Definition at line 1088 of file 0.5/lwIP/api/sockets.c.
void lwip_socket_init | ( | void | ) |
Initialize this module.
This function has to be called before any other functions in this module!
Definition at line 173 of file 0.5/lwIP/api/sockets.c.
Variable Documentation
const int err_to_errno_table[] [static] |
{ 0, ENOMEM, ENOBUFS, EHOSTUNREACH, ECONNABORTED, ECONNRESET, ESHUTDOWN, ENOTCONN, EINVAL, EIO, EADDRINUSE, -1, -1, ETIMEDOUT, EINPROGRESS }
Table to quickly map an lwIP error (err_t) to a socket error by using -err as an index.
Definition at line 127 of file 0.5/lwIP/api/sockets.c.
struct lwip_select_cb* select_cb_list [static] |
The global list of tasks waiting for select.
Definition at line 118 of file 0.5/lwIP/api/sockets.c.
sys_sem_t selectsem [static] |
Semaphore protecting select_cb_list.
Definition at line 123 of file 0.5/lwIP/api/sockets.c.
struct lwip_socket sockets[NUM_SOCKETS] [static] |
The global array of available sockets.
Definition at line 116 of file 0.5/lwIP/api/sockets.c.
sys_sem_t socksem [static] |
Semaphore protecting the sockets array.
Definition at line 121 of file 0.5/lwIP/api/sockets.c.
Generated on Tue Jul 12 2022 16:06:30 by 1.7.2