2 This file is part of GNUnet
3 (C) 2012 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
27 * - decide what goes into storage API and what into GNS-service API
28 * - decide where to pass/expose/check keys / signatures
29 * - are GNS private keys per peer or per user?
33 #ifndef GNUNET_GNS_SERVICE_H
34 #define GNUNET_GNS_SERVICE_H
36 #include "gnunet_util_lib.h"
41 #if 0 /* keep Emacsens' auto-indent happy */
48 * Connection to the GNS service.
50 struct GNUNET_GNS_Handle;
53 * Handle to control a get operation.
55 struct GNUNET_GNS_LookupHandle;
58 * A single GNS record.
60 struct GNUNET_GNS_Record;
64 * Based on GNUNET_DNSPARSER_TYPEs (standard DNS)
66 enum GNUNET_GNS_RecordType
69 GNUNET_GNS_RECORD_TYPE_A = 1,
70 GNUNET_GNS_RECORD_TYPE_NS = 2,
71 GNUNET_GNS_RECORD_TYPE_CNAME = 5,
72 GNUNET_GNS_RECORD_TYPE_SOA = 6,
73 GNUNET_GNS_RECORD_TYPE_PTR = 12,
74 GNUNET_GNS_RECORD_MX = 15,
75 GNUNET_GNS_RECORD_TXT = 16,
76 GNUNET_GNS_RECORD_AAAA = 28,
79 GNUNET_GNS_RECORD_PKEY = 256
83 * Initialize the connection with the GNS service.
84 * FIXME: Do we need the ht_len?
86 * @param cfg configuration to use
87 * @param ht_len size of the internal hash table to use for parallel lookups
88 * @return NULL on error
90 struct GNUNET_GNS_Handle *
91 GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
96 * Shutdown connection with the GNS service.
98 * @param handle connection to shut down
101 GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle);
104 /* *************** Standard API: lookup ******************* */
107 * Iterator called on each result obtained for a GNS
111 * @param name "name" of the original lookup
112 * @param record the records in reply
113 * @param num_records the number of records in reply
115 typedef void (*GNUNET_GNS_LookupIterator) (void *cls,
117 const struct GNUNET_GNS_Record *record,
118 unsigned int num_records);
123 * Perform an asynchronous lookup operation on the GNS.
125 * @param handle handle to the GNS service
126 * @param timeout how long to wait for transmission of this request to the service
127 * // FIXME: what happens afterwards?
128 * @param type expected type of the response object
129 * @param name the name to look up
130 * @param type the GNUNET_GNS_RecordType to look for
131 * @param iter function to call on each result
132 * @param iter_cls closure for iter
134 * @return handle to stop the async get
136 struct GNUNET_GNS_LookupHandle *
137 GNUNET_GNS_lookup_start (struct GNUNET_GNS_Handle *handle,
138 struct GNUNET_TIME_Relative timeout,
140 enum GNUNET_GNS_RecordType type,
141 GNUNET_GNS_LookupIterator iter,
146 * Stop async GNS lookup. Frees associated resources.
148 * @param lookup_handle lookup operation to stop.
150 * On return lookup_handle will no longer be valid, caller
151 * must not use again!!!
154 GNUNET_GNS_lookup_stop (struct GNUNET_GNS_LookupHandle *lookup_handle);
157 #if 0 /* keep Emacsens' auto-indent happy */
166 /* gnunet_gns_service.h */