glitch in the license text detected by hyazinthe, thank you!
[oweals/gnunet.git] / src / include / gnunet_identity_provider_plugin.h
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
16 /**
17  * @author Martin Schanzenbach
18  *
19  * @file
20  * Plugin API for the idp database backend
21  *
22  * @defgroup identity-provider-plugin  IdP service plugin API
23  * Plugin API for the idp database backend
24  * @{
25  */
26 #ifndef GNUNET_IDENTITY_PROVIDER_PLUGIN_H
27 #define GNUNET_IDENTITY_PROVIDER_PLUGIN_H
28
29 #include "gnunet_util_lib.h"
30 #include "gnunet_identity_provider_service.h"
31
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #if 0                           /* keep Emacsens' auto-indent happy */
36 }
37 #endif
38 #endif
39
40
41 /**
42  * Function called by for each matching ticket.
43  *
44  * @param cls closure
45  * @param ticket the ticket
46  */
47 typedef void (*GNUNET_IDENTITY_PROVIDER_TicketIterator) (void *cls,
48                                                  const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket,
49              const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs);
50
51
52 /**
53  * @brief struct returned by the initialization function of the plugin
54  */
55 struct GNUNET_IDENTITY_PROVIDER_PluginFunctions
56 {
57
58   /**
59    * Closure to pass to all plugin functions.
60    */
61   void *cls;
62
63   /**
64    * Store a ticket in the database.
65    *
66    * @param cls closure (internal context for the plugin)
67    * @param ticket the ticket to store
68    * @return #GNUNET_OK on success, else #GNUNET_SYSERR
69    */
70   int (*store_ticket) (void *cls,
71                         const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket,
72       const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs);
73
74   /**
75    * Delete a ticket from the database.
76    *
77    * @param cls closure (internal context for the plugin)
78    * @param ticket the ticket to store
79    * @return #GNUNET_OK on success, else #GNUNET_SYSERR
80    */
81   int (*delete_ticket) (void *cls,
82                         const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket);
83
84
85
86   /**
87    * Iterate over all tickets
88    *
89    * @param cls closure (internal context for the plugin)
90    * @param identity the identity
91    * @param audience GNUNET_YES if the identity is the audience of the ticket
92    *                 else it is considered the issuer
93    * @param iter function to call with the result
94    * @param iter_cls closure for @a iter
95    * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
96    */
97   int (*iterate_tickets) (void *cls,
98                           const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
99         int audience,
100                           uint64_t offset,
101                           GNUNET_IDENTITY_PROVIDER_TicketIterator iter, void *iter_cls);
102
103   int (*get_ticket_attributes) (void* cls,
104                                 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket,
105                                 GNUNET_IDENTITY_PROVIDER_TicketIterator iter,
106                                 void *iter_cls);
107 };
108
109 #if 0                           /* keep Emacsens' auto-indent happy */
110 {
111 #endif
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif
117
118 /** @} */  /* end of group */