libtins
4.0
|
Represents a DHCPv6 PDU. More...
#include <dhcpv6.h>
Classes | |
struct | authentication_type |
struct | duid_en |
struct | duid_ll |
struct | duid_llt |
struct | duid_type |
struct | ia_address_type |
struct | ia_na_type |
struct | ia_ta_type |
struct | status_code_type |
struct | user_class_type |
struct | vendor_class_type |
struct | vendor_info_type |
Public Types | |
enum | MessageType { SOLICIT = 1, ADVERTISE, REQUEST, CONFIRM, RENEW, REBIND, REPLY, RELEASE, DECLINE, RECONFIGURE, INFO_REQUEST, RELAY_FORWARD, RELAY_REPLY, LEASE_QUERY, LEASE_QUERY_REPLY, LEASE_QUERY_DONE, LEASE_QUERY_DATA } |
enum | OptionTypes { CLIENTID = 1, SERVERID, IA_NA, IA_TA, IA_ADDR, OPTION_REQUEST, PREFERENCE, ELAPSED_TIME, RELAY_MSG, AUTH = 11, UNICAST, STATUS_CODE, RAPID_COMMIT, USER_CLASS, VENDOR_CLASS, VENDOR_OPTS, INTERFACE_ID, RECONF_MSG, RECONF_ACCEPT, SIP_SERVER_D, SIP_SERVER_A, DNS_SERVERS, DOMAIN_LIST, IA_PD, IAPREFIX, NIS_SERVERS, NISP_SERVERS, NIS_DOMAIN_NAME, NISP_DOMAIN_NAME, SNTP_SERVERS, INFORMATION_REFRESH_TIME, BCMCS_SERVER_D, BCMCS_SERVER_A, GEOCONF_CIVIC = 36, REMOTE_ID, SUBSCRIBER_ID, CLIENT_FQDN, PANA_AGENT, NEW_POSIX_TIMEZONE, NEW_TZDB_TIMEZONE, ERO, LQ_QUERY, CLIENT_DATA, CLT_TIME, LQ_RELAY_DATA, LQ_CLIENT_LINK, MIP6_HNIDF, MIP6_VDINF, V6_LOST, CAPWAP_AC_V6, RELAY_ID, NTP_SERVER, V6_ACCESS_DOMAIN, SIP_UA_CS_LIST, BOOTFILE_URL, BOOTFILE_PARAM, CLIENT_ARCH_TYPE, NII, GEOLOCATION, AFTR_NAME, ERP_LOCAL_DOMAIN_NAME, RSOO, PD_EXCLUDE, VSS, MIP6_IDINF, MIP6_UDINF, MIP6_HNP, MIP6_HAA, MIP6_HAF, RDNSS_SELECTION, KRB_PRINCIPAL_NAME, KRB_REALM_NAME, KRB_DEFAULT_REALM_NAME, KRB_KDC } |
typedef PDUOption< uint16_t, DHCPv6 > | option |
typedef std::vector< option > | options_type |
typedef IPv6Address | ipaddress_type |
typedef std::vector< uint8_t > | class_option_data_type |
typedef std::vector< uint16_t > | option_request_type |
typedef std::vector< uint8_t > | relay_msg_type |
typedef std::vector< uint8_t > | interface_id_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 | |
DHCPv6 () | |
DHCPv6 (const uint8_t *buffer, uint32_t total_sz) | |
Constructs a DHCPv6 object from a buffer. More... | |
MessageType | msg_type () const |
Getter for the message type field. More... | |
uint8_t | hop_count () const |
Getter for the hop count field. More... | |
small_uint< 24 > | transaction_id () const |
Getter for the transaction id field. More... | |
const ipaddress_type & | peer_address () const |
Getter for the peer address field. More... | |
const ipaddress_type & | link_address () const |
Getter for the link address field. More... | |
const options_type & | options () const |
Getter for the DHCPv6 options. More... | |
void | msg_type (MessageType type) |
Setter for the message type field. More... | |
void | hop_count (uint8_t count) |
Setter for the hop count field. More... | |
void | transaction_id (small_uint< 24 > id) |
Setter for the transaction id field. More... | |
void | peer_address (const ipaddress_type &addr) |
Setter for the peer address field. More... | |
void | link_address (const ipaddress_type &addr) |
Setter for the link address field. More... | |
ia_na_type | ia_na () const |
Getter for the Identity Association for Non-Temporary Addresses option. More... | |
ia_ta_type | ia_ta () const |
Getter for the Identity Association for Temporary Addresses option. More... | |
ia_address_type | ia_address () const |
Getter for the Identity Association Address option. More... | |
option_request_type | option_request () const |
Getter for the Option Request option. More... | |
uint8_t | preference () const |
Getter for the Preference option. More... | |
uint16_t | elapsed_time () const |
Getter for the Elapsed Time option. More... | |
relay_msg_type | relay_message () const |
Getter for the Relay Message option. More... | |
authentication_type | authentication () const |
Getter for the Authentication option. More... | |
ipaddress_type | server_unicast () const |
Getter for the Server Unicast option. More... | |
status_code_type | status_code () const |
Getter for the Server Unicast option. More... | |
bool | has_rapid_commit () const |
Getter for the Rapid Commit option. More... | |
user_class_type | user_class () const |
Getter for the User Class option. More... | |
vendor_class_type | vendor_class () const |
Getter for the Vendor Class option. More... | |
vendor_info_type | vendor_info () const |
Getter for the Vendor-specific Information option. More... | |
interface_id_type | interface_id () const |
Getter for the Interface ID option. More... | |
uint8_t | reconfigure_msg () const |
Getter for the Reconfigure Message option. More... | |
bool | has_reconfigure_accept () const |
Getter for the Reconfigure Accept option. More... | |
duid_type | client_id () const |
Getter for the Client Identifier option. More... | |
duid_type | server_id () const |
Getter for the Server Identifier option. More... | |
void | ia_na (const ia_na_type &value) |
Setter for the Identity Association for Non-Temporary Addresses option. More... | |
void | ia_ta (const ia_ta_type &value) |
Setter for the Identity Association for Temporary Addresses option. More... | |
void | ia_address (const ia_address_type &value) |
Setter for the Identity Association Address option. More... | |
void | option_request (const option_request_type &value) |
Setter for the Identity Association Address option. More... | |
void | preference (uint8_t value) |
Setter for the Preference option. More... | |
void | elapsed_time (uint16_t value) |
Setter for the Elapsed Time option. More... | |
void | relay_message (const relay_msg_type &value) |
Setter for the Relay Message option. More... | |
void | authentication (const authentication_type &value) |
Setter for the Authentication option. More... | |
void | server_unicast (const ipaddress_type &value) |
Setter for the Server Unicast option. More... | |
void | status_code (const status_code_type &value) |
Setter for the Status Code option. More... | |
void | rapid_commit () |
Adds a Rapid Commit option. | |
void | user_class (const user_class_type &value) |
Setter for the User Class option. More... | |
void | vendor_class (const vendor_class_type &value) |
Setter for the Vendor Class option. More... | |
void | vendor_info (const vendor_info_type &value) |
Setter for the Vendor-specific Information option. More... | |
void | interface_id (const interface_id_type &value) |
Setter for the Interface ID option. More... | |
void | reconfigure_msg (uint8_t value) |
Setter for the Reconfigure Message option. More... | |
void | reconfigure_accept () |
Adds a Reconfigure Accept option. | |
void | client_id (const duid_type &value) |
Setter for the Client Identifier option. More... | |
void | server_id (const duid_type &value) |
Setter for the Server Identifier option. More... | |
bool | is_relay_message () const |
void | add_option (const option &opt) |
Adds a DHCPv6 option. More... | |
bool | remove_option (OptionTypes type) |
Removes a DHCPv6 option. More... | |
const option * | search_option (OptionTypes type) const |
Searchs for an option that matchs the given type. 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... | |
DHCPv6 * | clone () const |
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 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... | |
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::DHCPv6 |
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 a DHCPv6 PDU.
typedef std::vector<uint8_t> Tins::DHCPv6::class_option_data_type |
The type used to store the User Class option's user class data.
typedef std::vector<uint8_t> Tins::DHCPv6::interface_id_type |
The type used to store the Interface-ID option.
The type used to store IP addresses.
typedef PDUOption<uint16_t, DHCPv6> Tins::DHCPv6::option |
Represents a DHCPv6 option.
typedef std::vector<uint16_t> Tins::DHCPv6::option_request_type |
The type used to store the Option Request option.
typedef std::vector<option> Tins::DHCPv6::options_type |
The type used to store the DHCPv6 options.
typedef std::vector<uint8_t> Tins::DHCPv6::relay_msg_type |
The type used to store the Relay Message option.
The message types.
The DHCPv6 options.
Tins::DHCPv6::DHCPv6 | ( | ) |
Default constructor.
Tins::DHCPv6::DHCPv6 | ( | const uint8_t * | buffer, |
uint32_t | total_sz | ||
) |
Constructs a DHCPv6 object from a buffer.
If there is not enough size for the DHCPv6 header, or any of the TLV options contains an invalid size field, 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::DHCPv6::add_option | ( | const option & | opt | ) |
Adds a DHCPv6 option.
The option is added after the last option in the option fields.
opt | The option to be added |
DHCPv6::authentication_type Tins::DHCPv6::authentication | ( | ) | const |
Getter for the Authentication option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::authentication | ( | const authentication_type & | value | ) |
Setter for the Authentication option.
value | The new Authentication option data. |
DHCPv6::duid_type Tins::DHCPv6::client_id | ( | ) | const |
Getter for the Client Identifier option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::client_id | ( | const duid_type & | value | ) |
Setter for the Client Identifier option.
value | The new Client Identifier option data. |
|
inlinevirtual |
Implements Tins::PDU.
uint16_t Tins::DHCPv6::elapsed_time | ( | ) | const |
Getter for the Elapsed Time option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::elapsed_time | ( | uint16_t | value | ) |
Setter for the Elapsed Time option.
value | The new Elapsed Time option data. |
|
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 |
bool Tins::DHCPv6::has_rapid_commit | ( | ) | const |
Getter for the Rapid Commit option.
This method will throw an option_not_found exception if the option is not found.
bool Tins::DHCPv6::has_reconfigure_accept | ( | ) | const |
Getter for the Reconfigure Accept option.
This method will throw an option_not_found exception if the option is not found.
|
virtual |
Returns the header size.
This method overrides PDU::header_size.
Implements Tins::PDU.
|
inline |
Getter for the hop count field.
void Tins::DHCPv6::hop_count | ( | uint8_t | count | ) |
Setter for the hop count field.
count | The new hop count. |
DHCPv6::ia_address_type Tins::DHCPv6::ia_address | ( | ) | const |
Getter for the Identity Association Address option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::ia_address | ( | const ia_address_type & | value | ) |
Setter for the Identity Association Address option.
value | The new IA Address option data. |
DHCPv6::ia_na_type Tins::DHCPv6::ia_na | ( | ) | const |
Getter for the Identity Association for Non-Temporary Addresses option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::ia_na | ( | const ia_na_type & | value | ) |
Setter for the Identity Association for Non-Temporary Addresses option.
value | The new IA_NA option data. |
DHCPv6::ia_ta_type Tins::DHCPv6::ia_ta | ( | ) | const |
Getter for the Identity Association for Temporary Addresses option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::ia_ta | ( | const ia_ta_type & | value | ) |
Setter for the Identity Association for Temporary Addresses option.
value | The new IA_TA option data. |
DHCPv6::interface_id_type Tins::DHCPv6::interface_id | ( | ) | const |
Getter for the Interface ID option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::interface_id | ( | const interface_id_type & | value | ) |
Setter for the Interface ID option.
value | The new Interface ID option data. |
bool Tins::DHCPv6::is_relay_message | ( | ) | const |
Indicates whether this is a relay agent/server message
|
inline |
Getter for the link address field.
void Tins::DHCPv6::link_address | ( | const ipaddress_type & | addr | ) |
Setter for the link address field.
count | The new link address. |
|
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 message type field.
void Tins::DHCPv6::msg_type | ( | MessageType | type | ) |
Setter for the message type field.
type | The new message type. |
DHCPv6::option_request_type Tins::DHCPv6::option_request | ( | ) | const |
Getter for the Option Request option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::option_request | ( | const option_request_type & | value | ) |
Setter for the Identity Association Address option.
value | The new Option Request option data. |
|
inline |
Getter for the DHCPv6 options.
|
inlinevirtual |
|
inline |
Getter for the peer address field.
void Tins::DHCPv6::peer_address | ( | const ipaddress_type & | addr | ) |
Setter for the peer address field.
count | The new peer address. |
uint8_t Tins::DHCPv6::preference | ( | ) | const |
Getter for the Preference option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::preference | ( | uint8_t | value | ) |
Setter for the Preference option.
value | The new Preference option data. |
uint8_t Tins::DHCPv6::reconfigure_msg | ( | ) | const |
Getter for the Reconfigure Message option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::reconfigure_msg | ( | uint8_t | value | ) |
Setter for the Reconfigure Message option.
value | The new Reconfigure Message option data. |
DHCPv6::relay_msg_type Tins::DHCPv6::relay_message | ( | ) | const |
Getter for the Relay Message option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::relay_message | ( | const relay_msg_type & | value | ) |
Setter for the Relay Message option.
value | The new Relay Message option data. |
bool Tins::DHCPv6::remove_option | ( | OptionTypes | type | ) |
Removes a DHCPv6 option.
If there are multiple options of the given type, only the first one will be removed.
type | The type of the option to be removed. |
const DHCPv6::option * Tins::DHCPv6::search_option | ( | OptionTypes | type | ) | const |
Searchs for an option that matchs the given type.
If the option is not found, a null pointer is returned. Deleting the returned pointer will result in undefined behaviour.
type | The option identifier to be searched. |
DHCPv6::duid_type Tins::DHCPv6::server_id | ( | ) | const |
Getter for the Server Identifier option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::server_id | ( | const duid_type & | value | ) |
Setter for the Server Identifier option.
value | The new Server Identifier option data. |
DHCPv6::ipaddress_type Tins::DHCPv6::server_unicast | ( | ) | const |
Getter for the Server Unicast option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::server_unicast | ( | const ipaddress_type & | value | ) |
Setter for the Server Unicast option.
value | The new Server Unicast option data. |
DHCPv6::status_code_type Tins::DHCPv6::status_code | ( | ) | const |
Getter for the Server Unicast option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::status_code | ( | const status_code_type & | value | ) |
Setter for the Status Code option.
value | The new Status Code option data. |
|
inline |
Getter for the transaction id field.
void Tins::DHCPv6::transaction_id | ( | small_uint< 24 > | id | ) |
Setter for the transaction id field.
id | The new transaction id. |
DHCPv6::user_class_type Tins::DHCPv6::user_class | ( | ) | const |
Getter for the User Class option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::user_class | ( | const user_class_type & | value | ) |
Setter for the User Class option.
value | The new User Class option data. |
DHCPv6::vendor_class_type Tins::DHCPv6::vendor_class | ( | ) | const |
Getter for the Vendor Class option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::vendor_class | ( | const vendor_class_type & | value | ) |
Setter for the Vendor Class option.
value | The new Vendor Class option data. |
DHCPv6::vendor_info_type Tins::DHCPv6::vendor_info | ( | ) | const |
Getter for the Vendor-specific Information option.
This method will throw an option_not_found exception if the option is not found.
void Tins::DHCPv6::vendor_info | ( | const vendor_info_type & | value | ) |
Setter for the Vendor-specific Information option.
value | The new Vendor-specific Information option data. |
|
static |
This PDU's flag.