Go to the source code of this file.
Data Structures | |
struct | Request |
Request we should make. More... | |
Macros | |
#define | THRESH 20 |
Maximum number of queries pending at the same time. More... | |
#define | TIME_THRESH 10 |
TIME_THRESH is in usecs. More... | |
#define | MAX_RETRIES 5 |
How often do we retry a query before giving up for good? More... | |
Functions | |
static void | process_record (struct Request *req, struct GNUNET_DNSPARSER_Record *rec) |
We received rec for req. More... | |
static void | process_result (void *cls, const struct GNUNET_TUN_DnsHeader *dns, size_t dns_len) |
Function called with the result of a DNS resolution. More... | |
static int | submit_req (struct Request *req) |
Submit a request to DNS unless we need to slow down because we are at the rate limit. More... | |
static void | process_queue (void *cls) |
Process as many requests as possible from the queue. More... | |
static void | do_shutdown (void *cls) |
Clean up and terminate the process. More... | |
static void | run (void *cls) |
Process requests from the queue, then if the queue is not empty, try again. More... | |
static void | queue (const char *hostname) |
Add hostname to the list of requests to be made. More... | |
int | main (int argc, char **argv) |
Call with IP address of resolver to query. More... | |
Variables | |
static struct GNUNET_DNSSTUB_Context * | ctx |
Context for DNS resolution. More... | |
static unsigned int | pending |
The number of queries that are outstanding. More... | |
static unsigned int | lookups |
Number of lookups we performed overall. More... | |
static unsigned int | failures |
Number of lookups that failed. More... | |
static unsigned int | records |
Number of records we found. More... | |
static struct Request * | req_head |
Head of DLL of all requests to perform. More... | |
static struct Request * | req_tail |
Tail of DLL of all requests to perform. More... | |
static struct GNUNET_SCHEDULER_Task * | t |
Main task. More... | |
#define THRESH 20 |
Maximum number of queries pending at the same time.
Definition at line 124 of file gnunet-zonewalk.c.
#define TIME_THRESH 10 |
TIME_THRESH is in usecs.
How quickly do we submit fresh queries. Used as an additional throttle.
Definition at line 130 of file gnunet-zonewalk.c.
#define MAX_RETRIES 5 |
How often do we retry a query before giving up for good?
Definition at line 135 of file gnunet-zonewalk.c.
|
static |
We received rec for req.
Remember the answer.
req | request |
rec | response |
Definition at line 145 of file gnunet-zonewalk.c.
References GNUNET_DNSPARSER_RawRecord::data, GNUNET_DNSPARSER_Record::data, GNUNET_DNSPARSER_RawRecord::data_len, GNUNET_DNSPARSER_SoaRecord::expire, GNUNET_DNSPARSER_TYPE_A, GNUNET_DNSPARSER_TYPE_AAAA, GNUNET_DNSPARSER_TYPE_AFSDB, GNUNET_DNSPARSER_TYPE_APL, GNUNET_DNSPARSER_TYPE_CDNSKEY, GNUNET_DNSPARSER_TYPE_CDS, GNUNET_DNSPARSER_TYPE_CERT, GNUNET_DNSPARSER_TYPE_CNAME, GNUNET_DNSPARSER_TYPE_DHCID, GNUNET_DNSPARSER_TYPE_DNAME, GNUNET_DNSPARSER_TYPE_DNSKEY, GNUNET_DNSPARSER_TYPE_DS, GNUNET_DNSPARSER_TYPE_HIP, GNUNET_DNSPARSER_TYPE_IPSECKEY, GNUNET_DNSPARSER_TYPE_KEY, GNUNET_DNSPARSER_TYPE_KX, GNUNET_DNSPARSER_TYPE_LOC, GNUNET_DNSPARSER_TYPE_MX, GNUNET_DNSPARSER_TYPE_NAPTR, GNUNET_DNSPARSER_TYPE_NS, GNUNET_DNSPARSER_TYPE_NSEC, GNUNET_DNSPARSER_TYPE_NSEC3, GNUNET_DNSPARSER_TYPE_NSEC3PARAM, GNUNET_DNSPARSER_TYPE_OPENPGPKEY, GNUNET_DNSPARSER_TYPE_PTR, GNUNET_DNSPARSER_TYPE_RP, GNUNET_DNSPARSER_TYPE_RRSIG, GNUNET_DNSPARSER_TYPE_SIG, GNUNET_DNSPARSER_TYPE_SMIMEA, GNUNET_DNSPARSER_TYPE_SOA, GNUNET_DNSPARSER_TYPE_SRV, GNUNET_DNSPARSER_TYPE_SSHFP, GNUNET_DNSPARSER_TYPE_TA, GNUNET_DNSPARSER_TYPE_TKEY, GNUNET_DNSPARSER_TYPE_TLSA, GNUNET_DNSPARSER_TYPE_TSIG, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_DNSPARSER_TYPE_URI, GNUNET_free, GNUNET_STRINGS_data_to_string_alloc(), Request::hostname, GNUNET_DNSPARSER_Record::hostname, GNUNET_DNSPARSER_SoaRecord::minimum_ttl, GNUNET_DNSPARSER_SoaRecord::mname, GNUNET_DNSPARSER_Record::mx, GNUNET_DNSPARSER_MxRecord::mxhost, GNUNET_DNSPARSER_SrvRecord::port, GNUNET_DNSPARSER_MxRecord::preference, GNUNET_DNSPARSER_SrvRecord::priority, GNUNET_DNSPARSER_UriRecord::priority, GNUNET_DNSPARSER_Record::raw, records, GNUNET_DNSPARSER_SoaRecord::refresh, GNUNET_DNSPARSER_SoaRecord::retry, GNUNET_DNSPARSER_SoaRecord::rname, GNUNET_DNSPARSER_SoaRecord::serial, GNUNET_DNSPARSER_Record::soa, GNUNET_DNSPARSER_Record::srv, GNUNET_DNSPARSER_SrvRecord::target, GNUNET_DNSPARSER_UriRecord::target, GNUNET_DNSPARSER_Record::type, GNUNET_DNSPARSER_Record::uri, GNUNET_DNSPARSER_SrvRecord::weight, and GNUNET_DNSPARSER_UriRecord::weight.
Referenced by process_result().
|
static |
Function called with the result of a DNS resolution.
cls | closure with the struct Request |
dns | dns response, never NULL |
dns_len | number of bytes in dns |
Definition at line 314 of file gnunet-zonewalk.c.
References failures, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_DNSPARSER_free_packet(), GNUNET_DNSPARSER_parse(), GNUNET_DNSSTUB_resolve_cancel(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, Request::hostname, Request::id, GNUNET_TUN_DnsHeader::id, Request::issue_num, MAX_RETRIES, p, pending, process_record(), Request::raw, req_head, req_tail, and Request::rs.
Referenced by submit_req().
|
static |
Submit a request to DNS unless we need to slow down because we are at the rate limit.
req | request to submit |
Definition at line 411 of file gnunet-zonewalk.c.
References ctx, GNUNET_assert, GNUNET_DNSSTUB_resolve(), GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, Request::issue_num, lookups, pending, process_result(), Request::raw, Request::raw_len, Request::rs, THRESH, Request::time, and TIME_THRESH.
Referenced by process_queue().
|
static |
Process as many requests as possible from the queue.
cls | NULL |
Definition at line 446 of file gnunet-zonewalk.c.
References GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_TIME_UNIT_MILLISECONDS, Request::next, process_queue(), req_head, submit_req(), and t.
Referenced by process_queue(), and run().
|
static |
Clean up and terminate the process.
cls | NULL |
Definition at line 472 of file gnunet-zonewalk.c.
References ctx, GNUNET_DNSSTUB_stop(), GNUNET_SCHEDULER_cancel(), and t.
Referenced by run().
|
static |
Process requests from the queue, then if the queue is not empty, try again.
cls | NULL |
Definition at line 492 of file gnunet-zonewalk.c.
References do_shutdown(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_shutdown(), process_queue(), and t.
Referenced by main().
|
static |
Add hostname to the list of requests to be made.
hostname | name to resolve |
Definition at line 509 of file gnunet-zonewalk.c.
References GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_DNSPARSER_check_name(), GNUNET_DNSPARSER_pack(), GNUNET_DNSPARSER_TYPE_NS, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_TUN_DNS_CLASS_INTERNET, Request::hostname, Request::id, p, q, raw, Request::raw, Request::raw_len, req_head, req_tail, and ret.
Referenced by main().
int main | ( | int | argc, |
char ** | argv | ||
) |
Call with IP address of resolver to query.
argc | should be 2 |
argv[1] | should contain IP address |
Definition at line 570 of file gnunet-zonewalk.c.
References ctx, failures, GNUNET_DNSSTUB_add_dns_ip(), GNUNET_DNSSTUB_start(), GNUNET_OK, GNUNET_SCHEDULER_run(), Request::hn, lookups, pending, queue(), records, and run().
|
static |
Context for DNS resolution.
Definition at line 84 of file gnunet-zonewalk.c.
Referenced by do_shutdown(), main(), and submit_req().
|
static |
The number of queries that are outstanding.
Definition at line 89 of file gnunet-zonewalk.c.
Referenced by main(), process_result(), and submit_req().
|
static |
Number of lookups we performed overall.
Definition at line 94 of file gnunet-zonewalk.c.
Referenced by main(), and submit_req().
|
static |
Number of lookups that failed.
Definition at line 99 of file gnunet-zonewalk.c.
Referenced by main(), and process_result().
|
static |
Number of records we found.
Definition at line 104 of file gnunet-zonewalk.c.
Referenced by main(), and process_record().
|
static |
Head of DLL of all requests to perform.
Definition at line 109 of file gnunet-zonewalk.c.
Referenced by process_queue(), process_result(), and queue().
|
static |
Tail of DLL of all requests to perform.
Definition at line 114 of file gnunet-zonewalk.c.
Referenced by process_result(), and queue().
|
static |
Main task.
Definition at line 119 of file gnunet-zonewalk.c.
Referenced by do_shutdown(), process_queue(), and run().