harvest.c File Reference

This program downloads relevant DNS data to a set of queries. More...

#include "config.h"
#include <signal.h>
#include "libunbound/unbound.h"
#include <sys/stat.h>

Data Structures

struct  harvest_data
 this represents the data that has been collected as well as a todo list and some settings More...
struct  todo_item
 Todo item. More...
struct  labdata
 Every label has a sest of sublabels, that have sets of sublabels . More...

Functions

static void usage (char *nm)
 usage information for harvest
static void error_exit (const char *str)
 exit with error
static void qlist_read_file (struct harvest_data *data, char *fname)
 read a query file
static int lab_cmp (const void *x, const void *y)
 compare two labels
static struct labdatalab_create (const char *name)
 create label entry
static struct labdatafind_create_lab (struct harvest_data *data, ldns_rdf *name)
 for this name, lookup the label, create if does not exist
static void new_todo_item (struct harvest_data *data, ldns_rdf *qname, int qtype, int qclass, int depth)
 for given query, create todo items, and labels if needed
static void new_todo_infra (struct harvest_data *data, struct labdata *startlab, int depth)
 add infra todo items for this query
static void make_todo (struct harvest_data *data)
 make todo items for initial data
static void process_rr (struct harvest_data *data, ldns_rr *rr, int depth)
 store RR and make new work items for it if needed
static void process_pkt (struct harvest_data *data, ldns_pkt *pkt, int depth)
 store RRs and make new work items if needed
static void process (struct harvest_data *data, struct todo_item *it)
 process a todo item
static void harvest_main (struct harvest_data *data)
 perform main harvesting
static void hv_mkdir (char *dir)
 create directory if it does not exist
static ldns_rr * has_SOA (ldns_rr_list *list)
 see if rrlist contains a SOA record
static void write_moredata (struct harvest_data *data, struct labdata *zone, FILE *f, struct labdata *thislab, ldns_rr *nslist)
 write moredata for a zone
static void write_glue (struct harvest_data *data, struct labdata *thislab, FILE *f, ldns_rdf *name, int dep)
 find and write glue into zone file
static void write_zonefile (struct harvest_data *data, int dep, FILE *zlist, struct labdata *apex, ldns_rr *soa)
 write zonefile for zone at this apex
static void create_zones (struct harvest_data *data, int dep, FILE *zlist, struct labdata *labnow, int depnow)
 create zones at depth d in label tree
static void harvest_sort (struct labdata *lab)
 sort rrlists
static void harvest_output (struct harvest_data *data)
 output harvested results
int main (int argc, char *argv[])
 main program for harvest

Variables

static int hverb = 0
 verbosity for harvest
int optind
 getopt global, in case header files fail to declare it.
char * optarg
 getopt global, in case header files fail to declare it.


Detailed Description

This program downloads relevant DNS data to a set of queries.

This means that the queries are asked to root, TLD, SLD servers and the results stored per zone. The following data is pertinent:

At each label: SOA NS DNSKEY DS For the whole query: the result. For NS-records: their label data and the A and AAAA records for it. (as if the name, with A and AAAA query type is in the list, referred to as recursion depth+1) Any NSEC, NSEC3, SOA records or additional data found in answers.

All of this is data that would be encountered during an iterative lookup for the queries in the list. It is saved to enable a replay of iterative lookups for performance testing.

A number of assumptions are made. 1) configuration is correct. The parent has the same NS records as the child. All nameservers carry the same data. 2) EDNS/nonEDNS responses and other behaviour is ignored. Only the data is saved. This creates a snapshot that represents the data as this resolver saw it.


Variable Documentation

int optind

getopt global, in case header files fail to declare it.

char* optarg

getopt global, in case header files fail to declare it.


Generated on Tue Oct 13 06:46:31 2009 for unbound by  doxygen 1.5.9