26 #include <netinet/in.h> 27 #include <arpa/nameser.h> 28 #include <arpa/inet.h> 47 Question(
const std::string& qname, ns_type qtype, ns_class qclass )
67 std::cout <<
"Question:" 68 <<
" qtype=" << m_qtype
69 <<
" qclass=" << m_qclass
70 <<
" qname=" << m_qname
86 class QuestionList :
public std::list<Question*>
123 m_expires( time(NULL) + ttl )
154 std::cout <<
"ResourceRecord:" 155 <<
" type=" << getType()
156 <<
" class=" << getClass()
157 <<
" ttl=" << getTTL()
158 <<
" expires=" << getExpires()
159 <<
" name=" << getName()
175 class ResourceRecordList :
public std::list<ResourceRecord*>
178 ResourceRecordList() {}
179 ~ResourceRecordList()
204 const struct in_addr &address )
207 memcpy( &m_address, &address,
sizeof(m_address) );
218 char address[ INET_ADDRSTRLEN ];
219 inet_ntop( AF_INET, &m_address, address,
sizeof(address) );
226 std::cout <<
"RRecordA:" 227 <<
" type=" << getType()
228 <<
" class=" << getClass()
229 <<
" ttl=" << getTTL()
230 <<
" expires=" << getExpires()
231 <<
" address=" << getAddressString()
232 <<
" name=" << getName()
237 struct in_addr m_address;
253 const std::string &ns )
264 std::cout <<
"RRecordNS:" 265 <<
" type=" << getType()
266 <<
" class=" << getClass()
267 <<
" ttl=" << getTTL()
268 <<
" expires=" << getExpires()
269 <<
" ns=" << getNamedServer()
270 <<
" name=" << getName()
291 const struct in6_addr &address )
294 memcpy( &m_address, &address,
sizeof(m_address) );
301 char address[ INET6_ADDRSTRLEN ];
302 inet_ntop( AF_INET6, &m_address, address,
sizeof(address) );
309 std::cout <<
"RRecordAAAA:" 310 <<
" type=" << getType()
311 <<
" class=" << getClass()
312 <<
" ttl=" << getTTL()
313 <<
" expires=" << getExpires()
314 <<
" address=" << getAddressString()
315 <<
" name=" << getName()
320 struct in6_addr m_address;
336 const std::string &alias )
347 std::cout <<
"RRecordCNAME:" 348 <<
" type=" << getType()
349 <<
" class=" << getClass()
350 <<
" ttl=" << getTTL()
351 <<
" expires=" << getExpires()
352 <<
" alias=" << getAlias()
353 <<
" name=" << getName()
380 const std::string &target)
382 m_priority( priority ),
405 std::cout <<
"RRecordSRV:" 406 <<
" type=" << getType()
407 <<
" class=" << getClass()
408 <<
" ttl=" << getTTL()
409 <<
" expires=" << getExpires()
410 <<
" priority=" << getPriority()
411 <<
" weight=" << getWeight()
412 <<
" port=" << getPort()
413 <<
" target=" << getTarget()
414 <<
" name=" << getName()
452 const std::string &flags,
453 const std::string &service,
454 const std::string ®exp,
455 const std::string &replacement )
458 m_preference( preference ),
460 m_service( service ),
462 m_replacement( replacement )
470 const uint16_t
getOrder()
const {
return m_order; }
493 std::cout <<
"RRecordNAPTR:" 494 <<
" type=" << getType()
495 <<
" class=" << getClass()
496 <<
" ttl=" << getTTL()
497 <<
" expires=" << getExpires()
498 <<
" order=" << getOrder()
499 <<
" preference=" << getPreference()
500 <<
" flags=" << getFlags()
501 <<
" service=" << getService()
502 <<
" regexp=" << getRegexp()
503 <<
" replacement=" << getReplacement()
504 <<
" name=" << getName()
510 uint16_t m_preference;
518 #endif // #ifdef __DNSRECORD_H Encapsulates and extends a std::string object.
Bool isExpired()
Determines if this resource record has expired.
Definition: dnsrecord.h:149
Represents an NS resource record.
Definition: dnsrecord.h:244
virtual Void dump()
Prints the contents fo this A record.
Definition: dnsrecord.h:224
RRecordNAPTR(const std::string &name, int32_t ttl, uint16_t order, uint16_t preference, const std::string &flags, const std::string &service, const std::string ®exp, const std::string &replacement)
Class constructor.
Definition: dnsrecord.h:448
const EString & getReplacement()
Retrieves the replacement string associated with this NAPTR record.
Definition: dnsrecord.h:488
Represents an NAPTR resource record.
Definition: dnsrecord.h:429
const EString & getService()
Retrieves the Service Parameters applicable to this this delegation path.
Definition: dnsrecord.h:482
uint32_t getTTL()
Retrieves the time interval (in seconds) that the resource record may be cached before it should be d...
Definition: dnsrecord.h:142
ResourceRecord(const std::string &name, ns_type rtype, ns_class rclass, int32_t ttl)
Class constructor.
Definition: dnsrecord.h:115
virtual Void dump()
Prints the contents fo this SRV record.
Definition: dnsrecord.h:403
const struct in_addr & getAddress()
Retrieves the IP address for this A record.
Definition: dnsrecord.h:212
const EString & getFlags()
Retrieves the flags associated with this NAPTR record.
Definition: dnsrecord.h:478
RRecordCNAME(const std::string &name, int32_t ttl, const std::string &alias)
Class constructor.
Definition: dnsrecord.h:334
const EString & getTarget()
The domain name of the target host.
Definition: dnsrecord.h:400
uint16_t getWeight()
Retrieves.
Definition: dnsrecord.h:394
ns_class getClass()
Retrieves the class of the data in the RDATA field.
Definition: dnsrecord.h:137
virtual Void dump()
Prints the contents fo this NAPTR record.
Definition: dnsrecord.h:491
ns_type getType()
Retrieves the resource type.
Definition: dnsrecord.h:134
uint16_t getPriority()
Retrieves the priority of this target host.
Definition: dnsrecord.h:391
Represents a DNS Resource Record.
Definition: dnsrecord.h:106
const EString & getAlias()
Definition: dnsrecord.h:342
const EString & getNamedServer()
Definition: dnsrecord.h:259
RRecordA(const std::string &name, int32_t ttl, const struct in_addr &address)
Class constructor.
Definition: dnsrecord.h:202
virtual Void dump()
Prints the contents fo this CNAME record.
Definition: dnsrecord.h:345
Represents an SRV resource record.
Definition: dnsrecord.h:365
const EString & getName()
Retrieves the domain name to which this resource record pertains.
Definition: dnsrecord.h:131
Represents an CNAME resource record.
Definition: dnsrecord.h:327
EString getAddressString()
Convert the IPv4 address to a string.
Definition: dnsrecord.h:216
RRecordSRV(const std::string &name, int32_t ttl, uint16_t priority, uint16_t weight, uint16_t port, const std::string &target)
Class constructor.
Definition: dnsrecord.h:375
Represents an A resource record.
Definition: dnsrecord.h:195
virtual ~ResourceRecord()
Class destructor.
Definition: dnsrecord.h:127
ns_type getQType()
Retrieves the query type for the requested resource.
Definition: dnsrecord.h:59
ns_class getQClass()
Retrieves the class of the query.
Definition: dnsrecord.h:62
const uint16_t getOrder() const
Retrieves the order in which the NAPTR records MUST be processed in order to accurately represent the...
Definition: dnsrecord.h:470
EString & getQName()
Retrieves the query name of the requested resource.
Definition: dnsrecord.h:56
const struct in6_addr & getAddress()
Definition: dnsrecord.h:297
virtual Void dump()
Prints the contents fo this AAAA record.
Definition: dnsrecord.h:307
const EString & getRegexp()
Retrieves the regular expression associated with this NAPTR record.
Definition: dnsrecord.h:485
const uint16_t getPreference() const
Retrieves he order in which NAPTR records with equal Order values SHOULD be processed, low numbers being processed before high numbers.
Definition: dnsrecord.h:475
time_t getExpires()
Retrieves the expiration time of this resource record.
Definition: dnsrecord.h:145
virtual Void dump()
Prints the contents fo this NS record.
Definition: dnsrecord.h:262
uint16_t getPort()
Retrieves the relative weight for entries with the same priority.
Definition: dnsrecord.h:397
Definition: dnscache.h:34
Question(const std::string &qname, ns_type qtype, ns_class qclass)
Class constructor.
Definition: dnsrecord.h:47
RRecordNS(const std::string &name, int32_t ttl, const std::string &ns)
Class constructor.
Definition: dnsrecord.h:251
virtual Void dump()
Prints the contents of this resource record.
Definition: dnsrecord.h:152
RRecordAAAA(const std::string &name, int32_t ttl, const struct in6_addr &address)
Class constructor.
Definition: dnsrecord.h:289
EString getAddressString()
Definition: dnsrecord.h:299
String class.
Definition: estring.h:31
Represents an AAAA resource record.
Definition: dnsrecord.h:282
Void dump()
Prints the contents the stdout.
Definition: dnsrecord.h:65
Represents the question for the name server.
Definition: dnsrecord.h:40