|
enum | Flags {
FIN = 1
, SYN = 2
, RST = 4
, PSH = 8
,
ACK = 16
, URG = 32
, ECE = 64
, CWR = 128
} |
| TCP flags enum. More...
|
|
enum | OptionTypes {
EOL = 0
, NOP = 1
, MSS = 2
, WSCALE = 3
,
SACK_OK = 4
, SACK = 5
, TSOPT = 8
, ALTCHK = 14
,
RFC_EXPERIMENT_1 = 253
, RFC_EXPERIMENT_2 = 254
} |
| TCP options enum. More...
|
|
enum | AltChecksums { CHK_TCP
, CHK_8FLETCHER
, CHK_16FLETCHER
} |
| Alternate checksum enum.
|
|
typedef PDUOption< uint8_t, TCP > | option |
|
typedef std::vector< option > | options_type |
|
typedef std::vector< uint32_t > | sack_type |
|
enum | endian_type { BE
, LE
} |
|
enum | PDUType {
RAW
, ETHERNET_II
, IEEE802_3
, DOT3 = IEEE802_3
,
RADIOTAP
, DOT11
, DOT11_ACK
, DOT11_ASSOC_REQ
,
DOT11_ASSOC_RESP
, DOT11_AUTH
, DOT11_BEACON
, DOT11_BLOCK_ACK
,
DOT11_BLOCK_ACK_REQ
, DOT11_CF_END
, DOT11_DATA
, DOT11_CONTROL
,
DOT11_DEAUTH
, DOT11_DIASSOC
, DOT11_END_CF_ACK
, DOT11_MANAGEMENT
,
DOT11_PROBE_REQ
, DOT11_PROBE_RESP
, DOT11_PS_POLL
, DOT11_REASSOC_REQ
,
DOT11_REASSOC_RESP
, DOT11_RTS
, DOT11_QOS_DATA
, LLC
,
SNAP
, IP
, ARP
, TCP
,
UDP
, ICMP
, BOOTP
, DHCP
,
EAPOL
, RC4EAPOL
, RSNEAPOL
, DNS
,
LOOPBACK
, IPv6
, ICMPv6
, SLL
,
DHCPv6
, DOT1AD
, DOT1Q
, PPPOE
,
STP
, PPI
, IPSEC_AH
, IPSEC_ESP
,
PKTAP
, MPLS
, DOT11_CONTROL_TA
, UNKNOWN = 999
,
USER_DEFINED_PDU = 1000
} |
| Enum which identifies each type of PDU. More...
|
|
typedef byte_array | serialization_type |
|
|
| TCP (uint16_t dport=0, uint16_t sport=0) |
| TCP constructor. More...
|
|
| TCP (const uint8_t *buffer, uint32_t total_sz) |
| Constructs TCP object from a buffer. More...
|
|
uint16_t | dport () const |
| Getter for the destination port field. More...
|
|
uint16_t | sport () const |
| Getter for the source port field. More...
|
|
uint32_t | seq () const |
| Getter for the sequence number field. More...
|
|
uint32_t | ack_seq () const |
| Getter for the acknowledge number field. More...
|
|
uint16_t | window () const |
| Getter for the window size field. More...
|
|
uint16_t | checksum () const |
| Getter for the checksum field. More...
|
|
uint16_t | urg_ptr () const |
| Getter for the urgent pointer field. More...
|
|
small_uint< 4 > | data_offset () const |
| Getter for the data offset field. More...
|
|
const options_type & | options () const |
| Getter for the option list. More...
|
|
small_uint< 1 > | get_flag (Flags tcp_flag) const |
| Gets the value of a flag. More...
|
|
small_uint< 12 > | flags () const |
| Gets the flags' values. More...
|
|
bool | has_flags (small_uint< 12 > check_flags) const |
| Check if the given flags are set. More...
|
|
void | dport (uint16_t new_dport) |
| Setter for the destination port field. More...
|
|
void | sport (uint16_t new_sport) |
| Setter for the source port field. More...
|
|
void | seq (uint32_t new_seq) |
| Setter for the sequence number. More...
|
|
void | ack_seq (uint32_t new_ack_seq) |
| Setter for the acknowledge number. More...
|
|
void | window (uint16_t new_window) |
| Setter for the window size. More...
|
|
void | urg_ptr (uint16_t new_urg_ptr) |
| Setter for the urgent pointer field. More...
|
|
void | data_offset (small_uint< 4 > new_doff) |
| Setter for the data offset pointer field. More...
|
|
void | mss (uint16_t value) |
| Add a maximum segment size option. More...
|
|
uint16_t | mss () const |
| Searchs for a maximum segment size option. More...
|
|
void | winscale (uint8_t value) |
| Add a window scale option. More...
|
|
uint8_t | winscale () const |
| Searchs for a window scale option. More...
|
|
void | sack_permitted () |
| Add a sack permitted option.
|
|
bool | has_sack_permitted () const |
| Searchs for a sack permitted option. More...
|
|
void | sack (const sack_type &edges) |
| Add a sack option. More...
|
|
sack_type | sack () const |
| Searchs for a sack option. More...
|
|
void | timestamp (uint32_t value, uint32_t reply) |
| Add a timestamp option. More...
|
|
std::pair< uint32_t, uint32_t > | timestamp () const |
| Searchs for a timestamp option. More...
|
|
void | altchecksum (AltChecksums value) |
| Add a alternate checksum option. More...
|
|
AltChecksums | altchecksum () const |
| Searchs for a alternate checksum option. More...
|
|
void | set_flag (Flags tcp_flag, small_uint< 1 > value) |
| Set a TCP flag value. More...
|
|
void | flags (small_uint< 12 > value) |
| Sets the value of the flag fields. More...
|
|
void | add_option (const option &opt) |
| Adds a TCP option. More...
|
|
void | add_option (option &&opt) |
| Adds a TCP option. More...
|
|
template<typename... Args> |
void | add_option (Args &&... args) |
| Adds a TCP option using the provided arguments. More...
|
|
bool | remove_option (OptionTypes type) |
| Removes a TCP option. More...
|
|
uint32_t | header_size () const |
| Returns the header size. More...
|
|
bool | matches_response (const uint8_t *ptr, uint32_t total_sz) const |
| Check whether ptr points to a valid response for this PDU. More...
|
|
PDUType | pdu_type () const |
| Getter for the PDU's type. More...
|
|
const option * | search_option (OptionTypes type) const |
| Searchs for an option that matchs the given type. More...
|
|
TCP * | clone () const |
|
| PDU () |
| Default constructor.
|
|
| PDU (PDU &&rhs) TINS_NOEXCEPT |
| Move constructor. More...
|
|
PDU & | operator= (PDU &&rhs) TINS_NOEXCEPT |
| Move assignment operator. More...
|
|
virtual | ~PDU () |
| PDU destructor. More...
|
|
virtual uint32_t | trailer_size () const |
| Trailer's size. More...
|
|
uint32_t | size () const |
| The whole chain of PDU's size, including this one. More...
|
|
virtual uint32_t | advertised_size () const |
| The whole chain of PDU's advertised size, including this one. More...
|
|
PDU * | inner_pdu () const |
| Getter for the inner PDU. More...
|
|
PDU * | parent_pdu () const |
|
PDU * | release_inner_pdu () |
| Releases the inner PDU. More...
|
|
void | inner_pdu (PDU *next_pdu) |
| Sets the child PDU. More...
|
|
void | inner_pdu (const PDU &next_pdu) |
| Sets the child PDU. More...
|
|
serialization_type | serialize () |
| Serializes the whole chain of PDU's, including this one. More...
|
|
template<typename T > |
T * | find_pdu (PDUType type=T::pdu_flag) |
| Finds and returns the first PDU that matches the given flag. More...
|
|
template<typename T > |
const T * | find_pdu (PDUType type=T::pdu_flag) const |
| Finds and returns the first PDU that matches the given flag. More...
|
|
template<typename T > |
T & | rfind_pdu (PDUType type=T::pdu_flag) |
| Finds and returns the first PDU that matches the given flag. More...
|
|
template<typename T > |
const T & | rfind_pdu (PDUType type=T::pdu_flag) const |
| Finds and returns the first PDU that matches the given flag. More...
|
|
virtual void | send (PacketSender &sender, const NetworkInterface &iface) |
| Send the stack of PDUs through a PacketSender. More...
|
|
virtual PDU * | recv_response (PacketSender &sender, const NetworkInterface &iface) |
| Receives a matching response for this packet. More...
|
|
virtual bool | matches_flag (PDUType flag) const |
| Check whether this PDU matches the specified flag. More...
|
|
Represents a TCP PDU.
This class represents a TCP PDU.
When sending TCP PDUs, the checksum is calculated automatically every time you send the packet.
While sniffing, the payload sent in each packet will be wrapped in a RawPDU, which is set as the TCP object's inner_pdu. Therefore, if you are sniffing and want to see the TCP packet's payload, you need to do the following:
const RawPDU& raw = tcp.rfind_pdu<RawPDU>();
std::vector< uint8_t > payload_type
Definition: rawpdu.h:69
TCP(uint16_t dport=0, uint16_t sport=0)
TCP constructor.
Definition: tcp.cpp:58
- See also
- RawPDU