42 #ifndef _DWMDNSMESSAGE_HH_ 43 #define _DWMDNSMESSAGE_HH_ 122 const std::vector<ResourceRecord> &
Answers()
const 178 uint8_t *
Encode(uint8_t *pkt, uint8_t *ptr, uint16_t pktlen)
const;
187 const uint8_t *
Decode(
const uint8_t *pkt,
const uint8_t *ptr,
196 ssize_t
SendTo(
int sockFd,
int flags,
const struct sockaddr *to,
205 ssize_t
Write(
int fd)
const;
215 ssize_t
RecvFrom(
int sockFd,
int flags, sockaddr *from,
224 ssize_t
Read(
int fd);
230 void EnableEDNS(uint16_t pduSize,
bool doDnssec);
234 std::vector<MessageQuestion> _questions;
235 std::vector<ResourceRecord> _answers;
236 std::vector<ResourceRecord> _authorities;
237 std::vector<ResourceRecord> _additional;
244 #endif // _DWMDNSMESSAGE_HH_ std::vector< ResourceRecord > & Answers()
Returns a mutable reference to the records from the answers section of the message.
Definition: DwmDnsMessage.hh:131
ssize_t SendTo(int sockFd, int flags, const struct sockaddr *to, int tolen) const
A wrapper for sendto().
void Clear()
Clears the message contents.
ssize_t Read(int fd)
Reads the Message from a connected TCP socket fd.
const std::vector< ResourceRecord > & Answers() const
Returns a const reference to the records from the answers section of the message. ...
Definition: DwmDnsMessage.hh:122
ssize_t RecvFrom(int sockFd, int flags, sockaddr *from, socklen_t *fromlen)
A wrapper for recvfrom().
const uint8_t * Decode(const uint8_t *pkt, const uint8_t *ptr, uint16_t pktlen)
Decodes the Message in pkt of length pktlen, starting at ptr.
const std::vector< MessageQuestion > & Questions() const
Returns a const reference to the questions in the message.
Definition: DwmDnsMessage.hh:105
Encapsulates a DNS message.
Definition: DwmDnsMessage.hh:68
void EnableEDNS(uint16_t pduSize, bool doDnssec)
Enable EDNS by setting the maximum packet size to pduSize and enable or disable DNSSEC.
ssize_t Write(int fd) const
Writes the message to a connected TCP socket fd.
Dwm::Dns::ResourceRecord class definition.
MessageHeader & Header()
Returns a mutable reference to the message header.
Definition: DwmDnsMessage.hh:97
std::vector< MessageQuestion > & Questions()
Returns a mutable reference to the questions in the message.
Definition: DwmDnsMessage.hh:113
std::vector< ResourceRecord > & Additional()
Returns a mutable reference to the records from the additional section of the message.
Definition: DwmDnsMessage.hh:167
Definition: DwmDnsEtcHosts.hh:60
const std::vector< ResourceRecord > & Additional() const
Returns a const reference to the records from the additional section of the message.
Definition: DwmDnsMessage.hh:158
const MessageHeader & Header() const
Returns a const reference to the message header.
Definition: DwmDnsMessage.hh:89
std::vector< ResourceRecord > & Authorities()
Returns a mutable reference to the records from the authority section of the message.
Definition: DwmDnsMessage.hh:149
const std::vector< ResourceRecord > & Authorities() const
Returns a const reference to the records from the authority section of the message.
Definition: DwmDnsMessage.hh:140
bool operator==(const Message &message) const
Equal-to operator, mostly useful for unit tests.
uint8_t * Encode(uint8_t *pkt, uint8_t *ptr, uint16_t pktlen) const
Encode the Message in pkt of length pktlen, starting at ptr.
Dwm::Dns::MessageQuestion class definition.