Deprecated fork of old network stack source from github. Please use official library instead: https://mbed.org/users/mbed_official/code/EthernetInterface/
Sockets BSD-Like API module. More...
Go to the source code of this file.
Functions | |
void | lwip_socket_init (void) |
Initialize this module. | |
static struct lwip_sock * | get_socket (int s) |
Map a externally used socket index to the internal socket representation. | |
static struct lwip_sock * | tryget_socket (int s) |
Same as get_socket but doesn't set errno. | |
static int | alloc_socket (struct netconn *newconn, int accepted) |
Allocate a new socket for a given netconn. | |
static void | free_socket (struct lwip_sock *sock, int is_tcp) |
Free a socket. | |
int | lwip_listen (int s, int backlog) |
Set a socket into listen mode. | |
int | lwip_sendto (int s, const void *data, size_t size, int flags, const struct sockaddr *to, socklen_t tolen) |
Variables | |
static struct lwip_sock | 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 volatile int | select_cb_ctr |
This counter is increased from lwip_select when the list is chagned and checked in event_callback to see if it has changed. | |
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 sockets.c.
Function Documentation
static int alloc_socket | ( | struct netconn * | newconn, |
int | accepted | ||
) | [static] |
static void free_socket | ( | struct lwip_sock * | sock, |
int | is_tcp | ||
) | [static] |
static struct lwip_sock* get_socket | ( | int | s ) | [static, read] |
int lwip_listen | ( | int | s, |
int | backlog | ||
) |
int lwip_sendto | ( | int | s, |
const void * | data, | ||
size_t | size, | ||
int | flags, | ||
const struct sockaddr * | to, | ||
socklen_t | tolen | ||
) |
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 writeset_in,: set of sockets to check for write events exceptset_in,: set of sockets to check for error events readset_out,: set of sockets that had read events writeset_out,: set of sockets that had write events exceptset_out,: set os sockets that had error events
- Returns:
- number of sockets that had events (read/write/exception) (>= 0)
Processing exceptset is not yet implemented.
Callback registered in the netconn layer for each socket-netconn. Processes recvevent (data available) and wakes up tasks waiting for select.
Unimplemented: Close one end of a full-duplex connection. Currently, the full connection is closed.
A minimal implementation of fcntl. Currently only the commands F_GETFL and F_SETFL are implemented. Only the flag O_NONBLOCK is implemented.
void lwip_socket_init | ( | void | ) |
static struct lwip_sock* tryget_socket | ( | int | s ) | [static, read] |
Variable Documentation
const int err_to_errno_table[] [static] |
{ 0, ENOMEM, ENOBUFS, EWOULDBLOCK, EHOSTUNREACH, EINPROGRESS, EINVAL, EWOULDBLOCK, EADDRINUSE, EALREADY, ECONNABORTED, ECONNRESET, ENOTCONN, ENOTCONN, EIO, -1, }
Table to quickly map an lwIP error (err_t) to a socket error by using -err as an index.
volatile int select_cb_ctr [static] |
struct lwip_select_cb* select_cb_list [static] |
Generated on Tue Jul 12 2022 23:10:20 by 1.7.2