Transmission Control Protocol, outgoing traffic
The output functions of TCP.
There are two distinct ways for TCP segments to get sent:
- queued data: these are segments transferring data or segments containing SYN or FIN (which both count as one sequence number). They are created as struct Packet buffers (PBUF) together with a struct tcp_seg and enqueue to the unsent list of the pcb. They are sent by tcp_output:
- tcp_write : creates data segments
- tcp_split_unsent_seg : splits a data segment
- tcp_enqueue_flags : creates SYN-only or FIN-only segments
- tcp_output / tcp_output_segment : finalize the tcp header (e.g. sequence numbers, options, checksum) and output to IP
- the various tcp_rexmit functions shuffle around segments between the unsent an unacked lists to retransmit them
- tcp_create_segment and tcp_pbuf_prealloc allocate pbuf and segment for these functions
- direct send: these segments don't contain data but control the connection behaviour. They are created as pbuf only and sent directly without enqueueing them:
- tcp_send_empty_ack sends an ACK-only segment
- tcp_rst sends a RST segment
- tcp_keepalive sends a keepalive segment
- tcp_zero_window_probe sends a window probe segment
- tcp_output_alloc_header allocates a header-only pbuf for these functions
Definition in file tcp_out.c.