Encapsulates a DNS message question. More...
#include <DwmDnsMessageQuestion.hh>
Public Member Functions | |
| MessageQuestion () | |
| Constructs an empty question. | |
| MessageQuestion (const std::string &qname, uint16_t qtype, uint16_t qclass) | |
Constructs a question for domain name qname of type qtype and class qclass. More... | |
| bool | operator== (const MessageQuestion &question) const |
| Equal-to operator, mostly useful for unit testing. | |
| const std::string & | QName () const |
| Returns the QNAME from the question. | |
| const std::string & | QName (const std::string &qname) |
| Sets and returns the QNAME of the question. | |
| uint16_t | QType () const |
| Returns the QTYPE of the question. | |
| uint16_t | QType (uint16_t qtype) |
| Sets and returns the QTYPE of the question. | |
| uint16_t | QClass () const |
| Returns the QCLASS of the question. | |
| uint16_t | QClass (uint16_t qclass) |
| Sets and returns the QCLASS of the question. | |
| uint8_t * | Encode (uint8_t *pkt, uint8_t *ptr, uint16_t pktlen, LabelPositions &lps) const |
Encodes the question 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 question from buffer pkt of length pktlen, starting at ptr. More... | |
Static Public Attributes | |
| static constexpr uint16_t | k_typeA = 1 |
| Query types. | |
| static constexpr uint16_t | k_typeNS = 2 |
| static constexpr uint16_t | k_typeCNAME = 5 |
| static constexpr uint16_t | k_typeSOA = 6 |
| static constexpr uint16_t | k_typeMB = 7 |
| static constexpr uint16_t | k_typeMG = 8 |
| static constexpr uint16_t | k_typeMR = 9 |
| static constexpr uint16_t | k_typePTR = 12 |
| static constexpr uint16_t | k_typeHINFO = 13 |
| static constexpr uint16_t | k_typeMINFO = 14 |
| static constexpr uint16_t | k_typeMX = 15 |
| static constexpr uint16_t | k_typeTXT = 16 |
| static constexpr uint16_t | k_typeRP = 17 |
| static constexpr uint16_t | k_typeKEY = 25 |
| static constexpr uint16_t | k_typeAAAA = 28 |
| static constexpr uint16_t | k_typeLOC = 29 |
| static constexpr uint16_t | k_typeSRV = 33 |
| static constexpr uint16_t | k_typeCERT = 37 |
| static constexpr uint16_t | k_typeDS = 43 |
| static constexpr uint16_t | k_typeSSHFP = 44 |
| static constexpr uint16_t | k_typeRRSIG = 46 |
| static constexpr uint16_t | k_typeNSEC = 47 |
| static constexpr uint16_t | k_typeDNSKEY = 48 |
| static constexpr uint16_t | k_typeDHCID = 49 |
| static constexpr uint16_t | k_typeNSEC3 = 50 |
| static constexpr uint16_t | k_typeNSEC3PARAM = 51 |
| static constexpr uint16_t | k_typeTLSA = 52 |
| static constexpr uint16_t | k_typeSMIMEA = 53 |
| static constexpr uint16_t | k_typeCDS = 59 |
| static constexpr uint16_t | k_typeCDNSKEY = 60 |
| static constexpr uint16_t | k_typeOPENPGPKEY = 61 |
| static constexpr uint16_t | k_typeURI = 256 |
| static constexpr uint16_t | k_typeCAA = 257 |
| static constexpr uint16_t | k_classIN = 1 |
| Query classes. | |
| static constexpr uint16_t | k_classCH = 3 |
| static constexpr uint16_t | k_classHS = 4 |
| static constexpr uint16_t | k_classANY = 255 |
| static constexpr uint16_t | k_classUNKNOWN = 0xFFFF |
Encapsulates a DNS message question.
See section 4.1.2 of RFC1035 for details.
| Dwm::Dns::MessageQuestion::MessageQuestion | ( | const std::string & | qname, |
| uint16_t | qtype, | ||
| uint16_t | qclass | ||
| ) |
Constructs a question for domain name qname of type qtype and class qclass.
| const uint8_t* Dwm::Dns::MessageQuestion::Decode | ( | const uint8_t * | pkt, |
| const uint8_t * | ptr, | ||
| uint16_t | pktlen | ||
| ) |
Decodes the question from buffer pkt of length pktlen, starting at ptr.
Returns the address immediately following the encoded question in pkt on success. Throws std::out_of_range if pkt was too short to contain an encoded question.
| uint8_t* Dwm::Dns::MessageQuestion::Encode | ( | uint8_t * | pkt, |
| uint8_t * | ptr, | ||
| uint16_t | pktlen, | ||
| LabelPositions & | lps | ||
| ) | const |
Encodes the question into buffer @ pkt of length pktlen, starting at ptr.
Returns the address immediately following the encoded question in pkt on success. Throws std::out_of_range if pkt is too short to contain the encoded question.