DwmDns-0.1.0
Dwm::Dns::Label Class Reference

Encapsulates a DNS label. More...

#include <DwmDnsLabel.hh>

Public Member Functions

 Label ()=default
 Default constructor. Creates an empty label.
 
 Label (const std::string &label)
 Construct from a string.
 
 operator std::string () const
 Convert to a string.
 
uint8_t * Encode (uint8_t *pkt, uint8_t *ptr, uint16_t pktlen) const
 Encodes the label into buffer @ pkt of length pktlen, starting at ptr. More...
 
const uint8_t * Decode (const uint8_t *pkt, const uint8_t *ptr, uint16_t pktlen)
 Decodes the label from buffer pkt of length pktlen, starting at ptr. More...
 

Protected Attributes

std::string _value
 

Detailed Description

Encapsulates a DNS label.

See section 2.3.1 of RFC1035 for details.

Member Function Documentation

◆ Decode()

const uint8_t* Dwm::Dns::Label::Decode ( const uint8_t *  pkt,
const uint8_t *  ptr,
uint16_t  pktlen 
)

Decodes the label from buffer pkt of length pktlen, starting at ptr.

Returns the address immediately following the encoded label in pkt on success. Throws std::out_of_range if pkt was too short to contain an encoded label.

◆ Encode()

uint8_t* Dwm::Dns::Label::Encode ( uint8_t *  pkt,
uint8_t *  ptr,
uint16_t  pktlen 
) const

Encodes the label into buffer @ pkt of length pktlen, starting at ptr.

Returns the address immediately following the encoded label in pkt on success. Throws std::out_of_range if pkt is too short to contain the encoded label.


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