Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
lwip_api_lib.c File Reference
Sequential API External module. More...
Go to the source code of this file.
Functions | |
struct netconn * | netconn_new_with_proto_and_callback (enum netconn_type t, u8_t proto, netconn_callback callback) |
Create a new netconn (of a specific type) that has a callback function. | |
err_t | netconn_delete (struct netconn *conn) |
Close a netconn 'connection' and free its resources. | |
err_t | netconn_getaddr (struct netconn *conn, ip_addr_t *addr, u16_t *port, u8_t local) |
Get the local or remote IP address and port of a netconn. | |
err_t | netconn_bind (struct netconn *conn, ip_addr_t *addr, u16_t port) |
Bind a netconn to a specific local IP address and port. | |
err_t | netconn_connect (struct netconn *conn, ip_addr_t *addr, u16_t port) |
Connect a netconn to a specific remote IP address and port. | |
err_t | netconn_disconnect (struct netconn *conn) |
Disconnect a netconn from its current peer (only valid for UDP netconns). | |
err_t | netconn_listen_with_backlog (struct netconn *conn, u8_t backlog) |
Set a TCP netconn into listen mode. | |
err_t | netconn_accept (struct netconn *conn, struct netconn **new_conn) |
Accept a new connection on a TCP listening netconn. | |
static err_t | netconn_recv_data (struct netconn *conn, void **new_buf) |
Receive data: actual implementation that doesn't care whether pbuf or netbuf is received. | |
err_t | netconn_recv_tcp_pbuf (struct netconn *conn, struct pbuf **new_buf) |
Receive data (in form of a pbuf) from a TCP netconn. | |
err_t | netconn_recv (struct netconn *conn, struct netbuf **new_buf) |
Receive data (in form of a netbuf containing a packet buffer) from a netconn. | |
void | netconn_recved (struct netconn *conn, u32_t length) |
TCP: update the receive window: by calling this, the application tells the stack that it has processed data and is able to accept new data. | |
err_t | netconn_sendto (struct netconn *conn, struct netbuf *buf, ip_addr_t *addr, u16_t port) |
Send data (in form of a netbuf) to a specific remote IP address and port. | |
err_t | netconn_send (struct netconn *conn, struct netbuf *buf) |
Send data over a UDP or RAW netconn (that is already connected). | |
err_t | netconn_write (struct netconn *conn, const void *dataptr, size_t size, u8_t apiflags) |
Send data over a TCP netconn. | |
static err_t | netconn_close_shutdown (struct netconn *conn, u8_t how) |
Close ot shutdown a TCP netconn (doesn't delete it). | |
err_t | netconn_close (struct netconn *conn) |
Close a TCP netconn (doesn't delete it). | |
err_t | netconn_shutdown (struct netconn *conn, u8_t shut_rx, u8_t shut_tx) |
Shut down one or both sides of a TCP netconn (doesn't delete it). | |
err_t | netconn_join_leave_group (struct netconn *conn, ip_addr_t *multiaddr, ip_addr_t *netif_addr, enum netconn_igmp join_or_leave) |
Join multicast groups for UDP netconns. | |
err_t | netconn_gethostbyname (const char *name, ip_addr_t *addr) |
Execute a DNS query, only one IP address is returned. |
Detailed Description
Sequential API External module.
Definition in file lwip_api_lib.c.
Function Documentation
Accept a new connection on a TCP listening netconn.
- Parameters:
-
conn the TCP listen netconn new_conn pointer where the new connection is stored
- Returns:
- ERR_OK if a new connection has been received or an error code otherwise
Definition at line 277 of file lwip_api_lib.c.
err_t netconn_bind | ( | struct netconn * | conn, |
ip_addr_t * | addr, | ||
u16_t | port | ||
) |
Bind a netconn to a specific local IP address and port.
Binding one netconn twice might not always be checked correctly!
- Parameters:
-
conn the netconn to bind addr the local IP address to bind the netconn to (use IP_ADDR_ANY to bind to all addresses) port the local port to bind the netconn to (not used for RAW)
- Returns:
- ERR_OK if bound, any other err_t on failure
Definition at line 166 of file lwip_api_lib.c.
err_t netconn_close | ( | struct netconn * | conn ) |
Close a TCP netconn (doesn't delete it).
- Parameters:
-
conn the TCP netconn to close
- Returns:
- ERR_OK if the netconn was closed, any other err_t on error
Definition at line 649 of file lwip_api_lib.c.
static err_t netconn_close_shutdown | ( | struct netconn * | conn, |
u8_t | how | ||
) | [static] |
Close ot shutdown a TCP netconn (doesn't delete it).
- Parameters:
-
conn the TCP netconn to close or shutdown how fully close or only shutdown one side?
- Returns:
- ERR_OK if the netconn was closed, any other err_t on error
Definition at line 623 of file lwip_api_lib.c.
err_t netconn_connect | ( | struct netconn * | conn, |
ip_addr_t * | addr, | ||
u16_t | port | ||
) |
Connect a netconn to a specific remote IP address and port.
- Parameters:
-
conn the netconn to connect addr the remote IP address to connect to port the remote port to connect to (no used for RAW)
- Returns:
- ERR_OK if connected, return value of tcp_/udp_/raw_connect otherwise
Definition at line 192 of file lwip_api_lib.c.
err_t netconn_delete | ( | struct netconn * | conn ) |
Close a netconn 'connection' and free its resources.
UDP and RAW connection are completely closed, TCP pcbs might still be in a waitstate after this returns.
- Parameters:
-
conn the netconn to delete
- Returns:
- ERR_OK if the connection was deleted
Definition at line 103 of file lwip_api_lib.c.
err_t netconn_disconnect | ( | struct netconn * | conn ) |
Disconnect a netconn from its current peer (only valid for UDP netconns).
- Parameters:
-
conn the netconn to disconnect
- Returns:
- TODO: return value is not set here...
Definition at line 217 of file lwip_api_lib.c.
err_t netconn_getaddr | ( | struct netconn * | conn, |
ip_addr_t * | addr, | ||
u16_t * | port, | ||
u8_t | local | ||
) |
Get the local or remote IP address and port of a netconn.
For RAW netconns, this returns the protocol instead of a port!
- Parameters:
-
conn the netconn to query addr a pointer to which to save the IP address port a pointer to which to save the port (or protocol for RAW) local 1 to get the local IP address, 0 to get the remote one
- Returns:
- ERR_CONN for invalid connections ERR_OK if the information was retrieved
Definition at line 135 of file lwip_api_lib.c.
err_t netconn_gethostbyname | ( | const char * | name, |
ip_addr_t * | addr | ||
) |
Execute a DNS query, only one IP address is returned.
- Parameters:
-
name a string representation of the DNS host name to query addr a preallocated ip_addr_t where to store the resolved IP address
- Returns:
- ERR_OK: resolving succeeded ERR_MEM: memory error, try again later ERR_ARG: dns client not initialized or invalid hostname ERR_VAL: dns server response was invalid
Definition at line 713 of file lwip_api_lib.c.
err_t netconn_join_leave_group | ( | struct netconn * | conn, |
ip_addr_t * | multiaddr, | ||
ip_addr_t * | netif_addr, | ||
enum netconn_igmp | join_or_leave | ||
) |
Join multicast groups for UDP netconns.
- Parameters:
-
conn the UDP netconn for which to change multicast addresses multiaddr IP address of the multicast group to join or leave netif_addr the IP address of the network interface on which to send the igmp message join_or_leave flag whether to send a join- or leave-message
- Returns:
- ERR_OK if the action was taken, any err_t on error
Definition at line 679 of file lwip_api_lib.c.
err_t netconn_listen_with_backlog | ( | struct netconn * | conn, |
u8_t | backlog | ||
) |
Set a TCP netconn into listen mode.
- Parameters:
-
conn the tcp netconn to set to listen mode backlog the listen backlog, only used if TCP_LISTEN_BACKLOG==1
- Returns:
- ERR_OK if the netconn was set to listen (UDP and RAW netconns don't return any error (yet?))
Definition at line 241 of file lwip_api_lib.c.
struct netconn* netconn_new_with_proto_and_callback | ( | enum netconn_type | t, |
u8_t | proto, | ||
netconn_callback | callback | ||
) | [read] |
Create a new netconn (of a specific type) that has a callback function.
The corresponding pcb is also created.
- Parameters:
-
t the type of 'connection' to create (
- See also:
- enum netconn_type)
- Parameters:
-
proto the IP protocol for RAW IP pcbs callback a function to call on status changes (RX available, TX'ed)
- Returns:
- a newly allocated struct netconn or NULL on memory error
Definition at line 68 of file lwip_api_lib.c.
err_t netconn_recv | ( | struct netconn * | conn, |
struct netbuf ** | new_buf | ||
) |
Receive data (in form of a netbuf containing a packet buffer) from a netconn.
- Parameters:
-
conn the netconn from which to receive data new_buf pointer where a new netbuf is stored when received data
- Returns:
- ERR_OK if data has been received, an error code otherwise (timeout, memory error or another error)
Definition at line 451 of file lwip_api_lib.c.
static err_t netconn_recv_data | ( | struct netconn * | conn, |
void ** | new_buf | ||
) | [static] |
Receive data: actual implementation that doesn't care whether pbuf or netbuf is received.
- Parameters:
-
conn the netconn from which to receive data new_buf pointer where a new pbuf/netbuf is stored when received data
- Returns:
- ERR_OK if data has been received, an error code otherwise (timeout, memory error or another error)
Definition at line 342 of file lwip_api_lib.c.
err_t netconn_recv_tcp_pbuf | ( | struct netconn * | conn, |
struct pbuf ** | new_buf | ||
) |
Receive data (in form of a pbuf) from a TCP netconn.
- Parameters:
-
conn the netconn from which to receive data new_buf pointer where a new pbuf is stored when received data
- Returns:
- ERR_OK if data has been received, an error code otherwise (timeout, memory error or another error) ERR_ARG if conn is not a TCP netconn
Definition at line 434 of file lwip_api_lib.c.
void netconn_recved | ( | struct netconn * | conn, |
u32_t | length | ||
) |
TCP: update the receive window: by calling this, the application tells the stack that it has processed data and is able to accept new data.
ATTENTION: use with care, this is mainly used for sockets! Can only be used when calling netconn_set_noautorecved(conn, 1) before.
- Parameters:
-
conn the netconn for which to update the receive window length amount of data processed (ATTENTION: this must be accurate!)
Definition at line 508 of file lwip_api_lib.c.
err_t netconn_send | ( | struct netconn * | conn, |
struct netbuf * | buf | ||
) |
Send data over a UDP or RAW netconn (that is already connected).
- Parameters:
-
conn the UDP or RAW netconn over which to send data buf a netbuf containing the data to send
- Returns:
- ERR_OK if data was sent, any other err_t on error
Definition at line 558 of file lwip_api_lib.c.
err_t netconn_sendto | ( | struct netconn * | conn, |
struct netbuf * | buf, | ||
ip_addr_t * | addr, | ||
u16_t | port | ||
) |
Send data (in form of a netbuf) to a specific remote IP address and port.
Only to be used for UDP and RAW netconns (not TCP).
- Parameters:
-
conn the netconn over which to send data buf a netbuf containing the data to send addr the remote IP address to which to send the data port the remote port to which to send the data
- Returns:
- ERR_OK if data was sent, any other err_t on error
Definition at line 540 of file lwip_api_lib.c.
err_t netconn_shutdown | ( | struct netconn * | conn, |
u8_t | shut_rx, | ||
u8_t | shut_tx | ||
) |
Shut down one or both sides of a TCP netconn (doesn't delete it).
- Parameters:
-
conn the TCP netconn to shut down
- Returns:
- ERR_OK if the netconn was closed, any other err_t on error
Definition at line 662 of file lwip_api_lib.c.
err_t netconn_write | ( | struct netconn * | conn, |
const void * | dataptr, | ||
size_t | size, | ||
u8_t | apiflags | ||
) |
Send data over a TCP netconn.
- Parameters:
-
conn the TCP netconn over which to send data dataptr pointer to the application buffer that contains the data to send size size of the application data to send apiflags combination of following flags : - NETCONN_COPY: data will be copied into memory belonging to the stack
- NETCONN_MORE: for TCP connection, PSH flag will be set on last segment sent
- NETCONN_DONTBLOCK: only write the data if all dat can be written at once
- Returns:
- ERR_OK if data was sent, any other err_t on error
Definition at line 588 of file lwip_api_lib.c.
Generated on Tue Jul 12 2022 12:29:01 by
