#include <gpxe/tcpip.h>
Go to the source code of this file.
Data Structures | |
| struct | tcp_header |
| A TCP header. More... | |
| struct | tcp_option |
| Generic TCP option. More... | |
| struct | tcp_mss_option |
| TCP MSS option. More... | |
| struct | tcp_timestamp_option |
| TCP timestamp option. More... | |
| struct | tcp_timestamp_padded_option |
| Padded TCP timestamp option (used for sending). More... | |
| struct | tcp_options |
| Parsed TCP options. More... | |
Defines | |
| #define | TCP_OPTION_END 0 |
| End of TCP options list. | |
| #define | TCP_OPTION_NOP 1 |
| TCP option pad. | |
| #define | TCP_OPTION_MSS 2 |
| Code for the TCP MSS option. | |
| #define | TCP_OPTION_TS 8 |
| Code for the TCP timestamp option. | |
| #define | TCP_CWR 0x80 |
| #define | TCP_ECE 0x40 |
| #define | TCP_URG 0x20 |
| #define | TCP_ACK 0x10 |
| #define | TCP_PSH 0x08 |
| #define | TCP_RST 0x04 |
| #define | TCP_SYN 0x02 |
| #define | TCP_FIN 0x01 |
| #define | TCP_STATE_SENT(flags) ( (flags) << 0 ) |
| TCP flags that have been sent in outgoing packets. | |
| #define | TCP_FLAGS_SENT(state) ( ( (state) >> 0 ) & 0xff ) |
| #define | TCP_STATE_ACKED(flags) ( (flags) << 8 ) |
| TCP flags that have been acknowledged by the peer. | |
| #define | TCP_FLAGS_ACKED(state) ( ( (state) >> 8 ) & 0xff ) |
| #define | TCP_STATE_RCVD(flags) ( (flags) << 16 ) |
| TCP flags that have been received from the peer. | |
| #define | TCP_FLAGS_RCVD(state) ( ( (state) >> 16 ) & 0xff ) |
| #define | TCP_FLAGS_SENDING(state) ( TCP_FLAGS_SENT ( state ) & ~TCP_FLAGS_ACKED ( state ) ) |
| TCP flags that are currently being sent in outgoing packets. | |
| #define | TCP_CLOSED TCP_RST |
| CLOSED. | |
| #define | TCP_LISTEN 0 |
| LISTEN. | |
| #define | TCP_SYN_SENT ( TCP_STATE_SENT ( TCP_SYN ) ) |
| SYN_SENT. | |
| #define | TCP_SYN_RCVD |
| SYN_RCVD. | |
| #define | TCP_ESTABLISHED |
| ESTABLISHED. | |
| #define | TCP_FIN_WAIT_1 |
| FIN_WAIT_1. | |
| #define | TCP_FIN_WAIT_2 |
| FIN_WAIT_2. | |
| #define | TCP_CLOSING_OR_LAST_ACK |
| CLOSING / LAST_ACK. | |
| #define | TCP_TIME_WAIT |
| TIME_WAIT. | |
| #define | TCP_CLOSE_WAIT |
| CLOSE_WAIT. | |
| #define | TCP_CAN_SEND_DATA(state) |
| Can send data in current state. | |
| #define | TCP_HAS_BEEN_ESTABLISHED(state) |
| Have ever been fully established. | |
| #define | TCP_CLOSED_GRACEFULLY(state) |
| Have closed gracefully. | |
| #define | TCP_MASK_HLEN 0xf0 |
| Mask for TCP header length field. | |
| #define | TCP_MIN_PORT 1 |
| Smallest port number on which a TCP connection can listen. | |
| #define | MAX_HDR_LEN 100 |
| #define | MAX_IOB_LEN 1500 |
| #define | MIN_IOB_LEN MAX_HDR_LEN + 100 |
| #define | TCP_MAX_WINDOW_SIZE 4096 |
| Maxmimum advertised TCP window size. | |
| #define | TCP_PATH_MTU 1460 |
| Path MTU. | |
| #define | TCP_MSS 1460 |
| Advertised TCP MSS. | |
| #define | TCP_MSL ( 2 * 60 * TICKS_PER_SEC ) |
| TCP maximum segment lifetime. | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
Variables | |
| struct tcpip_protocol | tcp_protocol |
This file defines the gPXE TCP API.
Definition in file tcp.h.
| #define TCP_ACK 0x10 |
Definition at line 90 of file tcp.h.
Referenced by tcp_dump_flags(), tcp_rx(), tcp_rx_syn(), and tcp_xmit_reset().
| #define TCP_PSH 0x08 |
| #define TCP_RST 0x04 |
Definition at line 92 of file tcp.h.
Referenced by tcp_dump_flags(), tcp_rx(), and tcp_xmit_reset().
| #define TCP_SYN 0x02 |
Definition at line 93 of file tcp.h.
Referenced by tcp_close(), tcp_dump_flags(), tcp_open(), tcp_rx(), tcp_rx_ack(), tcp_rx_rst(), tcp_rx_syn(), and tcp_xmit().
| #define TCP_FIN 0x01 |
Definition at line 94 of file tcp.h.
Referenced by tcp_close(), tcp_dump_flags(), tcp_rx(), tcp_rx_ack(), tcp_rx_fin(), and tcp_xmit().
| #define TCP_MASK_HLEN 0xf0 |
| #define TCP_MIN_PORT 1 |
| #define TCP_MAX_WINDOW_SIZE 4096 |
Maxmimum advertised TCP window size.
We estimate the TCP window size as the amount of free memory we have. This is not strictly accurate (since it ignores any space already allocated as RX buffers), but it will do for now.
Since we don't store out-of-order received packets, the retransmission penalty is that the whole window contents must be resent. This suggests keeping the window size small, but bear in mind that the maximum bandwidth on any link is limited to
max_bandwidth = ( tcp_window / round_trip_time )
With a 48kB window, which probably accurately reflects our amount of free memory, and a WAN RTT of say 200ms, this gives a maximum bandwidth of 240kB/s. This is sufficiently close to realistic that we will need to be careful that our advertised window doesn't end up limiting WAN download speeds.
Finally, since the window goes into a 16-bit field and we cannot actually use 65536, we use a window size of (65536-4) to ensure that payloads remain dword-aligned.
Definition at line 290 of file tcp.h.
Referenced by tcp_xmit(), and tcp_xmit_reset().
| #define TCP_PATH_MTU 1460 |
Path MTU.
We really ought to implement Path MTU discovery. Until we do, anything with a path MTU greater than this may fail.
Definition at line 298 of file tcp.h.
Referenced by tcp_xmit_win().
| #define TCP_MSS 1460 |
Advertised TCP MSS.
We currently hardcode this to a reasonable value and hope that the sender uses path MTU discovery. The alternative is breaking the abstraction layer so that we can find out the MTU from the IP layer (which would have to find out from the net device layer).
Definition at line 308 of file tcp.h.
Referenced by tcp_xmit().
| #define TCP_MSL ( 2 * 60 * TICKS_PER_SEC ) |
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| struct tcpip_protocol tcp_protocol |
Referenced by tcp_xmit(), and tcp_xmit_reset().
1.5.7.1