GNUnet 0.21.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);
445 le->data,
446 le->rd_count,
447 rd))
448 {
450 "Unable to deserialize ticket record(s)\n");
451 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
452 cleanup_rvk (rvk);
453 return;
454 }
455 for (int i = 0; i < le->rd_count; i++)
456 {
458 continue;
459 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
460 {
461 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
462 continue;
463 rd[i].data = &ae->new_id;
464 }
465 }
467 &rvk->identity,
468 le->label,
469 le->rd_count,
470 rd,
472 rvk);
473 GNUNET_free (le->label);
474 GNUNET_free (le->data);
475 GNUNET_free (le);
476}
477
478
484static void
486{
487 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
488
489 rvk->ns_it = NULL;
491}
492
493
504static void
506 const struct GNUNET_CRYPTO_PrivateKey *zone,
507 const char *label,
508 unsigned int rd_count,
509 const struct GNUNET_GNSRECORD_Data *rd)
510{
511 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
512 struct TicketRecordsEntry *le;
513 struct RevokedAttributeEntry *ae;
514 int has_changed = GNUNET_NO;
515
517 for (int i = 0; i < rd_count; i++)
518 {
520 continue;
521 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
522 {
523 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
524 continue;
525 has_changed = GNUNET_YES;
526 break;
527 }
528 if (GNUNET_YES == has_changed)
529 break;
530 }
531 if (GNUNET_YES == has_changed)
532 {
533 le = GNUNET_new (struct TicketRecordsEntry);
535 le->data = GNUNET_malloc (le->data_size);
536 le->rd_count = rd_count;
537 le->label = GNUNET_strdup (label);
541 le);
542 }
544}
545
546
552static void
554{
555 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
556
557 rvk->ns_it = NULL;
558 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
559 cleanup_rvk (rvk);
560}
561
562
568static void
569rvk_ns_err (void *cls)
570{
571 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
572
573 rvk->ns_qe = NULL;
574 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
575 cleanup_rvk (rvk);
576}
577
578
587static void
589
590
596static void
598{
600}
601
602
611static void
613{
614 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
615
616 rvk->ns_qe = NULL;
617 if (GNUNET_EC_NONE != ec)
618 {
620 "Error removing attribute: %s\n",
622 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
623 cleanup_rvk (rvk);
624 return;
625 }
626 rvk->move_attr = rvk->move_attr->next;
628}
629
630
640static void
642{
643 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
644 char *label;
645
646 rvk->ns_qe = NULL;
647 if (GNUNET_EC_NONE != ec)
648 {
650 "Error moving attribute: %s\n",
652 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
653 cleanup_rvk (rvk);
654 return;
655 }
657 sizeof(rvk->move_attr->old_id));
658 GNUNET_assert (NULL != label);
659 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
661 &rvk->identity,
662 label,
663 0,
664 NULL,
666 rvk);
667 GNUNET_free (label);
668}
669
670
680static void
682 const struct GNUNET_CRYPTO_PrivateKey *zone,
683 const char *label,
684 unsigned int rd_count,
685 const struct GNUNET_GNSRECORD_Data *rd)
686{
687 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
688 struct GNUNET_GNSRECORD_Data new_rd[rd_count];
689 struct RevokedAttributeEntry *le;
690 char *new_label;
691 char *attr_data;
692
693 rvk->ns_qe = NULL;
694 if (0 == rd_count)
695 {
697 "The claim %s no longer exists!\n",
698 label);
699 le = rvk->move_attr;
700 rvk->move_attr = le->next;
702 GNUNET_free (le);
704 return;
705 }
707 new_label =
709 sizeof (rvk->move_attr->new_id));
710
711 attr_data = NULL;
712 // new_rd = *rd;
713 for (int i = 0; i < rd_count; i++)
714 {
715 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type)
716 {
720 rd[i].data_size,
721 &claim);
723 "Attribute to update: Name=%s\n",
724 claim->name);
725 claim->id = rvk->move_attr->new_id;
727 attr_data = GNUNET_malloc (rd[i].data_size);
729 attr_data);
730 new_rd[i].data = attr_data;
731 new_rd[i].record_type = rd[i].record_type;
732 new_rd[i].flags = rd[i].flags;
733 new_rd[i].expiration_time = rd[i].expiration_time;
734 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
736 }
737 else if (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL == rd[i].record_type)
738 {
741 rd[i].data_size);
743 "Credential to update: Name=%s\n",
744 credential->name);
745 credential->id = rvk->move_attr->new_id;
746 new_rd[i].data_size =
748 attr_data = GNUNET_malloc (rd[i].data_size);
750 attr_data);
751 new_rd[i].data = attr_data;
752 new_rd[i].record_type = rd[i].record_type;
753 new_rd[i].flags = rd[i].flags;
754 new_rd[i].expiration_time = rd[i].expiration_time;
755 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding credential %s\n",
756 new_label);
758 }
759 else
760 {
761 memcpy (&new_rd[i], &rd[i], sizeof (struct GNUNET_GNSRECORD_Data));
762 }
763 }
765 &rvk->identity,
766 new_label,
767 rd_count,
768 new_rd,
770 rvk);
771 GNUNET_free (new_label);
772 GNUNET_free (attr_data);
773}
774
775
776static void
778{
779 char *label;
780
781 if (NULL == rvk->move_attr)
782 {
783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n");
784 rvk->ns_it =
786 &rvk->identity,
788 rvk,
790 rvk,
792 rvk);
793 return;
794 }
796 sizeof (rvk->move_attr->old_id));
797 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label);
798
800 &rvk->identity,
801 label,
802 &rvk_ns_err,
803 rvk,
805 rvk);
806 GNUNET_free (label);
807}
808
809
821static void
823{
824 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
825
826 rvk->ns_qe = NULL;
827 if (GNUNET_EC_NONE != ec)
828 {
831 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
832 cleanup_rvk (rvk);
833 return;
834 }
835 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted ticket\n");
836 if (0 == rvk->ticket_attrs)
837 {
839 "No attributes to move... strange\n");
840 rvk->cb (rvk->cb_cls, GNUNET_OK);
841 cleanup_rvk (rvk);
842 return;
843 }
844 rvk->move_attr = rvk->attrs_head;
845 move_attrs (rvk);
846}
847
848
859static void
861 const struct GNUNET_CRYPTO_PrivateKey *zone,
862 const char *label,
863 unsigned int rd_count,
864 const struct GNUNET_GNSRECORD_Data *rd)
865
866{
867 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
868 struct RevokedAttributeEntry *le;
869
870 rvk->ns_qe = NULL;
875 for (int i = 0; i < rd_count; i++)
876 {
878 continue;
879 le = GNUNET_new (struct RevokedAttributeEntry);
880 le->old_id = *((struct GNUNET_RECLAIM_Identifier *) rd[i].data);
882 rvk->ticket_attrs++;
883 }
884
887 &rvk->identity,
888 label,
889 0,
890 NULL,
892 rvk);
893}
894
895
901static void
903{
904 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
905
906 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
907 cleanup_rvk (rvk);
908}
909
910
926 void *cb_cls)
927{
929 char *label;
930 char *tmp;
931
933 rvk->cb = cb;
934 rvk->cb_cls = cb_cls;
935 rvk->identity = *identity;
936 rvk->ticket = *ticket;
938 label = strtok (tmp, ".");
939 GNUNET_assert (NULL != label);
942 identity,
943 label,
945 rvk,
947 rvk);
948 GNUNET_free (tmp);
949 return rvk;
950}
951
952
958void
960{
961 GNUNET_assert (NULL != rh);
962 cleanup_rvk (rh);
963}
964
965
966/*******************************
967* Ticket consume
968*******************************/
969
975static void
977{
978 struct ParallelLookup *lu;
979
980 if (NULL != cth->lookup_request)
982 if (NULL != cth->kill_task)
984 while (NULL != (lu = cth->parallel_lookups_head))
985 {
986 if (NULL != lu->lookup_request)
988 GNUNET_free (lu->label);
991 lu);
992 GNUNET_free (lu);
993 }
994
995 if (NULL != cth->attrs)
997 if (NULL != cth->presentations)
999 GNUNET_free (cth);
1000}
1001
1002
1003static void
1005 uint32_t rd_count,
1006 const struct GNUNET_GNSRECORD_Data *rd)
1007{
1008 struct ParallelLookup *parallel_lookup = cls;
1009 struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
1010 struct GNUNET_RECLAIM_AttributeListEntry *attr_le;
1011 struct GNUNET_CRYPTO_PublicKey iss;
1012
1014 "Parallel lookup finished (count=%u)\n",
1015 rd_count);
1016
1019 parallel_lookup);
1020 GNUNET_free (parallel_lookup->label);
1021
1023 "attribute_lookup_time_total",
1025 parallel_lookup->lookup_start_time)
1026 .rel_value_us,
1027 GNUNET_YES);
1028 GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES);
1029
1030
1031 GNUNET_free (parallel_lookup);
1032 if (0 == rd_count)
1033 GNUNET_break (0);
1034 // REMARK: It is possible now to find rd_count > 1
1035 for (int i = 0; i < rd_count; i++)
1036 {
1037 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd[i].record_type)
1038 continue;
1041 &attr_le->attribute);
1043 cth->attrs->list_tail,
1044 attr_le);
1045 }
1046 if (NULL != cth->parallel_lookups_head)
1047 return; // Wait for more
1048 /* Else we are done */
1050 );
1051 cth->cb (cth->cb_cls, &iss,
1052 cth->attrs, cth->presentations, GNUNET_OK, NULL);
1053 cleanup_cth (cth);
1054}
1055
1056
1062static void
1064{
1065 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1066 struct ParallelLookup *lu;
1067 struct ParallelLookup *tmp;
1068
1069 cth->kill_task = NULL;
1070 for (lu = cth->parallel_lookups_head; NULL != lu;)
1071 {
1073 GNUNET_free (lu->label);
1074 tmp = lu->next;
1077 lu);
1078 GNUNET_free (lu);
1079 lu = tmp;
1080 }
1081 cth->cb (cth->cb_cls, NULL, NULL, NULL, GNUNET_SYSERR, "Aborted");
1082}
1083
1084
1085static void
1087 int is_gns,
1088 uint32_t rd_count,
1089 const struct GNUNET_GNSRECORD_Data *rd)
1090{
1091 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1092 struct GNUNET_CRYPTO_PublicKey iss;
1093 struct ParallelLookup *parallel_lookup;
1094 const char *rp_uri = NULL;
1095 char *lbl;
1097
1098 cth->lookup_request = NULL;
1099
1100 GNUNET_assert (GNUNET_YES == is_gns);
1102 "reclaim_authz_lookup_time_total",
1104 cth->lookup_start_time)
1105 .rel_value_us,
1106 GNUNET_YES);
1108 "reclaim_authz_lookups_count",
1109 1,
1110 GNUNET_YES);
1111
1113 == GNUNET_GNS_parse_ztld (cth->ticket.gns_name, &iss));
1114 for (int i = 0; i < rd_count; i++)
1115 {
1120 switch (rd[i].record_type)
1121 {
1123 rp_uri = rd[i].data;
1124 break;
1127 ale->presentation =
1129 rd[i].data_size);
1132 ale);
1133 break;
1136 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ticket reference found %s\n", lbl);
1137 parallel_lookup = GNUNET_new (struct ParallelLookup);
1138 parallel_lookup->handle = cth;
1139 parallel_lookup->label = lbl;
1140 parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get ();
1141 parallel_lookup->lookup_request =
1143 lbl,
1144 &iss,
1148 parallel_lookup);
1151 parallel_lookup);
1152 break;
1153 default:
1155 "Ignoring unknown record type %d", rd[i].record_type);
1156 }
1157 }
1158 if (NULL == rp_uri)
1159 {
1161 "RP URI not found along references, ignoring...\n");
1165 cth->cb (cth->cb_cls, &iss,
1166 cth->attrs, NULL, GNUNET_NO, NULL);
1167 cleanup_cth (cth);
1168 return;
1169 }
1170 if (0 != strcmp (rp_uri, cth->rp_uri))
1171 {
1173 "RP URI does not match consume request: `%s' != `%s'\n",
1174 rp_uri, cth->rp_uri);
1178 cth->cb (cth->cb_cls, &iss,
1179 cth->attrs, NULL, GNUNET_NO, NULL);
1180 cleanup_cth (cth);
1181 return;
1182 }
1187 if (NULL != cth->parallel_lookups_head)
1188 {
1192 cth);
1193 return;
1194 }
1198 cth->cb (cth->cb_cls, &iss,
1199 cth->attrs, NULL, GNUNET_OK, NULL);
1200 cleanup_cth (cth);
1201}
1202
1203
1217 const char *rp_uri,
1219 void *cb_cls)
1220{
1222
1224
1227 cth->ticket = *ticket;
1228 memcpy (cth->rp_uri, rp_uri, strlen (rp_uri) + 1);
1229 cth->cb = cb;
1230 cth->cb_cls = cb_cls;
1232 cth->lookup_request =
1238 cth);
1239 return cth;
1240}
1241
1242
1248void
1250{
1251 cleanup_cth (cth);
1252 return;
1253}
1254
1255
1256/*******************************
1257 * Ticket issue
1258 *******************************/
1259
1264static void
1266{
1267 if (NULL != handle->ns_qe)
1270}
1271
1272
1281static void
1283{
1284 struct TicketIssueHandle *handle = cls;
1285
1286 handle->ns_qe = NULL;
1287 if (GNUNET_EC_NONE != ec)
1288 {
1289 handle->cb (handle->cb_cls,
1290 &handle->ticket,
1291 NULL,
1293 "Error storing AuthZ ticket in GNS");
1294 return;
1295 }
1296 handle->cb (handle->cb_cls,
1297 &handle->ticket,
1298 handle->presentations,
1299 GNUNET_OK, NULL);
1301}
1302
1303
1311static void
1313{
1316 struct GNUNET_GNSRECORD_Data *attrs_record;
1317 char *label;
1318 char *tkt_data;
1319 int i;
1320 int j;
1321 int attrs_count = 0;
1322
1323 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1324 attrs_count++;
1325
1326 // Worst case we have one presentation per attribute plus the ticket
1327 // plus the RP URI record
1328 attrs_record =
1329 GNUNET_malloc ((2 * attrs_count + 2) * sizeof(struct GNUNET_GNSRECORD_Data))
1330 ;
1331 i = 0;
1332 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1333 {
1335 "Adding list entry: %s\n", le->attribute->name);
1336
1337 attrs_record[i].data = &le->attribute->id;
1338 attrs_record[i].data_size = sizeof(le->attribute->id);
1342 i++;
1344 {
1346 "Attribute is backed by credential. Adding...\n");
1347 struct GNUNET_RECLAIM_Presentation *presentation = NULL;
1348 for (j = 0; j < i; j++)
1349 {
1350 if (attrs_record[j].record_type
1352 continue;
1354 attrs_record[j].data,
1355 attrs_record[j].
1356 data_size);
1357 if (NULL == presentation)
1358 {
1360 "Failed to deserialize presentation\n");
1361 continue;
1362 }
1363 if (0 == memcmp (&presentation->credential_id,
1364 &le->attribute->credential,
1365 sizeof (le->attribute->credential)))
1366 break;
1367 GNUNET_free (presentation);
1368 presentation = NULL;
1369 }
1370 if (NULL != presentation)
1371 {
1372 GNUNET_free (presentation);
1373 continue; // Skip as we have already added this credential presentation.
1374 }
1375 for (ple = ih->presentations->list_head; NULL != ple; ple = ple->next)
1376 {
1378 "Checking presentation....\n");
1379
1380 if (0 != memcmp (&le->attribute->credential,
1382 sizeof (le->attribute->credential)))
1383 {
1385 "Presentation does not match credential ID.\n");
1386 continue;
1387 }
1388 char *pres_buf;
1389 size_t pres_size;
1390
1391 pres_size =
1393 pres_buf = GNUNET_malloc (pres_size);
1395 pres_buf);
1396 attrs_record[i].data = pres_buf;
1397 attrs_record[i].data_size = pres_size;
1398 attrs_record[i].expiration_time =
1400 attrs_record[i].record_type =
1403 i++;
1404 break;
1405 }
1406 }
1407 }
1408
1409 label =
1411 sizeof(ih->rnd));
1414 &pub);
1417 "Storing AuthZ information under %s in %s\n", label, str);
1418 sprintf (ih->ticket.gns_name, "%s.%s", label, str);
1419 GNUNET_free (str);
1420
1421 attrs_record[i].data_size =
1422 strlen (ih->ticket.gns_name) + 1;
1423 tkt_data = GNUNET_malloc (attrs_record[i].data_size);
1424 memcpy (tkt_data, &ih->ticket, attrs_record[i].data_size);
1425 // The ticket: Could be removed?
1426 attrs_record[i].data = tkt_data;
1429 attrs_record[i].flags =
1431 i++;
1432 // The RP URI
1433 attrs_record[i].data_size = strlen (ih->rp_uri);
1434 attrs_record[i].data = ih->rp_uri;
1436 attrs_record[i].record_type = GNUNET_DNSPARSER_TYPE_TXT;
1437 attrs_record[i].flags =
1439 i++;
1440
1441 // Publish record
1443 &ih->identity,
1444 label,
1445 i,
1446 attrs_record,
1448 ih);
1449 for (j = 0; j < i; j++)
1450 {
1451 if (attrs_record[j].record_type
1453 continue;
1454 // Yes, we are allowed to do this because we allocated it above
1455 char *ptr = (char*) attrs_record[j].data;
1456 GNUNET_free (ptr);
1457 }
1458 GNUNET_free (tkt_data);
1459 GNUNET_free (attrs_record);
1460 GNUNET_free (label);
1461}
1462
1463
1464/*************************************************
1465 * Ticket iteration (finding a specific ticket)
1466 *************************************************/
1467
1468
1474static void
1476{
1477 struct TicketIssueHandle *tih = cls;
1478
1479 tih->ns_it = NULL;
1480 tih->cb (tih->cb_cls,
1481 &tih->ticket,
1482 NULL,
1484 "Error storing AuthZ ticket in GNS");
1486}
1487
1488
1501static void
1503 const struct GNUNET_CRYPTO_PrivateKey *zone,
1504 const char *label,
1505 unsigned int rd_count,
1506 const struct GNUNET_GNSRECORD_Data *rd)
1507{
1508 struct TicketIssueHandle *tih = cls;
1510 struct GNUNET_RECLAIM_Presentation *presentation;
1511 struct GNUNET_RECLAIM_PresentationList *ticket_presentations;
1512 struct GNUNET_RECLAIM_Credential *cred;
1515 unsigned int attr_cnt = 0;
1516 unsigned int pres_cnt = 0;
1517 int ticket_found = GNUNET_NO;
1518 int rp_uri_matches = GNUNET_NO;
1519
1520 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1521 {
1522 attr_cnt++;
1524 pres_cnt++;
1525 }
1526
1527 // ticket search
1528 unsigned int found_attrs_cnt = 0;
1529 unsigned int found_pres_cnt = 0;
1530 ticket_presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList);
1531
1532 for (int i = 0; i < rd_count; i++)
1533 {
1534 // found ticket
1535 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET == rd[i].record_type)
1536 {
1537 ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1538 tih->ticket = *ticket;
1539 ticket_found = GNUNET_YES;
1540 }
1541 if (GNUNET_DNSPARSER_TYPE_TXT == rd[i].record_type)
1542 {
1543 // cmp audience
1544 if (0 != strncmp (tih->rp_uri,
1545 rd[i].data,
1546 rd[i].data_size))
1547 continue;
1548 rp_uri_matches = GNUNET_YES;
1549 }
1550 // cmp requested attributes with ticket attributes
1551 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1552 {
1553 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1554 {
1556 &le->attribute->id))
1557 found_attrs_cnt++;
1558 }
1559 }
1560 if (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL == rd[i].record_type)
1561 {
1563 "Found credential...\n");
1564
1565 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1566 {
1568 rd[i].data_size);
1570 &le->attribute->credential
1571 ))
1572 {
1574 "No match.\n");
1575 GNUNET_free (cred);
1576 continue;
1577 }
1579 "Match, creating presentation...\n");
1581 cred,
1582 tih->attrs,
1583 &presentation))
1584 {
1586 "Unable to retrieve presentation from credential\n");
1587 GNUNET_free (cred);
1588 continue;
1589 }
1591 ple->presentation = presentation;
1594 ple);
1595 GNUNET_free (cred);
1596 break;
1597 }
1598 }
1599 if (GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION == rd[i].record_type)
1600 {
1601 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1602 {
1604 rd[i].data_size)
1605 ;
1606 if (NULL == presentation)
1607 {
1609 "Failed to deserialize presentation\n");
1610 continue;
1611 }
1613 &presentation->credential_id,
1614 &le->attribute->credential))
1615 {
1616 found_pres_cnt++;
1618 ple->presentation = presentation;
1619 GNUNET_CONTAINER_DLL_insert (ticket_presentations->list_head,
1620 ticket_presentations->list_tail,
1621 ple);
1622 }
1623 }
1624 }
1625 }
1626
1631 if ((attr_cnt == found_attrs_cnt) &&
1632 (pres_cnt == found_pres_cnt) &&
1633 (GNUNET_YES == ticket_found) &&
1634 (GNUNET_YES == rp_uri_matches))
1635 {
1637 tih->cb (tih->cb_cls, &tih->ticket, ticket_presentations, GNUNET_OK, NULL);
1638 GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations);
1640 return;
1641 }
1642 GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations);
1643 // ticket not found in current record, checking next record set
1645}
1646
1647
1655static void
1657{
1658 struct TicketIssueHandle *tih = cls;
1659
1661 issue_ticket (tih);
1662}
1663
1664
1676void
1678 const struct GNUNET_RECLAIM_AttributeList *attrs,
1679 const char *rp,
1681 void *cb_cls)
1682{
1683 struct TicketIssueHandle *tih;
1684
1685 tih = GNUNET_new (struct TicketIssueHandle);
1686 tih->cb = cb;
1687 tih->cb_cls = cb_cls;
1690 tih->identity = *identity;
1691 memcpy (tih->rp_uri, rp, strlen (rp) + 1);
1692
1693 // First check whether the ticket has already been issued
1694 tih->ns_it =
1696 &tih->identity,
1698 tih,
1700 tih,
1702 tih);
1703}
1704
1705
1706/************************************
1707 * Ticket iteration
1708 ************************************/
1709
1715static void
1717{
1718 if (NULL != iter->ns_it)
1720 GNUNET_free (iter);
1721}
1722
1723
1735static void
1737 const struct GNUNET_CRYPTO_PrivateKey *zone,
1738 const char *label,
1739 unsigned int rd_count,
1740 const struct GNUNET_GNSRECORD_Data *rd)
1741{
1742 struct RECLAIM_TICKETS_Iterator *iter = cls;
1744 int ticket_found = GNUNET_NO;
1745 const char *rp_uri = NULL;
1746
1747 for (int i = 0; i < rd_count; i++)
1748 {
1749 if (GNUNET_DNSPARSER_TYPE_TXT == rd[i].record_type)
1750 rp_uri = rd[i].data;
1751 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET != rd[i].record_type)
1752 continue;
1753 if ((GNUNET_YES == ticket_found) && (NULL != rp_uri))
1754 break;
1755 ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1756 ticket_found = GNUNET_YES;
1757 }
1758 if ((GNUNET_YES == ticket_found) && (NULL != rp_uri))
1759 iter->cb (iter->cb_cls, ticket, rp_uri);
1761}
1762
1763
1769static void
1771{
1772 struct RECLAIM_TICKETS_Iterator *iter = cls;
1773
1774 iter->ns_it = NULL;
1775 iter->cb (iter->cb_cls, NULL, NULL);
1776 cleanup_iter (iter);
1777}
1778
1779
1785static void
1787{
1788 struct RECLAIM_TICKETS_Iterator *iter = cls;
1789
1790 iter->ns_it = NULL;
1791 iter->cb (iter->cb_cls, NULL, NULL);
1792 cleanup_iter (iter);
1793}
1794
1795
1801void
1803{
1805}
1806
1807
1813void
1815{
1817 cleanup_iter (iter);
1818}
1819
1820
1831 const struct GNUNET_CRYPTO_PrivateKey *identity,
1833 void *cb_cls)
1834{
1835 struct RECLAIM_TICKETS_Iterator *iter;
1836
1837 iter = GNUNET_new (struct RECLAIM_TICKETS_Iterator);
1838 iter->cb = cb;
1839 iter->cb_cls = cb_cls;
1840 iter->ns_it =
1842 identity,
1844 iter,
1846 iter,
1848 iter);
1849 return iter;
1850}
1851
1852
1859int
1861{
1862 // Get ticket expiration time (relative) from config
1863 if (GNUNET_OK ==
1865 "reclaim",
1866 "TICKET_REFRESH_INTERVAL",
1868 {
1870 "Configured refresh interval for tickets: %s\n",
1872 GNUNET_YES));
1873 }
1874 else
1875 {
1877 }
1878 // Connect to identity and namestore services
1880 if (NULL == nsh)
1881 {
1883 "error connecting to namestore");
1884 return GNUNET_SYSERR;
1885 }
1886 gns = GNUNET_GNS_connect (c);
1887 if (NULL == gns)
1888 {
1889 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns");
1890 return GNUNET_SYSERR;
1891 }
1892 stats = GNUNET_STATISTICS_create ("reclaim", c);
1893 return GNUNET_OK;
1894}
1895
1896
1901void
1903{
1904 if (NULL != nsh)
1906 nsh = NULL;
1907 if (NULL != gns)
1909 gns = NULL;
1910 if (NULL != stats)
1911 {
1913 stats = NULL;
1914 }
1915}
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:394
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:445
@ 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: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
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.
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.