Struct peel_ip::layer3::tcp::TcpHeader
[−]
[src]
pub struct TcpHeader { pub source_port: u16, pub dest_port: u16, pub sequence_no: u32, pub ack_no: u32, pub data_offset: u8, pub reserved: u8, pub flag_urg: bool, pub flag_ack: bool, pub flag_psh: bool, pub flag_rst: bool, pub flag_syn: bool, pub flag_fin: bool, pub window: u16, pub checksum: u16, pub urgent_pointer: u16, pub options: Vec<u8>, }
Representation of a Transmission Control Protocol packet header
Fields
source_port: u16
Identifies the sending port
dest_port: u16
Identifies the receiving port
sequence_no: u32
If the SYN flag is set (1), then this is the initial sequence number. The sequence number of the actual first data byte and the acknowledged number in the corresponding ACK are then this sequence number plus 1. If the SYN flag is clear (0), then this is the accumulated sequence number of the first data byte of this segment for the current session.
ack_no: u32
If the ACK flag is set then the value of this field is the next sequence number that the sender is expecting. This acknowledges receipt of all prior bytes (if any). The first ACK sent by each end acknowledges the other end's initial sequence number itself, but no data.
data_offset: u8
Specifies the size of the TCP header in 32-bit words. The minimum size header is 5 words and the maximum is 15 words thus giving the minimum size of 20 bytes and maximum of 60 bytes, allowing for up to 40 bytes of options in the header. This field gets its name from the fact that it is also the offset from the start of the TCP segment to the actual data.
reserved: u8
Kor future use and should be set to zero
flag_urg: bool
Indicates that the Urgent pointer field is significant
flag_ack: bool
Indicates that the Acknowledgment field is significant. All packets after the initial SYN packet sent by the client should have this flag set.
flag_psh: bool
Push function. Asks to push the buffered data to the receiving application.
flag_rst: bool
Reset the connection
flag_syn: bool
Synchronize sequence numbers. Only the first packet sent from each end should have this flag set. Some other flags and fields change meaning based on this flag, and some are only valid for when it is set, and others when it is clear.
flag_fin: bool
No more data from sender
window: u16
The size of the receive window, which specifies the number of window size units (by default, bytes) (beyond the segment identified by the sequence number in the acknowledgment field) that the sender of this segment is currently willing to receive (see Flow control and Window Scaling)
checksum: u16
The 16-bit checksum field is used for error-checking of the header and data
urgent_pointer: u16
If the URG flag is set, then this 16-bit field is an offset from the sequence number indicating the last urgent data byte
options: Vec<u8>
The length of this field is determined by the data offset field.