#### `void lookup(const QType &qtype, const string &qdomain, DNSPacket *pkt=0, int zoneId=-1)`
This function is used to initiate a straight lookup for a record of name 'qdomain' and type 'qtype'. A QType can be converted into an integer by invoking its `getCode()` method and into a string with the `getCode()`.
-The original question may or may not be passed in the pointer p. If it is, you can retrieve (from 1.99.11 onwards) information about who asked the question with the `getRemote(DNSPacket *)` method. Alternatively, `bool getRemote(struct sockaddr *sa, socklen_t *len)` is available.
+The original question may or may not be passed in the pointer pkt. If it is, you can retrieve information about who asked the question with the `pkt->getRemote()` method.
Note that **qdomain** can be of any case and that your backend should make sure it is in effect case insensitive. Furthermore, the case of the original question should be retained in answers returned by `get()`!
#include "dnspacket.hh"
#include "dns.hh"
-string DNSBackend::getRemote(DNSPacket *p)
-{
- return p->getRemote();
-}
-
-bool DNSBackend::getRemote(DNSPacket *p, struct sockaddr *sa, Utility::socklen_t *len)
-{
- if(p->d_remote.getSocklen() < *len)
- return false;
- *len=p->d_remote.getSocklen();
- memcpy(sa,&p->d_remote,*len);
- return true;
-}
-
bool DNSBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId, const int best_match_len)
{
bool found=false;
bool mustDo(const string &key);
const string &getArg(const string &key);
int getArgAsNum(const string &key);
- string getRemote(DNSPacket *p);
- bool getRemote(DNSPacket *p, struct sockaddr *in, Utility::socklen_t *len);
private:
string d_prefix;