#include "lwip/opt.h"
#include "lwip/mem.h"
#include "lwip/pbuf.h"
#include "lwip/ip.h"
#include "lwip/icmp.h"
#include "lwip/err.h"
#include "lwip/ip6.h"
#include "lwip/ip6_addr.h"
Data Structures | |
struct | tcp_pcb |
struct | tcp_pcb_listen |
Macros | |
#define | DEF_ACCEPT_CALLBACK tcp_accept_fn accept; |
#define | RCV_WND_SCALE(pcb, wnd) (wnd) |
#define | SND_WND_SCALE(pcb, wnd) (wnd) |
#define | tcp_accepted(pcb) |
#define | tcp_bind_ip6(pcb, ip6addr, port) tcp_bind(pcb, ip6_2_ip(ip6addr), port) |
#define | tcp_connect_ip6(pcb, ip6addr, port, connected) tcp_connect(pcb, ip6_2_ip(ip6addr), port, connected) |
#define | tcp_listen(pcb) tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG) |
#define | tcp_listen_dual(pcb) tcp_listen_dual_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG) |
#define | tcp_mss(pcb) (((pcb)->flags & TF_TIMESTAMP) ? ((pcb)->mss - 12) : (pcb)->mss) |
#define | tcp_nagle_disable(pcb) ((pcb)->flags |= TF_NODELAY) |
#define | tcp_nagle_disabled(pcb) (((pcb)->flags & TF_NODELAY) != 0) |
#define | tcp_nagle_enable(pcb) ((pcb)->flags &= (tcpflags_t)~TF_NODELAY) |
#define | TCP_PCB_COMMON(type) |
members common to struct tcp_pcb and struct tcp_listen_pcb More... | |
#define | TCP_PRIO_MAX 127 |
#define | TCP_PRIO_MIN 1 |
#define | TCP_PRIO_NORMAL 64 |
#define | tcp_sndbuf(pcb) ((pcb)->snd_buf) |
#define | tcp_sndqueuelen(pcb) ((pcb)->snd_queuelen) |
#define | TCP_SNDQUEUELEN_OVERFLOW (0xffffU-3) |
#define | TCP_WRITE_FLAG_COPY 0x01 |
#define | TCP_WRITE_FLAG_MORE 0x02 |
#define | TF_ACK_DELAY ((tcpflags_t)0x0001U) /* Delayed ACK. */ |
#define | TF_ACK_NOW ((tcpflags_t)0x0002U) /* Immediate ACK. */ |
#define | TF_FIN ((tcpflags_t)0x0020U) /* Connection was closed locally (FIN segment enqueued). */ |
#define | TF_INFR ((tcpflags_t)0x0004U) /* In fast recovery. */ |
#define | TF_NAGLEMEMERR ((tcpflags_t)0x0080U) /* nagle enabled, memerr, try to output to prevent delayed ACK to happen */ |
#define | TF_NODELAY ((tcpflags_t)0x0040U) /* Disable Nagle algorithm */ |
#define | TF_RXCLOSED ((tcpflags_t)0x0010U) /* rx closed by tcp_shutdown */ |
#define | TF_TIMESTAMP ((tcpflags_t)0x0008U) /* Timestamp option enabled */ |
Typedefs | |
typedef err_t(* | tcp_accept_fn )(void *arg, struct tcp_pcb *newpcb, err_t err) |
Function prototype for tcp accept callback functions. More... | |
typedef err_t(* | tcp_connected_fn )(void *arg, struct tcp_pcb *tpcb, err_t err) |
Function prototype for tcp connected callback functions. More... | |
typedef void(* | tcp_err_fn )(void *arg, err_t err) |
Function prototype for tcp error callback functions. More... | |
typedef err_t(* | tcp_poll_fn )(void *arg, struct tcp_pcb *tpcb) |
Function prototype for tcp poll callback functions. More... | |
typedef err_t(* | tcp_recv_fn )(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) |
Function prototype for tcp receive callback functions. More... | |
typedef err_t(* | tcp_sent_fn )(void *arg, struct tcp_pcb *tpcb, u16_t len) |
Function prototype for tcp sent callback functions. More... | |
typedef u8_t | tcpflags_t |
typedef u16_t | tcpwnd_size_t |
Enumerations | |
enum | tcp_state { CLOSED = 0, LISTEN = 1, SYN_SENT = 2, SYN_RCVD = 3, ESTABLISHED = 4, FIN_WAIT_1 = 5, FIN_WAIT_2 = 6, CLOSE_WAIT = 7, CLOSING = 8, LAST_ACK = 9, TIME_WAIT = 10 } |
Functions | |
void | tcp_abort (struct tcp_pcb *pcb) |
Aborts the connection by sending a RST (reset) segment to the remote host. More... | |
void | tcp_accept (struct tcp_pcb *pcb, tcp_accept_fn accept) |
Used for specifying the function that should be called when a LISTENing connection has been connected to another host. More... | |
void | tcp_arg (struct tcp_pcb *pcb, void *arg) |
Used to specify the argument that should be passed callback functions. More... | |
err_t | tcp_bind (struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port) |
Binds the connection to a local port number and IP address. More... | |
err_t | tcp_close (struct tcp_pcb *pcb) |
Closes the connection held by the PCB. More... | |
err_t | tcp_connect (struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port, tcp_connected_fn connected) |
Connects to another host. More... | |
const char * | tcp_debug_state_str (enum tcp_state s) |
void | tcp_err (struct tcp_pcb *pcb, tcp_err_fn err) |
Used to specify the function that should be called when a fatal error has occurred on the connection. More... | |
struct tcp_pcb * | tcp_listen_dual_with_backlog (struct tcp_pcb *pcb, u8_t backlog) |
Same as tcp_listen_with_backlog, but allows to accept IPv4 and IPv6 connections, if the pcb's local address is set to ANY. More... | |
struct tcp_pcb * | tcp_listen_with_backlog (struct tcp_pcb *pcb, u8_t backlog) |
Set the state of the connection to be LISTEN, which means that it is able to accept incoming connections. More... | |
struct tcp_pcb * | tcp_new (void) |
Creates a new TCP protocol control block but doesn't place it on any of the TCP PCB lists. More... | |
struct tcp_pcb * | tcp_new_ip6 (void) |
Creates a new TCP-over-IPv6 protocol control block but doesn't place it on any of the TCP PCB lists. More... | |
err_t | tcp_output (struct tcp_pcb *pcb) |
Find out what we can send and send it. More... | |
void | tcp_poll (struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval) |
Used to specify the function that should be called periodically from TCP. More... | |
void | tcp_recv (struct tcp_pcb *pcb, tcp_recv_fn recv) |
Used to specify the function that should be called when a TCP connection receives data. More... | |
void | tcp_recved (struct tcp_pcb *pcb, u16_t len) |
This function should be called by the application when it has processed the data. More... | |
void | tcp_sent (struct tcp_pcb *pcb, tcp_sent_fn sent) |
Used to specify the function that should be called when TCP data has been successfully delivered to the remote host. More... | |
void | tcp_setprio (struct tcp_pcb *pcb, u8_t prio) |
Sets the priority of a connection. More... | |
err_t | tcp_shutdown (struct tcp_pcb *pcb, int shut_rx, int shut_tx) |
Causes all or part of a full-duplex connection of this PCB to be shut down. More... | |
err_t | tcp_write (struct tcp_pcb *pcb, const void *dataptr, u16_t len, u8_t apiflags) |
Write data for sending (but does not send it immediately). More... | |
#define DEF_ACCEPT_CALLBACK tcp_accept_fn accept; |
#define RCV_WND_SCALE | ( | pcb, | |
wnd | |||
) | (wnd) |
Referenced by tcp_output_alloc_header(), and tcp_output_segment().
#define SND_WND_SCALE | ( | pcb, | |
wnd | |||
) | (wnd) |
Referenced by tcp_listen_input(), tcp_process(), and tcp_receive().
#define tcp_accepted | ( | pcb | ) |
Referenced by lwip_netconn_do_recv(), and netconn_drain().
#define tcp_connect_ip6 | ( | pcb, | |
ip6addr, | |||
port, | |||
connected | |||
) | tcp_connect(pcb, ip6_2_ip(ip6addr), port, connected) |
#define tcp_listen | ( | pcb | ) | tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG) |
Referenced by lwip_netconn_do_listen().
#define tcp_listen_dual | ( | pcb | ) | tcp_listen_dual_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG) |
Referenced by lwip_netconn_do_listen().
#define tcp_mss | ( | pcb | ) | (((pcb)->flags & TF_TIMESTAMP) ? ((pcb)->mss - 12) : (pcb)->mss) |
#define tcp_nagle_disable | ( | pcb | ) | ((pcb)->flags |= TF_NODELAY) |
#define tcp_nagle_disabled | ( | pcb | ) | (((pcb)->flags & TF_NODELAY) != 0) |
#define tcp_nagle_enable | ( | pcb | ) | ((pcb)->flags &= (tcpflags_t)~TF_NODELAY) |
#define TCP_PCB_COMMON | ( | type | ) |
members common to struct tcp_pcb and struct tcp_listen_pcb
#define TCP_PRIO_MAX 127 |
#define TCP_PRIO_MIN 1 |
#define TCP_PRIO_NORMAL 64 |
Referenced by tcp_new(), and tcp_new_ip6().
#define tcp_sndbuf | ( | pcb | ) | ((pcb)->snd_buf) |
Referenced by lwip_netconn_do_writemore(), poll_tcp(), and sent_tcp().
#define tcp_sndqueuelen | ( | pcb | ) | ((pcb)->snd_queuelen) |
Referenced by lwip_netconn_do_writemore(), poll_tcp(), and sent_tcp().
#define TCP_SNDQUEUELEN_OVERFLOW (0xffffU-3) |
Referenced by tcp_enqueue_flags(), tcp_write(), and tcp_write_checks().
#define TCP_WRITE_FLAG_COPY 0x01 |
Referenced by tcp_write().
#define TCP_WRITE_FLAG_MORE 0x02 |
Referenced by lwip_netconn_do_writemore(), tcp_pbuf_prealloc(), and tcp_write().
#define TF_ACK_DELAY ((tcpflags_t)0x0001U) /* Delayed ACK. */ |
Referenced by tcp_fasttmr(), tcp_output(), tcp_pcb_remove(), tcp_process(), and tcp_send_empty_ack().
#define TF_ACK_NOW ((tcpflags_t)0x0002U) /* Immediate ACK. */ |
Referenced by tcp_fasttmr(), tcp_output(), tcp_pcb_remove(), tcp_send_empty_ack(), and tcp_timewait_input().
#define TF_FIN ((tcpflags_t)0x0020U) /* Connection was closed locally (FIN segment enqueued). */ |
Referenced by tcp_enqueue_flags(), tcp_output(), and tcp_send_fin().
#define TF_INFR ((tcpflags_t)0x0004U) /* In fast recovery. */ |
Referenced by tcp_receive(), and tcp_rexmit_fast().
#define TF_NAGLEMEMERR ((tcpflags_t)0x0080U) /* nagle enabled, memerr, try to output to prevent delayed ACK to happen */ |
Referenced by tcp_enqueue_flags(), tcp_output(), tcp_write(), and tcp_write_checks().
#define TF_NODELAY ((tcpflags_t)0x0040U) /* Disable Nagle algorithm */ |
Referenced by tcp_pbuf_prealloc().
#define TF_RXCLOSED ((tcpflags_t)0x0010U) /* rx closed by tcp_shutdown */ |
Referenced by lwip_netconn_do_close_internal(), tcp_close(), tcp_close_shutdown(), tcp_input(), tcp_process(), tcp_shutdown(), and tcp_slowtmr().
#define TF_TIMESTAMP ((tcpflags_t)0x0008U) /* Timestamp option enabled */ |
Referenced by tcp_enqueue_flags(), tcp_parseopt(), tcp_send_empty_ack(), and tcp_write().
Function prototype for tcp accept callback functions.
Called when a new connection can be accepted on a listening pcb.
arg | Additional argument to pass to the callback function ( |
newpcb | The new connection pcb |
err | An error code if there has been an error accepting. Only return ERR_ABRT if you have called tcp_abort from within the callback function! |
Function prototype for tcp connected callback functions.
Called when a pcb is connected to the remote side after initiating a connection attempt by calling tcp_connect().
arg | Additional argument to pass to the callback function ( |
tpcb | The connection pcb which is connected |
err | An unused error code, always ERR_OK currently ;-) TODO! Only return ERR_ABRT if you have called tcp_abort from within the callback function! |
Function prototype for tcp error callback functions.
Called when the pcb receives a RST or is unexpectedly closed for any other reason.
arg | Additional argument to pass to the callback function ( |
err | Error code to indicate why the pcb has been closed ERR_ABRT: aborted through tcp_abort or by a TCP timer ERR_RST: the connection was reset by the remote host |
Function prototype for tcp poll callback functions.
Called periodically as specified by
arg | Additional argument to pass to the callback function ( |
tpcb | tcp pcb |
Function prototype for tcp receive callback functions.
Called when data has been received.
arg | Additional argument to pass to the callback function ( |
tpcb | The connection pcb which received data |
p | The received data (or NULL when the connection has been closed!) |
err | An error code if there has been an error receiving Only return ERR_ABRT if you have called tcp_abort from within the callback function! |
Function prototype for tcp sent callback functions.
Called when sent data has been acknowledged by the remote side. Use it to free corresponding resources. This also means that the pcb has now space available to send new data.
arg | Additional argument to pass to the callback function ( |
tpcb | The connection pcb for which data has been acknowledged |
len | The amount of bytes acknowledged |
typedef u8_t tcpflags_t |
typedef u16_t tcpwnd_size_t |
enum tcp_state |
Aborts the connection by sending a RST (reset) segment to the remote host.
The pcb is deallocated. This function never fails.
ATTENTION: When calling this from one of the TCP callbacks, make sure you always return ERR_ABRT (and never return ERR_ABRT otherwise or you will risk accessing deallocated memory or memory leaks!
pcb | the tcp pcb to abort |
References tcp_abandon().
Referenced by netconn_drain(), netif_set_ipaddr(), tcp_input(), tcp_kill_prio(), tcp_kill_timewait(), and tcp_process().
void tcp_accept | ( | struct tcp_pcb * | pcb, |
tcp_accept_fn | accept | ||
) |
Used for specifying the function that should be called when a LISTENing connection has been connected to another host.
pcb | tcp_pcb to set the accept callback |
accept | callback function to call for this pcb when LISTENing connection has been connected to another host |
Referenced by lwip_netconn_do_close_internal(), and lwip_netconn_do_listen().
Used to specify the argument that should be passed callback functions.
pcb | tcp_pcb to set the callback argument |
arg | void pointer argument to pass to callback functions |
References arg.
Referenced by accept_function(), lwip_netconn_do_close_internal(), lwip_netconn_do_listen(), and setup_tcp().
Binds the connection to a local port number and IP address.
If the IP address is not given (i.e., ipaddr == NULL), the IP address of the outgoing network interface is used instead.
pcb | the tcp_pcb to bind (no check is done whether this pcb is already bound!) |
ipaddr | the local ip address to bind to (use IP_ADDR_ANY to bind to any local address |
port | the local port to bind to |
References CLOSED, ERR_BUF, ERR_OK, ERR_USE, ERR_VAL, ip_2_ipX, ip_get_option, IP_PCB_IPVER_EQ, ipX_addr_cmp, ipX_addr_isany, ipX_addr_set, LWIP_DEBUGF, LWIP_ERROR(), NULL, NUM_TCP_PCB_LISTS, NUM_TCP_PCB_LISTS_NO_TIME_WAIT, PCB_ISIPV6, SOF_REUSEADDR, TCP_DEBUG, tcp_new_port(), TCP_REG, and U16_F.
Referenced by lwip_netconn_do_bind().
Closes the connection held by the PCB.
Listening pcbs are freed and may not be referenced any more. Connection pcbs are freed if not yet connected and may not be referenced any more. If a connection is established (at least SYN received or in a closing state), the connection is closed, and put in a closing state. The pcb is then automatically freed in tcp_slowtmr(). It is therefore unsafe to reference it (unless an error is returned).
pcb | the tcp_pcb to close |
References tcp_pcb::flags, LISTEN, LWIP_DEBUGF, tcp_close_shutdown(), TCP_DEBUG, tcp_debug_print_state, and TF_RXCLOSED.
Referenced by lwip_netconn_do_close_internal(), lwip_netconn_do_listen(), and tcp_recv_null().
err_t tcp_connect | ( | struct tcp_pcb * | pcb, |
ip_addr_t * | ipaddr, | ||
u16_t | port, | ||
tcp_connected_fn | connected | ||
) |
Connects to another host.
The function given as the "connected" argument will be called when the connection has been established.
pcb | the tcp_pcb used to establish the connection |
ipaddr | the remote ip address to connect to |
port | the remote tcp port to connect to |
connected | callback function to call when connected (on error, the err calback will be called) |
References CLOSED, tcp_pcb::connected, tcp_pcb::cwnd, ERR_BUF, ERR_ISCONN, ERR_OK, ERR_RTE, ERR_USE, ERR_VAL, ip_2_ipX, ip_get_option, IP_PCB_IPVER_EQ, ipX_addr_cmp, ipX_addr_copy, ipX_addr_isany, ipX_addr_set, ipX_route_get_local_ipX, tcp_pcb::lastack, LWIP_DEBUGF, LWIP_ERROR(), tcp_pcb::mss, NULL, NUM_TCP_PCB_LISTS, PCB_ISIPV6, tcp_pcb::rcv_ann_right_edge, tcp_pcb::rcv_ann_wnd, tcp_pcb::rcv_nxt, tcp_pcb::rcv_wnd, tcp_pcb::remote_port, tcp_pcb::snd_lbb, tcp_pcb::snd_nxt, tcp_pcb::snd_wnd, snmp_inc_tcpactiveopens, SOF_REUSEADDR, tcp_pcb::ssthresh, SYN_SENT, TCP_DEBUG, tcp_eff_send_mss, tcp_enqueue_flags(), TCP_MSS, tcp_new_port(), tcp_next_iss(), tcp_output(), TCP_REG_ACTIVE, TCP_RMV, TCP_SYN, TCP_WND, and U16_F.
Referenced by lwip_netconn_do_connect().
const char* tcp_debug_state_str | ( | enum tcp_state | s | ) |
References tcp_state_str.
Referenced by accept_function().
void tcp_err | ( | struct tcp_pcb * | pcb, |
tcp_err_fn | err | ||
) |
Used to specify the function that should be called when a fatal error has occurred on the connection.
pcb | tcp_pcb to set the err callback |
err | callback function to call for this pcb when a fatal error has occurred on the connection |
References tcp_pcb::errf, LISTEN, and LWIP_ASSERT.
Referenced by accept_function(), lwip_netconn_do_close_internal(), and setup_tcp().
Same as tcp_listen_with_backlog, but allows to accept IPv4 and IPv6 connections, if the pcb's local address is set to ANY.
References ipX_addr_isany, NULL, PCB_ISIPV6, and tcp_listen_with_backlog().
Referenced by lwip_netconn_do_listen().
Set the state of the connection to be LISTEN, which means that it is able to accept incoming connections.
The protocol control block is reallocated in order to consume less memory. Setting the connection to LISTEN is an irreversible process.
pcb | the original tcp_pcb |
backlog | the incoming connections queue limit |
References tcp_pcb_listen::accept_any_ip_version, CLOSED, ip_get_option, IP_PCB_IPVER_EQ, ipX_addr_cmp, ipX_addr_copy, LISTEN, tcp_listen_pcbs_t::listen_pcbs, LWIP_ERROR(), memp_free(), memp_malloc(), NULL, PCB_ISIPV6, tcp_listen_pcbs_t::pcbs, SOF_REUSEADDR, tcp_accept_null(), tcp_listen_pcbs, TCP_REG, and TCP_RMV.
Referenced by lwip_netconn_do_listen(), and tcp_listen_dual_with_backlog().
Creates a new TCP protocol control block but doesn't place it on any of the TCP PCB lists.
The pcb is not put on any list until binding using tcp_bind().
: Maybe there should be a idle TCP PCB list where these PCBs are put on. Port reservation using tcp_bind() is implemented but allocated pcbs that are not bound can't be killed automatically if wanting to allocate a pcb with higher prio (
References tcp_alloc(), and TCP_PRIO_NORMAL.
Referenced by pcb_new().
Creates a new TCP-over-IPv6 protocol control block but doesn't place it on any of the TCP PCB lists.
The pcb is not put on any list until binding using tcp_bind().
References ip_set_v6, tcp_alloc(), and TCP_PRIO_NORMAL.
Find out what we can send and send it.
pcb | Protocol control block for the TCP connection to send data |
References tcp_pcb::cwnd, ERR_OK, tcp_pcb::flags, tcp_pcb::lastack, tcp_seg::len, LISTEN, LWIP_ASSERT, LWIP_DEBUGF, LWIP_MIN, tcp_seg::next, ntohl, NULL, S16_F, tcp_pcb::snd_nxt, tcp_pcb::snd_wnd, SYN_SENT, TCP_ACK, TCP_CWND_DEBUG, tcp_do_output_nagle, tcp_input_pcb, TCP_OUTPUT_DEBUG, tcp_output_segment(), TCP_RST, tcp_seg_free(), tcp_send_empty_ack(), TCP_SEQ_LT, TCP_TCPLEN, TCPH_FLAGS, TCPH_SET_FLAG, tcp_seg::tcphdr, TCPWNDSIZE_F, TF_ACK_DELAY, TF_ACK_NOW, TF_FIN, TF_NAGLEMEMERR, U32_F, tcp_pcb::unacked, tcp_pcb::unsent, and tcp_pcb::unsent_oversize.
Referenced by lwip_netconn_do_writemore(), tcp_close_shutdown(), tcp_connect(), tcp_fasttmr(), tcp_input(), tcp_listen_input(), tcp_pcb_remove(), tcp_recved(), tcp_rexmit_rto(), tcp_slowtmr(), and tcp_timewait_input().
void tcp_poll | ( | struct tcp_pcb * | pcb, |
tcp_poll_fn | poll, | ||
u8_t | interval | ||
) |
Used to specify the function that should be called periodically from TCP.
The interval is specified in terms of the TCP coarse timer interval, which is called twice a second.
References LISTEN, LWIP_ASSERT, tcp_pcb::poll, and tcp_pcb::pollinterval.
Referenced by accept_function(), lwip_netconn_do_close_internal(), and setup_tcp().
void tcp_recv | ( | struct tcp_pcb * | pcb, |
tcp_recv_fn | recv | ||
) |
Used to specify the function that should be called when a TCP connection receives data.
pcb | tcp_pcb to set the recv callback |
recv | callback function to call for this pcb when data is received |
References LISTEN, LWIP_ASSERT, and tcp_pcb::recv.
Referenced by accept_function(), lwip_netconn_do_close_internal(), and setup_tcp().
This function should be called by the application when it has processed the data.
The purpose is to advertise a larger window when the data has been processed.
pcb | the tcp_pcb for which data is read |
len | the amount of bytes that have been read by the application |
References CLOSE_WAIT, LAST_ACK, LISTEN, LWIP_ASSERT, LWIP_DEBUGF, tcp_pcb::rcv_wnd, tcp_ack_now, TCP_DEBUG, tcp_output(), tcp_update_rcv_ann_wnd(), TCP_WND, and U16_F.
Referenced by lwip_netconn_do_recv(), netconn_drain(), recv_tcp(), and tcp_recv_null().
void tcp_sent | ( | struct tcp_pcb * | pcb, |
tcp_sent_fn | sent | ||
) |
Used to specify the function that should be called when TCP data has been successfully delivered to the remote host.
pcb | tcp_pcb to set the sent callback |
sent | callback function to call for this pcb when data is successfully sent |
References LISTEN, LWIP_ASSERT, and tcp_pcb::sent.
Referenced by accept_function(), lwip_netconn_do_close_internal(), and setup_tcp().
Sets the priority of a connection.
pcb | the tcp_pcb to manipulate |
prio | new priority |
Causes all or part of a full-duplex connection of this PCB to be shut down.
This doesn't deallocate the PCB unless shutting down both sides! Shutting down both sides is the same as calling tcp_close, so if it succeds, the PCB should not be referenced any more.
pcb | PCB to shutdown |
shut_rx | shut down receive side if this is != 0 |
shut_tx | shut down send side if this is != 0 |
References CLOSE_WAIT, ERR_CONN, ERR_OK, ESTABLISHED, tcp_pcb::flags, LISTEN, NULL, pbuf_free(), tcp_pcb::refused_data, SYN_RCVD, tcp_close_shutdown(), and TF_RXCLOSED.
Referenced by lwip_netconn_do_close_internal().
Write data for sending (but does not send it immediately).
It waits in the expectation of more data being sent soon (as it can send them more efficiently by combining them together). To prompt the system to send data now, call tcp_output() after calling tcp_write().
pcb | Protocol control block for the TCP connection to enqueue data for. |
arg | Pointer to the data to be enqueued for sending. |
len | Data length in bytes |
apiflags | combination of following flags :
|
References ERR_ARG, ERR_MEM, ERR_OK, tcp_pcb::flags, tcp_seg::flags, inet_chksum(), pbuf::len, tcp_seg::len, LWIP_ASSERT, LWIP_DBG_STATE, LWIP_DBG_TRACE, LWIP_DEBUGF, LWIP_ERROR(), LWIP_MAX, LWIP_MIN, LWIP_TCP_OPT_LENGTH, tcp_pcb::mss, pbuf::next, tcp_seg::next, ntohl, NULL, tcp_seg::p, pbuf::payload, pbuf_alloc(), pbuf_cat(), pbuf_clen(), pbuf_free(), PBUF_RAM, PBUF_RAW, PBUF_ROM, PBUF_TRANSPORT, S16_F, tcp_pcb::snd_buf, tcp_pcb::snd_lbb, tcp_pcb::snd_queuelen, tcp_pcb::snd_wnd_max, SWAP_BYTES_IN_WORD, tcp_create_segment(), TCP_DATA_COPY, TCP_DATA_COPY2, TCP_OUTPUT_DEBUG, tcp_pbuf_prealloc(), TCP_PSH, TCP_QLEN_DEBUG, tcp_segs_free(), TCP_SND_QUEUELEN, TCP_SNDQUEUELEN_OVERFLOW, TCP_STATS_INC, TCP_TCPLEN, tcp_write_checks(), TCP_WRITE_FLAG_COPY, TCP_WRITE_FLAG_MORE, TCPH_SET_FLAG, TCPWNDSIZE_F, TF_NAGLEMEMERR, TF_SEG_DATA_CHECKSUMMED, TF_SEG_OPTS_TS, TF_TIMESTAMP, pbuf::tot_len, U16_F, U32_F, tcp_pcb::unacked, tcp_pcb::unsent, and tcp_pcb::unsent_oversize.
Referenced by lwip_netconn_do_writemore().