libtins  3.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
Tins::DNS::resource Class Reference

Class that represent DNS resource records. More...

#include <dns.h>

Public Member Functions

 resource (const std::string &dname, const std::string &data, uint16_t type, uint16_t rclass, uint32_t ttl, uint16_t preference=0)
 
const std::string & dname () const
 Getter for the domain name field. More...
 
const std::string & data () const
 
uint16_t query_type () const
 
 TINS_DEPRECATED (uint16_t type() const)
 Getter for the query type field. More...
 
uint16_t query_class () const
 
uint32_t ttl () const
 
uint16_t preference () const
 Getter for the preferece field. More...
 
void dname (const std::string &data)
 
void data (const std::string &data)
 Setter for the data field. More...
 
void data (const soa_record &data)
 Sets the contents of this resource to the provided SOA record. More...
 
void query_type (uint16_t data)
 
 TINS_DEPRECATED (void type(uint16_t data))
 Setter for the query type field. More...
 
void query_class (uint16_t data)
 
void ttl (uint32_t data)
 
void preference (uint16_t data)
 Setter for the preference field. More...
 

Detailed Description

Class that represent DNS resource records.

Constructor & Destructor Documentation

Tins::DNS::resource::resource ( const std::string &  dname,
const std::string &  data,
uint16_t  type,
uint16_t  rclass,
uint32_t  ttl,
uint16_t  preference = 0 
)
inline

Constructs a Resource object.

Parameters
dnameThe domain name for which this records provides an answer.
dataThe resource's payload.
typeThe type of this record.
rclassThe class of this record.
ttlThe time-to-live of this record.

Member Function Documentation

const std::string& Tins::DNS::resource::data ( ) const
inline

Getter for the data field.

void Tins::DNS::resource::data ( const std::string &  data)
inline

Setter for the data field.

The data will be encoded properly by the DNS class before being added to this packet. That means that if the type is A or AAAA, it will be properly encoded as an IPv4 or IPv6 address.

The same happens for records that contain domain names, such as NS or CNAME. This data will be encoded using DNS domain name encoding.

void Tins::DNS::resource::data ( const soa_record data)
inline

Sets the contents of this resource to the provided SOA record.

Parameters
dataThe SOA record that will be stored in this resource
const std::string& Tins::DNS::resource::dname ( ) const
inline

Getter for the domain name field.

This returns the domain name for which this record provides an answer.

void Tins::DNS::resource::dname ( const std::string &  data)
inline

Setter for the domain name field.

uint16_t Tins::DNS::resource::preference ( ) const
inline

Getter for the preferece field.

This field is only valid for MX resources.

void Tins::DNS::resource::preference ( uint16_t  data)
inline

Setter for the preference field.

This field is only valid for MX resources.

uint16_t Tins::DNS::resource::query_class ( ) const
inline

Getter for the query class field.

void Tins::DNS::resource::query_class ( uint16_t  data)
inline

Setter for the query class field.

uint16_t Tins::DNS::resource::query_type ( ) const
inline

Getter for the query type field.

void Tins::DNS::resource::query_type ( uint16_t  data)
inline

Setter for the query type field.

Tins::DNS::resource::TINS_DEPRECATED ( uint16_t type()  const)
inline

Getter for the query type field.

This method is deprecated. Use resource::query_type

Deprecated:
See Also
resource::query_type
Tins::DNS::resource::TINS_DEPRECATED ( void   typeuint16_t data)
inline

Setter for the query type field.

This method is deprecated. Use query::query_type

Deprecated:
See Also
resource::query_type
uint32_t Tins::DNS::resource::ttl ( ) const
inline

Getter for the time-to-live field.

void Tins::DNS::resource::ttl ( uint32_t  data)
inline

Setter for the time-to-live field.


The documentation for this class was generated from the following file: