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

Identifies the sending port

Identifies the receiving port

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.

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.

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.

Kor future use and should be set to zero

Indicates that the Urgent pointer field is significant

Indicates that the Acknowledgment field is significant. All packets after the initial SYN packet sent by the client should have this flag set.

Push function. Asks to push the buffered data to the receiving application.

Reset the connection

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.

No more data from sender

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)

The 16-bit checksum field is used for error-checking of the header and data

If the URG flag is set, then this 16-bit field is an offset from the sequence number indicating the last urgent data byte

The length of this field is determined by the data offset field.

Trait Implementations

impl Debug for TcpHeader
[src]

Formats the value using the given formatter.

impl Eq for TcpHeader
[src]

impl PartialEq for TcpHeader
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.