diff options
author | jospaeth <spaethj@in.tum.de> | 2020-08-05 13:15:25 +0200 |
---|---|---|
committer | jospaeth <spaethj@in.tum.de> | 2020-08-05 13:15:25 +0200 |
commit | e35aa4c6b22ae0ae81a23e973eda3655f29e29b5 (patch) | |
tree | e826aaf4e9ad0c1706778c6bbe6e56c0eb957dae /src | |
parent | 7d0910b473aff309d0ee9852d44f611cf897dbda (diff) | |
download | gnunet-e35aa4c6b22ae0ae81a23e973eda3655f29e29b5.tar.gz gnunet-e35aa4c6b22ae0ae81a23e973eda3655f29e29b5.zip |
add a API method for getting the escrow status
not yet working!
Diffstat (limited to 'src')
-rw-r--r-- | src/escrow/escrow.h | 21 | ||||
-rw-r--r-- | src/escrow/escrow_api.c | 25 | ||||
-rw-r--r-- | src/escrow/gnunet-escrow.c | 87 | ||||
-rw-r--r-- | src/escrow/plugin_escrow_anastasis.c | 27 | ||||
-rw-r--r-- | src/escrow/plugin_escrow_gns.c | 27 | ||||
-rw-r--r-- | src/escrow/plugin_escrow_plaintext.c | 27 | ||||
-rw-r--r-- | src/include/gnunet_escrow_lib.h | 36 | ||||
-rw-r--r-- | src/include/gnunet_escrow_plugin.h | 28 |
8 files changed, 273 insertions, 5 deletions
diff --git a/src/escrow/escrow.h b/src/escrow/escrow.h index 3c5bb68c8..b9128f5a4 100644 --- a/src/escrow/escrow.h +++ b/src/escrow/escrow.h | |||
@@ -154,7 +154,14 @@ struct ESCROW_PluginOperationWrapper | |||
154 | */ | 154 | */ |
155 | struct ESCROW_Plugin_AnchorContinuationWrapper | 155 | struct ESCROW_Plugin_AnchorContinuationWrapper |
156 | { | 156 | { |
157 | /** | ||
158 | * Handle for the escrow component | ||
159 | */ | ||
157 | struct GNUNET_ESCROW_Handle *h; | 160 | struct GNUNET_ESCROW_Handle *h; |
161 | |||
162 | /** | ||
163 | * The escrow anchor | ||
164 | */ | ||
158 | struct GNUNET_ESCROW_Anchor *escrowAnchor; | 165 | struct GNUNET_ESCROW_Anchor *escrowAnchor; |
159 | }; | 166 | }; |
160 | 167 | ||
@@ -166,7 +173,14 @@ struct ESCROW_Plugin_AnchorContinuationWrapper | |||
166 | */ | 173 | */ |
167 | struct ESCROW_Plugin_EgoContinuationWrapper | 174 | struct ESCROW_Plugin_EgoContinuationWrapper |
168 | { | 175 | { |
176 | /** | ||
177 | * Handle for the escrow component | ||
178 | */ | ||
169 | struct GNUNET_ESCROW_Handle *h; | 179 | struct GNUNET_ESCROW_Handle *h; |
180 | |||
181 | /** | ||
182 | * The restored ego | ||
183 | */ | ||
170 | const struct GNUNET_IDENTITY_Ego *ego; | 184 | const struct GNUNET_IDENTITY_Ego *ego; |
171 | }; | 185 | }; |
172 | 186 | ||
@@ -178,7 +192,14 @@ struct ESCROW_Plugin_EgoContinuationWrapper | |||
178 | */ | 192 | */ |
179 | struct ESCROW_Plugin_VerifyContinuationWrapper | 193 | struct ESCROW_Plugin_VerifyContinuationWrapper |
180 | { | 194 | { |
195 | /** | ||
196 | * Handle for the escrow component | ||
197 | */ | ||
181 | struct GNUNET_ESCROW_Handle *h; | 198 | struct GNUNET_ESCROW_Handle *h; |
199 | |||
200 | /** | ||
201 | * The result of the verification | ||
202 | */ | ||
182 | int verificationResult; | 203 | int verificationResult; |
183 | }; | 204 | }; |
184 | 205 | ||
diff --git a/src/escrow/escrow_api.c b/src/escrow/escrow_api.c index 5b57f9244..446833758 100644 --- a/src/escrow/escrow_api.c +++ b/src/escrow/escrow_api.c | |||
@@ -350,6 +350,31 @@ GNUNET_ESCROW_verify (struct GNUNET_ESCROW_Handle *h, | |||
350 | 350 | ||
351 | 351 | ||
352 | /** | 352 | /** |
353 | * Get the status of an escrow, i.e. | ||
354 | * -> when the last escrow was | ||
355 | * -> when the next escrow is recommended | ||
356 | * | ||
357 | * @param h the handle for the escrow component | ||
358 | * @param ego the identity ego of which the escrow status has to be determined | ||
359 | * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method | ||
360 | * @param method the escrow method to use | ||
361 | * | ||
362 | * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct | ||
363 | */ | ||
364 | struct GNUNET_ESCROW_Status * | ||
365 | GNUNET_ESCROW_get_status (struct GNUNET_ESCROW_Handle *h, | ||
366 | const struct GNUNET_IDENTITY_Ego *ego, | ||
367 | struct GNUNET_ESCROW_Anchor *escrowAnchor, | ||
368 | enum GNUNET_ESCROW_Key_Escrow_Method method) | ||
369 | { | ||
370 | const struct GNUNET_ESCROW_KeyPluginFunctions *api; | ||
371 | |||
372 | api = init_plugin (h, method); | ||
373 | return api->get_status (h, ego, escrowAnchor); | ||
374 | } | ||
375 | |||
376 | |||
377 | /** | ||
353 | * Deserialize an escrow anchor string (e.g. from command line) into a | 378 | * Deserialize an escrow anchor string (e.g. from command line) into a |
354 | * GNUNET_ESCROW_Anchor struct | 379 | * GNUNET_ESCROW_Anchor struct |
355 | * | 380 | * |
diff --git a/src/escrow/gnunet-escrow.c b/src/escrow/gnunet-escrow.c index 268815ce5..1974c4b2c 100644 --- a/src/escrow/gnunet-escrow.c +++ b/src/escrow/gnunet-escrow.c | |||
@@ -66,6 +66,11 @@ static char *verify_ego; | |||
66 | static char *get_ego; | 66 | static char *get_ego; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * -s option | ||
70 | */ | ||
71 | static char *status_ego; | ||
72 | |||
73 | /** | ||
69 | * The ego | 74 | * The ego |
70 | */ | 75 | */ |
71 | const struct GNUNET_IDENTITY_Ego *ego; | 76 | const struct GNUNET_IDENTITY_Ego *ego; |
@@ -101,6 +106,11 @@ static struct GNUNET_ESCROW_Handle *escrow_handle; | |||
101 | static struct GNUNET_ESCROW_Operation *escrow_op; | 106 | static struct GNUNET_ESCROW_Operation *escrow_op; |
102 | 107 | ||
103 | /** | 108 | /** |
109 | * Escrow status | ||
110 | */ | ||
111 | static struct GNUNET_ESCROW_Status *escrow_status; | ||
112 | |||
113 | /** | ||
104 | * Handle to the identity service | 114 | * Handle to the identity service |
105 | */ | 115 | */ |
106 | static struct GNUNET_IDENTITY_Handle *identity_handle; | 116 | static struct GNUNET_IDENTITY_Handle *identity_handle; |
@@ -128,6 +138,21 @@ do_cleanup (void *cls) | |||
128 | GNUNET_free (escrow_op); | 138 | GNUNET_free (escrow_op); |
129 | escrow_op = NULL; | 139 | escrow_op = NULL; |
130 | } | 140 | } |
141 | if (NULL != method_name) | ||
142 | { | ||
143 | GNUNET_free (method_name); | ||
144 | method_name = NULL; | ||
145 | } | ||
146 | if (NULL != anchor_string) | ||
147 | { | ||
148 | GNUNET_free (anchor_string); | ||
149 | anchor_string = NULL; | ||
150 | } | ||
151 | if (NULL != anchor) | ||
152 | { | ||
153 | GNUNET_free (anchor); | ||
154 | anchor = NULL; | ||
155 | } | ||
131 | if (NULL != put_ego) | 156 | if (NULL != put_ego) |
132 | { | 157 | { |
133 | GNUNET_free (put_ego); | 158 | GNUNET_free (put_ego); |
@@ -143,6 +168,16 @@ do_cleanup (void *cls) | |||
143 | GNUNET_free (get_ego); | 168 | GNUNET_free (get_ego); |
144 | get_ego = NULL; | 169 | get_ego = NULL; |
145 | } | 170 | } |
171 | if (NULL != status_ego) | ||
172 | { | ||
173 | GNUNET_free (status_ego); | ||
174 | status_ego = NULL; | ||
175 | } | ||
176 | if (NULL != escrow_status) | ||
177 | { | ||
178 | GNUNET_free (escrow_status); | ||
179 | escrow_status = NULL; | ||
180 | } | ||
146 | if (NULL != ego) | 181 | if (NULL != ego) |
147 | { | 182 | { |
148 | /* does not have to be freed, as this is done when | 183 | /* does not have to be freed, as this is done when |
@@ -256,6 +291,26 @@ start_process () | |||
256 | &get_cb); | 291 | &get_cb); |
257 | return; | 292 | return; |
258 | } | 293 | } |
294 | /* status */ | ||
295 | if (NULL != status_ego) | ||
296 | { | ||
297 | if (NULL == ego) | ||
298 | { | ||
299 | fprintf (stderr, "Ego %s not found\n", status_ego); | ||
300 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | ||
301 | return; | ||
302 | } | ||
303 | escrow_status = GNUNET_ESCROW_get_status (escrow_handle, | ||
304 | ego, | ||
305 | anchor, | ||
306 | method); | ||
307 | // TODO: formatting/interpretation | ||
308 | fprintf (stdout, "Last escrow:\t\t\t%s\nNext recommended escrow:\t%s\n", | ||
309 | GNUNET_STRINGS_absolute_time_to_string (escrow_status->last_escrow_time), | ||
310 | GNUNET_STRINGS_absolute_time_to_string (escrow_status->next_recommended_escrow_time)); | ||
311 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | ||
312 | return; | ||
313 | } | ||
259 | } | 314 | } |
260 | 315 | ||
261 | 316 | ||
@@ -304,10 +359,10 @@ run (void *cls, | |||
304 | 359 | ||
305 | if (NULL != put_ego) | 360 | if (NULL != put_ego) |
306 | { | 361 | { |
307 | if (NULL != verify_ego || NULL != get_ego) | 362 | if (NULL != verify_ego || NULL != get_ego || NULL != status_ego) |
308 | { | 363 | { |
309 | ret = 1; | 364 | ret = 1; |
310 | fprintf (stderr, _ ("-P may only be used without -V or -G!\n")); | 365 | fprintf (stderr, _ ("-P may only be used without -V, -G or -S!\n")); |
311 | return; | 366 | return; |
312 | } | 367 | } |
313 | /* put */ | 368 | /* put */ |
@@ -315,10 +370,10 @@ run (void *cls, | |||
315 | } | 370 | } |
316 | else if (NULL != verify_ego) | 371 | else if (NULL != verify_ego) |
317 | { | 372 | { |
318 | if (NULL != get_ego) | 373 | if (NULL != get_ego || NULL != status_ego) |
319 | { | 374 | { |
320 | ret = 1; | 375 | ret = 1; |
321 | fprintf (stderr, _ ("-V may only be used without -P or -G!\n")); | 376 | fprintf (stderr, _ ("-V may only be used without -P, -G or -S!\n")); |
322 | return; | 377 | return; |
323 | } | 378 | } |
324 | /* verify */ | 379 | /* verify */ |
@@ -332,6 +387,12 @@ run (void *cls, | |||
332 | } | 387 | } |
333 | else if (NULL != get_ego) | 388 | else if (NULL != get_ego) |
334 | { | 389 | { |
390 | if (NULL != status_ego) | ||
391 | { | ||
392 | ret = 1; | ||
393 | fprintf (stderr, _ ("-G may only be used without -P, -V or -S!\n")); | ||
394 | return; | ||
395 | } | ||
335 | /* get */ | 396 | /* get */ |
336 | if (NULL == anchor_string) | 397 | if (NULL == anchor_string) |
337 | { | 398 | { |
@@ -341,11 +402,22 @@ run (void *cls, | |||
341 | } | 402 | } |
342 | ego_name = get_ego; | 403 | ego_name = get_ego; |
343 | } | 404 | } |
405 | else if (NULL != status_ego) | ||
406 | { | ||
407 | /* status */ | ||
408 | if (NULL == anchor_string) | ||
409 | { | ||
410 | ret = 1; | ||
411 | fprintf (stderr, _ ("-a is needed for -S!\n")); | ||
412 | return; | ||
413 | } | ||
414 | ego_name = status_ego; | ||
415 | } | ||
344 | else | 416 | else |
345 | { | 417 | { |
346 | /* nothing */ | 418 | /* nothing */ |
347 | ret = 1; | 419 | ret = 1; |
348 | fprintf (stderr, _ ("-P, -V or -G option must be specified!\n")); | 420 | fprintf (stderr, _ ("-P, -V, -G or -S option must be specified!\n")); |
349 | return; | 421 | return; |
350 | } | 422 | } |
351 | 423 | ||
@@ -397,6 +469,11 @@ main (int argc, char *const argv[]) | |||
397 | "NAME", | 469 | "NAME", |
398 | gettext_noop ("Get the ego NAME back from escrow"), | 470 | gettext_noop ("Get the ego NAME back from escrow"), |
399 | &get_ego), | 471 | &get_ego), |
472 | GNUNET_GETOPT_option_string ('S', | ||
473 | "status", | ||
474 | "NAME", | ||
475 | gettext_noop ("Get the status of the escrow of ego NAME"), | ||
476 | &status_ego), | ||
400 | GNUNET_GETOPT_option_string ('a', | 477 | GNUNET_GETOPT_option_string ('a', |
401 | "anchor", | 478 | "anchor", |
402 | "ANCHOR", | 479 | "ANCHOR", |
diff --git a/src/escrow/plugin_escrow_anastasis.c b/src/escrow/plugin_escrow_anastasis.c index 165fdda23..a66410099 100644 --- a/src/escrow/plugin_escrow_anastasis.c +++ b/src/escrow/plugin_escrow_anastasis.c | |||
@@ -125,6 +125,32 @@ restore_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
125 | 125 | ||
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Get the status of a Anastasis escrow | ||
129 | * | ||
130 | * @param h the handle for the escrow component | ||
131 | * @param ego the identity ego of which the status has to be obtained | ||
132 | * @param escrowAnchor the escrow anchor needed to restore the key | ||
133 | * | ||
134 | * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct | ||
135 | */ | ||
136 | struct GNUNET_ESCROW_Status * | ||
137 | anastasis_get_status (struct GNUNET_ESCROW_Handle *h, | ||
138 | const struct GNUNET_IDENTITY_Ego *ego, | ||
139 | struct GNUNET_ESCROW_Anchor *escrowAnchor) | ||
140 | { | ||
141 | struct GNUNET_ESCROW_Status *status; | ||
142 | |||
143 | status = GNUNET_new (struct GNUNET_ESCROW_Status); | ||
144 | // TODO: get the correct time values | ||
145 | status->last_escrow_time = GNUNET_TIME_absolute_get (); | ||
146 | status->next_recommended_escrow_time = GNUNET_TIME_absolute_get (); | ||
147 | // END TODO | ||
148 | |||
149 | return status; | ||
150 | } | ||
151 | |||
152 | |||
153 | /** | ||
128 | * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct | 154 | * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct |
129 | * | 155 | * |
130 | * @param anchorString the encoded escrow anchor string | 156 | * @param anchorString the encoded escrow anchor string |
@@ -206,6 +232,7 @@ libgnunet_plugin_escrow_anastasis_init (void *cls) | |||
206 | api->start_key_escrow = &start_anastasis_key_escrow; | 232 | api->start_key_escrow = &start_anastasis_key_escrow; |
207 | api->verify_key_escrow = &verify_anastasis_key_escrow; | 233 | api->verify_key_escrow = &verify_anastasis_key_escrow; |
208 | api->restore_key = &restore_anastasis_key_escrow; | 234 | api->restore_key = &restore_anastasis_key_escrow; |
235 | api->get_status = &anastasis_get_status; | ||
209 | api->anchor_string_to_data = &anastasis_anchor_string_to_data; | 236 | api->anchor_string_to_data = &anastasis_anchor_string_to_data; |
210 | api->cancel_plugin_operation = &cancel_anastasis_operation; | 237 | api->cancel_plugin_operation = &cancel_anastasis_operation; |
211 | 238 | ||
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c index 45c16366b..618591393 100644 --- a/src/escrow/plugin_escrow_gns.c +++ b/src/escrow/plugin_escrow_gns.c | |||
@@ -224,6 +224,32 @@ restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
224 | 224 | ||
225 | 225 | ||
226 | /** | 226 | /** |
227 | * Get the status of a GNS escrow | ||
228 | * | ||
229 | * @param h the handle for the escrow component | ||
230 | * @param ego the identity ego of which the status has to be obtained | ||
231 | * @param escrowAnchor the escrow anchor needed to restore the key | ||
232 | * | ||
233 | * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct | ||
234 | */ | ||
235 | struct GNUNET_ESCROW_Status * | ||
236 | gns_get_status (struct GNUNET_ESCROW_Handle *h, | ||
237 | const struct GNUNET_IDENTITY_Ego *ego, | ||
238 | struct GNUNET_ESCROW_Anchor *escrowAnchor) | ||
239 | { | ||
240 | struct GNUNET_ESCROW_Status *status; | ||
241 | |||
242 | status = GNUNET_new (struct GNUNET_ESCROW_Status); | ||
243 | // TODO: get the correct time values | ||
244 | status->last_escrow_time = GNUNET_TIME_absolute_get (); | ||
245 | status->next_recommended_escrow_time = GNUNET_TIME_absolute_get (); | ||
246 | // END TODO | ||
247 | |||
248 | return status; | ||
249 | } | ||
250 | |||
251 | |||
252 | /** | ||
227 | * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct | 253 | * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct |
228 | * | 254 | * |
229 | * @param anchorString the encoded escrow anchor string | 255 | * @param anchorString the encoded escrow anchor string |
@@ -305,6 +331,7 @@ libgnunet_plugin_escrow_gns_init (void *cls) | |||
305 | api->start_key_escrow = &start_gns_key_escrow; | 331 | api->start_key_escrow = &start_gns_key_escrow; |
306 | api->verify_key_escrow = &verify_gns_key_escrow; | 332 | api->verify_key_escrow = &verify_gns_key_escrow; |
307 | api->restore_key = &restore_gns_key_escrow; | 333 | api->restore_key = &restore_gns_key_escrow; |
334 | api->get_status = &gns_get_status; | ||
308 | api->anchor_string_to_data = &gns_anchor_string_to_data; | 335 | api->anchor_string_to_data = &gns_anchor_string_to_data; |
309 | api->cancel_plugin_operation = &cancel_gns_operation; | 336 | api->cancel_plugin_operation = &cancel_gns_operation; |
310 | 337 | ||
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c index b6de718e4..7d0fb24fb 100644 --- a/src/escrow/plugin_escrow_plaintext.c +++ b/src/escrow/plugin_escrow_plaintext.c | |||
@@ -331,6 +331,32 @@ restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
331 | 331 | ||
332 | 332 | ||
333 | /** | 333 | /** |
334 | * Get the status of a plaintext escrow | ||
335 | * | ||
336 | * @param h the handle for the escrow component | ||
337 | * @param ego the identity ego of which the status has to be obtained | ||
338 | * @param escrowAnchor the escrow anchor needed to restore the key | ||
339 | * | ||
340 | * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct | ||
341 | */ | ||
342 | struct GNUNET_ESCROW_Status * | ||
343 | plaintext_get_status (struct GNUNET_ESCROW_Handle *h, | ||
344 | const struct GNUNET_IDENTITY_Ego *ego, | ||
345 | struct GNUNET_ESCROW_Anchor *escrowAnchor) | ||
346 | { | ||
347 | struct GNUNET_ESCROW_Status *status; | ||
348 | |||
349 | status = GNUNET_new (struct GNUNET_ESCROW_Status); | ||
350 | // TODO: get the correct time values | ||
351 | status->last_escrow_time = GNUNET_TIME_absolute_get (); | ||
352 | status->next_recommended_escrow_time = GNUNET_TIME_absolute_get (); | ||
353 | // END TODO | ||
354 | |||
355 | return status; | ||
356 | } | ||
357 | |||
358 | |||
359 | /** | ||
334 | * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct | 360 | * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct |
335 | * | 361 | * |
336 | * @param h the handle for the escrow component | 362 | * @param h the handle for the escrow component |
@@ -434,6 +460,7 @@ libgnunet_plugin_escrow_plaintext_init (void *cls) | |||
434 | api->start_key_escrow = &start_plaintext_key_escrow; | 460 | api->start_key_escrow = &start_plaintext_key_escrow; |
435 | api->verify_key_escrow = &verify_plaintext_key_escrow; | 461 | api->verify_key_escrow = &verify_plaintext_key_escrow; |
436 | api->restore_key = &restore_plaintext_key_escrow; | 462 | api->restore_key = &restore_plaintext_key_escrow; |
463 | api->get_status = &plaintext_get_status; | ||
437 | api->anchor_string_to_data = &plaintext_anchor_string_to_data; | 464 | api->anchor_string_to_data = &plaintext_anchor_string_to_data; |
438 | api->anchor_data_to_string = &plaintext_anchor_data_to_string; | 465 | api->anchor_data_to_string = &plaintext_anchor_data_to_string; |
439 | api->cancel_plugin_operation = &cancel_plaintext_operation; | 466 | api->cancel_plugin_operation = &cancel_plaintext_operation; |
diff --git a/src/include/gnunet_escrow_lib.h b/src/include/gnunet_escrow_lib.h index 564c457b9..112f0afdb 100644 --- a/src/include/gnunet_escrow_lib.h +++ b/src/include/gnunet_escrow_lib.h | |||
@@ -77,6 +77,22 @@ struct GNUNET_ESCROW_Anchor { | |||
77 | 77 | ||
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Struct for the escrow status | ||
81 | */ | ||
82 | struct GNUNET_ESCROW_Status { | ||
83 | /** | ||
84 | * The time of the last successful escrow. | ||
85 | */ | ||
86 | struct GNUNET_TIME_Absolute last_escrow_time; | ||
87 | |||
88 | /** | ||
89 | * The time of the next recommended escrow. | ||
90 | */ | ||
91 | struct GNUNET_TIME_Absolute next_recommended_escrow_time; | ||
92 | }; | ||
93 | |||
94 | |||
95 | /** | ||
80 | * Function called after the initialization of the identity service. | 96 | * Function called after the initialization of the identity service. |
81 | * Passed via cls to the callback of GNUNET_IDENTITY_connect | 97 | * Passed via cls to the callback of GNUNET_IDENTITY_connect |
82 | */ | 98 | */ |
@@ -284,6 +300,26 @@ GNUNET_ESCROW_verify ( | |||
284 | 300 | ||
285 | 301 | ||
286 | /** | 302 | /** |
303 | * Get the status of an escrow, i.e. | ||
304 | * -> when the last escrow was | ||
305 | * -> when the next escrow is recommended | ||
306 | * | ||
307 | * @param h the handle for the escrow component | ||
308 | * @param ego the identity ego of which the escrow status has to be determined | ||
309 | * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method | ||
310 | * @param method the escrow method to use | ||
311 | * | ||
312 | * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct | ||
313 | */ | ||
314 | struct GNUNET_ESCROW_Status * | ||
315 | GNUNET_ESCROW_get_status ( | ||
316 | struct GNUNET_ESCROW_Handle *h, | ||
317 | const struct GNUNET_IDENTITY_Ego *ego, | ||
318 | struct GNUNET_ESCROW_Anchor *escrowAnchor, | ||
319 | enum GNUNET_ESCROW_Key_Escrow_Method method); | ||
320 | |||
321 | |||
322 | /** | ||
287 | * Deserialize an escrow anchor string (e.g. from command line) into a | 323 | * Deserialize an escrow anchor string (e.g. from command line) into a |
288 | * GNUNET_ESCROW_Anchor struct | 324 | * GNUNET_ESCROW_Anchor struct |
289 | * | 325 | * |
diff --git a/src/include/gnunet_escrow_plugin.h b/src/include/gnunet_escrow_plugin.h index 3cd461663..449921a8e 100644 --- a/src/include/gnunet_escrow_plugin.h +++ b/src/include/gnunet_escrow_plugin.h | |||
@@ -50,6 +50,8 @@ extern "C" { | |||
50 | * @param h the handle for the escrow component | 50 | * @param h the handle for the escrow component |
51 | * @param ego the identity ego containing the private key | 51 | * @param ego the identity ego containing the private key |
52 | * @param cb the function called upon completion | 52 | * @param cb the function called upon completion |
53 | * | ||
54 | * @return a wrapper for the plugin operation | ||
53 | */ | 55 | */ |
54 | typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunction) ( | 56 | typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunction) ( |
55 | struct GNUNET_ESCROW_Handle *h, | 57 | struct GNUNET_ESCROW_Handle *h, |
@@ -63,6 +65,8 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunc | |||
63 | * @param ego the identity ego containing the private key | 65 | * @param ego the identity ego containing the private key |
64 | * @param escrowAnchor the escrow anchor needed to restore the key | 66 | * @param escrowAnchor the escrow anchor needed to restore the key |
65 | * @param cb the function called upon completion | 67 | * @param cb the function called upon completion |
68 | * | ||
69 | * @return a wrapper for the plugin operation | ||
66 | */ | 70 | */ |
67 | typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFunction) ( | 71 | typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFunction) ( |
68 | struct GNUNET_ESCROW_Handle *h, | 72 | struct GNUNET_ESCROW_Handle *h, |
@@ -77,6 +81,8 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFun | |||
77 | * @param escrowAnchor the escrow anchor needed to restore the key | 81 | * @param escrowAnchor the escrow anchor needed to restore the key |
78 | * @param egoName the name of the ego to restore | 82 | * @param egoName the name of the ego to restore |
79 | * @param cb the function called upon completion | 83 | * @param cb the function called upon completion |
84 | * | ||
85 | * @return a wrapper for the plugin operation | ||
80 | */ | 86 | */ |
81 | typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_RestoreKeyFunction) ( | 87 | typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_RestoreKeyFunction) ( |
82 | struct GNUNET_ESCROW_Handle *h, | 88 | struct GNUNET_ESCROW_Handle *h, |
@@ -86,6 +92,23 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_RestoreKeyFunction | |||
86 | 92 | ||
87 | 93 | ||
88 | /** | 94 | /** |
95 | * Function called to get the status of an escrow, i.e. | ||
96 | * -> when the last successful escrow was | ||
97 | * -> when the next recommended escrow is | ||
98 | * | ||
99 | * @param h the handle for the escrow component | ||
100 | * @param ego the identity ego of which the status has to be obtained | ||
101 | * @param escrowAnchor the escrow anchor needed to restore the key | ||
102 | * | ||
103 | * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct | ||
104 | */ | ||
105 | typedef struct GNUNET_ESCROW_Status *(*GNUNET_ESCROW_GetEscrowStatusFunction) ( | ||
106 | struct GNUNET_ESCROW_Handle *h, | ||
107 | const struct GNUNET_IDENTITY_Ego *ego, | ||
108 | struct GNUNET_ESCROW_Anchor *escrowAnchor); | ||
109 | |||
110 | |||
111 | /** | ||
89 | * Function called to deserialize an escrow anchor string into a | 112 | * Function called to deserialize an escrow anchor string into a |
90 | * GNUNET_ESCROW_Anchor struct | 113 | * GNUNET_ESCROW_Anchor struct |
91 | * | 114 | * |
@@ -148,6 +171,11 @@ struct GNUNET_ESCROW_KeyPluginFunctions | |||
148 | GNUNET_ESCROW_RestoreKeyFunction restore_key; | 171 | GNUNET_ESCROW_RestoreKeyFunction restore_key; |
149 | 172 | ||
150 | /** | 173 | /** |
174 | * Get the status of an escrow | ||
175 | */ | ||
176 | GNUNET_ESCROW_GetEscrowStatusFunction get_status; | ||
177 | |||
178 | /** | ||
151 | * Deserialize anchor string to data | 179 | * Deserialize anchor string to data |
152 | */ | 180 | */ |
153 | GNUNET_ESCROW_AnchorStringToDataFunction anchor_string_to_data; | 181 | GNUNET_ESCROW_AnchorStringToDataFunction anchor_string_to_data; |