|
enum | Flags { FLAG_RESERVED = 4
, DONT_FRAGMENT = 2
, MORE_FRAGMENTS = 1
} |
|
enum | OptionClass { CONTROL = 0
, MEASUREMENT = 2
} |
| Enum indicating the option's class. More...
|
|
enum | OptionNumber {
END = 0
, NOOP = 1
, SEC = 2
, LSRR = 3
,
TIMESTAMP = 4
, EXTSEC = 5
, RR = 7
, SID = 8
,
SSRR = 9
, MTUPROBE = 11
, MTUREPLY = 12
, EIP = 17
,
TR = 18
, ADDEXT = 19
, RTRALT = 20
, SDB = 21
,
DPS = 23
, UMP = 24
, QS = 25
} |
| Enum indicating the option's id number. More...
|
|
typedef IPv4Address | address_type |
|
typedef PDUOption< option_identifier, IP > | option |
|
typedef generic_route_option_type | lsrr_type |
|
typedef generic_route_option_type | ssrr_type |
|
typedef generic_route_option_type | record_route_type |
|
typedef std::vector< option > | options_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 |
|
|
| IP (address_type ip_dst=address_type(), address_type ip_src=address_type()) |
| Constructor for building the IP PDU. More...
|
|
| IP (const uint8_t *buffer, uint32_t total_sz) |
| Constructs an IP object from a buffer and adds all identifiable PDUs found in the buffer as children of this one. More...
|
|
uint32_t | advertised_size () const |
| The whole chain of PDU's advertised size, including this one. More...
|
|
small_uint< 4 > | head_len () const |
| Getter for the header length field. More...
|
|
uint8_t | tos () const |
| Getter for the type of service field. More...
|
|
uint16_t | tot_len () const |
| Getter for the total length field. More...
|
|
uint16_t | id () const |
| Getter for the id field. More...
|
|
| TINS_DEPRECATED (uint16_t frag_off() const) |
| Getter for the fragment offset field. More...
|
|
small_uint< 13 > | fragment_offset () const |
| Getter for the fragment offset field. More...
|
|
Flags | flags () const |
| Getter for the flags field. More...
|
|
uint8_t | ttl () const |
| Getter for the time to live field. More...
|
|
uint8_t | protocol () const |
| Getter for the protocol field. More...
|
|
uint16_t | checksum () const |
| Getter for the checksum field. More...
|
|
address_type | src_addr () const |
| Getter for the source address field. More...
|
|
address_type | dst_addr () const |
| Getter for the destination address field. More...
|
|
small_uint< 4 > | version () const |
| Getter for the version field. More...
|
|
const options_type & | options () const |
| Getter for the IP options. More...
|
|
void | tos (uint8_t new_tos) |
| Setter for the type of service field. More...
|
|
void | id (uint16_t new_id) |
| Setter for the id field. More...
|
|
| TINS_DEPRECATED (void frag_off(uint16_t new_frag_off)) |
| Setter for the fragment offset field. More...
|
|
void | fragment_offset (small_uint< 13 > new_frag_off) |
| Setter for the fragment offset field. More...
|
|
void | flags (Flags new_flags) |
| Setter for the flags field. More...
|
|
void | ttl (uint8_t new_ttl) |
| Setter for the time to live field. More...
|
|
void | protocol (uint8_t new_protocol) |
| Setter for the protocol field. More...
|
|
void | src_addr (address_type ip) |
| Setter for the source address field. More...
|
|
void | dst_addr (address_type ip) |
| Setter for the destination address field. More...
|
|
void | version (small_uint< 4 > ver) |
| Setter for the version field. More...
|
|
void | add_option (const option &opt) |
| Adds an IP option. More...
|
|
void | add_option (option &&opt) |
| Adds an IP option. More...
|
|
template<typename... Args> |
void | add_option (Args &&... args) |
| Adds an IP option. More...
|
|
bool | remove_option (option_identifier id) |
| Removes an IP option. More...
|
|
const option * | search_option (option_identifier id) const |
| Searchs for an option that matchs the given flag. More...
|
|
void | eol () |
| Adds an End Of List option.
|
|
void | noop () |
| Adds a NOP option.
|
|
void | security (const security_type &data) |
| Adds a security option. More...
|
|
void | lsrr (const lsrr_type &data) |
| Adds a Loose Source and Record Route option. More...
|
|
void | ssrr (const ssrr_type &data) |
| Adds a Strict Source and Record Route option. More...
|
|
void | record_route (const record_route_type &data) |
| Adds a Record Route option. More...
|
|
void | stream_identifier (uint16_t stream_id) |
| Adds a Stream Identifier option. More...
|
|
security_type | security () const |
| Searchs and returns a security option. More...
|
|
lsrr_type | lsrr () const |
| Searchs and returns a Loose Source and Record Route option. More...
|
|
ssrr_type | ssrr () const |
| Searchs and returns a Strict Source and Record Route option. More...
|
|
record_route_type | record_route () const |
| Searchs and returns a Record Route option. More...
|
|
uint16_t | stream_identifier () const |
| Searchs and returns a Stream Identifier option. More...
|
|
uint32_t | header_size () const |
| Returns the header size. More...
|
|
void | send (PacketSender &sender, const NetworkInterface &) |
|
bool | matches_response (const uint8_t *ptr, uint32_t total_sz) const |
| Check whether ptr points to a valid response for this PDU. More...
|
|
PDU * | recv_response (PacketSender &sender, const NetworkInterface &) |
| Receives a matching response for this packet. More...
|
|
bool | is_fragmented () const |
|
PDUType | pdu_type () const |
| Getter for the PDU's type. More...
|
|
IP * | 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 | header_size () const =0 |
| The header's size. 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 PDU * | clone () const =0 |
| Clones this packet. 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_response (const uint8_t *ptr, uint32_t total_sz) const |
| Check whether ptr points to a valid response for this PDU. More...
|
|
virtual bool | matches_flag (PDUType flag) const |
| Check whether this PDU matches the specified flag. More...
|
|
virtual PDUType | pdu_type () const =0 |
| Getter for the PDU's type. More...
|
|
Class that represents an IP PDU.
By default, IP PDUs are initialized, setting TTL to IP::DEFAULT_TTL, id field to 1 and version to 4. Taking this into account, users should set destination and source port and would be enough to send one.
When IP is the lowest layer on a packet, and the packet is serialized this willc heck if the source address is different than 0.0.0.0. If it is, the address of the interface in which the packet is going to be sent is retrieved (by using the routing table and the destination address) and set as the source address. If you don't want this behaviour, simply set the source address to 0.0.0.0.