#include <gnunet_util_lib.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_namestore_service.h>
#include <gnunet_statistics_service.h>
#include <gnunet_identity_service.h>
Go to the source code of this file.
Data Structures | |
struct | Zone |
Some zones may include authoritative records for other zones, such as foo.com.uk or bar.com.fr. More... | |
struct | Record |
Record for the request to be stored by GNS. More... | |
struct | Request |
Request we should make. More... | |
struct | GlueClosure |
Closure for check_for_glue. More... | |
struct | ProcessRecordContext |
Closure for process_record(). More... | |
Macros | |
#define | THRESH 100 |
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... | |
#define | MAX_SERIES 10 |
How many DNS requests do we at most issue in rapid series? More... | |
#define | SERIES_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, 10) |
How long do we wait at least between series of requests? More... | |
#define | NS_BATCH_SIZE 1024 |
How many requests do we request from NAMESTORE in one batch during our initial iteration? More... | |
Typedefs | |
typedef void(* | RecordProcessor) (void *cls, const struct GNUNET_DNSPARSER_Record *rec) |
Callback for for_all_records. More... | |
Functions | |
static void | for_all_records (const struct GNUNET_DNSPARSER_Packet *p, RecordProcessor rp, void *rp_cls) |
Call rp for each record in p, regardless of what response section it is in. More... | |
static const char * | get_label (struct Request *req) |
Return just the label of the hostname in req. More... | |
static void * | build_dns_query (struct Request *req, size_t *raw_size) |
Build DNS query for hostname. More... | |
static void | free_records (struct Request *req) |
Free records associated with req. More... | |
static void | free_request (struct Request *req) |
Free req and data structures reachable from it. More... | |
static void | process_queue (void *cls) |
Process as many requests as possible from the queue. More... | |
static void | insert_sorted (struct Request *req) |
Insert req into DLL sorted by next fetch time. More... | |
static void | add_record (struct Request *req, uint32_t type, struct GNUNET_TIME_Absolute expiration_time, const void *data, size_t data_len) |
Add record to the GNS record set for req. More... | |
static void | check_for_glue (void *cls, const struct GNUNET_DNSPARSER_Record *rec) |
Try to find glue records for a given NS record. More... | |
static void | process_record (void *cls, const struct GNUNET_DNSPARSER_Record *rec) |
We received rec for req. More... | |
static void | store_completed_cb (void *cls, enum GNUNET_ErrorCode ec) |
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 | free_request_it (void *cls, const struct GNUNET_HashCode *key, void *value) |
Iterator called during do_shutdown() to free requests in the ns_pending map. More... | |
static void | do_shutdown (void *cls) |
Clean up and terminate the process. More... | |
static void | iterate_zones (void *cls) |
Iterate over all of the zones we care about and see which records we may need to re-fetch when. More... | |
static void | ns_lookup_error_cb (void *cls) |
Function called if GNUNET_NAMESTORE_records_lookup() failed. More... | |
static void | ns_lookup_result_cb (void *cls, const struct GNUNET_CRYPTO_PrivateKey *key, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Process a record that was stored in the namestore. More... | |
static void | queue (const char *hostname) |
Add hostname to the list of requests to be made. More... | |
static int | move_to_queue (void *cls, const struct GNUNET_HashCode *key, void *value) |
We have completed the initial iteration over the namestore's database. More... | |
static void | process_stdin (void *cls) |
Begin processing hostnames from stdin. More... | |
static void | identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name) |
Method called to inform about the egos of this peer. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Process requests from the queue, then if the queue is not empty, try again. More... | |
int | main (int argc, char *const *argv) |
Call with IP address of resolver to query. More... | |
Variables | |
static struct GNUNET_TIME_Relative | minimum_expiration_time |
How long do DNS records have to last at least after being imported? More... | |
static unsigned int | map_size = 1024 |
Command-line argument specifying desired size of the hash map with all of our pending names. More... | |
static struct GNUNET_IDENTITY_Handle * | id |
Handle to the identity service. More... | |
static struct GNUNET_NAMESTORE_Handle * | ns |
Namestore handle. More... | |
static struct GNUNET_STATISTICS_Handle * | stats |
Handle to the statistics service. More... | |
static struct GNUNET_DNSSTUB_Context * | dns_ctx |
Context for DNS resolution. More... | |
static unsigned int | pending |
The number of DNS queries that are outstanding. More... | |
static unsigned int | pending_rs |
The number of NAMESTORE record store operations that are outstanding. More... | |
static unsigned int | lookups |
Number of lookups we performed overall. More... | |
static unsigned int | cached |
Number of records we had cached. More... | |
static unsigned int | rejects |
How many hostnames did we reject (malformed). More... | |
static unsigned int | failures |
Number of lookups that failed. More... | |
static unsigned int | records |
Number of records we found. More... | |
static unsigned int | record_sets |
Number of record sets given to namestore. More... | |
static struct GNUNET_CONTAINER_Heap * | req_heap |
Heap of all requests to perform, sorted by the time we should next do the request (i.e. More... | |
static struct Request * | req_head |
Active requests are kept in a DLL. More... | |
static struct Request * | req_tail |
Active requests are kept in a DLL. More... | |
static struct GNUNET_SCHEDULER_Task * | t |
Main task. More... | |
static struct GNUNET_CONTAINER_MultiHashMap * | ns_pending |
Hash map of requests for which we may still get a response from the namestore. More... | |
static struct GNUNET_NAMESTORE_ZoneIterator * | zone_it |
Current zone iteration handle. More... | |
static struct Zone * | zone_head |
Head of list of zones we are managing. More... | |
static struct Zone * | zone_tail |
Tail of list of zones we are managing. More... | |
static uint64_t | ns_iterator_trigger_next |
After how many more results must ns_lookup_result_cb() ask the namestore for more? More... | |
static uint64_t | total_dns_latency_cnt |
Number of DNS requests counted in latency total. More... | |
static struct GNUNET_TIME_Relative | total_dns_latency |
Sum of DNS latencies observed. More... | |
static uint64_t | total_reg_proc_dns |
Number of records processed (DNS lookup, no NAMESTORE) in total. More... | |
static uint64_t | total_reg_proc_dns_ns |
Number of records processed (DNS lookup, with NAMESTORE) in total. More... | |
static struct GNUNET_TIME_Absolute | start_time_reg_proc |
Start time of the regular processing. More... | |
static struct GNUNET_TIME_Absolute | sleep_time_reg_proc |
Last time we worked before going idle. More... | |
static struct GNUNET_TIME_Relative | idle_time |
Time we slept just waiting for work. More... | |
#define THRESH 100 |
Maximum number of queries pending at the same time.
Definition at line 35 of file gnunet-zoneimport.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 41 of file gnunet-zoneimport.c.
#define MAX_RETRIES 5 |
How often do we retry a query before giving up for good?
Definition at line 46 of file gnunet-zoneimport.c.
#define MAX_SERIES 10 |
How many DNS requests do we at most issue in rapid series?
Definition at line 51 of file gnunet-zoneimport.c.
#define SERIES_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, 10) |
How long do we wait at least between series of requests?
Definition at line 56 of file gnunet-zoneimport.c.
#define NS_BATCH_SIZE 1024 |
How many requests do we request from NAMESTORE in one batch during our initial iteration?
Definition at line 68 of file gnunet-zoneimport.c.
typedef void(* RecordProcessor) (void *cls, const struct GNUNET_DNSPARSER_Record *rec) |
Callback for for_all_records.
cls | closure |
rec | a DNS record |
Definition at line 365 of file gnunet-zoneimport.c.
|
static |
Call rp for each record in p, regardless of what response section it is in.
p | packet from DNS |
rp | function to call |
rp_cls | closure for rp |
Definition at line 378 of file gnunet-zoneimport.c.
Referenced by process_record(), and process_result().
|
static |
Return just the label of the hostname in req.
req | request to process hostname of |
Definition at line 411 of file gnunet-zoneimport.c.
References GNUNET_break, GNUNET_memcpy, and Request::hostname.
Referenced by ns_lookup_result_cb(), and process_result().
|
static |
Build DNS query for hostname.
hostname | host to build query for | |
[out] | raw_size | number of bytes in the query |
Definition at line 442 of file gnunet-zoneimport.c.
References GNUNET_break, GNUNET_DNSPARSER_pack(), GNUNET_DNSPARSER_TYPE_NS, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_TUN_DNS_CLASS_INTERNET, Request::hostname, Request::id, p, q, raw, rejects, and ret.
Referenced by process_queue().
|
static |
Free records associated with req.
req | request to free records of |
Definition at line 491 of file gnunet-zoneimport.c.
References GNUNET_CONTAINER_DLL_remove, GNUNET_free, Request::rec_head, and Request::rec_tail.
Referenced by free_request(), ns_lookup_result_cb(), and store_completed_cb().
|
static |
Free req and data structures reachable from it.
req | request to free |
Definition at line 510 of file gnunet-zoneimport.c.
References free_records(), and GNUNET_free.
Referenced by do_shutdown(), free_request_it(), process_queue(), and process_result().
|
static |
Process as many requests as possible from the queue.
cls | NULL |
Definition at line 1181 of file gnunet-zoneimport.c.
References build_dns_query(), dns_ctx, Request::expires, free_request(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_heap_peek(), GNUNET_CONTAINER_heap_remove_root(), GNUNET_DNSSTUB_resolve(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_at(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_cancel(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_relative_add(), Request::hn, Request::hostname, idle_time, Request::issue_num, lookups, MAX_SERIES, Request::op_start_time, pending, pending_rs, process_queue(), process_result(), Request::qe, raw, GNUNET_TIME_Relative::rel_value_us, req_head, req_heap, req_tail, Request::rs, SERIES_DELAY, sleep_time_reg_proc, t, and THRESH.
Referenced by insert_sorted(), process_queue(), process_result(), and store_completed_cb().
|
static |
Insert req into DLL sorted by next fetch time.
req | request to insert into req_heap |
Definition at line 532 of file gnunet-zoneimport.c.
References GNUNET_TIME_Absolute::abs_value_us, Request::expires, GNUNET_CONTAINER_heap_insert(), GNUNET_CONTAINER_heap_peek(), GNUNET_SCHEDULER_add_at(), GNUNET_SCHEDULER_cancel(), GNUNET_TIME_absolute_get(), Request::hn, process_queue(), req_heap, sleep_time_reg_proc, and t.
Referenced by move_to_queue(), ns_lookup_result_cb(), and process_result().
|
static |
Add record to the GNS record set for req.
req | the request to expand GNS record set for |
type | type to use |
expiration_time | when should rec expire |
data | raw data to store |
data_len | number of bytes in data |
Definition at line 556 of file gnunet-zoneimport.c.
References GNUNET_TIME_Absolute::abs_value_us, data, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_CONTAINER_DLL_insert, GNUNET_GNSRECORD_RF_NONE, GNUNET_malloc, GNUNET_memcpy, Record::grd, Request::rec_head, Request::rec_tail, GNUNET_GNSRECORD_Data::record_type, and type.
Referenced by check_for_glue(), ns_lookup_result_cb(), and process_record().
|
static |
Try to find glue records for a given NS record.
cls | a struct GlueClosure * |
rec | record that may contain glue information |
Definition at line 604 of file gnunet-zoneimport.c.
References add_record(), GNUNET_DNSPARSER_RawRecord::data, GNUNET_DNSPARSER_Record::data, GNUNET_DNSPARSER_RawRecord::data_len, GNUNET_DNSPARSER_Record::expiration_time, GlueClosure::found, GNUNET_break, GNUNET_DNSPARSER_builder_add_name(), GNUNET_DNSPARSER_TYPE_A, GNUNET_DNSPARSER_TYPE_AAAA, GNUNET_DNSPARSER_TYPE_CNAME, GNUNET_GNSRECORD_TYPE_GNS2DNS, GNUNET_OK, GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_relative_to_absolute(), GNUNET_YES, Request::hostname, GNUNET_DNSPARSER_Record::hostname, minimum_expiration_time, GNUNET_DNSPARSER_Record::name, GlueClosure::ns, GNUNET_DNSPARSER_Record::raw, GNUNET_TIME_Relative::rel_value_us, GlueClosure::req, and GNUNET_DNSPARSER_Record::type.
Referenced by process_record().
|
static |
We received rec for req.
Remember the answer.
cls | a struct ProcessRecordContext |
rec | response |
Definition at line 734 of file gnunet-zoneimport.c.
References add_record(), GNUNET_DNSPARSER_Record::cert, check_for_glue(), GNUNET_DNSPARSER_RawRecord::data, GNUNET_DNSPARSER_Record::data, GNUNET_DNSPARSER_RawRecord::data_len, GNUNET_DNSPARSER_Record::expiration_time, for_all_records(), GlueClosure::found, GNUNET_DNSPARSER_builder_add_cert(), GNUNET_DNSPARSER_builder_add_mx(), GNUNET_DNSPARSER_builder_add_name(), GNUNET_DNSPARSER_builder_add_soa(), GNUNET_DNSPARSER_builder_add_srv(), GNUNET_DNSPARSER_builder_add_uri(), GNUNET_DNSPARSER_TYPE_A, GNUNET_DNSPARSER_TYPE_AAAA, GNUNET_DNSPARSER_TYPE_CERT, GNUNET_DNSPARSER_TYPE_CNAME, GNUNET_DNSPARSER_TYPE_DNAME, GNUNET_DNSPARSER_TYPE_MX, GNUNET_DNSPARSER_TYPE_NS, GNUNET_DNSPARSER_TYPE_PTR, GNUNET_DNSPARSER_TYPE_SOA, GNUNET_DNSPARSER_TYPE_SRV, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_DNSPARSER_TYPE_URI, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_GNSRECORD_TYPE_GNS2DNS, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_relative_to_absolute(), Request::hostname, GNUNET_DNSPARSER_Record::hostname, minimum_expiration_time, GNUNET_DNSPARSER_Record::mx, GNUNET_DNSPARSER_MxRecord::mxhost, GNUNET_DNSPARSER_Record::name, GlueClosure::ns, ProcessRecordContext::p, GNUNET_DNSPARSER_Record::raw, records, GNUNET_TIME_Relative::rel_value_us, GlueClosure::req, ProcessRecordContext::req, GNUNET_DNSPARSER_Record::soa, GNUNET_DNSPARSER_Record::srv, stats, GNUNET_DNSPARSER_Record::type, and GNUNET_DNSPARSER_Record::uri.
Referenced by process_result().
|
static |
Definition at line 936 of file gnunet-zoneimport.c.
References delta, free_records(), GNUNET_EC_NONE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ErrorCode_get_hint(), GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_STATISTICS_set(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_relative_add(), GNUNET_TIME_relative_divide(), GNUNET_TIME_relative_subtract(), GNUNET_YES, Request::hostname, idle_time, Request::op_start_time, pending_rs, process_queue(), Request::qe, GNUNET_TIME_Relative::rel_value_us, sleep_time_reg_proc, start_time_reg_proc, stats, t, total_reg_proc_dns, and total_reg_proc_dns_ns.
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 1030 of file gnunet-zoneimport.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_GNSRECORD_Data::expiration_time, Request::expires, failures, for_all_records(), free_request(), get_label(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_DNSPARSER_free_packet(), GNUNET_DNSPARSER_parse(), GNUNET_DNSSTUB_resolve_cancel(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NAMESTORE_record_set_store(), GNUNET_NO, GNUNET_NZL, GNUNET_SCHEDULER_add_now(), GNUNET_STATISTICS_set(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_absolute_min(), GNUNET_TIME_relative_add(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_UNIT_DAYS, GNUNET_TIME_UNIT_FOREVER_ABS, Record::grd, Request::hn, Request::hostname, Request::id, GNUNET_TUN_DnsHeader::id, insert_sorted(), Request::issue_num, Zone::key, MAX_RETRIES, Record::next, ns, Request::op_start_time, p, pending, pending_rs, process_queue(), process_record(), Request::qe, rd, rd_count, Request::rec_head, record_sets, GNUNET_TIME_Relative::rel_value_us, ProcessRecordContext::req, req_head, req_tail, Request::rs, sleep_time_reg_proc, stats, store_completed_cb(), t, total_dns_latency, total_dns_latency_cnt, total_reg_proc_dns, and Request::zone.
Referenced by process_queue().
|
static |
Iterator called during do_shutdown() to free requests in the ns_pending map.
cls | NULL |
key | unused |
value | the struct Request to free |
Definition at line 1279 of file gnunet-zoneimport.c.
References free_request(), GNUNET_OK, key, and value.
Referenced by do_shutdown().
|
static |
Clean up and terminate the process.
cls | NULL |
Definition at line 1296 of file gnunet-zoneimport.c.
References dns_ctx, Zone::domain, free_request(), free_request_it(), GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_heap_destroy(), GNUNET_CONTAINER_heap_remove_root(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_DNSSTUB_stop(), GNUNET_free, GNUNET_IDENTITY_disconnect(), GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_disconnect(), GNUNET_NAMESTORE_zone_iteration_stop(), GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_destroy(), Request::hn, ns, ns_pending, Request::qe, req_head, req_heap, req_tail, stats, t, zone_head, zone_it, and zone_tail.
Referenced by run().
|
static |
Iterate over all of the zones we care about and see which records we may need to re-fetch when.
cls | NULL |
Definition at line 1596 of file gnunet-zoneimport.c.
References Zone::domain, GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_NO, GNUNET_STATISTICS_set(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_get(), iterate_zones(), Zone::key, move_to_queue(), Zone::next, ns, ns_iterator_trigger_next, ns_lookup_error_cb(), ns_lookup_result_cb(), ns_pending, start_time_reg_proc, stats, total_reg_proc_dns, total_reg_proc_dns_ns, zone_head, zone_it, and zone_tail.
Referenced by iterate_zones(), ns_lookup_error_cb(), and process_stdin().
|
static |
Function called if GNUNET_NAMESTORE_records_lookup() failed.
Just logs an error.
cls | a struct Zone |
Definition at line 1383 of file gnunet-zoneimport.c.
References Zone::domain, GNUNET_ERROR_TYPE_INFO, GNUNET_log, iterate_zones(), ns_iterator_trigger_next, and zone_it.
Referenced by iterate_zones().
|
static |
Process a record that was stored in the namestore.
cls | a struct Zone * |
key | private key of the zone |
label | label of the records |
rd_count | number of entries in rd array, 0 if label was deleted |
rd | array of records with data to store |
Definition at line 1406 of file gnunet-zoneimport.c.
References GNUNET_TIME_Absolute::abs_value_us, add_record(), cached, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, Zone::domain, GNUNET_GNSRECORD_Data::expiration_time, Request::expires, GNUNET_GNSRECORD_Data::flags, free_records(), get_label(), GNUNET_asprintf(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_log, GNUNET_memcmp, GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_TIME_absolute_min(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_ZERO_ABS, Request::hostname, insert_sorted(), key, Zone::key, Record::next, NS_BATCH_SIZE, ns_iterator_trigger_next, ns_pending, rd, rd_count, Request::rec_head, GNUNET_GNSRECORD_Data::record_type, GNUNET_TIME_Relative::rel_value_us, stats, Request::zone, and zone_it.
Referenced by iterate_zones().
|
static |
Add hostname to the list of requests to be made.
hostname | name to resolve |
Definition at line 1506 of file gnunet-zoneimport.c.
References Zone::domain, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_DNSPARSER_check_name(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, Request::hostname, Request::id, Zone::next, ns_pending, rejects, Request::zone, and zone_head.
Referenced by boot_queue(), check_for_global_natted(), check_for_queue_with_higher_prio(), check_vl_transmission(), core_read_finished_cb(), decrypt_and_check_tc(), destroy_message_control(), do_rekey(), enqueue_message_control(), fragment_message(), free_pending_acknowledgement(), free_queue(), free_queue_entry(), free_timedout_queue_entry(), get_audiobin(), get_queue_delete_it(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop(), handle_add_queue_message(), handle_del_queue_message(), handle_send_message_ack(), handshake_ack_monotime_cb(), handshake_ack_monotime_store_cb(), handshake_monotime_cb(), handshake_monotime_store_cb(), inject_rekey(), iterate_address_and_compare_cb(), iterate_message_control(), lookup_queue_it(), mq_cancel(), mq_destroy(), mq_error(), mq_init(), mq_send(), pass_plaintext_to_core(), prepare_pending_acknowledgement(), process_stdin(), proto_read_kx(), queue_destroy(), queue_finish(), queue_read(), queue_read_kx(), queue_send_msg(), queue_timeout(), queue_write(), rekey_monotime_cb(), rekey_monotime_store_cb(), reliability_box_message(), reschedule_queue_timeout(), schedule_transmit_on_queue(), select_best_pending_from_link(), select_read_cb(), select_write_cb(), send_challenge(), setup_in_cipher(), setup_in_cipher_elligator(), setup_out_cipher(), setup_queue(), start_initial_kx_out(), task_message_control(), transmit_kx(), transmit_on_queue(), and try_handle_plaintext().
|
static |
We have completed the initial iteration over the namestore's database.
This function is called on each of the remaining records in move_to_queue to queue() them, as we will simply not find existing records for them any longer.
cls | NULL |
key | unused |
value | a struct Request |
Definition at line 1578 of file gnunet-zoneimport.c.
References GNUNET_OK, insert_sorted(), key, and value.
Referenced by iterate_zones().
|
static |
Begin processing hostnames from stdin.
cls | NULL |
Definition at line 1664 of file gnunet-zoneimport.c.
References delta, GNUNET_IDENTITY_disconnect(), GNUNET_NO, GNUNET_STATISTICS_set(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_YES, iterate_zones(), queue(), stats, and t.
Referenced by identity_cb().
|
static |
Method called to inform about the egos of this peer.
When used with GNUNET_IDENTITY_connect, this function is initially called for all egos and then again whenever a ego's name changes or if it is deleted. At the end of the initial pass over all egos, the function is once called with 'NULL' for ego. That does NOT mean that the callback won't be invoked in the future or that there was an error.
When used with GNUNET_IDENTITY_create or GNUNET_IDENTITY_get, this function is only called ONCE, and 'NULL' being passed in ego does indicate an error (for example because name is taken or no default value is known). If ego is non-NULL and if '*ctx' is set in those callbacks, the value WILL be passed to a subsequent call to the identity callback of GNUNET_IDENTITY_connect (if that one was not NULL).
When an identity is renamed, this function is called with the (known) ego but the NEW name.
When an identity is deleted, this function is called with the (known) ego and "NULL" for the name. In this case, the ego is henceforth invalid (and the ctx should also be cleaned up).
cls | closure |
ego | ego handle, NULL for end of list |
ctx | context for application to store data for this ego (during the lifetime of this process, initially NULL) |
name | name assigned by the user for this ego, NULL if the user just deleted the ego and it must thus no longer be used |
Definition at line 1739 of file gnunet-zoneimport.c.
References ctx, Zone::domain, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_ERROR, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_log, GNUNET_new, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, Zone::key, name, process_stdin(), t, zone_head, and zone_tail.
Referenced by run().
|
static |
Process requests from the queue, then if the queue is not empty, try again.
cls | NULL |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 1782 of file gnunet-zoneimport.c.
References consensus-simulation::args, cfg, dns_ctx, do_shutdown(), GNUNET_CONTAINER_heap_create(), GNUNET_CONTAINER_HEAP_ORDER_MIN, GNUNET_CONTAINER_multihashmap_create(), GNUNET_DNSSTUB_add_dns_ip(), GNUNET_DNSSTUB_start(), GNUNET_IDENTITY_connect(), GNUNET_NAMESTORE_connect(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), identity_cb(), map_size, ns, ns_pending, req_heap, and stats.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Call with IP address of resolver to query.
argc | should be 2 |
argv[1] | should contain IP address |
Definition at line 1839 of file gnunet-zoneimport.c.
References cached, failures, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_relative_time(), GNUNET_GETOPT_option_uint(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), lookups, map_size, minimum_expiration_time, options, pending, pending_rs, record_sets, records, rejects, ret, and run().
|
static |
How long do DNS records have to last at least after being imported?
Definition at line 62 of file gnunet-zoneimport.c.
Referenced by check_for_glue(), main(), and process_record().
|
static |
Command-line argument specifying desired size of the hash map with all of our pending names.
Usually, we use an automatically growing map, but this is only OK up to about a million entries. Above that number, the user must explicitly specify the size at startup.
Definition at line 212 of file gnunet-zoneimport.c.
Referenced by main(), process_notify(), and run().
|
static |
Handle to the identity service.
Definition at line 217 of file gnunet-zoneimport.c.
|
static |
Namestore handle.
Definition at line 222 of file gnunet-zoneimport.c.
Referenced by do_shutdown(), iterate_zones(), process_result(), and run().
|
static |
Handle to the statistics service.
Definition at line 227 of file gnunet-zoneimport.c.
Referenced by announce_id(), destroy_direction(), destroy_route(), dir_ready_cb(), discard_all_from_rung_tail(), discard_buffer(), do_shutdown(), GCC_latency_observed(), GCCH_channel_incoming_new(), GCCH_channel_local_new(), GCCH_handle_channel_open_ack(), GCCH_handle_channel_plaintext_data(), GCCH_handle_channel_plaintext_data_ack(), GCD_search(), GCT_handle_encrypted(), GCT_handle_kx(), GCT_handle_kx_auth(), GCT_send(), handle_connection_create(), handle_plaintext_keepalive(), iterate_zones(), ns_lookup_result_cb(), process_record(), process_result(), process_stdin(), REGEX_INTERNAL_announce(), REGEX_INTERNAL_search(), route_message(), run(), send_keepalive(), send_kx(), send_kx_auth(), store_completed_cb(), and update_ax_by_kx().
|
static |
Context for DNS resolution.
Definition at line 232 of file gnunet-zoneimport.c.
Referenced by do_shutdown(), process_queue(), and run().
|
static |
The number of DNS queries that are outstanding.
Definition at line 237 of file gnunet-zoneimport.c.
Referenced by GNUNET_NETWORK_socket_recvfrom_amount(), main(), process_queue(), and process_result().
|
static |
The number of NAMESTORE record store operations that are outstanding.
Definition at line 242 of file gnunet-zoneimport.c.
Referenced by main(), process_queue(), process_result(), and store_completed_cb().
|
static |
Number of lookups we performed overall.
Definition at line 247 of file gnunet-zoneimport.c.
Referenced by main(), and process_queue().
|
static |
Number of records we had cached.
Definition at line 252 of file gnunet-zoneimport.c.
Referenced by main(), and ns_lookup_result_cb().
|
static |
How many hostnames did we reject (malformed).
Definition at line 257 of file gnunet-zoneimport.c.
Referenced by build_dns_query(), main(), and queue().
|
static |
Number of lookups that failed.
Definition at line 262 of file gnunet-zoneimport.c.
Referenced by main(), and process_result().
|
static |
Number of records we found.
Definition at line 267 of file gnunet-zoneimport.c.
Referenced by cache_answers(), GNUNET_GNSRECORD_JSON_from_gnsrecord(), main(), and process_record().
|
static |
Number of record sets given to namestore.
Definition at line 272 of file gnunet-zoneimport.c.
Referenced by main(), and process_result().
|
static |
Heap of all requests to perform, sorted by the time we should next do the request (i.e.
by expires).
Definition at line 278 of file gnunet-zoneimport.c.
Referenced by do_shutdown(), insert_sorted(), process_queue(), and run().
|
static |
Active requests are kept in a DLL.
Definition at line 283 of file gnunet-zoneimport.c.
Referenced by do_shutdown(), process_queue(), and process_result().
|
static |
Active requests are kept in a DLL.
Definition at line 288 of file gnunet-zoneimport.c.
Referenced by do_shutdown(), process_queue(), and process_result().
|
static |
Main task.
Definition at line 293 of file gnunet-zoneimport.c.
Referenced by add_without_sets(), automaton_create_proofs(), automaton_destroy_state(), automaton_merge_states(), automaton_state_traverse(), block_create_ecdsa(), block_create_eddsa(), check_dht_p2p_hello(), compute_scalar_product(), connection_ready_cb(), consider_path_cb(), construct_task_graph(), destroy_t_connection(), destroy_task(), destroy_tunnel(), destroy_tunnels_now(), dfa_add_multi_strides_helper(), dfa_compress_paths(), dfa_compress_paths_helper(), dfa_move(), dfa_remove_dead_states(), do_send(), do_shutdown(), driver_add_multiple(), dump_backtrace(), extract_abs_time(), extract_abs_time_nbo(), extract_timestamp_nbo(), find_peer_context(), GCCH_channel_incoming_new(), GCP_drop_tunnel(), GCT_2s(), GCT_add_channel(), GCT_add_inbound_connection(), GCT_change_estate(), GCT_connection_lost(), GCT_consider_path(), GCT_count_any_connections(), GCT_count_channels(), GCT_create_tunnel(), GCT_debug(), GCT_destroy_tunnel_now(), GCT_get_destination(), GCT_get_estate(), GCT_handle_encrypted(), GCT_handle_kx(), GCT_handle_kx_auth(), GCT_iterate_channels(), GCT_iterate_connections(), GCT_remove_channel(), GCT_send(), GCT_send_cancel(), GCT_send_channel_destroy(), GDS_u_connect(), GDS_u_disconnect(), GDS_u_receive(), get_all_tunnels_iterator(), get_next_free_ctn(), get_ready_connection(), GNUNET_CRYPTO_hash_xorcmp(), GNUNET_DISK_file_seek(), GNUNET_DISK_mkdtemp(), GNUNET_DISK_mktemp(), GNUNET_FS_meta_data_add_publication_date(), GNUNET_JSON_pack_timestamp(), GNUNET_JSON_spec_timestamp(), GNUNET_log_setup(), GNUNET_SCHEDULER_add_at_with_priority(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_add_with_reason_and_priority(), GNUNET_SERVICE_client_drop(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_STRINGS_fancy_time_to_absolute(), GNUNET_STRINGS_timestamp_to_string(), GNUNET_TIME_absolute2s(), GNUNET_TIME_absolute_approx_eq(), GNUNET_TIME_get_current_year(), GNUNET_TIME_randomized_backoff(), GNUNET_TIME_time_to_year(), GNUNET_TIME_timestamp_hton(), GNUNET_TIME_timestamp_ntoh(), GNUNET_TIME_year_to_time(), GNUNET_TRANSPORT_TESTING_done(), GNUNET_TRANSPORT_TESTING_get_test_plugin_name(), handle_connection_create(), handle_decrypted(), handle_dht_p2p_get(), handle_dht_p2p_hello(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_encrypted(), handle_p2p_estimate(), handle_ping(), handle_plaintext_channel_destroy(), handle_plaintext_channel_open(), handle_plaintext_channel_open_ack(), handle_plaintext_data(), handle_plaintext_data_ack(), handle_plaintext_keepalive(), handle_pong(), helper_read(), helper_write(), identity_cb(), init_backtrace(), init_fd_info(), insert_sorted(), iterate_initial_edge(), lookup_channel(), maintain_connections_cb(), mark_connection_unready(), mktemp_name(), parse_definitions(), parse_pattern(), process_queue(), process_result(), process_stdin(), progress_cb(), put_task(), REGEX_INTERNAL_dfa_add_multi_strides(), restore_fair(), retry_kx(), rsa_gcd_validate(), scc_tarjan_strongconnect(), send_create(), send_done_cb(), send_kx(), send_kx_auth(), set_timestamp(), shutdown_if_no_lifeness(), state_add_transition(), state_get_edges(), store_completed_cb(), trigger_transmissions(), try_send_normal_payload(), and vec_for().
|
static |
Hash map of requests for which we may still get a response from the namestore.
Set to NULL once the initial namestore iteration is done.
Definition at line 300 of file gnunet-zoneimport.c.
Referenced by do_shutdown(), iterate_zones(), ns_lookup_result_cb(), queue(), and run().
|
static |
Current zone iteration handle.
Definition at line 305 of file gnunet-zoneimport.c.
Referenced by do_shutdown(), iterate_zones(), ns_lookup_error_cb(), and ns_lookup_result_cb().
|
static |
Head of list of zones we are managing.
Definition at line 310 of file gnunet-zoneimport.c.
Referenced by do_shutdown(), identity_cb(), iterate_zones(), and queue().
|
static |
Tail of list of zones we are managing.
Definition at line 315 of file gnunet-zoneimport.c.
Referenced by do_shutdown(), identity_cb(), and iterate_zones().
|
static |
After how many more results must ns_lookup_result_cb() ask the namestore for more?
Definition at line 321 of file gnunet-zoneimport.c.
Referenced by iterate_zones(), ns_lookup_error_cb(), and ns_lookup_result_cb().
|
static |
Number of DNS requests counted in latency total.
Definition at line 326 of file gnunet-zoneimport.c.
Referenced by process_result().
|
static |
Sum of DNS latencies observed.
Definition at line 331 of file gnunet-zoneimport.c.
Referenced by process_result().
|
static |
Number of records processed (DNS lookup, no NAMESTORE) in total.
Definition at line 336 of file gnunet-zoneimport.c.
Referenced by iterate_zones(), process_result(), and store_completed_cb().
|
static |
Number of records processed (DNS lookup, with NAMESTORE) in total.
Definition at line 341 of file gnunet-zoneimport.c.
Referenced by iterate_zones(), and store_completed_cb().
|
static |
Start time of the regular processing.
Definition at line 346 of file gnunet-zoneimport.c.
Referenced by iterate_zones(), and store_completed_cb().
|
static |
Last time we worked before going idle.
Definition at line 351 of file gnunet-zoneimport.c.
Referenced by insert_sorted(), process_queue(), process_result(), and store_completed_cb().
|
static |
Time we slept just waiting for work.
Definition at line 356 of file gnunet-zoneimport.c.
Referenced by process_queue(), and store_completed_cb().