GNUnet 0.22.2
gnunet-service-reclaim_tickets.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2012-2015 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
28#include "gnunet_common.h"
29#include "gnunet_gns_service.h"
32#include <string.h>
33
34
39#define DEFAULT_TICKET_REFRESH_INTERVAL GNUNET_TIME_UNIT_HOURS
40
45struct ParallelLookup;
46
47
52{
57
62
67
72};
73
74
79{
84
89
94
99
104
109
114
119
124
128 void *cb_cls;
129
136};
137
138
143{
144 /* DLL */
146
147 /* DLL */
149
150 /* The GNS request */
152
153 /* The handle the return to */
155
160
161 /* The label to look up */
162 char *label;
163};
164
165
170{
175
180
185
190
195
200
205
209 void *cb_cls;
210
217
222};
223
224
229{
234
239
243 void *cb_cls;
244};
245
246
248{
253
258
263
268};
269
270
275{
280
285
289 void *cb_cls;
290
295
300
305
310
315
320
324 unsigned int ticket_attrs;
325
330
335};
336
337
342
343
344/* Namestore handle */
346
347
348/* GNS handle */
349static struct GNUNET_GNS_Handle *gns;
350
351
352/* Handle to the statistics service */
354
355
361static void
363{
364 struct RevokedAttributeEntry *ae;
365 struct TicketRecordsEntry *le;
366
367 if (NULL != rh->ns_qe)
369 if (NULL != rh->ns_it)
371 while (NULL != (ae = rh->attrs_head))
372 {
374 GNUNET_free (ae);
375 }
376 while (NULL != (le = rh->tickets_to_update_head))
377 {
380 le);
381 if (NULL != le->data)
382 GNUNET_free (le->data);
383 if (NULL != le->label)
384 GNUNET_free (le->label);
385 GNUNET_free (le);
386 }
387 GNUNET_free (rh);
388}
389
390
397static void
398process_tickets (void *cls);
399
400
409static void
411{
412 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
413
414 rvk->ns_qe = NULL;
416}
417
418
424static void
426{
427 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
428 struct TicketRecordsEntry *le;
429 struct RevokedAttributeEntry *ae;
430
431 if (NULL == rvk->tickets_to_update_head)
432 {
434 "Finished updatding tickets, success\n");
435 rvk->cb (rvk->cb_cls, GNUNET_OK);
436 cleanup_rvk (rvk);
437 return;
438 }
439 le = rvk->tickets_to_update_head;
442 le);
443 {
446 le->data,
447 le->rd_count,
448 rd))
449 {
451 "Unable to deserialize ticket record(s)\n");
452 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
453 cleanup_rvk (rvk);
454 return;
455 }
456 for (int i = 0; i < le->rd_count; i++)
457 {
459 continue;
460 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
461 {
462 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
463 continue;
464 rd[i].data = &ae->new_id;
465 }
466 }
468 &rvk->identity,
469 le->label,
470 le->rd_count,
471 rd,
473 rvk);
474 }
475 GNUNET_free (le->label);
476 GNUNET_free (le->data);
477 GNUNET_free (le);
478}
479
480
486static void
488{
489 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
490
491 rvk->ns_it = NULL;
493}
494
495
506static void
508 const struct GNUNET_CRYPTO_PrivateKey *zone,
509 const char *label,
510 unsigned int rd_count,
511 const struct GNUNET_GNSRECORD_Data *rd)
512{
513 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
514 struct TicketRecordsEntry *le;
515 struct RevokedAttributeEntry *ae;
516 int has_changed = GNUNET_NO;
517
519 for (int i = 0; i < rd_count; i++)
520 {
522 continue;
523 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
524 {
525 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
526 continue;
527 has_changed = GNUNET_YES;
528 break;
529 }
530 if (GNUNET_YES == has_changed)
531 break;
532 }
533 if (GNUNET_YES == has_changed)
534 {
535 le = GNUNET_new (struct TicketRecordsEntry);
537 le->data = GNUNET_malloc (le->data_size);
538 le->rd_count = rd_count;
539 le->label = GNUNET_strdup (label);
543 le);
544 }
546}
547
548
554static void
556{
557 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
558
559 rvk->ns_it = NULL;
560 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
561 cleanup_rvk (rvk);
562}
563
564
570static void
571rvk_ns_err (void *cls)
572{
573 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
574
575 rvk->ns_qe = NULL;
576 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
577 cleanup_rvk (rvk);
578}
579
580
589static void
591
592
598static void
600{
602}
603
604
613static void
615{
616 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
617
618 rvk->ns_qe = NULL;
619 if (GNUNET_EC_NONE != ec)
620 {
622 "Error removing attribute: %s\n",
624 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
625 cleanup_rvk (rvk);
626 return;
627 }
628 rvk->move_attr = rvk->move_attr->next;
630}
631
632
642static void
644{
645 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
646 char *label;
647
648 rvk->ns_qe = NULL;
649 if (GNUNET_EC_NONE != ec)
650 {
652 "Error moving attribute: %s\n",
654 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
655 cleanup_rvk (rvk);
656 return;
657 }
659 sizeof(rvk->move_attr->old_id));
660 GNUNET_assert (NULL != label);
661 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
663 &rvk->identity,
664 label,
665 0,
666 NULL,
668 rvk);
669 GNUNET_free (label);
670}
671
672
682static void
684 const struct GNUNET_CRYPTO_PrivateKey *zone,
685 const char *label,
686 unsigned int rd_count,
687 const struct GNUNET_GNSRECORD_Data *rd)
688{
689 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
690 struct GNUNET_GNSRECORD_Data new_rd[rd_count];
691 struct RevokedAttributeEntry *le;
692 char *new_label;
693 char *attr_data;
694
695 rvk->ns_qe = NULL;
696 if (0 == rd_count)
697 {
699 "The claim %s no longer exists!\n",
700 label);
701 le = rvk->move_attr;
702 rvk->move_attr = le->next;
704 GNUNET_free (le);
706 return;
707 }
709 new_label =
711 sizeof (rvk->move_attr->new_id));
712
713 attr_data = NULL;
714 // new_rd = *rd;
715 for (int i = 0; i < rd_count; i++)
716 {
717 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type)
718 {
722 rd[i].data_size,
723 &claim);
725 "Attribute to update: Name=%s\n",
726 claim->name);
727 claim->id = rvk->move_attr->new_id;
729 attr_data = GNUNET_malloc (rd[i].data_size);
731 attr_data);
732 new_rd[i].data = attr_data;
733 new_rd[i].record_type = rd[i].record_type;
734 new_rd[i].flags = rd[i].flags;
735 new_rd[i].expiration_time = rd[i].expiration_time;
736 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
738 }
739 else if (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL == rd[i].record_type)
740 {
743 rd[i].data_size);
745 "Credential to update: Name=%s\n",
746 credential->name);
747 credential->id = rvk->move_attr->new_id;
748 new_rd[i].data_size =
750 attr_data = GNUNET_malloc (rd[i].data_size);
752 attr_data);
753 new_rd[i].data = attr_data;
754 new_rd[i].record_type = rd[i].record_type;
755 new_rd[i].flags = rd[i].flags;
756 new_rd[i].expiration_time = rd[i].expiration_time;
757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding credential %s\n",
758 new_label);
760 }
761 else
762 {
763 memcpy (&new_rd[i], &rd[i], sizeof (struct GNUNET_GNSRECORD_Data));
764 }
765 }
767 &rvk->identity,
768 new_label,
769 rd_count,
770 new_rd,
772 rvk);
773 GNUNET_free (new_label);
774 GNUNET_free (attr_data);
775}
776
777
778static void
780{
781 char *label;
782
783 if (NULL == rvk->move_attr)
784 {
785 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n");
786 rvk->ns_it =
788 &rvk->identity,
790 rvk,
792 rvk,
794 rvk);
795 return;
796 }
798 sizeof (rvk->move_attr->old_id));
799 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label);
800
802 &rvk->identity,
803 label,
804 &rvk_ns_err,
805 rvk,
807 rvk);
808 GNUNET_free (label);
809}
810
811
823static void
825{
826 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
827
828 rvk->ns_qe = NULL;
829 if (GNUNET_EC_NONE != ec)
830 {
833 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
834 cleanup_rvk (rvk);
835 return;
836 }
837 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted ticket\n");
838 if (0 == rvk->ticket_attrs)
839 {
841 "No attributes to move... strange\n");
842 rvk->cb (rvk->cb_cls, GNUNET_OK);
843 cleanup_rvk (rvk);
844 return;
845 }
846 rvk->move_attr = rvk->attrs_head;
847 move_attrs (rvk);
848}
849
850
861static void
863 const struct GNUNET_CRYPTO_PrivateKey *zone,
864 const char *label,
865 unsigned int rd_count,
866 const struct GNUNET_GNSRECORD_Data *rd)
867
868{
869 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
870 struct RevokedAttributeEntry *le;
871
872 rvk->ns_qe = NULL;
877 for (int i = 0; i < rd_count; i++)
878 {
880 continue;
881 le = GNUNET_new (struct RevokedAttributeEntry);
882 le->old_id = *((struct GNUNET_RECLAIM_Identifier *) rd[i].data);
884 rvk->ticket_attrs++;
885 }
886
889 &rvk->identity,
890 label,
891 0,
892 NULL,
894 rvk);
895}
896
897
903static void
905{
906 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
907
908 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
909 cleanup_rvk (rvk);
910}
911
912
928 void *cb_cls)
929{
931 char *label;
932 char *tmp;
933
935 rvk->cb = cb;
936 rvk->cb_cls = cb_cls;
937 rvk->identity = *identity;
938 rvk->ticket = *ticket;
940 label = strtok (tmp, ".");
941 GNUNET_assert (NULL != label);
944 identity,
945 label,
947 rvk,
949 rvk);
950 GNUNET_free (tmp);
951 return rvk;
952}
953
954
960void
962{
963 GNUNET_assert (NULL != rh);
964 cleanup_rvk (rh);
965}
966
967
968/*******************************
969* Ticket consume
970*******************************/
971
977static void
979{
980 struct ParallelLookup *lu;
981
982 if (NULL != cth->lookup_request)
984 if (NULL != cth->kill_task)
986 while (NULL != (lu = cth->parallel_lookups_head))
987 {
988 if (NULL != lu->lookup_request)
990 GNUNET_free (lu->label);
993 lu);
994 GNUNET_free (lu);
995 }
996
997 if (NULL != cth->attrs)
999 if (NULL != cth->presentations)
1001 GNUNET_free (cth);
1002}
1003
1004
1005static void
1007 uint32_t rd_count,
1008 const struct GNUNET_GNSRECORD_Data *rd)
1009{
1010 struct ParallelLookup *parallel_lookup = cls;
1011 struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
1012 struct GNUNET_RECLAIM_AttributeListEntry *attr_le;
1013 struct GNUNET_CRYPTO_PublicKey iss;
1014
1016 "Parallel lookup finished (count=%u)\n",
1017 rd_count);
1018
1021 parallel_lookup);
1022 GNUNET_free (parallel_lookup->label);
1023
1025 "attribute_lookup_time_total",
1027 parallel_lookup->lookup_start_time)
1028 .rel_value_us,
1029 GNUNET_YES);
1030 GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES);
1031
1032
1033 GNUNET_free (parallel_lookup);
1034 if (0 == rd_count)
1035 GNUNET_break (0);
1036 // REMARK: It is possible now to find rd_count > 1
1037 for (int i = 0; i < rd_count; i++)
1038 {
1039 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd[i].record_type)
1040 continue;
1043 &attr_le->attribute);
1045 cth->attrs->list_tail,
1046 attr_le);
1047 }
1048 if (NULL != cth->parallel_lookups_head)
1049 return; // Wait for more
1050 /* Else we are done */
1052 );
1053 cth->cb (cth->cb_cls, &iss,
1054 cth->attrs, cth->presentations, GNUNET_OK, NULL);
1055 cleanup_cth (cth);
1056}
1057
1058
1064static void
1066{
1067 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1068 struct ParallelLookup *lu;
1069 struct ParallelLookup *tmp;
1070
1071 cth->kill_task = NULL;
1072 for (lu = cth->parallel_lookups_head; NULL != lu;)
1073 {
1075 GNUNET_free (lu->label);
1076 tmp = lu->next;
1079 lu);
1080 GNUNET_free (lu);
1081 lu = tmp;
1082 }
1083 cth->cb (cth->cb_cls, NULL, NULL, NULL, GNUNET_SYSERR, "Aborted");
1084}
1085
1086
1087static void
1089 int is_gns,
1090 uint32_t rd_count,
1091 const struct GNUNET_GNSRECORD_Data *rd)
1092{
1093 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1094 struct GNUNET_CRYPTO_PublicKey iss;
1095 struct ParallelLookup *parallel_lookup;
1096 const char *rp_uri = NULL;
1097 char *lbl;
1099
1100 cth->lookup_request = NULL;
1101
1102 GNUNET_assert (GNUNET_YES == is_gns);
1104 "reclaim_authz_lookup_time_total",
1106 cth->lookup_start_time)
1107 .rel_value_us,
1108 GNUNET_YES);
1110 "reclaim_authz_lookups_count",
1111 1,
1112 GNUNET_YES);
1113
1115 == GNUNET_GNS_parse_ztld (cth->ticket.gns_name, &iss));
1116 for (int i = 0; i < rd_count; i++)
1117 {
1122 switch (rd[i].record_type)
1123 {
1125 rp_uri = rd[i].data;
1126 break;
1129 ale->presentation =
1131 rd[i].data_size);
1134 ale);
1135 break;
1138 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ticket reference found %s\n", lbl);
1139 parallel_lookup = GNUNET_new (struct ParallelLookup);
1140 parallel_lookup->handle = cth;
1141 parallel_lookup->label = lbl;
1142 parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get ();
1143 parallel_lookup->lookup_request =
1145 lbl,
1146 &iss,
1150 parallel_lookup);
1153 parallel_lookup);
1154 break;
1155 default:
1157 "Ignoring unknown record type %d", rd[i].record_type);
1158 }
1159 }
1160 if (NULL == rp_uri)
1161 {
1163 "RP URI not found along references, ignoring...\n");
1167 cth->cb (cth->cb_cls, &iss,
1168 cth->attrs, NULL, GNUNET_NO, NULL);
1169 cleanup_cth (cth);
1170 return;
1171 }
1172 if (0 != strcmp (rp_uri, cth->rp_uri))
1173 {
1175 "RP URI does not match consume request: `%s' != `%s'\n",
1176 rp_uri, cth->rp_uri);
1180 cth->cb (cth->cb_cls, &iss,
1181 cth->attrs, NULL, GNUNET_NO, NULL);
1182 cleanup_cth (cth);
1183 return;
1184 }
1189 if (NULL != cth->parallel_lookups_head)
1190 {
1194 cth);
1195 return;
1196 }
1200 cth->cb (cth->cb_cls, &iss,
1201 cth->attrs, NULL, GNUNET_OK, NULL);
1202 cleanup_cth (cth);
1203}
1204
1205
1219 const char *rp_uri,
1221 void *cb_cls)
1222{
1224
1226
1229 cth->ticket = *ticket;
1230 memcpy (cth->rp_uri, rp_uri, strlen (rp_uri) + 1);
1231 cth->cb = cb;
1232 cth->cb_cls = cb_cls;
1234 cth->lookup_request =
1240 cth);
1241 return cth;
1242}
1243
1244
1250void
1252{
1253 cleanup_cth (cth);
1254 return;
1255}
1256
1257
1258/*******************************
1259 * Ticket issue
1260 *******************************/
1261
1266static void
1268{
1269 if (NULL != handle->ns_qe)
1272}
1273
1274
1283static void
1285{
1286 struct TicketIssueHandle *handle = cls;
1287
1288 handle->ns_qe = NULL;
1289 if (GNUNET_EC_NONE != ec)
1290 {
1291 handle->cb (handle->cb_cls,
1292 &handle->ticket,
1293 NULL,
1295 "Error storing AuthZ ticket in GNS");
1296 return;
1297 }
1298 handle->cb (handle->cb_cls,
1299 &handle->ticket,
1300 handle->presentations,
1301 GNUNET_OK, NULL);
1303}
1304
1305
1313static void
1315{
1318 struct GNUNET_GNSRECORD_Data *attrs_record;
1319 struct GNUNET_RECLAIM_Presentation *presentation;
1321 char *label;
1322 char *tkt_data;
1323 int i;
1324 int j;
1325 int attrs_count = 0;
1326
1327 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1328 attrs_count++;
1329
1330 // Worst case we have one presentation per attribute plus the ticket
1331 // plus the RP URI record
1332 attrs_record =
1333 GNUNET_malloc ((2 * attrs_count + 2)
1334 * sizeof(struct GNUNET_GNSRECORD_Data));
1335 i = 0;
1336 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1337 {
1339 "Adding list entry: %s\n", le->attribute->name);
1340
1341 attrs_record[i].data = &le->attribute->id;
1342 attrs_record[i].data_size = sizeof(le->attribute->id);
1346 i++;
1348 {
1350 "Attribute is backed by credential. Adding...\n");
1351 presentation = NULL;
1352 for (j = 0; j < i; j++)
1353 {
1354 if (attrs_record[j].record_type
1356 continue;
1358 attrs_record[j].data,
1359 attrs_record[j].
1360 data_size);
1361 if (NULL == presentation)
1362 {
1364 "Failed to deserialize presentation\n");
1365 continue;
1366 }
1367 if (0 == memcmp (&presentation->credential_id,
1368 &le->attribute->credential,
1369 sizeof (le->attribute->credential)))
1370 break;
1371 GNUNET_free (presentation);
1372 presentation = NULL;
1373 }
1374 if (NULL != presentation)
1375 {
1376 GNUNET_free (presentation);
1377 continue; // Skip as we have already added this credential presentation.
1378 }
1379 for (ple = ih->presentations->list_head; NULL != ple; ple = ple->next)
1380 {
1382 "Checking presentation....\n");
1383
1384 if (0 != memcmp (&le->attribute->credential,
1386 sizeof (le->attribute->credential)))
1387 {
1389 "Presentation does not match credential ID.\n");
1390 continue;
1391 }
1392 {
1393 char *pres_buf;
1394 size_t pres_size;
1395
1396 pres_size =
1398 pres_buf = GNUNET_malloc (pres_size);
1400 pres_buf);
1401 attrs_record[i].data = pres_buf;
1402 attrs_record[i].data_size = pres_size;
1403 attrs_record[i].expiration_time =
1405 attrs_record[i].record_type =
1408 i++;
1409 break;
1410 }
1411 }
1412 }
1413 }
1414
1415 label =
1417 sizeof(ih->rnd));
1419 &pub);
1420 {
1423 "Storing AuthZ information under %s in %s\n", label, str);
1424 sprintf (ih->ticket.gns_name, "%s.%s", label, str);
1425 GNUNET_free (str);
1426 }
1427
1428 attrs_record[i].data_size =
1429 strlen (ih->ticket.gns_name) + 1;
1430 tkt_data = GNUNET_malloc (attrs_record[i].data_size);
1431 memcpy (tkt_data, &ih->ticket, attrs_record[i].data_size);
1432 // The ticket: Could be removed?
1433 attrs_record[i].data = tkt_data;
1436 attrs_record[i].flags =
1438 i++;
1439 // The RP URI
1440 attrs_record[i].data_size = strlen (ih->rp_uri);
1441 attrs_record[i].data = ih->rp_uri;
1443 attrs_record[i].record_type = GNUNET_DNSPARSER_TYPE_TXT;
1444 attrs_record[i].flags =
1446 i++;
1447
1448 // Publish record
1450 &ih->identity,
1451 label,
1452 i,
1453 attrs_record,
1455 ih);
1456 for (j = 0; j < i; j++)
1457 {
1458 char *ptr = (char*) attrs_record[j].data;
1459 if (attrs_record[j].record_type
1461 continue;
1462 // Yes, we are allowed to do this because we allocated it above
1463 GNUNET_free (ptr);
1464 }
1465 GNUNET_free (tkt_data);
1466 GNUNET_free (attrs_record);
1467 GNUNET_free (label);
1468}
1469
1470
1471/*************************************************
1472 * Ticket iteration (finding a specific ticket)
1473 *************************************************/
1474
1475
1481static void
1483{
1484 struct TicketIssueHandle *tih = cls;
1485
1486 tih->ns_it = NULL;
1487 tih->cb (tih->cb_cls,
1488 &tih->ticket,
1489 NULL,
1491 "Error storing AuthZ ticket in GNS");
1493}
1494
1495
1508static void
1510 const struct GNUNET_CRYPTO_PrivateKey *zone,
1511 const char *label,
1512 unsigned int rd_count,
1513 const struct GNUNET_GNSRECORD_Data *rd)
1514{
1515 struct TicketIssueHandle *tih = cls;
1517 struct GNUNET_RECLAIM_Presentation *presentation;
1518 struct GNUNET_RECLAIM_PresentationList *ticket_presentations;
1522 unsigned int attr_cnt = 0;
1523 unsigned int pres_cnt = 0;
1524 unsigned int found_attrs_cnt = 0;
1525 unsigned int found_pres_cnt = 0;
1526 int ticket_found = GNUNET_NO;
1527 int rp_uri_matches = GNUNET_NO;
1528
1529 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1530 {
1531 attr_cnt++;
1533 pres_cnt++;
1534 }
1535
1536 // ticket search
1537 found_attrs_cnt = 0;
1538 found_pres_cnt = 0;
1539 ticket_presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList);
1540
1541 for (int i = 0; i < rd_count; i++)
1542 {
1543 // found ticket
1544 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET == rd[i].record_type)
1545 {
1546 ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1547 tih->ticket = *ticket;
1548 ticket_found = GNUNET_YES;
1549 }
1550 if (GNUNET_DNSPARSER_TYPE_TXT == rd[i].record_type)
1551 {
1552 // cmp audience
1553 if (0 != strncmp (tih->rp_uri,
1554 rd[i].data,
1555 rd[i].data_size))
1556 continue;
1557 rp_uri_matches = GNUNET_YES;
1558 }
1559 // cmp requested attributes with ticket attributes
1560 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1561 {
1562 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1563 {
1565 &le->attribute->id))
1566 found_attrs_cnt++;
1567 }
1568 }
1569 if (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL == rd[i].record_type)
1570 {
1572 "Found credential...\n");
1573
1574 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1575 {
1577 rd[i].data_size);
1579 &le->attribute->credential
1580 ))
1581 {
1583 "No match.\n");
1584 GNUNET_free (cred);
1585 continue;
1586 }
1588 "Match, creating presentation...\n");
1590 cred,
1591 tih->attrs,
1592 &presentation))
1593 {
1595 "Unable to retrieve presentation from credential\n");
1596 GNUNET_free (cred);
1597 continue;
1598 }
1600 ple->presentation = presentation;
1603 ple);
1604 GNUNET_free (cred);
1605 break;
1606 }
1607 }
1608 if (GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION == rd[i].record_type)
1609 {
1610 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1611 {
1613 rd[i].data_size)
1614 ;
1615 if (NULL == presentation)
1616 {
1618 "Failed to deserialize presentation\n");
1619 continue;
1620 }
1622 &presentation->credential_id,
1623 &le->attribute->credential))
1624 {
1625 found_pres_cnt++;
1627 ple->presentation = presentation;
1628 GNUNET_CONTAINER_DLL_insert (ticket_presentations->list_head,
1629 ticket_presentations->list_tail,
1630 ple);
1631 }
1632 }
1633 }
1634 }
1635
1640 if ((attr_cnt == found_attrs_cnt) &&
1641 (pres_cnt == found_pres_cnt) &&
1642 (GNUNET_YES == ticket_found) &&
1643 (GNUNET_YES == rp_uri_matches))
1644 {
1646 tih->cb (tih->cb_cls, &tih->ticket, ticket_presentations, GNUNET_OK, NULL);
1647 GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations);
1649 return;
1650 }
1651 GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations);
1652 // ticket not found in current record, checking next record set
1654}
1655
1656
1664static void
1666{
1667 struct TicketIssueHandle *tih = cls;
1668
1670 issue_ticket (tih);
1671}
1672
1673
1685void
1687 const struct GNUNET_RECLAIM_AttributeList *attrs,
1688 const char *rp,
1690 void *cb_cls)
1691{
1692 struct TicketIssueHandle *tih;
1693
1694 tih = GNUNET_new (struct TicketIssueHandle);
1695 tih->cb = cb;
1696 tih->cb_cls = cb_cls;
1699 tih->identity = *identity;
1700 memcpy (tih->rp_uri, rp, strlen (rp) + 1);
1701
1702 // First check whether the ticket has already been issued
1703 tih->ns_it =
1705 &tih->identity,
1707 tih,
1709 tih,
1711 tih);
1712}
1713
1714
1715/************************************
1716 * Ticket iteration
1717 ************************************/
1718
1724static void
1726{
1727 if (NULL != iter->ns_it)
1729 GNUNET_free (iter);
1730}
1731
1732
1744static void
1746 const struct GNUNET_CRYPTO_PrivateKey *zone,
1747 const char *label,
1748 unsigned int rd_count,
1749 const struct GNUNET_GNSRECORD_Data *rd)
1750{
1751 struct RECLAIM_TICKETS_Iterator *iter = cls;
1753 int ticket_found = GNUNET_NO;
1754 const char *rp_uri = NULL;
1755
1756 for (int i = 0; i < rd_count; i++)
1757 {
1758 if (GNUNET_DNSPARSER_TYPE_TXT == rd[i].record_type)
1759 rp_uri = rd[i].data;
1760 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET != rd[i].record_type)
1761 continue;
1762 if ((GNUNET_YES == ticket_found) && (NULL != rp_uri))
1763 break;
1764 ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1765 ticket_found = GNUNET_YES;
1766 }
1767 if ((GNUNET_YES == ticket_found) && (NULL != rp_uri))
1768 iter->cb (iter->cb_cls, ticket, rp_uri);
1770}
1771
1772
1778static void
1780{
1781 struct RECLAIM_TICKETS_Iterator *iter = cls;
1782
1783 iter->ns_it = NULL;
1784 iter->cb (iter->cb_cls, NULL, NULL);
1785 cleanup_iter (iter);
1786}
1787
1788
1794static void
1796{
1797 struct RECLAIM_TICKETS_Iterator *iter = cls;
1798
1799 iter->ns_it = NULL;
1800 iter->cb (iter->cb_cls, NULL, NULL);
1801 cleanup_iter (iter);
1802}
1803
1804
1810void
1812{
1814}
1815
1816
1822void
1824{
1826 cleanup_iter (iter);
1827}
1828
1829
1840 const struct GNUNET_CRYPTO_PrivateKey *identity,
1842 void *cb_cls)
1843{
1844 struct RECLAIM_TICKETS_Iterator *iter;
1845
1846 iter = GNUNET_new (struct RECLAIM_TICKETS_Iterator);
1847 iter->cb = cb;
1848 iter->cb_cls = cb_cls;
1849 iter->ns_it =
1851 identity,
1853 iter,
1855 iter,
1857 iter);
1858 return iter;
1859}
1860
1861
1868int
1870{
1871 // Get ticket expiration time (relative) from config
1872 if (GNUNET_OK ==
1874 "reclaim",
1875 "TICKET_REFRESH_INTERVAL",
1877 {
1879 "Configured refresh interval for tickets: %s\n",
1881 GNUNET_YES));
1882 }
1883 else
1884 {
1886 }
1887 // Connect to identity and namestore services
1889 if (NULL == nsh)
1890 {
1892 "error connecting to namestore");
1893 return GNUNET_SYSERR;
1894 }
1895 gns = GNUNET_GNS_connect (c);
1896 if (NULL == gns)
1897 {
1898 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns");
1899 return GNUNET_SYSERR;
1900 }
1901 stats = GNUNET_STATISTICS_create ("reclaim", c);
1902 return GNUNET_OK;
1903}
1904
1905
1910void
1912{
1913 if (NULL != nsh)
1915 nsh = NULL;
1916 if (NULL != gns)
1918 gns = NULL;
1919 if (NULL != stats)
1920 {
1922 stats = NULL;
1923 }
1924}
static gnutls_certificate_credentials_t cred
The credential.
static char * data
The data to insert into the dht.
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static size_t data_size
Number of bytes in data.
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static char * rp
Relying party.
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
Definition: gnunet-scrypt.c:47
void RECLAIM_TICKETS_iteration_stop(struct RECLAIM_TICKETS_Iterator *iter)
Stop a running ticket iteration.
static struct GNUNET_GNS_Handle * gns
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
static void filter_tickets_finished_cb(void *cls)
Done iterating over tickets and we apparently did not find an existing, matching ticket.
static void filter_tickets_cb(void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Iterator over records.
void RECLAIM_TICKETS_consume_cancel(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cancel a consume operation.
static void collect_tickets_finished_cb(void *cls)
Signal ticket iteration has finished.
static void move_attrs_cont(void *cls)
Delayed continuation for move_attrs.
static void abort_parallel_lookups(void *cls)
Cancel the lookups for attribute records.
struct RECLAIM_TICKETS_Iterator * RECLAIM_TICKETS_iteration_start(const struct GNUNET_CRYPTO_PrivateKey *identity, RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
Iterate over all tickets issued by an identity.
void RECLAIM_TICKETS_revoke_cancel(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cancel a revocation.
static void lookup_authz_cb(void *cls, int is_gns, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
static void rvk_ticket_update_finished(void *cls)
Done collecting tickets.
static struct GNUNET_STATISTICS_Handle * stats
#define DEFAULT_TICKET_REFRESH_INTERVAL
FIXME: the default ticket iteration interval should probably be the minimum attribute expiration.
static void rvk_ticket_update(void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
We need to update all other tickets with the new attribute IDs.
int RECLAIM_TICKETS_init(const struct GNUNET_CONFIGURATION_Handle *c)
Initialize tickets component.
static void cleanup_iter(struct RECLAIM_TICKETS_Iterator *iter)
Cleanup ticket iterator.
static struct GNUNET_TIME_Relative ticket_refresh_interval
Ticket expiration interval.
static void revoke_attrs_cb(void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
We found the attribute references.
void RECLAIM_TICKETS_iteration_next(struct RECLAIM_TICKETS_Iterator *iter)
Continue ticket iteration.
static void collect_tickets_error_cb(void *cls)
Cancel ticket iteration on namestore error.
static void move_attrs(struct RECLAIM_TICKETS_RevokeHandle *rh)
We change every attribute ID of the ticket attributes we want to revoke.
static void remove_ticket_cont(void *cls, enum GNUNET_ErrorCode ec)
Finished deleting ticket and attribute references.
static void cleanup_cth(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cleanup ticket consume handle.
static void store_ticket_issue_cont(void *cls, enum GNUNET_ErrorCode ec)
Store finished, abort on error.
static void del_attr_finished(void *cls, enum GNUNET_ErrorCode ec)
Done deleting the old record.
static void process_tickets(void *cls)
For each ticket, store new, updated attribute references (Implementation further below)
static void cleanup_issue_handle(struct TicketIssueHandle *handle)
Cleanup ticket consume handle.
static void move_attr_finished(void *cls, enum GNUNET_ErrorCode ec)
Updated an attribute ID.
static void issue_ticket(struct TicketIssueHandle *ih)
Issue a new ticket.
struct RECLAIM_TICKETS_RevokeHandle * RECLAIM_TICKETS_revoke(const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_CRYPTO_PrivateKey *identity, RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls)
Revoke a ticket.
void RECLAIM_TICKETS_issue(const struct GNUNET_CRYPTO_PrivateKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const char *rp, RECLAIM_TICKETS_TicketResult cb, void *cb_cls)
Issue a new reclaim ticket, thereby authorizing the audience to access the set of provided attributes...
static void filter_tickets_error_cb(void *cls)
Namestore error on issue.
static struct GNUNET_NAMESTORE_Handle * nsh
static void rvk_ns_err(void *cls)
Error storing new attribute in namestore.
static void rvk_ns_iter_err(void *cls)
Error iterating namestore.
static void ticket_processed(void *cls, enum GNUNET_ErrorCode ec)
Finished storing updated attribute references.
struct RECLAIM_TICKETS_ConsumeHandle * RECLAIM_TICKETS_consume(const struct GNUNET_RECLAIM_Ticket *ticket, const char *rp_uri, RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls)
Consume a ticket.
static void collect_tickets_cb(void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Return each record of type GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET to the caller and proceed with the it...
static void rvk_move_attr_cb(void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got the referenced attribute.
static void rvk_attrs_err_cb(void *cls)
Failed to query namestore.
void RECLAIM_TICKETS_deinit(void)
Close handles and clean up.
static void process_parallel_lookup_result(void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
void(* RECLAIM_TICKETS_ConsumeCallback)(void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_AttributeList *attributes, const struct GNUNET_RECLAIM_PresentationList *presentations, int32_t success, const char *emsg)
Consume callback.
void(* RECLAIM_TICKETS_TicketIter)(void *cls, struct GNUNET_RECLAIM_Ticket *ticket, const char *rp_uri)
Continuation called with ticket.
void(* RECLAIM_TICKETS_TicketResult)(void *cls, struct GNUNET_RECLAIM_Ticket *ticket, struct GNUNET_RECLAIM_PresentationList *presentations, int32_t success, const char *emsg)
Continuation called with ticket.
void(* RECLAIM_TICKETS_RevokeCallback)(void *cls, int32_t success)
Revocation callback.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
API to the GNS service.
API that can be used to manipulate GNS record data.
reclaim service; implements identity and personal data sharing for GNUnet
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_DNSPARSER_TYPE_TXT
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
Definition: gns_api.c:289
struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup(struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_CRYPTO_PublicKey *zone, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS.
Definition: gns_api.c:421
enum GNUNET_GenericReturnValue GNUNET_GNS_parse_ztld(const char *name, struct GNUNET_CRYPTO_PublicKey *ztld_key)
Try to parse the zTLD into a public key.
Definition: gns_tld_api.c:228
struct GNUNET_GNS_LookupWithTldRequest * GNUNET_GNS_lookup_with_tld(struct GNUNET_GNS_Handle *handle, const char *name, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor2 proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS, determining the zone using the TLD of the given ...
Definition: gns_tld_api.c:240
void * GNUNET_GNS_lookup_with_tld_cancel(struct GNUNET_GNS_LookupWithTldRequest *ltr)
Cancel pending lookup request.
Definition: gns_tld_api.c:331
void * GNUNET_GNS_lookup_cancel(struct GNUNET_GNS_LookupRequest *lr)
Cancel pending lookup request.
Definition: gns_api.c:313
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
Definition: gns_api.c:267
@ GNUNET_GNS_LO_DEFAULT
Defaults, look in cache, then in DHT.
int GNUNET_GNSRECORD_records_deserialize(size_t len, const char *src, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *dest)
Deserialize the given records to the given destination.
ssize_t GNUNET_GNSRECORD_records_serialize(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest)
Serialize the given records to the given destination buffer.
ssize_t GNUNET_GNSRECORD_records_get_size(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Calculate how many bytes we will need to serialize the given records.
#define GNUNET_GNSRECORD_TYPE_ANY
Record type indicating any record/'*'.
@ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION
This expiration time of the record is a relative time (not an absolute time).
@ GNUNET_GNSRECORD_RF_PRIVATE
This is a private record of this peer and it should thus not be published.
#define GNUNET_log(kind,...)
char * GNUNET_CRYPTO_public_key_to_string(const struct GNUNET_CRYPTO_PublicKey *key)
Creates a (Base32) string representation of the public key.
Definition: crypto_pkey.c:379
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public(const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: crypto_pkey.c:430
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls)
Lookup an item in the namestore.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
void GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it, uint64_t limit)
Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_start for the next record.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
#define GNUNET_RECLAIM_id_is_equal(a, b)
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_deserialize(const char *data, size_t data_size)
Deserialize a presentation.
size_t GNUNET_RECLAIM_presentation_serialize_get_size(const struct GNUNET_RECLAIM_Presentation *presentation)
Get required size for serialization buffer.
int GNUNET_RECLAIM_credential_get_presentation(const struct GNUNET_RECLAIM_Credential *cred, const struct GNUNET_RECLAIM_AttributeList *attrs, struct GNUNET_RECLAIM_Presentation **presentation)
Create a presentation from a credential and a lift of (selected) attributes in the credential.
#define GNUNET_RECLAIM_id_is_zero(a)
size_t GNUNET_RECLAIM_presentation_serialize(const struct GNUNET_RECLAIM_Presentation *presentation, char *result)
Serialize a presentation.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attribute_list_dup(const struct GNUNET_RECLAIM_AttributeList *attrs)
Make a (deep) copy of a claim list.
void GNUNET_RECLAIM_presentation_list_destroy(struct GNUNET_RECLAIM_PresentationList *presentations)
Destroy presentations list.
#define GNUNET_RECLAIM_id_generate(id)
size_t GNUNET_RECLAIM_attribute_serialize_get_size(const struct GNUNET_RECLAIM_Attribute *attr)
Get required size for serialization buffer.
ssize_t GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size, struct GNUNET_RECLAIM_Attribute **attr)
Deserialize an attribute.
size_t GNUNET_RECLAIM_credential_serialize(const struct GNUNET_RECLAIM_Credential *credential, char *result)
Serialize an credential.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_deserialize(const char *data, size_t data_size)
Deserialize an credential.
size_t GNUNET_RECLAIM_credential_serialize_get_size(const struct GNUNET_RECLAIM_Credential *credential)
Get required size for serialization buffer.
size_t GNUNET_RECLAIM_attribute_serialize(const struct GNUNET_RECLAIM_Attribute *attr, char *result)
Serialize an attribute.
#define GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:980
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1304
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1277
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:787
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
Definition: time.c:438
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:579
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:111
#define GNUNET_TIME_UNIT_MINUTES
One minute.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:486
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE
identity attribute
#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION
Record type for a presentation of a credential.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF
for reclaim records
#define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL
Record type for an attribute attestation (e.g.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
local ticket reference
const char * GNUNET_ErrorCode_get_hint(enum GNUNET_ErrorCode ec)
Returns a hint for a given error code.
GNUNET_ErrorCode
Taler error codes.
@ GNUNET_EC_NONE
No error (success).
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
uint64_t expiration_time
Expiration time for the DNS record.
Connection to the GNS service.
Definition: gns_api.h:36
Handle to a lookup request.
Definition: gns_api.c:48
Handle to a lookup request.
Definition: gns_tld_api.c:45
Connection to the NAMESTORE service.
An QueueEntry used to store information for a pending NAMESTORE record operation.
Definition: namestore_api.c:49
Handle for a zone iterator operation.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
A list of GNUNET_RECLAIM_Attribute structures.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
struct GNUNET_RECLAIM_Identifier id
ID.
A reclaim identifier FIXME maybe put this in a different namespace.
struct GNUNET_RECLAIM_Presentation * presentation
The credential.
struct GNUNET_RECLAIM_PresentationListEntry * next
DLL.
A list of GNUNET_RECLAIM_Presentation structures.
struct GNUNET_RECLAIM_PresentationListEntry * list_head
List head.
struct GNUNET_RECLAIM_PresentationListEntry * list_tail
List tail.
A credential presentation.
struct GNUNET_RECLAIM_Identifier credential_id
The credential id of which this is a presentation.
The authorization ticket.
char gns_name[63 *2+2]
The ticket.
Entry in list of pending tasks.
Definition: scheduler.c:136
Handle for the service.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
Handle for a parallel GNS lookup job.
struct GNUNET_TIME_Absolute lookup_start_time
Lookup time.
struct RECLAIM_TICKETS_ConsumeHandle * handle
struct ParallelLookup * prev
struct ParallelLookup * next
struct GNUNET_GNS_LookupRequest * lookup_request
RECLAIM_TICKETS_ConsumeCallback cb
Callback.
char rp_uri[GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN]
The ticket audience (= relying party) URI.
struct GNUNET_TIME_Absolute lookup_start_time
Lookup time.
struct GNUNET_RECLAIM_AttributeList * attrs
Attributes.
struct ParallelLookup * parallel_lookups_tail
Lookup DLL.
struct GNUNET_RECLAIM_Ticket ticket
Ticket.
struct ParallelLookup * parallel_lookups_head
Lookup DLL.
struct GNUNET_GNS_LookupWithTldRequest * lookup_request
LookupRequest.
struct GNUNET_RECLAIM_PresentationList * presentations
Presentations.
struct GNUNET_SCHEDULER_Task * kill_task
Kill task.
RECLAIM_TICKETS_TicketIter cb
Iter callback.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.
Ticket revocation request handle.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
struct RevokedAttributeEntry * move_attr
Current attribute to move.
RECLAIM_TICKETS_RevokeCallback cb
Callback.
struct RevokedAttributeEntry * attrs_tail
Revoked attributes.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
struct GNUNET_CRYPTO_PrivateKey identity
Issuer Key.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
unsigned int ticket_attrs
Number of attributes in ticket.
struct RevokedAttributeEntry * attrs_head
Revoked attributes.
struct GNUNET_RECLAIM_Identifier old_id
Old ID of the attribute.
struct RevokedAttributeEntry * next
DLL.
struct RevokedAttributeEntry * prev
DLL.
struct GNUNET_RECLAIM_Identifier new_id
New ID of the attribute.
Ticket issue request handle.
struct GNUNET_RECLAIM_AttributeList * attrs
Attributes to issue.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore Iterator.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct GNUNET_RECLAIM_PresentationList * presentations
Presentations to add.
RECLAIM_TICKETS_TicketResult cb
Callback.
char rp_uri[GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN]
The ticket audience (= relying party) URI.
struct GNUNET_CRYPTO_PrivateKey identity
Issuer Key.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
unsigned int rd_count
Record count.
A reference to a ticket stored in GNS.
struct TicketReference * prev
DLL.
struct GNUNET_RECLAIM_AttributeList * attrs
Attributes.
struct GNUNET_RECLAIM_Ticket ticket
Tickets.
struct TicketReference * next
DLL.