36 #define TCP_OPTION_END 0 39 #define TCP_OPTION_NOP 1 55 #define TCP_OPTION_MSS 2 71 #define TCP_OPTION_WS 3 80 #define TCP_RX_WINDOW_SCALE 9 95 #define TCP_OPTION_SACK_PERMITTED 4 113 #define TCP_SACK_MAX 3 122 #define TCP_OPTION_SACK 5 139 #define TCP_OPTION_TS 8 176 #define TCP_STATE_SENT(flags) ( (flags) << 0 ) 177 #define TCP_FLAGS_SENT(state) ( ( (state) >> 0 ) & 0xff ) 183 #define TCP_STATE_ACKED(flags) ( (flags) << 8 ) 184 #define TCP_FLAGS_ACKED(state) ( ( (state) >> 8 ) & 0xff ) 191 #define TCP_STATE_RCVD(flags) ( (flags) << 16 ) 192 #define TCP_FLAGS_RCVD(state) ( ( (state) >> 16 ) & 0xff ) 195 #define TCP_FLAGS_SENDING(state) \ 196 ( TCP_FLAGS_SENT ( state ) & ~TCP_FLAGS_ACKED ( state ) ) 202 #define TCP_CLOSED TCP_RST 215 #define TCP_SYN_SENT ( TCP_STATE_SENT ( TCP_SYN ) ) 221 #define TCP_SYN_RCVD ( TCP_STATE_SENT ( TCP_SYN | TCP_ACK ) | \ 222 TCP_STATE_RCVD ( TCP_SYN ) ) 228 #define TCP_ESTABLISHED ( TCP_STATE_SENT ( TCP_SYN | TCP_ACK ) | \ 229 TCP_STATE_ACKED ( TCP_SYN ) | \ 230 TCP_STATE_RCVD ( TCP_SYN ) ) 246 #define TCP_FIN_WAIT_1 ( TCP_STATE_SENT ( TCP_SYN | TCP_ACK | TCP_FIN ) | \ 247 TCP_STATE_ACKED ( TCP_SYN ) | \ 248 TCP_STATE_RCVD ( TCP_SYN ) ) 255 #define TCP_FIN_WAIT_2 ( TCP_STATE_SENT ( TCP_SYN | TCP_ACK | TCP_FIN ) | \ 256 TCP_STATE_ACKED ( TCP_SYN | TCP_FIN ) | \ 257 TCP_STATE_RCVD ( TCP_SYN ) ) 268 #define TCP_CLOSING_OR_LAST_ACK \ 269 ( TCP_STATE_SENT ( TCP_SYN | TCP_ACK | TCP_FIN ) | \ 270 TCP_STATE_ACKED ( TCP_SYN ) | \ 271 TCP_STATE_RCVD ( TCP_SYN | TCP_FIN ) ) 278 #define TCP_TIME_WAIT ( TCP_STATE_SENT ( TCP_SYN | TCP_ACK | TCP_FIN ) | \ 279 TCP_STATE_ACKED ( TCP_SYN | TCP_FIN ) | \ 280 TCP_STATE_RCVD ( TCP_SYN | TCP_FIN ) ) 287 #define TCP_CLOSE_WAIT ( TCP_STATE_SENT ( TCP_SYN | TCP_ACK ) | \ 288 TCP_STATE_ACKED ( TCP_SYN ) | \ 289 TCP_STATE_RCVD ( TCP_SYN | TCP_FIN ) ) 296 #define TCP_CAN_SEND_DATA(state) \ 297 ( ( (state) & ( TCP_STATE_ACKED ( TCP_SYN ) | \ 298 TCP_STATE_SENT ( TCP_FIN ) ) ) \ 299 == TCP_STATE_ACKED ( TCP_SYN ) ) 306 #define TCP_HAS_BEEN_ESTABLISHED(state) \ 307 ( ( (state) & ( TCP_STATE_ACKED ( TCP_SYN ) | \ 308 TCP_STATE_RCVD ( TCP_SYN ) ) ) \ 309 == ( TCP_STATE_ACKED ( TCP_SYN ) | TCP_STATE_RCVD ( TCP_SYN ) ) ) 316 #define TCP_CLOSED_GRACEFULLY(state) \ 317 ( ( (state) & ( TCP_STATE_ACKED ( TCP_FIN ) | \ 318 TCP_STATE_RCVD ( TCP_FIN ) ) ) \ 319 == ( TCP_STATE_ACKED ( TCP_FIN ) | TCP_STATE_RCVD ( TCP_FIN ) ) ) 324 #define TCP_MASK_HLEN 0xf0 327 #define TCP_MIN_PORT 1 362 #define TCP_MAX_WINDOW_SIZE ( 2048 * 1024 ) 378 #define TCP_PATH_MTU \ 379 ( 1280 - 40 - 20 - 12 ) 385 #define TCP_MSL ( 2 * 60 * TICKS_PER_SEC ) 393 #define TCP_KEEPALIVE_DELAY ( 15 * TICKS_PER_SEC ) 399 #define TCP_MAX_HEADER_LEN \ 400 ( MAX_LL_NET_HEADER_LEN + \ 401 sizeof ( struct tcp_header ) + \ 402 sizeof ( struct tcp_mss_option ) + \ 403 sizeof ( struct tcp_window_scale_padded_option ) + \ 404 sizeof ( struct tcp_timestamp_padded_option ) ) 419 return ( (
int32_t ) ( seq1 - seq2 ) );
440 #define TCP_FINISH_TIMEOUT ( 1 * TICKS_PER_SEC ) struct tcp_timestamp_option tsopt
Padded TCP window scale option (used for sending)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
TCP selective acknowledgement option.
struct tcp_header __attribute__
Padded TCP selective acknowledgement option (used for sending)
struct tcp_sack_permitted_option __attribute
const struct tcp_window_scale_option * wsopt
Window scale option, if present.
u16 seq
802.11 Sequence Control field
uint32_t start
Starting offset.
const struct tcp_sack_permitted_option * spopt
SACK permitted option, if present.
Padded TCP selective acknowledgement permitted option (used for sending)
Padded TCP timestamp option (used for sending)
Transport-network layer interface.
static int tcp_in_window(uint32_t seq, uint32_t start, uint32_t len)
Check if TCP sequence number lies within window.
A transport-layer protocol of the TCP/IP stack (eg.
struct tcpip_protocol tcp_protocol __tcpip_protocol
ICMPv4 TCP/IP protocol.
struct tcp_sack_option sackopt
struct tcp_window_scale_option wsopt
static int32_t tcp_cmp(uint32_t seq1, uint32_t seq2)
Compare TCP sequence numbers.
const struct tcp_timestamp_option * tsopt
Timestamp option, if present.
TCP selective acknowledgement permitted option.
TCP selective acknowledgement block.
struct tcp_sack_permitted_option spopt