2 This file is part of GNUnet.
3 (C) 2009-2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file gns/gnunet-service-gns_resolver.h
22 * @brief GNUnet GNS service
23 * @author Martin Schanzenbach
25 #ifndef GNS_RESOLVER_H
26 #define GNS_RESOLVER_H
28 #include "gnunet_dht_service.h"
32 * Initialize the resolver subsystem.
33 * MUST be called before #GNS_resolver_lookup.
35 * @param nh handle to the namestore
36 * @param dht handle to the dht
37 * @param c configuration handle
38 * @param max_bg_queries maximum amount of background queries
41 GNS_resolver_init (struct GNUNET_NAMESTORE_Handle *nh,
42 struct GNUNET_DHT_Handle *dht,
43 const struct GNUNET_CONFIGURATION_Handle *c,
44 unsigned long long max_bg_queries);
48 * Cleanup resolver: Terminate pending lookups
51 GNS_resolver_done (void);
55 * Handle for an active request.
57 struct GNS_ResolverHandle;
61 * Function called with results for a GNS resolution.
64 * @param rd_count number of records in @a rd
65 * @param rd records returned for the lookup
67 typedef void (*GNS_ResultProcessor)(void *cls,
69 const struct GNUNET_NAMESTORE_RecordData *rd);
73 * Lookup of a record in a specific zone
74 * calls RecordLookupProcessor on result or timeout
76 * @param zone the zone to perform the lookup in
77 * @param record_type the record type to look up
78 * @param name the name to look up
79 * @param shorten_key optional private key for authority caching, can be NULL
80 * @param only_cached GNUNET_NO to only check locally not DHT for performance
81 * @param proc the processor to call
82 * @param proc_cls the closure to pass to @a proc
83 * @return handle to cancel operation
85 struct GNS_ResolverHandle *
86 GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicKey *zone,
89 const struct GNUNET_CRYPTO_EccPrivateKey *shorten_key,
91 GNS_ResultProcessor proc,
96 * Cancel active resolution (i.e. client disconnected).
98 * @param rh resolution to abort
101 GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh);
107 * Generic function to check for TLDs. Checks if "name" ends in ".tld"
109 * @param name the name to check
110 * @param tld the tld to check
111 * @return #GNUNET_YES or #GNUNET_NO
114 is_tld (const char *name,
120 * Checks for gnu/zkey
122 #define is_gads_tld(name) is_tld(name, GNUNET_GNS_TLD)
123 #define is_zkey_tld(name) is_tld(name, GNUNET_GNS_TLD_ZKEY)