diff options
Diffstat (limited to 'src/include/gnunet_zklaim_service.h')
-rw-r--r-- | src/include/gnunet_zklaim_service.h | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/src/include/gnunet_zklaim_service.h b/src/include/gnunet_zklaim_service.h new file mode 100644 index 000000000..6654555ab --- /dev/null +++ b/src/include/gnunet_zklaim_service.h | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2016 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 | * ZKlaim service. Manage ZKlaim issuers etc. | ||
24 | * | ||
25 | * @defgroup zklaim ZKlaim service | ||
26 | * @{ | ||
27 | */ | ||
28 | #ifndef GNUNET_ZKLAIM_SERVICE_H | ||
29 | #define GNUNET_ZKLAIM_SERVICE_H | ||
30 | |||
31 | #ifdef __cplusplus | ||
32 | extern "C" | ||
33 | { | ||
34 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
35 | } | ||
36 | #endif | ||
37 | #endif | ||
38 | |||
39 | #include "gnunet_util_lib.h" | ||
40 | |||
41 | /** | ||
42 | * Version number of GNUnet Identity Provider API. | ||
43 | */ | ||
44 | #define GNUNET_ZKLAIM_VERSION 0x00000000 | ||
45 | |||
46 | /** | ||
47 | * Handle to access the identity service. | ||
48 | */ | ||
49 | struct GNUNET_ZKLAIM_Handle; | ||
50 | |||
51 | /** | ||
52 | * Handle for an operation with the zklaim service. | ||
53 | */ | ||
54 | struct GNUNET_ZKLAIM_Operation; | ||
55 | |||
56 | /** | ||
57 | * Context | ||
58 | */ | ||
59 | struct GNUNET_ZKLAIM_Context; | ||
60 | |||
61 | /** | ||
62 | * Connect to the ZKlaim service. | ||
63 | * | ||
64 | * @param cfg Configuration to contact the service. | ||
65 | * @return handle to communicate with the service | ||
66 | */ | ||
67 | struct GNUNET_ZKLAIM_Handle * | ||
68 | GNUNET_ZKLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | ||
69 | |||
70 | /** | ||
71 | * Iterator called for each attribute and data. | ||
72 | * | ||
73 | * @param cls closure | ||
74 | * @param name name of attribute | ||
75 | * @param data attribute data (can be modified) | ||
76 | */ | ||
77 | typedef void | ||
78 | (*GNUNET_ZKLAIM_PayloadIterator) (void *cls, | ||
79 | const char* name, | ||
80 | uint64_t *data); | ||
81 | |||
82 | |||
83 | |||
84 | /** | ||
85 | * Continuation called to notify client about result of the | ||
86 | * operation. | ||
87 | * | ||
88 | * @param cls closure | ||
89 | * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) | ||
90 | * #GNUNET_NO if content was already there or not found | ||
91 | * #GNUNET_YES (or other positive value) on success | ||
92 | * @param emsg NULL on success, otherwise an error message | ||
93 | */ | ||
94 | typedef void | ||
95 | (*GNUNET_ZKLAIM_ContextResult) (void *cls, | ||
96 | const struct GNUNET_ZKLAIM_Context *ctx); | ||
97 | |||
98 | |||
99 | |||
100 | /** | ||
101 | * Continuation called to notify client about result of the | ||
102 | * operation. | ||
103 | * | ||
104 | * @param cls closure | ||
105 | * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) | ||
106 | * #GNUNET_NO if content was already there or not found | ||
107 | * #GNUNET_YES (or other positive value) on success | ||
108 | * @param emsg NULL on success, otherwise an error message | ||
109 | */ | ||
110 | typedef void | ||
111 | (*GNUNET_ZKLAIM_ContinuationWithStatus) (void *cls, | ||
112 | int32_t success, | ||
113 | const char *emsg); | ||
114 | |||
115 | |||
116 | /** | ||
117 | * Create a new issuer context | ||
118 | * | ||
119 | * @param h handle to the identity provider | ||
120 | * @param pkey private key of the identity | ||
121 | * @param attr the attribute | ||
122 | * @param exp_interval the relative expiration interval for the attribute | ||
123 | * @param cont continuation to call when done | ||
124 | * @param cont_cls closure for @a cont | ||
125 | * @return handle to abort the request | ||
126 | */ | ||
127 | struct GNUNET_ZKLAIM_Operation * | ||
128 | GNUNET_ZKLAIM_context_create (struct GNUNET_ZKLAIM_Handle *h, | ||
129 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
130 | const char *context_name, | ||
131 | const char *attr_list, | ||
132 | GNUNET_ZKLAIM_ContinuationWithStatus cont, | ||
133 | void *cont_cls); | ||
134 | |||
135 | /** | ||
136 | * Disconnect from service. | ||
137 | * | ||
138 | * @param h service to disconnect | ||
139 | */ | ||
140 | void | ||
141 | GNUNET_ZKLAIM_disconnect (struct GNUNET_ZKLAIM_Handle *h); | ||
142 | |||
143 | |||
144 | /** | ||
145 | * Cancel an operation. Note that the operation MAY still | ||
146 | * be executed; this merely cancels the continuation; if the request | ||
147 | * was already transmitted, the service may still choose to complete | ||
148 | * the operation. | ||
149 | * | ||
150 | * @param op operation to cancel | ||
151 | */ | ||
152 | void | ||
153 | GNUNET_ZKLAIM_cancel (struct GNUNET_ZKLAIM_Operation *op); | ||
154 | |||
155 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
156 | { | ||
157 | #endif | ||
158 | #ifdef __cplusplus | ||
159 | } | ||
160 | #endif | ||
161 | |||
162 | |||
163 | /* ifndef GNUNET_ZKLAIM_SERVICE_H */ | ||
164 | #endif | ||
165 | |||
166 | /** @} */ /* end of group identity */ | ||
167 | |||
168 | /* end of gnunet_zklaim_service.h */ | ||