2 This file is part of GNUnet.
3 Copyright (C) 2009-2013 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
16 * @file gns/gnunet-service-gns_resolver.h
17 * @brief GNUnet GNS service
18 * @author Martin Schanzenbach
20 #ifndef GNS_RESOLVER_H
21 #define GNS_RESOLVER_H
23 #include "gnunet_dht_service.h"
24 #include "gnunet_gns_service.h"
25 #include "gnunet_namecache_service.h"
28 * Initialize the resolver subsystem.
29 * MUST be called before #GNS_resolver_lookup.
31 * @param nc the namecache handle
32 * @param dht handle to the dht
33 * @param c configuration handle
34 * @param max_bg_queries maximum amount of background queries
37 GNS_resolver_init (struct GNUNET_NAMECACHE_Handle *nc,
38 struct GNUNET_DHT_Handle *dht,
39 const struct GNUNET_CONFIGURATION_Handle *c,
40 unsigned long long max_bg_queries);
44 * Cleanup resolver: Terminate pending lookups
47 GNS_resolver_done (void);
51 * Handle for an active request.
53 struct GNS_ResolverHandle;
57 * Function called with results for a GNS resolution.
60 * @param rd_count number of records in @a rd
61 * @param rd records returned for the lookup
64 (*GNS_ResultProcessor)(void *cls,
66 const struct GNUNET_GNSRECORD_Data *rd);
70 * Lookup of a record in a specific zone
71 * calls RecordLookupProcessor on result or timeout
73 * @param zone the zone to perform the lookup in
74 * @param record_type the record type to look up
75 * @param name the name to look up
76 * @param options options set to control local lookup
77 * @param proc the processor to call
78 * @param proc_cls the closure to pass to @a proc
79 * @return handle to cancel operation
81 struct GNS_ResolverHandle *
82 GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
85 enum GNUNET_GNS_LocalOptions options,
86 GNS_ResultProcessor proc,
91 * Cancel active resolution (i.e. client disconnected).
93 * @param rh resolution to abort
96 GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh);