2 This file is part of GNUnet
3 (C) 2012-2014 Christian Grothoff (and other contributing authors)
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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file include/gnunet_gns_service.h
23 * @brief API to the GNS service
24 * @author Martin Schanzenbach
26 #ifndef GNUNET_GNS_SERVICE_H
27 #define GNUNET_GNS_SERVICE_H
29 #include "gnunet_util_lib.h"
30 #include "gnunet_dnsparser_lib.h"
31 #include "gnunet_namestore_service.h"
36 #if 0 /* keep Emacsens' auto-indent happy */
43 * String we use to indicate the local master zone or a
44 * root entry in the current zone.
46 #define GNUNET_GNS_MASTERZONE_STR "+"
49 * Connection to the GNS service.
51 struct GNUNET_GNS_Handle;
54 * Handle to control a lookup operation.
56 struct GNUNET_GNS_LookupRequest;
60 * Initialize the connection with the GNS service.
62 * @param cfg configuration to use
63 * @return handle to the GNS service, or NULL on error
65 struct GNUNET_GNS_Handle *
66 GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
70 * Shutdown connection with the GNS service.
72 * @param handle connection to shut down
75 GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle);
79 * Iterator called on obtained result for a GNS lookup.
82 * @param rd_count number of records in @a rd
83 * @param rd the records in reply
85 typedef void (*GNUNET_GNS_LookupResultProcessor) (void *cls,
87 const struct GNUNET_GNSRECORD_Data *rd);
91 * Options for the GNS lookup.
93 enum GNUNET_GNS_LocalOptions
96 * Defaults, look in cache, then in DHT.
98 GNUNET_GNS_LO_DEFAULT = 0,
101 * Never look in the DHT, keep request to local cache.
103 GNUNET_GNS_LO_NO_DHT = 1,
106 * For the rightmost label, only look in the cache (it
107 * is our master zone), for the others, the DHT is OK.
109 GNUNET_GNS_LO_LOCAL_MASTER = 2
115 * Perform an asynchronous lookup operation on the GNS.
117 * @param handle handle to the GNS service
118 * @param name the name to look up
119 * @param zone zone to look in
120 * @param type the GNS record type to look for
121 * @param options local options for the lookup
122 * @param shorten_zone_key the private key of the shorten zone (can be NULL);
123 * specify to enable automatic shortening (given a PSEU
124 * record, if a given pseudonym is not yet used in the
125 * shorten zone, we automatically add the respective zone
127 * @param proc function to call on result
128 * @param proc_cls closure for processor
129 * @return handle to the queued request
131 struct GNUNET_GNS_LookupRequest *
132 GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
134 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
136 enum GNUNET_GNS_LocalOptions options,
137 const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_zone_key,
138 GNUNET_GNS_LookupResultProcessor proc,
143 * Cancel pending lookup request
145 * @param lr the lookup request to cancel
148 GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr);
151 #if 0 /* keep Emacsens' auto-indent happy */
160 /* gnunet_gns_service.h */