glitch in the license text detected by hyazinthe, thank you!
[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 /**
16  * @file gns/gnunet-service-gns_resolver.h
17  * @brief GNUnet GNS service
18  * @author Martin Schanzenbach
19  */
20 #ifndef GNS_RESOLVER_H
21 #define GNS_RESOLVER_H
22 #include "gns.h"
23 #include "gnunet_dht_service.h"
24 #include "gnunet_gns_service.h"
25 #include "gnunet_namecache_service.h"
26
27 /**
28  * Initialize the resolver subsystem.
29  * MUST be called before #GNS_resolver_lookup.
30  *
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
35  */
36 void
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);
41
42
43 /**
44  * Cleanup resolver: Terminate pending lookups
45  */
46 void
47 GNS_resolver_done (void);
48
49
50 /**
51  * Handle for an active request.
52  */
53 struct GNS_ResolverHandle;
54
55
56 /**
57  * Function called with results for a GNS resolution.
58  *
59  * @param cls closure
60  * @param rd_count number of records in @a rd
61  * @param rd records returned for the lookup
62  */
63 typedef void
64 (*GNS_ResultProcessor)(void *cls,
65                        uint32_t rd_count,
66                        const struct GNUNET_GNSRECORD_Data *rd);
67
68
69 /**
70  * Lookup of a record in a specific zone
71  * calls RecordLookupProcessor on result or timeout
72  *
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
80  */
81 struct GNS_ResolverHandle *
82 GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
83                      uint32_t record_type,
84                      const char *name,
85                      enum GNUNET_GNS_LocalOptions options,
86                      GNS_ResultProcessor proc,
87                      void *proc_cls);
88
89
90 /**
91  * Cancel active resolution (i.e. client disconnected).
92  *
93  * @param rh resolution to abort
94  */
95 void
96 GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh);
97
98 #endif