libtins
4.0
|
#include <ipv6.h>
Classes | |
struct | destination_routing_header |
struct | fragment_header |
The type used to store Fragment Extension headers. More... | |
struct | hop_by_hop_header |
struct | routing_header |
The type used to store Routing Extension headers. More... | |
Public Types | |
enum | ExtensionHeader { HOP_BY_HOP = 0, DESTINATION_ROUTING_OPTIONS = 60, ROUTING = 43, FRAGMENT = 44, AUTHENTICATION = 51, SECURITY_ENCAPSULATION = 50, DESTINATION_OPTIONS = 60, MOBILITY = 135, NO_NEXT_HEADER = 59 } |
enum | OptionType { PAD_1 = 0, PAD_N = 1, JUMBO_PAYLOAD = 0xC2 } |
typedef IPv6Address | address_type |
typedef PDUOption< uint8_t, IPv6 > | ext_header |
typedef std::vector< ext_header > | headers_type |
typedef std::pair< uint8_t, std::vector< uint8_t > > | header_option_type |
Public Types inherited from Tins::PDU | |
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, DOT1Q, PPPOE, STP, PPI, IPSEC_AH, IPSEC_ESP, PKTAP, MPLS, UNKNOWN = 999, USER_DEFINED_PDU = 1000 } |
Enum which identifies each type of PDU. More... | |
typedef byte_array | serialization_type |
Public Member Functions | |
IPv6 (address_type ip_dst=address_type(), address_type ip_src=address_type(), PDU *child=0) | |
Constructs an IPv6 object. More... | |
IPv6 (const uint8_t *buffer, uint32_t total_sz) | |
Constructs an IPv6 object from a buffer and adds all identifiable PDUs found in the buffer as children of this one. More... | |
small_uint< 4 > | version () const |
Getter for the version field. More... | |
uint8_t | traffic_class () const |
Getter for the traffic_class field. More... | |
small_uint< 20 > | flow_label () const |
Getter for the flow_label field. More... | |
uint16_t | payload_length () const |
Getter for the payload_length field. More... | |
uint8_t | next_header () const |
Getter for the next_header field. More... | |
uint8_t | hop_limit () const |
Getter for the hop_limit field. More... | |
address_type | src_addr () const |
Getter for the src_addr field. More... | |
address_type | dst_addr () const |
Getter for the dst_addr field. More... | |
const headers_type & | headers () const |
Getter for the IPv6 extension headers. More... | |
void | version (small_uint< 4 > new_version) |
Setter for the version field. More... | |
void | traffic_class (uint8_t new_traffic_class) |
Setter for the traffic_class field. More... | |
void | flow_label (small_uint< 20 > new_flow_label) |
Setter for the flow_label field. More... | |
void | payload_length (uint16_t new_payload_length) |
Setter for the payload_length field. More... | |
void | next_header (uint8_t new_next_header) |
Setter for the next_header field. More... | |
void | hop_limit (uint8_t new_hop_limit) |
Setter for the hop_limit field. More... | |
void | src_addr (const address_type &new_src_addr) |
Setter for the src_addr field. More... | |
void | dst_addr (const address_type &new_dst_addr) |
Setter for the dst_addr field. 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... | |
IPv6 * | clone () const |
PDUType | pdu_type () const |
Getter for the PDU's type. More... | |
void | send (PacketSender &sender, const NetworkInterface &) |
PDU * | recv_response (PacketSender &sender, const NetworkInterface &) |
Receives a matching response for this packet. More... | |
TINS_DEPRECATED (void add_ext_header(const ext_header &header)) | |
void | add_header (const ext_header &header) |
void | add_header (ext_header &&header) |
template<typename... Args> | |
void | add_header (Args &&...args) |
const ext_header * | search_header (ExtensionHeader id) const |
Searchs for an extension header that matchs the given flag. More... | |
Public Member Functions inherited from Tins::PDU | |
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... | |
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 bool | matches_flag (PDUType flag) const |
Check whether this PDU matches the specified flag. More... | |
Static Public Member Functions | |
static metadata | extract_metadata (const uint8_t *buffer, uint32_t total_sz) |
Extracts metadata for this protocol based on the buffer provided. More... | |
Static Public Attributes | |
static const PDU::PDUType | pdu_flag = PDU::IPv6 |
Static Public Attributes inherited from Tins::PDU | |
static const endian_type | endianness = BE |
Additional Inherited Members | |
Protected Member Functions inherited from Tins::PDU | |
PDU (const PDU &other) | |
Copy constructor. | |
PDU & | operator= (const PDU &other) |
Copy assignment operator. | |
void | copy_inner_pdu (const PDU &pdu) |
Copy other PDU's inner PDU(if any). More... | |
virtual void | prepare_for_serialize () |
Prepares this PDU for serialization. More... | |
void | serialize (uint8_t *buffer, uint32_t total_sz) |
Serializes this PDU and propagates this action to child PDUs. More... | |
Represents an IPv6 PDU.
typedef IPv6Address Tins::IPv6::address_type |
The type used to store addresses.
typedef PDUOption<uint8_t, IPv6> Tins::IPv6::ext_header |
The type used to represent IPv6 extension headers.
typedef std::pair<uint8_t, std::vector<uint8_t> > Tins::IPv6::header_option_type |
The type used to store an extension header option.
typedef std::vector<ext_header> Tins::IPv6::headers_type |
The type used to store the extension headers.
The values used to identify extension headers.
The values used to identify Hop-By-Hop Options and Destination Options.
Tins::IPv6::IPv6 | ( | address_type | ip_dst = address_type() , |
address_type | ip_src = address_type() , |
||
PDU * | child = 0 |
||
) |
Tins::IPv6::IPv6 | ( | const uint8_t * | buffer, |
uint32_t | total_sz | ||
) |
Constructs an IPv6 object from a buffer and adds all identifiable PDUs found in the buffer as children of this one.
If there is not enough size for an IPv6 header, a malformed_packet exception is thrown.
buffer | The buffer from which this PDU will be constructed. |
total_sz | The total size of the buffer. |
void Tins::IPv6::add_header | ( | const ext_header & | header | ) |
Adds an extension header
header | The extension header to be added. |
|
inline |
Adds an extension header by moving it
header | The extension header to be added. |
|
inline |
Adds an extension header by using the provided parameters
header | The extension header to be added. |
|
inlinevirtual |
Implements Tins::PDU.
|
inline |
Getter for the dst_addr field.
void Tins::IPv6::dst_addr | ( | const address_type & | new_dst_addr | ) |
Setter for the dst_addr field.
new_dst_addr | The new dst_addr field value. |
|
static |
Extracts metadata for this protocol based on the buffer provided.
buffer | Pointer to a buffer |
total_sz | Size of the buffer pointed by buffer |
|
inline |
Getter for the flow_label field.
void Tins::IPv6::flow_label | ( | small_uint< 20 > | new_flow_label | ) |
Setter for the flow_label field.
new_flow_label | The new flow_label field value. |
|
virtual |
Returns the header size.
This method overrides PDU::header_size.
Implements Tins::PDU.
|
inline |
Getter for the IPv6 extension headers.
|
inline |
Getter for the hop_limit field.
void Tins::IPv6::hop_limit | ( | uint8_t | new_hop_limit | ) |
Setter for the hop_limit field.
new_hop_limit | The new hop_limit field value. |
|
virtual |
Check whether ptr points to a valid response for this PDU.
ptr | The pointer to the buffer. |
total_sz | The size of the buffer. |
Reimplemented from Tins::PDU.
|
inline |
Getter for the next_header field.
void Tins::IPv6::next_header | ( | uint8_t | new_next_header | ) |
Setter for the next_header field.
new_next_header | The new next_header field value. |
|
inline |
Getter for the payload_length field.
void Tins::IPv6::payload_length | ( | uint16_t | new_payload_length | ) |
Setter for the payload_length field.
new_payload_length | The new payload_length field value. |
|
inlinevirtual |
|
virtual |
Receives a matching response for this packet.
sender | The packet sender which will receive the packet. |
Reimplemented from Tins::PDU.
const IPv6::ext_header * Tins::IPv6::search_header | ( | ExtensionHeader | id | ) | const |
Searchs for an extension header that matchs the given flag.
If the header is not found, a null pointer is returned. Deleting the returned pointer will result in undefined behaviour.
id | The header identifier to be searched. |
|
virtual |
Reimplemented from Tins::PDU.
|
inline |
Getter for the src_addr field.
void Tins::IPv6::src_addr | ( | const address_type & | new_src_addr | ) |
Setter for the src_addr field.
new_src_addr | The new src_addr field value. |
Tins::IPv6::TINS_DEPRECATED | ( | void | add_ext_headerconst ext_header &header | ) |
Adds an extension header.
header | The extension header to be added. |
|
inline |
Getter for the traffic_class field.
void Tins::IPv6::traffic_class | ( | uint8_t | new_traffic_class | ) |
Setter for the traffic_class field.
new_traffic_class | The new traffic_class field value. |
|
inline |
Getter for the version field.
void Tins::IPv6::version | ( | small_uint< 4 > | new_version | ) |
Setter for the version field.
new_version | The new version field value. |
|
static |
This PDU's flag.