GNUnet 0.21.1
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
29
34#define DEFAULT_TICKET_REFRESH_INTERVAL GNUNET_TIME_UNIT_HOURS
35
40struct ParallelLookup;
41
42
47{
52
57
62
67};
68
69
74{
79
84
89
94
99
104
109
114
119
124
129
133 void *cb_cls;
134};
135
136
141{
142 /* DLL */
144
145 /* DLL */
147
148 /* The GNS request */
150
151 /* The handle the return to */
153
158
159 /* The label to look up */
160 char *label;
161};
162
163
168{
173
178
183
188
193
198
203
207 void *cb_cls;
208};
209
210
215{
220
225
229 void *cb_cls;
230};
231
232
234{
239
244
249
254};
255
256
261{
266
271
275 void *cb_cls;
276
281
286
291
296
301
306
310 unsigned int ticket_attrs;
311
316
321};
322
323
328
329
330/* Namestore handle */
332
333
334/* GNS handle */
335static struct GNUNET_GNS_Handle *gns;
336
337
338/* Handle to the statistics service */
340
341
347static void
349{
350 struct RevokedAttributeEntry *ae;
351 struct TicketRecordsEntry *le;
352
353 if (NULL != rh->ns_qe)
355 if (NULL != rh->ns_it)
357 while (NULL != (ae = rh->attrs_head))
358 {
360 GNUNET_free (ae);
361 }
362 while (NULL != (le = rh->tickets_to_update_head))
363 {
366 le);
367 if (NULL != le->data)
368 GNUNET_free (le->data);
369 if (NULL != le->label)
370 GNUNET_free (le->label);
371 GNUNET_free (le);
372 }
373 GNUNET_free (rh);
374}
375
376
383static void
384process_tickets (void *cls);
385
386
395static void
397{
398 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
399
400 rvk->ns_qe = NULL;
402}
403
404
410static void
412{
413 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
414 struct TicketRecordsEntry *le;
415 struct RevokedAttributeEntry *ae;
416
417 if (NULL == rvk->tickets_to_update_head)
418 {
420 "Finished updatding tickets, success\n");
421 rvk->cb (rvk->cb_cls, GNUNET_OK);
422 cleanup_rvk (rvk);
423 return;
424 }
425 le = rvk->tickets_to_update_head;
428 le);
431 le->data,
432 le->rd_count,
433 rd))
434 {
436 "Unable to deserialize ticket record(s)\n");
437 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
438 cleanup_rvk (rvk);
439 return;
440 }
441 for (int i = 0; i < le->rd_count; i++)
442 {
444 continue;
445 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
446 {
447 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
448 continue;
449 rd[i].data = &ae->new_id;
450 }
451 }
453 &rvk->identity,
454 le->label,
455 le->rd_count,
456 rd,
458 rvk);
459 GNUNET_free (le->label);
460 GNUNET_free (le->data);
461 GNUNET_free (le);
462}
463
464
470static void
472{
473 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
474
475 rvk->ns_it = NULL;
477}
478
479
490static void
492 const struct GNUNET_CRYPTO_PrivateKey *zone,
493 const char *label,
494 unsigned int rd_count,
495 const struct GNUNET_GNSRECORD_Data *rd)
496{
497 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
498 struct TicketRecordsEntry *le;
499 struct RevokedAttributeEntry *ae;
500 int has_changed = GNUNET_NO;
501
503 for (int i = 0; i < rd_count; i++)
504 {
506 continue;
507 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
508 {
509 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
510 continue;
511 has_changed = GNUNET_YES;
512 break;
513 }
514 if (GNUNET_YES == has_changed)
515 break;
516 }
517 if (GNUNET_YES == has_changed)
518 {
519 le = GNUNET_new (struct TicketRecordsEntry);
521 le->data = GNUNET_malloc (le->data_size);
522 le->rd_count = rd_count;
523 le->label = GNUNET_strdup (label);
527 le);
528 }
530}
531
532
538static void
540{
541 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
542
543 rvk->ns_it = NULL;
544 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
545 cleanup_rvk (rvk);
546}
547
548
554static void
555rvk_ns_err (void *cls)
556{
557 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
558
559 rvk->ns_qe = NULL;
560 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
561 cleanup_rvk (rvk);
562}
563
564
573static void
575
576
582static void
584{
586}
587
588
597static void
599{
600 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
601
602 rvk->ns_qe = NULL;
603 if (GNUNET_EC_NONE != ec)
604 {
606 "Error removing attribute: %s\n",
608 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
609 cleanup_rvk (rvk);
610 return;
611 }
612 rvk->move_attr = rvk->move_attr->next;
614}
615
616
626static void
628{
629 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
630 char *label;
631
632 rvk->ns_qe = NULL;
633 if (GNUNET_EC_NONE != ec)
634 {
636 "Error moving attribute: %s\n",
638 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
639 cleanup_rvk (rvk);
640 return;
641 }
643 sizeof(rvk->move_attr->old_id));
644 GNUNET_assert (NULL != label);
645 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
647 &rvk->identity,
648 label,
649 0,
650 NULL,
652 rvk);
653 GNUNET_free (label);
654}
655
656
666static void
668 const struct GNUNET_CRYPTO_PrivateKey *zone,
669 const char *label,
670 unsigned int rd_count,
671 const struct GNUNET_GNSRECORD_Data *rd)
672{
673 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
674 struct GNUNET_GNSRECORD_Data new_rd[rd_count];
675 struct RevokedAttributeEntry *le;
676 char *new_label;
677 char *attr_data;
678
679 rvk->ns_qe = NULL;
680 if (0 == rd_count)
681 {
683 "The claim %s no longer exists!\n",
684 label);
685 le = rvk->move_attr;
686 rvk->move_attr = le->next;
688 GNUNET_free (le);
690 return;
691 }
693 new_label =
695 sizeof (rvk->move_attr->new_id));
696
697 attr_data = NULL;
698 // new_rd = *rd;
699 for (int i = 0; i < rd_count; i++)
700 {
701 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type)
702 {
706 rd[i].data_size,
707 &claim);
709 "Attribute to update: Name=%s\n",
710 claim->name);
711 claim->id = rvk->move_attr->new_id;
713 attr_data = GNUNET_malloc (rd[i].data_size);
715 attr_data);
716 new_rd[i].data = attr_data;
717 new_rd[i].record_type = rd[i].record_type;
718 new_rd[i].flags = rd[i].flags;
719 new_rd[i].expiration_time = rd[i].expiration_time;
720 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
722 }
723 else if (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL == rd[i].record_type)
724 {
727 rd[i].data_size);
729 "Credential to update: Name=%s\n",
730 credential->name);
731 credential->id = rvk->move_attr->new_id;
732 new_rd[i].data_size =
734 attr_data = GNUNET_malloc (rd[i].data_size);
736 attr_data);
737 new_rd[i].data = attr_data;
738 new_rd[i].record_type = rd[i].record_type;
739 new_rd[i].flags = rd[i].flags;
740 new_rd[i].expiration_time = rd[i].expiration_time;
741 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding credential %s\n",
742 new_label);
744 }
745 else
746 {
747 memcpy (&new_rd[i], &rd[i], sizeof (struct GNUNET_GNSRECORD_Data));
748 }
749 }
751 &rvk->identity,
752 new_label,
753 rd_count,
754 new_rd,
756 rvk);
757 GNUNET_free (new_label);
758 GNUNET_free (attr_data);
759}
760
761
762static void
764{
765 char *label;
766
767 if (NULL == rvk->move_attr)
768 {
769 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n");
770 rvk->ns_it =
772 &rvk->identity,
774 rvk,
776 rvk,
778 rvk);
779 return;
780 }
782 sizeof (rvk->move_attr->old_id));
783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label);
784
786 &rvk->identity,
787 label,
788 &rvk_ns_err,
789 rvk,
791 rvk);
792 GNUNET_free (label);
793}
794
795
807static void
809{
810 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
811
812 rvk->ns_qe = NULL;
813 if (GNUNET_EC_NONE != ec)
814 {
817 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
818 cleanup_rvk (rvk);
819 return;
820 }
821 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted ticket\n");
822 if (0 == rvk->ticket_attrs)
823 {
825 "No attributes to move... strange\n");
826 rvk->cb (rvk->cb_cls, GNUNET_OK);
827 cleanup_rvk (rvk);
828 return;
829 }
830 rvk->move_attr = rvk->attrs_head;
831 move_attrs (rvk);
832}
833
834
845static void
847 const struct GNUNET_CRYPTO_PrivateKey *zone,
848 const char *label,
849 unsigned int rd_count,
850 const struct GNUNET_GNSRECORD_Data *rd)
851
852{
853 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
854 struct RevokedAttributeEntry *le;
855
856 rvk->ns_qe = NULL;
861 for (int i = 0; i < rd_count; i++)
862 {
864 continue;
865 le = GNUNET_new (struct RevokedAttributeEntry);
866 le->old_id = *((struct GNUNET_RECLAIM_Identifier *) rd[i].data);
868 rvk->ticket_attrs++;
869 }
870
873 &rvk->identity,
874 label,
875 0,
876 NULL,
878 rvk);
879}
880
881
887static void
889{
890 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
891
892 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
893 cleanup_rvk (rvk);
894}
895
896
912 void *cb_cls)
913{
915 char *label;
916
918 rvk->cb = cb;
919 rvk->cb_cls = cb_cls;
920 rvk->identity = *identity;
921 rvk->ticket = *ticket;
925 sizeof(ticket->rnd));
926 GNUNET_assert (NULL != label);
928 identity,
929 label,
931 rvk,
933 rvk);
934 GNUNET_free (label);
935 return rvk;
936}
937
938
944void
946{
947 GNUNET_assert (NULL != rh);
948 cleanup_rvk (rh);
949}
950
951
952/*******************************
953* Ticket consume
954*******************************/
955
961static void
963{
964 struct ParallelLookup *lu;
965
966 if (NULL != cth->lookup_request)
968 if (NULL != cth->kill_task)
970 while (NULL != (lu = cth->parallel_lookups_head))
971 {
972 if (NULL != lu->lookup_request)
974 GNUNET_free (lu->label);
977 lu);
978 GNUNET_free (lu);
979 }
980
981 if (NULL != cth->attrs)
983 if (NULL != cth->presentations)
985 GNUNET_free (cth);
986}
987
988
996static void
998 uint32_t rd_count,
999 const struct GNUNET_GNSRECORD_Data *rd)
1000{
1001 struct ParallelLookup *parallel_lookup = cls;
1002 struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
1003 struct GNUNET_RECLAIM_AttributeListEntry *attr_le;
1004
1006 "Parallel lookup finished (count=%u)\n",
1007 rd_count);
1008
1011 parallel_lookup);
1012 GNUNET_free (parallel_lookup->label);
1013
1015 "attribute_lookup_time_total",
1017 parallel_lookup->lookup_start_time)
1018 .rel_value_us,
1019 GNUNET_YES);
1020 GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES);
1021
1022
1023 GNUNET_free (parallel_lookup);
1024 if (0 == rd_count)
1025 GNUNET_break (0);
1026 // REMARK: It is possible now to find rd_count > 1
1027 for (int i = 0; i < rd_count; i++)
1028 {
1029 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd[i].record_type)
1030 continue;
1033 &attr_le->attribute);
1035 cth->attrs->list_tail,
1036 attr_le);
1037 }
1038 if (NULL != cth->parallel_lookups_head)
1039 return; // Wait for more
1040 /* Else we are done */
1041 cth->cb (cth->cb_cls, &cth->ticket.identity,
1042 cth->attrs, cth->presentations, GNUNET_OK, NULL);
1043 cleanup_cth (cth);
1044}
1045
1046
1052static void
1054{
1055 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1056 struct ParallelLookup *lu;
1057 struct ParallelLookup *tmp;
1058
1059 cth->kill_task = NULL;
1060 for (lu = cth->parallel_lookups_head; NULL != lu;)
1061 {
1063 GNUNET_free (lu->label);
1064 tmp = lu->next;
1067 lu);
1068 GNUNET_free (lu);
1069 lu = tmp;
1070 }
1071 cth->cb (cth->cb_cls, NULL, NULL, NULL, GNUNET_SYSERR, "Aborted");
1072}
1073
1074
1084static void
1086 uint32_t rd_count,
1087 const struct GNUNET_GNSRECORD_Data *rd)
1088{
1089 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1090 struct ParallelLookup *parallel_lookup;
1091 char *lbl;
1093
1094 cth->lookup_request = NULL;
1095
1097 "reclaim_authz_lookup_time_total",
1099 cth->lookup_start_time)
1100 .rel_value_us,
1101 GNUNET_YES);
1103 "reclaim_authz_lookups_count",
1104 1,
1105 GNUNET_YES);
1106
1107 for (int i = 0; i < rd_count; i++)
1108 {
1113 switch (rd[i].record_type)
1114 {
1117 ale->presentation =
1119 rd[i].data_size);
1122 ale);
1123 break;
1126 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ticket reference found %s\n", lbl);
1127 parallel_lookup = GNUNET_new (struct ParallelLookup);
1128 parallel_lookup->handle = cth;
1129 parallel_lookup->label = lbl;
1130 parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get ();
1131 parallel_lookup->lookup_request =
1133 lbl,
1134 &cth->ticket.identity,
1138 parallel_lookup);
1141 parallel_lookup);
1142 break;
1143 default:
1145 "Ignoring unknown record type %d", rd[i].record_type);
1146 }
1147 }
1152 if (NULL != cth->parallel_lookups_head)
1153 {
1157 cth);
1158 return;
1159 }
1163 cth->cb (cth->cb_cls, &cth->ticket.identity,
1164 cth->attrs, NULL, GNUNET_OK, NULL);
1165 cleanup_cth (cth);
1166}
1167
1168
1182 const struct GNUNET_RECLAIM_Ticket *ticket,
1184 void *cb_cls)
1185{
1187 char *label;
1188
1190
1191 cth->identity = *id;
1195 cth->ticket = *ticket;
1196 cth->cb = cb;
1197 cth->cb_cls = cb_cls;
1198 label =
1200 sizeof(cth->ticket.rnd));
1203 "Looking for AuthZ info under %s in %s\n",
1204 label, str);
1205 GNUNET_free (str);
1207 cth->lookup_request =
1209 label,
1210 &cth->ticket.identity,
1214 cth);
1215 GNUNET_free (label);
1216 return cth;
1217}
1218
1219
1225void
1227{
1228 cleanup_cth (cth);
1229 return;
1230}
1231
1232
1233/*******************************
1234 * Ticket issue
1235 *******************************/
1236
1241static void
1243{
1244 if (NULL != handle->ns_qe)
1247}
1248
1249
1258static void
1260{
1261 struct TicketIssueHandle *handle = cls;
1262
1263 handle->ns_qe = NULL;
1264 if (GNUNET_EC_NONE != ec)
1265 {
1266 handle->cb (handle->cb_cls,
1267 &handle->ticket,
1268 NULL,
1270 "Error storing AuthZ ticket in GNS");
1271 return;
1272 }
1273 handle->cb (handle->cb_cls,
1274 &handle->ticket,
1275 handle->presentations,
1276 GNUNET_OK, NULL);
1278}
1279
1280
1288static void
1290{
1293 struct GNUNET_GNSRECORD_Data *attrs_record;
1294 char *label;
1295 char *tkt_data;
1296 int i;
1297 int j;
1298 int attrs_count = 0;
1299
1300 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1301 attrs_count++;
1302
1303 // Worst case we have one presentation per attribute
1304 attrs_record =
1305 GNUNET_malloc (2 * attrs_count * sizeof(struct GNUNET_GNSRECORD_Data));
1306 i = 0;
1307 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1308 {
1310 "Adding list entry: %s\n", le->attribute->name);
1311
1312 attrs_record[i].data = &le->attribute->id;
1313 attrs_record[i].data_size = sizeof(le->attribute->id);
1317 i++;
1319 {
1321 "Attribute is backed by credential. Adding...\n");
1322 struct GNUNET_RECLAIM_Presentation *presentation = NULL;
1323 for (j = 0; j < i; j++)
1324 {
1325 if (attrs_record[j].record_type
1327 continue;
1329 attrs_record[j].data,
1330 attrs_record[j].
1331 data_size);
1332 if (NULL == presentation)
1333 {
1335 "Failed to deserialize presentation\n");
1336 continue;
1337 }
1338 if (0 == memcmp (&presentation->credential_id,
1339 &le->attribute->credential,
1340 sizeof (le->attribute->credential)))
1341 break;
1342 GNUNET_free (presentation);
1343 presentation = NULL;
1344 }
1345 if (NULL != presentation)
1346 {
1347 GNUNET_free (presentation);
1348 continue; // Skip as we have already added this credential presentation.
1349 }
1350 for (ple = ih->presentations->list_head; NULL != ple; ple = ple->next)
1351 {
1353 "Checking presentation....\n");
1354
1355 if (0 != memcmp (&le->attribute->credential,
1357 sizeof (le->attribute->credential)))
1358 {
1360 "Presentation does not match credential ID.\n");
1361 continue;
1362 }
1363 char *pres_buf;
1364 size_t pres_size;
1365
1366 pres_size =
1368 pres_buf = GNUNET_malloc (pres_size);
1370 pres_buf);
1371 attrs_record[i].data = pres_buf;
1372 attrs_record[i].data_size = pres_size;
1373 attrs_record[i].expiration_time =
1375 attrs_record[i].record_type =
1378 i++;
1379 break;
1380 }
1381 }
1382 }
1383 attrs_record[i].data_size =
1385 tkt_data = GNUNET_malloc (attrs_record[i].data_size);
1387 tkt_data,
1388 attrs_record[i].data_size);
1389 attrs_record[i].data = tkt_data;
1392 attrs_record[i].flags =
1394 i++;
1395
1396 label =
1398 sizeof(ih->ticket.rnd));
1401 &pub);
1404 "Storing AuthZ information under %s in %s\n", label, str);
1405 GNUNET_free (str);
1406 // Publish record
1408 &ih->identity,
1409 label,
1410 i,
1411 attrs_record,
1413 ih);
1414 for (j = 0; j < i; j++)
1415 {
1416 if (attrs_record[j].record_type
1418 continue;
1419 // Yes, we are allowed to do this because we allocated it above
1420 char *ptr = (char*) attrs_record[j].data;
1421 GNUNET_free (ptr);
1422 }
1423 GNUNET_free (tkt_data);
1424 GNUNET_free (attrs_record);
1425 GNUNET_free (label);
1426}
1427
1428
1429/*************************************************
1430 * Ticket iteration (finding a specific ticket)
1431 *************************************************/
1432
1433
1439static void
1441{
1442 struct TicketIssueHandle *tih = cls;
1443
1444 tih->ns_it = NULL;
1445 tih->cb (tih->cb_cls,
1446 &tih->ticket,
1447 NULL,
1449 "Error storing AuthZ ticket in GNS");
1451}
1452
1453
1466static void
1468 const struct GNUNET_CRYPTO_PrivateKey *zone,
1469 const char *label,
1470 unsigned int rd_count,
1471 const struct GNUNET_GNSRECORD_Data *rd)
1472{
1473 struct TicketIssueHandle *tih = cls;
1475 struct GNUNET_RECLAIM_Presentation *presentation;
1476 struct GNUNET_RECLAIM_PresentationList *ticket_presentations;
1477 struct GNUNET_RECLAIM_Credential *cred;
1480 unsigned int attr_cnt = 0;
1481 unsigned int pres_cnt = 0;
1482 int ticket_found = GNUNET_NO;
1483
1484 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1485 {
1486 attr_cnt++;
1488 pres_cnt++;
1489 }
1490
1491 // ticket search
1492 unsigned int found_attrs_cnt = 0;
1493 unsigned int found_pres_cnt = 0;
1494 size_t read;
1495 ticket_presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList);
1496
1497 for (int i = 0; i < rd_count; i++)
1498 {
1499 // found ticket
1500 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET == rd[i].record_type)
1501 {
1502 if ((GNUNET_SYSERR ==
1504 rd[i].data_size,
1505 &ticket,
1506 &read)) ||
1507 (read != rd[i].data_size))
1508 {
1510 "Failed to deserialize ticket from record\n");
1511 continue;
1512 }
1513 // cmp audience
1514 // FIXME this is ugly, GNUNET_CRYPTO_PublicKey cannot be compared
1515 // like this
1516 if (0 == memcmp (&tih->ticket.audience,
1518 sizeof(struct GNUNET_CRYPTO_PublicKey)))
1519 {
1520 tih->ticket = ticket;
1521 ticket_found = GNUNET_YES;
1522 continue;
1523 }
1524 }
1525
1526 // cmp requested attributes with ticket attributes
1527 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1528 {
1529 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1530 {
1532 &le->attribute->id))
1533 found_attrs_cnt++;
1534 }
1535 }
1536 if (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL == rd[i].record_type)
1537 {
1539 "Found credential...\n");
1540
1541 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1542 {
1544 rd[i].data_size);
1546 &le->attribute->credential))
1547 {
1549 "No match.\n");
1550 GNUNET_free (cred);
1551 continue;
1552 }
1554 "Match, creating presentation...\n");
1556 cred,
1557 tih->attrs,
1558 &presentation))
1559 {
1561 "Unable to retrieve presentation from credential\n");
1562 GNUNET_free (cred);
1563 continue;
1564 }
1566 ple->presentation = presentation;
1569 ple);
1570 GNUNET_free (cred);
1571 break;
1572 }
1573 }
1574 if (GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION == rd[i].record_type)
1575 {
1576 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1577 {
1579 rd[i].data_size);
1580 if (NULL == presentation)
1581 {
1583 "Failed to deserialize presentation\n");
1584 continue;
1585 }
1587 &presentation->credential_id,
1588 &le->attribute->credential))
1589 {
1590 found_pres_cnt++;
1592 ple->presentation = presentation;
1593 GNUNET_CONTAINER_DLL_insert (ticket_presentations->list_head,
1594 ticket_presentations->list_tail,
1595 ple);
1596 }
1597 }
1598 }
1599 }
1600
1605 if ((attr_cnt == found_attrs_cnt) &&
1606 (pres_cnt == found_pres_cnt) &&
1607 (GNUNET_YES == ticket_found))
1608 {
1610 tih->cb (tih->cb_cls, &tih->ticket, ticket_presentations, GNUNET_OK, NULL);
1611 GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations);
1613 return;
1614 }
1615 GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations);
1616 // ticket not found in current record, checking next record set
1618}
1619
1620
1628static void
1630{
1631 struct TicketIssueHandle *tih = cls;
1632
1635 issue_ticket (tih);
1636}
1637
1638
1650void
1652 const struct GNUNET_RECLAIM_AttributeList *attrs,
1653 const struct GNUNET_CRYPTO_PublicKey *audience,
1655 void *cb_cls)
1656{
1657 struct TicketIssueHandle *tih;
1658
1659 tih = GNUNET_new (struct TicketIssueHandle);
1660 tih->cb = cb;
1661 tih->cb_cls = cb_cls;
1664 tih->identity = *identity;
1665 tih->ticket.audience = *audience;
1666
1667 // First check whether the ticket has already been issued
1668 tih->ns_it =
1670 &tih->identity,
1672 tih,
1674 tih,
1676 tih);
1677}
1678
1679
1680/************************************
1681 * Ticket iteration
1682 ************************************/
1683
1689static void
1691{
1692 if (NULL != iter->ns_it)
1694 GNUNET_free (iter);
1695}
1696
1697
1709static void
1711 const struct GNUNET_CRYPTO_PrivateKey *zone,
1712 const char *label,
1713 unsigned int rd_count,
1714 const struct GNUNET_GNSRECORD_Data *rd)
1715{
1716 struct RECLAIM_TICKETS_Iterator *iter = cls;
1718 size_t read;
1719
1720 for (int i = 0; i < rd_count; i++)
1721 {
1722 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET != rd[i].record_type)
1723 continue;
1724 if ((GNUNET_SYSERR ==
1726 rd[i].data_size,
1727 &ticket,
1728 &read)) ||
1729 (read != rd[i].data_size))
1730 {
1732 "Failed to deserialize ticket from record\n");
1733 continue;
1734 }
1735 iter->cb (iter->cb_cls, &ticket);
1736 return;
1737 }
1739}
1740
1741
1747static void
1749{
1750 struct RECLAIM_TICKETS_Iterator *iter = cls;
1751
1752 iter->ns_it = NULL;
1753 iter->cb (iter->cb_cls, NULL);
1754 cleanup_iter (iter);
1755}
1756
1757
1763static void
1765{
1766 struct RECLAIM_TICKETS_Iterator *iter = cls;
1767
1768 iter->ns_it = NULL;
1769 iter->cb (iter->cb_cls, NULL);
1770 cleanup_iter (iter);
1771}
1772
1773
1779void
1781{
1783}
1784
1785
1791void
1793{
1795 cleanup_iter (iter);
1796}
1797
1798
1809 const struct GNUNET_CRYPTO_PrivateKey *identity,
1811 void *cb_cls)
1812{
1813 struct RECLAIM_TICKETS_Iterator *iter;
1814
1815 iter = GNUNET_new (struct RECLAIM_TICKETS_Iterator);
1816 iter->cb = cb;
1817 iter->cb_cls = cb_cls;
1818 iter->ns_it =
1820 identity,
1822 iter,
1824 iter,
1826 iter);
1827 return iter;
1828}
1829
1830
1837int
1839{
1840 // Get ticket expiration time (relative) from config
1841 if (GNUNET_OK ==
1843 "reclaim",
1844 "TICKET_REFRESH_INTERVAL",
1846 {
1848 "Configured refresh interval for tickets: %s\n",
1850 GNUNET_YES));
1851 }
1852 else
1853 {
1855 }
1856 // Connect to identity and namestore services
1858 if (NULL == nsh)
1859 {
1861 "error connecting to namestore");
1862 return GNUNET_SYSERR;
1863 }
1864 gns = GNUNET_GNS_connect (c);
1865 if (NULL == gns)
1866 {
1867 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns");
1868 return GNUNET_SYSERR;
1869 }
1870 stats = GNUNET_STATISTICS_create ("reclaim", c);
1871 return GNUNET_OK;
1872}
1873
1874
1879void
1881{
1882 if (NULL != nsh)
1884 nsh = NULL;
1885 if (NULL != gns)
1887 gns = NULL;
1888 if (NULL != stats)
1889 {
1891 stats = NULL;
1892 }
1893}
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_IDENTITY_Handle * id
Handle to IDENTITY.
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 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.
struct RECLAIM_TICKETS_ConsumeHandle * RECLAIM_TICKETS_consume(const struct GNUNET_CRYPTO_PrivateKey *id, const struct GNUNET_RECLAIM_Ticket *ticket, RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls)
Consume a ticket.
static void collect_tickets_finished_cb(void *cls)
Signal ticket iteration has finished.
static void lookup_authz_cb(void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
GNS result with attribute references.
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 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 minimim 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.
static void filter_tickets_error_cb(void *cls)
Namestore error on issue.
static struct GNUNET_NAMESTORE_Handle * nsh
void RECLAIM_TICKETS_issue(const struct GNUNET_CRYPTO_PrivateKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_CRYPTO_PublicKey *audience, 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 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.
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)
We found an attribute record.
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)
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
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.
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
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:551
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:602
@ 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.
enum GNUNET_GenericReturnValue GNUNET_RECLAIM_read_ticket_from_buffer(const void *buffer, size_t len, struct GNUNET_RECLAIM_Ticket *tkt, size_t *tb_read)
Deserializes a ticket.
Definition: reclaim_api.c:1752
ssize_t GNUNET_RECLAIM_write_ticket_to_buffer(const struct GNUNET_RECLAIM_Ticket *tkt, void *buffer, size_t len)
Serializes a ticket.
Definition: reclaim_api.c:1785
size_t GNUNET_RECLAIM_ticket_serialize_get_size(const struct GNUNET_RECLAIM_Ticket *tkt)
Get serialized ticket size.
Definition: reclaim_api.c:1742
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:981
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:1305
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:1278
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:764
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:436
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:570
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:484
#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
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.
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.
struct GNUNET_CRYPTO_PublicKey audience
The ticket audience (= relying party)
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_CRYPTO_PublicKey identity
The ticket issuer (= the user)
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.
struct GNUNET_GNS_LookupRequest * lookup_request
LookupRequest.
struct GNUNET_CRYPTO_PublicKey identity_pub
Audience Key.
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_CRYPTO_PrivateKey identity
Audience Key.
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.
struct GNUNET_CRYPTO_PrivateKey identity
Issuer Key.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
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.