More API function tests...
[oweals/gnunet.git] / src / gns / gnunet-service-gns_reverser.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
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.
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      General Public License for more details.
14
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.
19 */
20 /**
21  * @file gns/gnunet-service-gns_reverser.h
22  * @brief GNUnet GNS service
23  * @author Martin Schanzenbach
24  */
25 #ifndef GNS_REVERSER_H
26 #define GNS_REVERSER_H
27 #include "gns.h"
28 #include "gnunet_gns_service.h"
29
30 /**
31  * Handle for an active request.
32  */
33 struct GNS_ReverserHandle;
34
35
36 /**
37  * Function called with results for a GNS resolution.
38  *
39  * @param cls closure
40  * @param rd_count number of records in @a rd
41  * @param rd records returned for the lookup
42  */
43 typedef void (*GNS_ReverseResultProcessor)(void *cls,
44                                            const char *name);
45
46
47 /**
48  * Reverse lookup of a specific zone
49  * calls RecordLookupProcessor on result or timeout
50  *
51  * @param target the zone to perform the lookup in
52  * @param authority the authority
53  * @param proc the processor to call
54  * @param proc_cls the closure to pass to @a proc
55  * @return handle to cancel operation
56  */
57 struct GNS_ReverserHandle *
58 GNS_reverse_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *target,
59                     const struct GNUNET_CRYPTO_EcdsaPublicKey *authority,
60                     GNS_ReverseResultProcessor proc,
61                     void *proc_cls);
62
63
64 /**
65  * Cancel active resolution (i.e. client disconnected).
66  *
67  * @param rh resolution to abort
68  */
69 void
70 GNS_reverse_lookup_cancel (struct GNS_ReverserHandle *rh);
71
72 /**
73  * Initialize reverser
74  *
75  * @param nh handle to a namestore
76  * @param key the private key of the gns-reverse zone
77  * @param name the name of the gns-reverse zone
78  * @return GNUNET_OK
79  */
80 int
81 GNS_reverse_init (struct GNUNET_NAMESTORE_Handle *nh,
82                   const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
83                   const char *name);
84
85 /**
86  * Cleanup reverser
87  */
88 void
89 GNS_reverse_done ();
90
91 #endif