-remove debug message
[oweals/gnunet.git] / src / gns / gnunet-service-gns_resolver.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009-2020 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      SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 /**
21  * @file gns/gnunet-service-gns_resolver.h
22  * @brief GNUnet GNS service
23  * @author Martin Schanzenbach
24  */
25 #ifndef GNS_RESOLVER_H
26 #define GNS_RESOLVER_H
27 #include "gns.h"
28 #include "gnunet_dht_service.h"
29 #include "gnunet_gns_service.h"
30 #include "gnunet_namecache_service.h"
31
32 /**
33  * Initialize the resolver subsystem.
34  * MUST be called before #GNS_resolver_lookup.
35  *
36  * @param nc the namecache handle
37  * @param dht handle to the dht
38  * @param c configuration handle
39  * @param max_bg_queries maximum amount of background queries
40  */
41 void
42 GNS_resolver_init (struct GNUNET_NAMECACHE_Handle *nc,
43                    struct GNUNET_DHT_Handle *dht,
44                    const struct GNUNET_CONFIGURATION_Handle *c,
45                    unsigned long long max_bg_queries);
46
47
48 /**
49  * Cleanup resolver: Terminate pending lookups
50  */
51 void
52 GNS_resolver_done (void);
53
54
55 /**
56  * Handle for an active request.
57  */
58 struct GNS_ResolverHandle;
59
60
61 /**
62  * Function called with results for a GNS resolution.
63  *
64  * @param cls closure
65  * @param rd_count number of records in @a rd
66  * @param rd records returned for the lookup
67  */
68 typedef void
69 (*GNS_ResultProcessor)(void *cls,
70                        uint32_t rd_count,
71                        const struct GNUNET_GNSRECORD_Data *rd);
72
73
74 /**
75  * Lookup of a record in a specific zone
76  * calls RecordLookupProcessor on result or timeout
77  *
78  * @param zone the zone to perform the lookup in
79  * @param record_type the record type to look up
80  * @param name the name to look up
81  * @param options options set to control local lookup
82  * @param recursion_depth_limit how many zones to traverse
83  *        at most
84  * @param proc the processor to call
85  * @param proc_cls the closure to pass to @a proc
86  * @return handle to cancel operation
87  */
88 struct GNS_ResolverHandle *
89 GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
90                      uint32_t record_type,
91                      const char *name,
92                      enum GNUNET_GNS_LocalOptions options,
93                      uint16_t recursion_depth_limit,
94                      GNS_ResultProcessor proc,
95                      void *proc_cls);
96
97
98 /**
99  * Cancel active resolution (i.e. client disconnected).
100  *
101  * @param rh resolution to abort
102  */
103 void
104 GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh);
105
106 #endif