xref: /dpdk/lib/net/rte_tcp.h (revision fba9875559906e04eaeb74532f4cfd51194259a2)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(c) 1982, 1986, 1990, 1993
399a2dd95SBruce Richardson  *      The Regents of the University of California.
499a2dd95SBruce Richardson  * Copyright(c) 2010-2014 Intel Corporation.
599a2dd95SBruce Richardson  * All rights reserved.
699a2dd95SBruce Richardson  */
799a2dd95SBruce Richardson 
899a2dd95SBruce Richardson #ifndef _RTE_TCP_H_
999a2dd95SBruce Richardson #define _RTE_TCP_H_
1099a2dd95SBruce Richardson 
1199a2dd95SBruce Richardson /**
1299a2dd95SBruce Richardson  * @file
1399a2dd95SBruce Richardson  *
1499a2dd95SBruce Richardson  * TCP-related defines
1599a2dd95SBruce Richardson  */
1699a2dd95SBruce Richardson 
1799a2dd95SBruce Richardson #include <stdint.h>
1899a2dd95SBruce Richardson 
1999a2dd95SBruce Richardson #include <rte_byteorder.h>
2099a2dd95SBruce Richardson 
2199a2dd95SBruce Richardson /**
2299a2dd95SBruce Richardson  * TCP Header
2399a2dd95SBruce Richardson  */
24*fba98755SAndre Muezerie struct __rte_packed_begin rte_tcp_hdr {
2599a2dd95SBruce Richardson 	rte_be16_t src_port; /**< TCP source port. */
2699a2dd95SBruce Richardson 	rte_be16_t dst_port; /**< TCP destination port. */
2799a2dd95SBruce Richardson 	rte_be32_t sent_seq; /**< TX data sequence number. */
2899a2dd95SBruce Richardson 	rte_be32_t recv_ack; /**< RX data acknowledgment sequence number. */
2999a2dd95SBruce Richardson 	uint8_t  data_off;   /**< Data offset. */
3099a2dd95SBruce Richardson 	uint8_t  tcp_flags;  /**< TCP flags */
3199a2dd95SBruce Richardson 	rte_be16_t rx_win;   /**< RX flow control window. */
3299a2dd95SBruce Richardson 	rte_be16_t cksum;    /**< TCP checksum. */
3399a2dd95SBruce Richardson 	rte_be16_t tcp_urp;  /**< TCP urgent pointer, if any. */
34*fba98755SAndre Muezerie } __rte_packed_end;
3599a2dd95SBruce Richardson 
3699a2dd95SBruce Richardson /**
3799a2dd95SBruce Richardson  * TCP Flags
3899a2dd95SBruce Richardson  */
3999a2dd95SBruce Richardson #define RTE_TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
4099a2dd95SBruce Richardson #define RTE_TCP_ECE_FLAG 0x40 /**< ECN-Echo */
4199a2dd95SBruce Richardson #define RTE_TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
4299a2dd95SBruce Richardson #define RTE_TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
4399a2dd95SBruce Richardson #define RTE_TCP_PSH_FLAG 0x08 /**< Push Function */
4499a2dd95SBruce Richardson #define RTE_TCP_RST_FLAG 0x04 /**< Reset the connection */
4599a2dd95SBruce Richardson #define RTE_TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
4699a2dd95SBruce Richardson #define RTE_TCP_FIN_FLAG 0x01 /**< No more data from sender */
4799a2dd95SBruce Richardson 
4899a2dd95SBruce Richardson #endif /* RTE_TCP_H_ */
49