2 This file is part of GNUnet
3 Copyright (C) 2012-2014, 2017 GNUnet e.V.
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @author Martin Schanzenbach
25 * API to the GNS service
27 * @defgroup gns GNS service
30 * @see [Documentation](https://gnunet.org/gns-implementation)
34 #ifndef GNUNET_GNS_SERVICE_H
35 #define GNUNET_GNS_SERVICE_H
37 #include "gnunet_util_lib.h"
38 #include "gnunet_dnsparser_lib.h"
39 #include "gnunet_namestore_service.h"
44 #if 0 /* keep Emacsens' auto-indent happy */
51 * String we use to indicate the local master zone or a
52 * root entry in the current zone.
54 * FIXME: probably should be changed to "@" and renamed
55 * (this name is confusing!)
57 #define GNUNET_GNS_MASTERZONE_STR "+"
60 * Connection to the GNS service.
62 struct GNUNET_GNS_Handle;
65 * Handle to control a lookup operation.
67 struct GNUNET_GNS_LookupRequest;
71 * Initialize the connection with the GNS service.
73 * @param cfg configuration to use
74 * @return handle to the GNS service, or NULL on error
76 struct GNUNET_GNS_Handle *
77 GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
81 * Shutdown connection with the GNS service.
83 * @param handle connection to shut down
86 GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle);
90 * Iterator called on obtained result for a GNS lookup.
93 * @param rd_count number of records in @a rd
94 * @param rd the records in reply
97 (*GNUNET_GNS_LookupResultProcessor) (void *cls,
99 const struct GNUNET_GNSRECORD_Data *rd);
103 * Options for the GNS lookup.
105 enum GNUNET_GNS_LocalOptions
108 * Defaults, look in cache, then in DHT.
110 GNUNET_GNS_LO_DEFAULT = 0,
113 * Never look in the DHT, keep request to local cache.
115 GNUNET_GNS_LO_NO_DHT = 1,
118 * For the rightmost label, only look in the cache (it
119 * is our master zone), for the others, the DHT is OK.
121 GNUNET_GNS_LO_LOCAL_MASTER = 2
127 * Perform an asynchronous lookup operation on the GNS.
129 * @param handle handle to the GNS service
130 * @param name the name to look up
131 * @param zone zone to look in
132 * @param type the GNS record type to look for
133 * @param options local options for the lookup
134 * @param proc function to call on result
135 * @param proc_cls closure for @a proc
136 * @return handle to the queued request
138 struct GNUNET_GNS_LookupRequest *
139 GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
141 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
143 enum GNUNET_GNS_LocalOptions options,
144 GNUNET_GNS_LookupResultProcessor proc,
149 * Cancel pending lookup request
151 * @param lr the lookup request to cancel
154 GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr);
157 #if 0 /* keep Emacsens' auto-indent happy */
166 /** @} */ /* end of group */