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