diff options
Diffstat (limited to 'src/escrow/escrow.h')
-rw-r--r-- | src/escrow/escrow.h | 244 |
1 files changed, 244 insertions, 0 deletions
diff --git a/src/escrow/escrow.h b/src/escrow/escrow.h new file mode 100644 index 000000000..cf3660e03 --- /dev/null +++ b/src/escrow/escrow.h | |||
@@ -0,0 +1,244 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020 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 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author Johannes Späth | ||
23 | * @file escrow/escrow.h | ||
24 | * | ||
25 | * @brief Common type definitions for the escrow component | ||
26 | */ | ||
27 | |||
28 | #ifndef ESCROW_H | ||
29 | #define ESCROW_H | ||
30 | |||
31 | #include "gnunet_escrow_lib.h" | ||
32 | |||
33 | |||
34 | /** | ||
35 | * State while collecting all egos | ||
36 | */ | ||
37 | #define ESCROW_PLUGIN_STATE_INIT 0 | ||
38 | |||
39 | /** | ||
40 | * Done collecting egos | ||
41 | */ | ||
42 | #define ESCROW_PLUGIN_STATE_POST_INIT 1 | ||
43 | |||
44 | |||
45 | /** | ||
46 | * The ego list | ||
47 | */ | ||
48 | struct EgoEntry | ||
49 | { | ||
50 | /** | ||
51 | * DLL | ||
52 | */ | ||
53 | struct EgoEntry *next; | ||
54 | |||
55 | /** | ||
56 | * DLL | ||
57 | */ | ||
58 | struct EgoEntry *prev; | ||
59 | |||
60 | /** | ||
61 | * Ego Identifier | ||
62 | */ | ||
63 | char *identifier; | ||
64 | |||
65 | /** | ||
66 | * Public key string | ||
67 | */ | ||
68 | char *keystring; | ||
69 | |||
70 | /** | ||
71 | * The Ego | ||
72 | */ | ||
73 | struct GNUNET_IDENTITY_Ego *ego; | ||
74 | }; | ||
75 | |||
76 | /** | ||
77 | * Handle for a plugin instance | ||
78 | */ | ||
79 | struct ESCROW_PluginHandle | ||
80 | { | ||
81 | /** | ||
82 | * The identity init continuation. | ||
83 | */ | ||
84 | GNUNET_ESCROW_IdentityInitContinuation id_init_cont; | ||
85 | |||
86 | /** | ||
87 | * The ego create continuation. | ||
88 | */ | ||
89 | GNUNET_ESCROW_EgoCreateContinuation ego_create_cont; | ||
90 | |||
91 | /** | ||
92 | * The current restore callback. | ||
93 | */ | ||
94 | GNUNET_ESCROW_EgoContinuation curr_restore_cb; | ||
95 | |||
96 | /** | ||
97 | * The handle to the escrow component. | ||
98 | */ | ||
99 | struct GNUNET_ESCROW_Handle *escrow_handle; | ||
100 | |||
101 | /** | ||
102 | * The state of the plugin (in the initialization phase). | ||
103 | */ | ||
104 | int state; | ||
105 | |||
106 | /** | ||
107 | * The head of the ego list. | ||
108 | */ | ||
109 | struct EgoEntry *ego_head; | ||
110 | |||
111 | /** | ||
112 | * The tail of the ego list | ||
113 | */ | ||
114 | struct EgoEntry *ego_tail; | ||
115 | |||
116 | /** | ||
117 | * The head of the plugin operation list | ||
118 | */ | ||
119 | struct ESCROW_PluginOperationWrapper *plugin_op_head; | ||
120 | |||
121 | /** | ||
122 | * The tail of the plugin operation list | ||
123 | */ | ||
124 | struct ESCROW_PluginOperationWrapper *plugin_op_tail; | ||
125 | }; | ||
126 | |||
127 | /** | ||
128 | * Wrapper for an escrow plugin operation | ||
129 | */ | ||
130 | struct ESCROW_PluginOperationWrapper | ||
131 | { | ||
132 | /** | ||
133 | * Plugin operations are kept in a DLL. | ||
134 | */ | ||
135 | struct ESCROW_PluginOperationWrapper *prev; | ||
136 | |||
137 | /** | ||
138 | * Plugin operations are kept in a DLL. | ||
139 | */ | ||
140 | struct ESCROW_PluginOperationWrapper *next; | ||
141 | |||
142 | /** | ||
143 | * The actual plugin operation | ||
144 | */ | ||
145 | void *plugin_op; | ||
146 | }; | ||
147 | |||
148 | |||
149 | /** | ||
150 | * Continuation for a plugin operation (e.g. used for restore, as this | ||
151 | * callback has to be called from the IDENTITY service after finishing) | ||
152 | */ | ||
153 | typedef void (*ESCROW_Plugin_Continuation) (void *cls); | ||
154 | |||
155 | |||
156 | /** | ||
157 | * Wrapper for the Plugin_AnchorContinuation. | ||
158 | * | ||
159 | * As this type of function is called from the scheduler, which only takes | ||
160 | * one argument as closure, this struct is used to pass more arguments. | ||
161 | */ | ||
162 | struct ESCROW_Plugin_AnchorContinuationWrapper | ||
163 | { | ||
164 | /** | ||
165 | * Handle for the escrow component | ||
166 | */ | ||
167 | struct GNUNET_ESCROW_Handle *h; | ||
168 | |||
169 | /** | ||
170 | * The escrow anchor | ||
171 | */ | ||
172 | struct GNUNET_ESCROW_Anchor *escrowAnchor; | ||
173 | |||
174 | /** | ||
175 | * The unique ID of the respective ESCROW_Operation | ||
176 | */ | ||
177 | uint32_t op_id; | ||
178 | |||
179 | /** | ||
180 | * The error message, NULL on success | ||
181 | */ | ||
182 | const char *emsg; | ||
183 | }; | ||
184 | |||
185 | /** | ||
186 | * Wrapper for the Plugin_EgoContinuation. | ||
187 | * | ||
188 | * As this type of function is called from the scheduler, which only takes | ||
189 | * one argument as closure, this struct is used to pass more arguments. | ||
190 | */ | ||
191 | struct ESCROW_Plugin_EgoContinuationWrapper | ||
192 | { | ||
193 | /** | ||
194 | * Handle for the escrow component | ||
195 | */ | ||
196 | struct GNUNET_ESCROW_Handle *h; | ||
197 | |||
198 | /** | ||
199 | * The restored ego | ||
200 | */ | ||
201 | const struct GNUNET_IDENTITY_Ego *ego; | ||
202 | |||
203 | /** | ||
204 | * The unique ID of the respective ESCROW_Operation | ||
205 | */ | ||
206 | uint32_t op_id; | ||
207 | |||
208 | /** | ||
209 | * The error message, NULL on success | ||
210 | */ | ||
211 | const char *emsg; | ||
212 | }; | ||
213 | |||
214 | /** | ||
215 | * Wrapper for the Plugin_VerifyContinuation. | ||
216 | * | ||
217 | * As this type of function is called from the scheduler, which only takes | ||
218 | * one argument as closure, this struct is used to pass more arguments. | ||
219 | */ | ||
220 | struct ESCROW_Plugin_VerifyContinuationWrapper | ||
221 | { | ||
222 | /** | ||
223 | * Handle for the escrow component | ||
224 | */ | ||
225 | struct GNUNET_ESCROW_Handle *h; | ||
226 | |||
227 | /** | ||
228 | * The result of the verification | ||
229 | */ | ||
230 | int verificationResult; | ||
231 | |||
232 | /** | ||
233 | * The unique ID of the respective ESCROW_Operation | ||
234 | */ | ||
235 | uint32_t op_id; | ||
236 | |||
237 | /** | ||
238 | * The error message, NULL on success | ||
239 | */ | ||
240 | const char *emsg; | ||
241 | }; | ||
242 | |||
243 | |||
244 | #endif | ||