|
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
, VXLAN
,
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.
|
|
| TCP (const uint8_t *buffer, uint32_t total_sz) |
| Constructs TCP object from a buffer.
|
|
uint16_t | dport () const |
| Getter for the destination port field.
|
|
uint16_t | sport () const |
| Getter for the source port field.
|
|
uint32_t | seq () const |
| Getter for the sequence number field.
|
|
uint32_t | ack_seq () const |
| Getter for the acknowledge number field.
|
|
uint16_t | window () const |
| Getter for the window size field.
|
|
uint16_t | checksum () const |
| Getter for the checksum field.
|
|
uint16_t | urg_ptr () const |
| Getter for the urgent pointer field.
|
|
small_uint< 4 > | data_offset () const |
| Getter for the data offset field.
|
|
const options_type & | options () const |
| Getter for the option list.
|
|
small_uint< 1 > | get_flag (Flags tcp_flag) const |
| Gets the value of a flag.
|
|
small_uint< 12 > | flags () const |
| Gets the flags' values.
|
|
bool | has_flags (small_uint< 12 > check_flags) const |
| Check if the given flags are set.
|
|
void | dport (uint16_t new_dport) |
| Setter for the destination port field.
|
|
void | sport (uint16_t new_sport) |
| Setter for the source port field.
|
|
void | seq (uint32_t new_seq) |
| Setter for the sequence number.
|
|
void | ack_seq (uint32_t new_ack_seq) |
| Setter for the acknowledge number.
|
|
void | window (uint16_t new_window) |
| Setter for the window size.
|
|
void | urg_ptr (uint16_t new_urg_ptr) |
| Setter for the urgent pointer field.
|
|
void | data_offset (small_uint< 4 > new_doff) |
| Setter for the data offset pointer field.
|
|
void | mss (uint16_t value) |
| Add a maximum segment size option.
|
|
uint16_t | mss () const |
| Searchs for a maximum segment size option.
|
|
void | winscale (uint8_t value) |
| Add a window scale option.
|
|
uint8_t | winscale () const |
| Searchs for a window scale option.
|
|
void | sack_permitted () |
| Add a sack permitted option.
|
|
bool | has_sack_permitted () const |
| Searchs for a sack permitted option.
|
|
void | sack (const sack_type &edges) |
| Add a sack option.
|
|
sack_type | sack () const |
| Searchs for a sack option.
|
|
void | timestamp (uint32_t value, uint32_t reply) |
| Add a timestamp option.
|
|
std::pair< uint32_t, uint32_t > | timestamp () const |
| Searchs for a timestamp option.
|
|
void | altchecksum (AltChecksums value) |
| Add a alternate checksum option.
|
|
AltChecksums | altchecksum () const |
| Searchs for a alternate checksum option.
|
|
void | set_flag (Flags tcp_flag, small_uint< 1 > value) |
| Set a TCP flag value.
|
|
void | flags (small_uint< 12 > value) |
| Sets the value of the flag fields.
|
|
void | add_option (const option &opt) |
| Adds a TCP option.
|
|
void | add_option (option &&opt) |
| Adds a TCP option.
|
|
template<typename... Args> |
void | add_option (Args &&... args) |
| Adds a TCP option using the provided arguments.
|
|
bool | remove_option (OptionTypes type) |
| Removes a TCP option.
|
|
uint32_t | header_size () const |
| Returns the header size.
|
|
bool | matches_response (const uint8_t *ptr, uint32_t total_sz) const |
| Check whether ptr points to a valid response for this PDU.
|
|
PDUType | pdu_type () const |
| Getter for the PDU's type.
|
|
const option * | search_option (OptionTypes type) const |
| Searchs for an option that matchs the given type.
|
|
TCP * | clone () const |
|
| PDU () |
| Default constructor.
|
|
| PDU (PDU &&rhs) TINS_NOEXCEPT |
| Move constructor.
|
|
PDU & | operator= (PDU &&rhs) TINS_NOEXCEPT |
| Move assignment operator.
|
|
virtual | ~PDU () |
| PDU destructor.
|
|
virtual uint32_t | trailer_size () const |
| Trailer's size.
|
|
uint32_t | size () const |
| The whole chain of PDU's size, including this one.
|
|
virtual uint32_t | advertised_size () const |
| The whole chain of PDU's advertised size, including this one.
|
|
PDU * | inner_pdu () const |
| Getter for the inner PDU.
|
|
PDU * | parent_pdu () const |
|
PDU * | release_inner_pdu () |
| Releases the inner PDU.
|
|
void | inner_pdu (PDU *next_pdu) |
| Sets the child PDU.
|
|
void | inner_pdu (const PDU &next_pdu) |
| Sets the child PDU.
|
|
serialization_type | serialize () |
| Serializes the whole chain of PDU's, including this one.
|
|
template<typename T > |
T * | find_pdu (PDUType type=T::pdu_flag) |
| Finds and returns the first PDU that matches the given flag.
|
|
template<typename T > |
const T * | find_pdu (PDUType type=T::pdu_flag) const |
| Finds and returns the first PDU that matches the given flag.
|
|
template<typename T > |
T & | rfind_pdu (PDUType type=T::pdu_flag) |
| Finds and returns the first PDU that matches the given flag.
|
|
template<typename T > |
const T & | rfind_pdu (PDUType type=T::pdu_flag) const |
| Finds and returns the first PDU that matches the given flag.
|
|
virtual void | send (PacketSender &sender, const NetworkInterface &iface) |
| Send the stack of PDUs through a PacketSender.
|
|
virtual PDU * | recv_response (PacketSender &sender, const NetworkInterface &iface) |
| Receives a matching response for this packet.
|
|
virtual bool | matches_flag (PDUType flag) const |
| Check whether this PDU matches the specified flag.
|
|
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:
T & rfind_pdu(PDUType type=T::pdu_flag)
Finds and returns the first PDU that matches the given flag.
Definition pdu.h:393
std::vector< uint8_t > payload_type
Definition rawpdu.h:69
void payload(const payload_type &pload)
Setter for the payload field.
Definition rawpdu.cpp:55
Represents a TCP PDU.
Definition tcp.h:76
- See also
- RawPDU