diff options
Diffstat (limited to 'src/include/gnunet_reclaim_plugin.h')
-rw-r--r-- | src/include/gnunet_reclaim_plugin.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h new file mode 100644 index 000000000..c400af64c --- /dev/null +++ b/src/include/gnunet_reclaim_plugin.h | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2012, 2013 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 | |||
19 | /** | ||
20 | * @author Martin Schanzenbach | ||
21 | * | ||
22 | * @file | ||
23 | * Plugin API for the idp database backend | ||
24 | * | ||
25 | * @defgroup reclaim-plugin IdP service plugin API | ||
26 | * Plugin API for the idp database backend | ||
27 | * @{ | ||
28 | */ | ||
29 | #ifndef GNUNET_RECLAIM_PLUGIN_H | ||
30 | #define GNUNET_RECLAIM_PLUGIN_H | ||
31 | |||
32 | #include "gnunet_util_lib.h" | ||
33 | #include "gnunet_reclaim_service.h" | ||
34 | |||
35 | #ifdef __cplusplus | ||
36 | extern "C" | ||
37 | { | ||
38 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
39 | } | ||
40 | #endif | ||
41 | #endif | ||
42 | |||
43 | |||
44 | /** | ||
45 | * Function called by for each matching ticket. | ||
46 | * | ||
47 | * @param cls closure | ||
48 | * @param ticket the ticket | ||
49 | */ | ||
50 | typedef void (*GNUNET_RECLAIM_TicketIterator) (void *cls, | ||
51 | const struct GNUNET_RECLAIM_Ticket *ticket, | ||
52 | const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); | ||
53 | |||
54 | |||
55 | /** | ||
56 | * @brief struct returned by the initialization function of the plugin | ||
57 | */ | ||
58 | struct GNUNET_RECLAIM_PluginFunctions | ||
59 | { | ||
60 | |||
61 | /** | ||
62 | * Closure to pass to all plugin functions. | ||
63 | */ | ||
64 | void *cls; | ||
65 | |||
66 | /** | ||
67 | * Store a ticket in the database. | ||
68 | * | ||
69 | * @param cls closure (internal context for the plugin) | ||
70 | * @param ticket the ticket to store | ||
71 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
72 | */ | ||
73 | int (*store_ticket) (void *cls, | ||
74 | const struct GNUNET_RECLAIM_Ticket *ticket, | ||
75 | const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); | ||
76 | |||
77 | /** | ||
78 | * Delete a ticket from the database. | ||
79 | * | ||
80 | * @param cls closure (internal context for the plugin) | ||
81 | * @param ticket the ticket to store | ||
82 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
83 | */ | ||
84 | int (*delete_ticket) (void *cls, | ||
85 | const struct GNUNET_RECLAIM_Ticket *ticket); | ||
86 | |||
87 | |||
88 | |||
89 | /** | ||
90 | * Iterate over all tickets | ||
91 | * | ||
92 | * @param cls closure (internal context for the plugin) | ||
93 | * @param identity the identity | ||
94 | * @param audience GNUNET_YES if the identity is the audience of the ticket | ||
95 | * else it is considered the issuer | ||
96 | * @param iter function to call with the result | ||
97 | * @param iter_cls closure for @a iter | ||
98 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error | ||
99 | */ | ||
100 | int (*iterate_tickets) (void *cls, | ||
101 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | ||
102 | int audience, | ||
103 | uint64_t offset, | ||
104 | GNUNET_RECLAIM_TicketIterator iter, void *iter_cls); | ||
105 | |||
106 | int (*get_ticket_attributes) (void* cls, | ||
107 | const struct GNUNET_RECLAIM_Ticket *ticket, | ||
108 | GNUNET_RECLAIM_TicketIterator iter, | ||
109 | void *iter_cls); | ||
110 | }; | ||
111 | |||
112 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
113 | { | ||
114 | #endif | ||
115 | #ifdef __cplusplus | ||
116 | } | ||
117 | #endif | ||
118 | |||
119 | #endif | ||
120 | |||
121 | /** @} */ /* end of group */ | ||