#include "lwip/opt.h"
#include <stddef.h>
#include "lwip/netbuf.h"
#include "lwip/sys.h"
#include "lwip/ip_addr.h"
#include "lwip/err.h"
Data Structures | |
struct | netconn |
A netconn descriptor. More... | |
Macros | |
#define | API_EVENT(c, e, l) |
Register an Network connection event. More... | |
#define | LWIP_NETCONN_SCOPE |
#define | netconn_addr(c, i, p) netconn_getaddr(c,i,p,1) |
#define | netconn_bind_ip6(conn, ip6addr, port) |
#define | netconn_connect_ip6(conn, ip6addr, port) |
#define | NETCONN_COPY 0x01 |
#define | NETCONN_DONTBLOCK 0x04 |
#define | netconn_err(conn) ((conn)->last_err) |
#define | NETCONN_FLAG_CHECK_WRITESPACE 0x10 |
If a nonblocking write has been rejected before, poll_tcp needs to check if the netconn is writable again. More... | |
#define | NETCONN_FLAG_IN_NONBLOCKING_CONNECT 0x04 |
Was the last connect action a non-blocking one? More... | |
#define | NETCONN_FLAG_IPV6_V6ONLY 0x20 |
If this flag is set then only IPv6 communication is allowed on the netconn. More... | |
#define | NETCONN_FLAG_NO_AUTO_RECVED 0x08 |
If this is set, a TCP netconn must call netconn_recved() to update the TCP receive window (done automatically if not set). More... | |
#define | NETCONN_FLAG_NON_BLOCKING 0x02 |
Should this netconn avoid blocking? More... | |
#define | NETCONN_FLAG_WRITE_DELAYED 0x01 |
TCP: when data passed to netconn_write doesn't fit into the send buffer, this temporarily stores whether to wake up the original application task if data couldn't be sent in the first try. More... | |
#define | netconn_get_noautorecved(conn) (((conn)->flags & NETCONN_FLAG_NO_AUTO_RECVED) != 0) |
TCP: Get the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) More... | |
#define | netconn_get_recvtimeout(conn) ((conn)->recv_timeout) |
Get the receive timeout in milliseconds. More... | |
#define | netconn_is_nonblocking(conn) (((conn)->flags & NETCONN_FLAG_NON_BLOCKING) != 0) |
Get the blocking status of netconn calls (. More... | |
#define | netconn_join_leave_group_ip6(conn, multiaddr, srcaddr, join_or_leave) |
#define | netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG) |
#define | NETCONN_MORE 0x02 |
#define | netconn_new(t) netconn_new_with_proto_and_callback(t, 0, NULL) |
#define | netconn_new_with_callback(t, c) netconn_new_with_proto_and_callback(t, 0, c) |
#define | NETCONN_NOCOPY 0x00 /* Only for source code compatibility */ |
#define | NETCONN_NOFLAG 0x00 |
#define | netconn_peer(c, i, p) netconn_getaddr(c,i,p,0) |
#define | netconn_recv_bufsize(conn) ((conn)->recv_bufsize) |
#define | netconn_sendto_ip6(conn, buf, ip6addr, port) |
#define | netconn_set_noautorecved(conn, val) |
TCP: Set the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) More... | |
#define | netconn_set_nonblocking(conn, val) |
Set the blocking status of netconn calls (. More... | |
#define | netconn_set_recvtimeout(conn, timeout) ((conn)->recv_timeout = (timeout)) |
Set the receive timeout in milliseconds. More... | |
#define | NETCONN_SET_SAFE_ERR(conn, err) |
Set conn->last_err to err but don't overwrite fatal errors. More... | |
#define | netconn_thread_cleanup() |
#define | netconn_thread_init() |
#define | netconn_type(conn) (conn->type) |
Get the type of a netconn (as enum netconn_type). More... | |
#define | NETCONN_TYPE_IPV6 0x08 |
#define | netconn_write(conn, dataptr, size, apiflags) netconn_write_partly(conn, dataptr, size, apiflags, NULL) |
#define | NETCONNTYPE_DATAGRAM(t) ((t)&0xE0) |
#define | NETCONNTYPE_GROUP(t) ((t)&0xF0) |
#define | NETCONNTYPE_ISIPV6(t) ((t)&0x08) |
#define | NETCONNTYPE_ISUDPLITE(t) (((t)&0xF7) == NETCONN_UDPLITE) |
#define | NETCONNTYPE_ISUDPNOCHKSUM(t) (((t)&0xF7) == NETCONN_UDPNOCHKSUM) |
Typedefs | |
typedef void(* | netconn_callback )(struct netconn *, enum netconn_evt, u16_t len) |
A callback prototype to inform about events for a netconn. More... | |
Enumerations | |
enum | netconn_evt { NETCONN_EVT_RCVPLUS, NETCONN_EVT_RCVMINUS, NETCONN_EVT_SENDPLUS, NETCONN_EVT_SENDMINUS, NETCONN_EVT_ERROR } |
Use to inform the callback function about changes. More... | |
enum | netconn_igmp { NETCONN_JOIN, NETCONN_LEAVE } |
Used for netconn_join_leave_group() More... | |
enum | netconn_state { NETCONN_NONE, NETCONN_WRITE, NETCONN_LISTEN, NETCONN_CONNECT, NETCONN_CLOSE } |
Current state of the netconn. More... | |
enum | netconn_type { NETCONN_INVALID = 0, NETCONN_TCP = 0x10, NETCONN_TCP_IPV6 = NETCONN_TCP | NETCONN_TYPE_IPV6, NETCONN_UDP = 0x20, NETCONN_UDPLITE = 0x21, NETCONN_UDPNOCHKSUM = 0x22, NETCONN_UDP_IPV6 = NETCONN_UDP | NETCONN_TYPE_IPV6, NETCONN_UDPLITE_IPV6 = NETCONN_UDPLITE | NETCONN_TYPE_IPV6, NETCONN_UDPNOCHKSUM_IPV6 = NETCONN_UDPNOCHKSUM | NETCONN_TYPE_IPV6, NETCONN_RAW = 0x40, NETCONN_RAW_IPV6 = NETCONN_RAW | NETCONN_TYPE_IPV6 } |
Protocol family and type of the netconn. More... | |
Functions | |
LWIP_NETCONN_SCOPE err_t | netconn_accept (struct netconn *conn, struct netconn **new_conn) |
Accept a new connection on a TCP listening netconn. More... | |
LWIP_NETCONN_SCOPE 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. More... | |
LWIP_NETCONN_SCOPE err_t | netconn_close (struct netconn *conn) |
Close a TCP netconn (doesn't delete it). More... | |
LWIP_NETCONN_SCOPE 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. More... | |
LWIP_NETCONN_SCOPE err_t | netconn_delete (struct netconn *conn) |
Close a netconn 'connection' and free its resources. More... | |
LWIP_NETCONN_SCOPE err_t | netconn_disconnect (struct netconn *conn) |
Disconnect a netconn from its current peer (only valid for UDP netconns). More... | |
LWIP_NETCONN_SCOPE 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. More... | |
err_t | netconn_gethostbyname (const char *name, ip_addr_t *addr) |
Execute a DNS query, only one IP address is returned. More... | |
LWIP_NETCONN_SCOPE 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. More... | |
LWIP_NETCONN_SCOPE err_t | netconn_listen_with_backlog (struct netconn *conn, u8_t backlog) |
Set a TCP netconn into listen mode. More... | |
LWIP_NETCONN_SCOPE 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. More... | |
LWIP_NETCONN_SCOPE 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. More... | |
LWIP_NETCONN_SCOPE err_t | netconn_recv_tcp_pbuf (struct netconn *conn, struct pbuf **new_buf) |
Receive data (in form of a pbuf) from a TCP netconn. More... | |
LWIP_NETCONN_SCOPE 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. More... | |
LWIP_NETCONN_SCOPE err_t | netconn_send (struct netconn *conn, struct netbuf *buf) |
Send data over a UDP or RAW netconn (that is already connected). More... | |
LWIP_NETCONN_SCOPE 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. More... | |
LWIP_NETCONN_SCOPE 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). More... | |
LWIP_NETCONN_SCOPE err_t | netconn_write_partly (struct netconn *conn, const void *dataptr, size_t size, u8_t apiflags, size_t *bytes_written) |
Send data over a TCP netconn. More... | |
#define API_EVENT | ( | c, | |
e, | |||
l | |||
) |
Register an Network connection event.
Referenced by accept_function(), err_tcp(), lwip_netconn_do_close_internal(), lwip_netconn_do_connected(), lwip_netconn_do_delconn(), lwip_netconn_do_writemore(), netconn_accept(), netconn_recv_data(), poll_tcp(), recv_raw(), recv_tcp(), recv_udp(), and sent_tcp().
#define LWIP_NETCONN_SCOPE |
#define netconn_addr | ( | c, | |
i, | |||
p | |||
) | netconn_getaddr(c,i,p,1) |
#define netconn_bind_ip6 | ( | conn, | |
ip6addr, | |||
port | |||
) |
#define netconn_connect_ip6 | ( | conn, | |
ip6addr, | |||
port | |||
) |
#define NETCONN_COPY 0x01 |
Referenced by iperf_tcp_client_task(), and lwip_send().
#define NETCONN_DONTBLOCK 0x04 |
Referenced by lwip_netconn_do_writemore(), lwip_send(), and netconn_write_partly().
#define netconn_err | ( | conn | ) | ((conn)->last_err) |
#define NETCONN_FLAG_CHECK_WRITESPACE 0x10 |
If a nonblocking write has been rejected before, poll_tcp needs to check if the netconn is writable again.
Referenced by lwip_netconn_do_writemore(), poll_tcp(), and sent_tcp().
#define NETCONN_FLAG_IN_NONBLOCKING_CONNECT 0x04 |
Was the last connect action a non-blocking one?
#define NETCONN_FLAG_IPV6_V6ONLY 0x20 |
If this flag is set then only IPv6 communication is allowed on the netconn.
As per RFC#3493 this features defaults to OFF allowing dual-stack usage by default.
Referenced by lwip_getsockopt_impl(), lwip_netconn_do_listen(), and lwip_setsockopt_impl().
#define NETCONN_FLAG_NO_AUTO_RECVED 0x08 |
If this is set, a TCP netconn must call netconn_recved() to update the TCP receive window (done automatically if not set).
#define NETCONN_FLAG_NON_BLOCKING 0x02 |
Should this netconn avoid blocking?
#define NETCONN_FLAG_WRITE_DELAYED 0x01 |
TCP: when data passed to netconn_write doesn't fit into the send buffer, this temporarily stores whether to wake up the original application task if data couldn't be sent in the first try.
Referenced by lwip_netconn_do_write(), and lwip_netconn_do_writemore().
#define netconn_get_noautorecved | ( | conn | ) | (((conn)->flags & NETCONN_FLAG_NO_AUTO_RECVED) != 0) |
TCP: Get the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED)
Referenced by netconn_recv_data(), and netconn_recved().
#define netconn_get_recvtimeout | ( | conn | ) | ((conn)->recv_timeout) |
Get the receive timeout in milliseconds.
Referenced by lwip_getsockopt_impl().
#define netconn_is_nonblocking | ( | conn | ) | (((conn)->flags & NETCONN_FLAG_NON_BLOCKING) != 0) |
Get the blocking status of netconn calls (.
Referenced by lwip_accept(), lwip_fcntl(), lwip_netconn_do_connect(), lwip_netconn_do_writemore(), lwip_recvfrom(), and netconn_write_partly().
#define netconn_join_leave_group_ip6 | ( | conn, | |
multiaddr, | |||
srcaddr, | |||
join_or_leave | |||
) |
#define netconn_listen | ( | conn | ) | netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG) |
Referenced by iperf_tcp_task().
#define NETCONN_MORE 0x02 |
Referenced by lwip_send().
#define netconn_new | ( | t | ) | netconn_new_with_proto_and_callback(t, 0, NULL) |
Referenced by iperf_tcp_client_task(), iperf_tcp_send(), iperf_tcp_task(), and iperf_udp_task().
#define netconn_new_with_callback | ( | t, | |
c | |||
) | netconn_new_with_proto_and_callback(t, 0, c) |
Referenced by lwip_socket().
#define NETCONN_NOCOPY 0x00 /* Only for source code compatibility */ |
Referenced by iperf_tcp_client_task(), and iperf_tcp_send().
#define NETCONN_NOFLAG 0x00 |
#define netconn_peer | ( | c, | |
i, | |||
p | |||
) | netconn_getaddr(c,i,p,0) |
Referenced by lwip_accept().
#define netconn_recv_bufsize | ( | conn | ) | ((conn)->recv_bufsize) |
#define netconn_sendto_ip6 | ( | conn, | |
buf, | |||
ip6addr, | |||
port | |||
) |
#define netconn_set_noautorecved | ( | conn, | |
val | |||
) |
TCP: Set the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED)
Referenced by lwip_accept(), and lwip_socket().
#define netconn_set_nonblocking | ( | conn, | |
val | |||
) |
Set the blocking status of netconn calls (.
Referenced by lwip_fcntl(), and lwip_ioctl().
Set the receive timeout in milliseconds.
Referenced by lwip_setsockopt_impl().
#define NETCONN_SET_SAFE_ERR | ( | conn, | |
err | |||
) |
Set conn->last_err to err but don't overwrite fatal errors.
Referenced by lwip_netconn_do_connected(), netconn_accept(), netconn_bind(), netconn_close_shutdown(), netconn_connect(), netconn_disconnect(), netconn_getaddr(), netconn_join_leave_group(), netconn_listen_with_backlog(), netconn_recv(), netconn_recv_data(), netconn_send(), netconn_write_partly(), and recv_tcp().
#define netconn_thread_cleanup | ( | ) |
#define netconn_thread_init | ( | ) |
#define netconn_type | ( | conn | ) | (conn->type) |
Get the type of a netconn (as enum netconn_type).
#define NETCONN_TYPE_IPV6 0x08 |
#define netconn_write | ( | conn, | |
dataptr, | |||
size, | |||
apiflags | |||
) | netconn_write_partly(conn, dataptr, size, apiflags, NULL) |
Referenced by iperf_tcp_client_task(), and iperf_tcp_send().
#define NETCONNTYPE_DATAGRAM | ( | t | ) | ((t)&0xE0) |
#define NETCONNTYPE_GROUP | ( | t | ) | ((t)&0xF0) |
Referenced by alloc_socket(), lwip_accept(), lwip_close(), lwip_getsockopt_impl(), lwip_ioctl(), lwip_listen(), lwip_netconn_do_bind(), lwip_netconn_do_close(), lwip_netconn_do_close_internal(), lwip_netconn_do_connect(), lwip_netconn_do_connected(), lwip_netconn_do_delconn(), lwip_netconn_do_disconnect(), lwip_netconn_do_getaddr(), lwip_netconn_do_join_leave_group(), lwip_netconn_do_listen(), lwip_netconn_do_recv(), lwip_netconn_do_send(), lwip_netconn_do_write(), lwip_recvfrom(), lwip_send(), lwip_sendto(), lwip_shutdown(), netconn_alloc(), netconn_connect(), netconn_drain(), netconn_recv(), netconn_recv_data(), netconn_recv_tcp_pbuf(), netconn_recved(), netconn_write_partly(), and pcb_new().
#define NETCONNTYPE_ISIPV6 | ( | t | ) | ((t)&0x08) |
Referenced by lwip_accept(), lwip_getaddrname(), lwip_recvfrom(), lwip_sendto(), and pcb_new().
#define NETCONNTYPE_ISUDPLITE | ( | t | ) | (((t)&0xF7) == NETCONN_UDPLITE) |
Referenced by lwip_getsockopt_impl(), lwip_setsockopt_impl(), and pcb_new().
#define NETCONNTYPE_ISUDPNOCHKSUM | ( | t | ) | (((t)&0xF7) == NETCONN_UDPNOCHKSUM) |
Referenced by pcb_new().
typedef void(* netconn_callback)(struct netconn *, enum netconn_evt, u16_t len) |
A callback prototype to inform about events for a netconn.
enum netconn_evt |
enum netconn_igmp |
Used for netconn_join_leave_group()
Enumerator | |
---|---|
NETCONN_JOIN | |
NETCONN_LEAVE |
enum netconn_state |
enum netconn_type |
LWIP_NETCONN_SCOPE err_t netconn_accept | ( | struct netconn * | conn, |
struct netconn ** | new_conn | ||
) |
Accept a new connection on a TCP listening netconn.
conn | the TCP listen netconn |
new_conn | pointer where the new connection is stored |
References netconn::acceptmbox, API_EVENT, API_MSG_VAR_ALLOC_DONTFAIL, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_ABRT, ERR_ARG, ERR_IS_FATAL, ERR_OK, ERR_TIMEOUT, netconn::last_err, LWIP_ERROR(), lwip_netconn_do_recv(), NETCONN_EVT_RCVMINUS, NETCONN_SET_SAFE_ERR, NULL, netconn::recv_timeout, sys_arch_mbox_fetch(), SYS_ARCH_TIMEOUT, sys_mbox_valid(), and TCPIP_APIMSG_NOERR.
Referenced by iperf_tcp_task(), and lwip_accept().
LWIP_NETCONN_SCOPE 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!
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) |
References API_MSG_VAR_ALLOC, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_ARG, IP_ADDR_ANY, LWIP_ERROR(), lwip_netconn_do_bind(), NETCONN_SET_SAFE_ERR, NULL, and TCPIP_APIMSG.
Referenced by iperf_tcp_client_task(), iperf_tcp_send(), iperf_tcp_task(), iperf_udp_task(), and lwip_bind().
LWIP_NETCONN_SCOPE err_t netconn_close | ( | struct netconn * | conn | ) |
Close a TCP netconn (doesn't delete it).
conn | the TCP netconn to close |
References netconn_close_shutdown(), and NETCONN_SHUT_RDWR.
Referenced by iperf_tcp_client_task(), and iperf_tcp_send().
LWIP_NETCONN_SCOPE 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.
conn | the netconn to connect |
addr | the remote IP address to connect to |
port | the remote port to connect to (no used for RAW) |
References API_MSG_VAR_ALLOC, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_ARG, IP_ADDR_ANY, LWIP_ERROR(), lwip_netconn_do_connect(), NETCONN_SET_SAFE_ERR, NETCONN_TCP, NETCONNTYPE_GROUP, NULL, TCPIP_APIMSG, tcpip_apimsg(), and netconn::type.
Referenced by iperf_tcp_client_task(), iperf_tcp_send(), and lwip_connect().
LWIP_NETCONN_SCOPE 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.
conn | the netconn to delete |
References API_MSG_VAR_ALLOC, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_OK, lwip_netconn_do_delconn(), netconn_free(), NULL, and tcpip_apimsg().
Referenced by iperf_tcp_client_task(), iperf_tcp_recv(), iperf_tcp_send(), lwip_accept(), lwip_close(), and lwip_socket().
LWIP_NETCONN_SCOPE err_t netconn_disconnect | ( | struct netconn * | conn | ) |
Disconnect a netconn from its current peer (only valid for UDP netconns).
conn | the netconn to disconnect |
References API_MSG_VAR_ALLOC, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_ARG, LWIP_ERROR(), lwip_netconn_do_disconnect(), NETCONN_SET_SAFE_ERR, NULL, and TCPIP_APIMSG.
Referenced by lwip_connect().
LWIP_NETCONN_SCOPE 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!
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 |
References API_MSG_VAR_ALLOC, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_ARG, ip_2_ipX, ipX_2_ip, LWIP_ERROR(), lwip_netconn_do_getaddr(), NETCONN_SET_SAFE_ERR, NULL, and TCPIP_APIMSG.
Referenced by iperf_tcp_task(), lwip_getaddrname(), and lwip_recvfrom().
Execute a DNS query, only one IP address is returned.
name | a string representation of the DNS host name to query |
addr | a preallocated ip_addr_t where to store the resolved IP address |
References API_EXPR_REF, API_VAR_ALLOC, API_VAR_DECLARE, API_VAR_FREE, API_VAR_REF, ERR_ARG, ERR_OK, LWIP_ERROR(), lwip_netconn_do_gethostbyname(), NULL, sys_sem_free(), sys_sem_new(), sys_sem_wait, and tcpip_callback.
Referenced by lwip_getaddrinfo(), lwip_gethostbyname(), and lwip_gethostbyname_r().
LWIP_NETCONN_SCOPE 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.
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 |
References API_MSG_VAR_ALLOC, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_ARG, ip_2_ipX, IP_ADDR_ANY, LWIP_ERROR(), lwip_netconn_do_join_leave_group(), NETCONN_SET_SAFE_ERR, NULL, and TCPIP_APIMSG.
LWIP_NETCONN_SCOPE err_t netconn_listen_with_backlog | ( | struct netconn * | conn, |
u8_t | backlog | ||
) |
Set a TCP netconn into listen mode.
conn | the tcp netconn to set to listen mode |
backlog | the listen backlog, only used if TCP_LISTEN_BACKLOG==1 |
References API_MSG_VAR_ALLOC, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_ARG, LWIP_ERROR(), lwip_netconn_do_listen(), NETCONN_SET_SAFE_ERR, NULL, and TCPIP_APIMSG.
Referenced by lwip_listen().
LWIP_NETCONN_SCOPE 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.
The corresponding pcb is also created.
t | the type of 'connection' to create ( |
proto | the IP protocol for RAW IP pcbs |
callback | a function to call on status changes (RX available, TX'ed) |
References netconn::acceptmbox, API_MSG_VAR_ALLOC_DONTFAIL, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_OK, LWIP_ASSERT, lwip_netconn_do_newconn(), memp_free(), netconn_alloc(), NULL, netconn::op_completed, netconn::pcb, netconn::recvmbox, sys_mbox_free(), sys_mbox_valid(), sys_sem_free(), sys_sem_valid(), netconn::tcp, and TCPIP_APIMSG.
Referenced by lwip_socket().
LWIP_NETCONN_SCOPE 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.
conn | the netconn from which to receive data |
new_buf | pointer where a new netbuf is stored when received data |
References ERR_ARG, ERR_CONN, ERR_MEM, ERR_OK, ipX_addr_set_any, LWIP_ASSERT, LWIP_ERROR(), LWIP_IPV6, memp_free(), memp_malloc(), netconn_recv_data(), NETCONN_SET_SAFE_ERR, NETCONN_TCP, NETCONNTYPE_GROUP, NULL, netconn::recvmbox, sys_mbox_valid(), and netconn::type.
Referenced by iperf_tcp_recv(), iperf_udp_recv(), lwip_ioctl(), and lwip_recvfrom().
LWIP_NETCONN_SCOPE err_t netconn_recv_tcp_pbuf | ( | struct netconn * | conn, |
struct pbuf ** | new_buf | ||
) |
Receive data (in form of a pbuf) from a TCP netconn.
conn | the netconn from which to receive data |
new_buf | pointer where a new pbuf is stored when received data |
References ERR_ARG, LWIP_ERROR(), netconn_recv_data(), NETCONN_TCP, NETCONNTYPE_GROUP, and NULL.
Referenced by lwip_recvfrom().
LWIP_NETCONN_SCOPE 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.
conn | the netconn for which to update the receive window |
length | amount of data processed (ATTENTION: this must be accurate!) |
References API_MSG_VAR_ALLOC_DONTFAIL, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, lwip_netconn_do_recv(), netconn_get_noautorecved, NETCONN_TCP, NETCONNTYPE_GROUP, NULL, TCPIP_APIMSG_NOERR, and netconn::type.
Referenced by lwip_recvfrom().
LWIP_NETCONN_SCOPE err_t netconn_send | ( | struct netconn * | conn, |
struct netbuf * | buf | ||
) |
Send data over a UDP or RAW netconn (that is already connected).
conn | the UDP or RAW netconn over which to send data |
buf | a netbuf containing the data to send |
References API_LIB_DEBUG, API_MSG_VAR_ALLOC, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_ARG, LWIP_DEBUGF, LWIP_ERROR(), lwip_netconn_do_send(), NETCONN_SET_SAFE_ERR, NULL, TCPIP_APIMSG, and U16_F.
Referenced by lwip_sendto(), and netconn_sendto().
LWIP_NETCONN_SCOPE 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).
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 |
References ERR_VAL, netconn::ip, ipX_addr_set_ipaddr, netconn_send(), NULL, netconn::pcb, and PCB_ISIPV6.
Referenced by iperf_udp_recv(), and iperf_udp_send().
LWIP_NETCONN_SCOPE 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).
conn | the TCP netconn to shut down |
References netconn_close_shutdown(), NETCONN_SHUT_RD, and NETCONN_SHUT_WR.
Referenced by lwip_shutdown().
LWIP_NETCONN_SCOPE err_t netconn_write_partly | ( | struct netconn * | conn, |
const void * | dataptr, | ||
size_t | size, | ||
u8_t | apiflags, | ||
size_t * | bytes_written | ||
) |
Send data over a TCP netconn.
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 :
|
bytes_written | pointer to a location that receives the number of written bytes |
References API_MSG_VAR_ALLOC, API_MSG_VAR_DECLARE, API_MSG_VAR_FREE, API_MSG_VAR_REF, ERR_ARG, ERR_OK, ERR_VAL, LWIP_ERROR(), lwip_netconn_do_write(), NETCONN_DONTBLOCK, netconn_is_nonblocking, NETCONN_SET_SAFE_ERR, NETCONN_TCP, NETCONNTYPE_GROUP, NULL, sys_now(), TCPIP_APIMSG, and netconn::type.
Referenced by lwip_send().