33#include <tins/macros.h>
34#include <tins/cxxstd.h>
36#include <tins/endianness.h>
37#include <tins/small_uint.h>
38#include <tins/pdu_option.h>
39#include <tins/ipv6_address.h>
44class OutputMemoryStream;
86 DESTINATION_ROUTING_OPTIONS = 60,
90 SECURITY_ENCAPSULATION = 50,
91 DESTINATION_OPTIONS = 60,
102 JUMBO_PAYLOAD = 0xC2,
117 std::vector<header_option_type> options;
126 std::vector<header_option_type> options;
137 std::vector<uint8_t> data;
184 return header_.version;
192 #if TINS_IS_LITTLE_ENDIAN
193 return ((header_.traffic_class << 4) & 0xf0) |
194 ((header_.flow_label[0] >> 4) & 0x0f);
196 return header_.traffic_class;
205 #if TINS_IS_LITTLE_ENDIAN
206 return ((header_.flow_label[0] & 0x0f) << 16)
207 | (header_.flow_label[1] << 8)
208 | (header_.flow_label[2]);
210 return header_.flow_label;
219 return Endian::be_to_host(header_.payload_length);
227 return header_.next_header;
235 return header_.hop_limit;
243 return header_.src_addr;
251 return header_.dst_addr;
332 return new IPv6(*
this);
380 ext_headers_.emplace_back(std::move(
header));
388 template <
typename...
Args>
390 ext_headers_.emplace_back(std::forward<Args>(
args)...);
405 const ext_header* search_header(ExtensionHeader
id)
const;
408 void set_last_next_header(
uint8_t value);
409 uint32_t calculate_headers_size()
const;
410 static void write_header(
const ext_header&
header, Memory::OutputMemoryStream&
stream);
413 static std::vector<header_option_type> parse_header_options(
const uint8_t* data,
size_t size);
417 #if TINS_IS_BIG_ENDIAN
432 uint8_t src_addr[16], dst_addr[16];
436 headers_type ext_headers_;
437 uint8_t next_header_;
Represents a range of addresses.
Definition address_range.h:167
Definition ipv6_address.h:45
IPv6Address address_type
Definition ipv6.h:64
address_type src_addr() const
Getter for the src_addr field.
Definition ipv6.h:242
uint16_t payload_length() const
Getter for the payload_length field.
Definition ipv6.h:218
std::pair< uint8_t, std::vector< uint8_t > > header_option_type
Definition ipv6.h:79
PDUType pdu_type() const
Getter for the PDU's type.
Definition ipv6.h:339
std::vector< ext_header > headers_type
Definition ipv6.h:74
PDUOption< uint8_t, IPv6 > ext_header
Definition ipv6.h:69
uint8_t hop_limit() const
Getter for the hop_limit field.
Definition ipv6.h:234
address_type dst_addr() const
Getter for the dst_addr field.
Definition ipv6.h:250
uint8_t next_header() const
Getter for the next_header field.
Definition ipv6.h:226
uint8_t traffic_class() const
Getter for the traffic_class field.
Definition ipv6.h:191
small_uint< 20 > flow_label() const
Getter for the flow_label field.
Definition ipv6.h:204
ExtensionHeader
Definition ipv6.h:84
TINS_DEPRECATED(void add_ext_header(const ext_header &header))
const headers_type & headers() const
Getter for the IPv6 extension headers.
Definition ipv6.h:258
IPv6 * clone() const
Definition ipv6.h:331
void add_header(ext_header &&header)
Definition ipv6.h:379
void add_header(Args &&... args)
Definition ipv6.h:389
OptionType
Definition ipv6.h:99
small_uint< 4 > version() const
Getter for the version field.
Definition ipv6.h:183
Abstraction of a network interface.
Definition network_interface.h:47
Represents a PDU option field.
Definition pdu_option.h:201
Base class for protocol data units.
Definition pdu.h:107
PDUType
Enum which identifies each type of PDU.
Definition pdu.h:127
Sends packets through a network interface.
Definition packet_sender.h:118
The Tins namespace.
Definition address_range.h:38