paragraph for gnunet devs that don't know how to use the web
[oweals/gnunet.git] / src / gns / gnunet-service-gns_resolver.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009-2013 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero 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.
9
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.
14     
15      You should have received a copy of the GNU Affero General Public License
16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 /**
19  * @file gns/gnunet-service-gns_resolver.h
20  * @brief GNUnet GNS service
21  * @author Martin Schanzenbach
22  */
23 #ifndef GNS_RESOLVER_H
24 #define GNS_RESOLVER_H
25 #include "gns.h"
26 #include "gnunet_dht_service.h"
27 #include "gnunet_gns_service.h"
28 #include "gnunet_namecache_service.h"
29
30 /**
31  * Initialize the resolver subsystem.
32  * MUST be called before #GNS_resolver_lookup.
33  *
34  * @param nc the namecache handle
35  * @param dht handle to the dht
36  * @param c configuration handle
37  * @param max_bg_queries maximum amount of background queries
38  */
39 void
40 GNS_resolver_init (struct GNUNET_NAMECACHE_Handle *nc,
41                    struct GNUNET_DHT_Handle *dht,
42                    const struct GNUNET_CONFIGURATION_Handle *c,
43                    unsigned long long max_bg_queries);
44
45
46 /**
47  * Cleanup resolver: Terminate pending lookups
48  */
49 void
50 GNS_resolver_done (void);
51
52
53 /**
54  * Handle for an active request.
55  */
56 struct GNS_ResolverHandle;
57
58
59 /**
60  * Function called with results for a GNS resolution.
61  *
62  * @param cls closure
63  * @param rd_count number of records in @a rd
64  * @param rd records returned for the lookup
65  */
66 typedef void
67 (*GNS_ResultProcessor)(void *cls,
68                        uint32_t rd_count,
69                        const struct GNUNET_GNSRECORD_Data *rd);
70
71
72 /**
73  * Lookup of a record in a specific zone
74  * calls RecordLookupProcessor on result or timeout
75  *
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 options options set to control local lookup
80  * @param proc the processor to call
81  * @param proc_cls the closure to pass to @a proc
82  * @return handle to cancel operation
83  */
84 struct GNS_ResolverHandle *
85 GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
86                      uint32_t record_type,
87                      const char *name,
88                      enum GNUNET_GNS_LocalOptions options,
89                      GNS_ResultProcessor proc,
90                      void *proc_cls);
91
92
93 /**
94  * Cancel active resolution (i.e. client disconnected).
95  *
96  * @param rh resolution to abort
97  */
98 void
99 GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh);
100
101 #endif