Teach async DNS lookup builtin-functions about BRO_DNS_FAKE.

And enable fake DNS mode for test suites.

Addresses BIT-1134.
This commit is contained in:
Jon Siwek 2014-03-10 16:51:04 -05:00
parent 18eb31a6df
commit da338c8ffe
7 changed files with 123 additions and 21 deletions

View file

@ -62,8 +62,8 @@ public:
int Save();
const char* LookupAddrInCache(const IPAddr& addr);
TableVal* LookupNameInCache(string name);
const char* LookupTextInCache(string name);
TableVal* LookupNameInCache(const string& name);
const char* LookupTextInCache(const string& name);
// Support for async lookups.
class LookupCallback {
@ -77,8 +77,8 @@ public:
};
void AsyncLookupAddr(const IPAddr& host, LookupCallback* callback);
void AsyncLookupName(string name, LookupCallback* callback);
void AsyncLookupNameText(string name, LookupCallback* callback);
void AsyncLookupName(const string& name, LookupCallback* callback);
void AsyncLookupNameText(const string& name, LookupCallback* callback);
struct Stats {
unsigned long requests; // These count only async requests.
@ -102,6 +102,9 @@ protected:
Val* BuildMappingVal(DNS_Mapping* dm);
TableVal* BuildFakeAddrResult();
const char* BuildFakeNameResult();
void AddResult(DNS_Mgr_Request* dr, struct nb_dns_result* r);
void CompareMappings(DNS_Mapping* prev_dm, DNS_Mapping* new_dm);
ListVal* AddrListDelta(ListVal* al1, ListVal* al2);
@ -163,7 +166,7 @@ protected:
RecordType* dm_rec;
int dns_fake_count; // used to generate unique fake replies
uint32 dns_fake_count; // used to generate unique fake replies
typedef list<LookupCallback*> CallbackList;