/// ************************************************************************
/// Copyright (C) 2001, Patrick Charles and Jonas Lehmann *
/// Distributed under the Mozilla Public License *
/// http://www.mozilla.org/NPL/MPL-1.1.txt *
/// *************************************************************************
///
namespace SharpPcap.Packets
{
/// IP protocol field encoding information.
///
///
public struct TCPFields_Fields
{
// flag bitmasks
public readonly static int TCP_CWR_MASK = 0x0080;
public readonly static int TCP_ECN_MASK = 0x0040;
public readonly static int TCP_URG_MASK = 0x0020;
public readonly static int TCP_ACK_MASK = 0x0010;
public readonly static int TCP_PSH_MASK = 0x0008;
public readonly static int TCP_RST_MASK = 0x0004;
public readonly static int TCP_SYN_MASK = 0x0002;
public readonly static int TCP_FIN_MASK = 0x0001;
/// Length of a TCP port in bytes.
public readonly static int TCP_PORT_LEN = 2;
/// Length of the sequence number in bytes.
public readonly static int TCP_SEQ_LEN = 4;
/// Length of the acknowledgment number in bytes.
public readonly static int TCP_ACK_LEN = 4;
/// Length of the header length and flags field in bytes.
public readonly static int TCP_FLAG_LEN = 2;
/// Length of the window size field in bytes.
public readonly static int TCP_WIN_LEN = 2;
/// Length of the checksum field in bytes.
public readonly static int TCP_CSUM_LEN = 2;
/// Length of the urgent field in bytes.
public readonly static int TCP_URG_LEN = 2;
/// Position of the source port field.
public readonly static int TCP_SP_POS = 0;
/// Position of the destination port field.
public readonly static int TCP_DP_POS;
/// Position of the sequence number field.
public readonly static int TCP_SEQ_POS;
/// Position of the acknowledgment number field.
public readonly static int TCP_ACK_POS;
/// Position of the header length and flags field.
public readonly static int TCP_FLAG_POS;
/// Position of the window size field.
public readonly static int TCP_WIN_POS;
/// Position of the checksum field.
public readonly static int TCP_CSUM_POS;
/// Position of the urgent pointer field.
public readonly static int TCP_URG_POS;
/// Length in bytes of a TCP header.
public readonly static int TCP_HEADER_LEN; // == 20
static TCPFields_Fields()
{
TCP_DP_POS = TCPFields_Fields.TCP_PORT_LEN;
TCP_SEQ_POS = TCPFields_Fields.TCP_DP_POS + TCPFields_Fields.TCP_PORT_LEN;
TCP_ACK_POS = TCPFields_Fields.TCP_SEQ_POS + TCPFields_Fields.TCP_SEQ_LEN;
TCP_FLAG_POS = TCPFields_Fields.TCP_ACK_POS + TCPFields_Fields.TCP_ACK_LEN;
TCP_WIN_POS = TCPFields_Fields.TCP_FLAG_POS + TCPFields_Fields.TCP_FLAG_LEN;
TCP_CSUM_POS = TCPFields_Fields.TCP_WIN_POS + TCPFields_Fields.TCP_WIN_LEN;
TCP_URG_POS = TCPFields_Fields.TCP_CSUM_POS + TCPFields_Fields.TCP_CSUM_LEN;
TCP_HEADER_LEN = TCPFields_Fields.TCP_URG_POS + TCPFields_Fields.TCP_URG_LEN;
}
}
}