GNUnet  0.11.x
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 
27 #include <inttypes.h>
29 
30 
35 #define DEFAULT_TICKET_REFRESH_INTERVAL GNUNET_TIME_UNIT_HOURS
36 
41 struct ParallelLookup;
42 
43 
48 {
53 
58 
63 
68 };
69 
70 
75 {
79  struct GNUNET_RECLAIM_Ticket ticket;
80 
85 
90 
94  struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub;
95 
100 
105 
110 
115 
120 
124  struct GNUNET_TIME_Absolute lookup_start_time;
125 
130 
134  void *cb_cls;
135 };
136 
137 
142 {
143  /* DLL */
145 
146  /* DLL */
148 
149  /* The GNS request */
151 
152  /* The handle the return to */
154 
158  struct GNUNET_TIME_Absolute lookup_start_time;
159 
160  /* The label to look up */
161  char *label;
162 };
163 
164 
169 {
174 
179 
183  struct GNUNET_RECLAIM_Ticket ticket;
184 
189 
194 
199 
203  void *cb_cls;
204 };
205 
206 
211 {
216 
221 
225  void *cb_cls;
226 };
227 
228 
230 {
235 
240 
245 
250 };
251 
252 
257 {
262 
267 
271  void *cb_cls;
272 
276  struct GNUNET_RECLAIM_Ticket ticket;
277 
282 
287 
292 
297 
302 
306  unsigned int ticket_attrs;
307 
312 
317 };
318 
319 
324 
325 
326 /* Namestore handle */
328 
329 
330 /* GNS handle */
331 static struct GNUNET_GNS_Handle *gns;
332 
333 
334 /* Handle to the statistics service */
336 
337 
343 static void
345 {
346  struct RevokedAttributeEntry *ae;
347  struct TicketRecordsEntry *le;
348 
349  if (NULL != rh->ns_qe)
351  if (NULL != rh->ns_it)
353  while (NULL != (ae = rh->attrs_head))
354  {
356  GNUNET_free (ae);
357  }
358  while (NULL != (le = rh->tickets_to_update_head))
359  {
362  le);
363  if (NULL != le->data)
364  GNUNET_free (le->data);
365  if (NULL != le->label)
366  GNUNET_free (le->label);
367  GNUNET_free (le);
368  }
369  GNUNET_free (rh);
370 }
371 
372 
379 static void
380 process_tickets (void *cls);
381 
382 
391 static void
392 ticket_processed (void *cls, int32_t success, const char *emsg)
393 {
394  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
395 
396  rvk->ns_qe = NULL;
398 }
399 
400 
406 static void
407 process_tickets (void *cls)
408 {
409  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
410  struct TicketRecordsEntry *le;
411  struct RevokedAttributeEntry *ae;
412 
413  if (NULL == rvk->tickets_to_update_head)
414  {
416  "Finished updatding tickets, success\n");
417  rvk->cb (rvk->cb_cls, GNUNET_OK);
418  cleanup_rvk (rvk);
419  return;
420  }
421  le = rvk->tickets_to_update_head;
424  le);
425  struct GNUNET_GNSRECORD_Data rd[le->rd_count];
427  le->data,
428  le->rd_count,
429  rd))
430  {
432  "Unable to deserialize ticket record(s)\n");
433  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
434  cleanup_rvk (rvk);
435  return;
436  }
437  for (int i = 0; i < le->rd_count; i++)
438  {
440  continue;
441  for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
442  {
443  if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
444  continue;
445  rd[i].data = &ae->new_id;
446  }
447  }
449  &rvk->identity,
450  le->label,
451  le->rd_count,
452  rd,
454  rvk);
455  GNUNET_free (le->label);
456  GNUNET_free (le->data);
457  GNUNET_free (le);
458 }
459 
460 
466 static void
468 {
469  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
470 
471  rvk->ns_it = NULL;
473 }
474 
475 
486 static void
487 rvk_ticket_update (void *cls,
488  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
489  const char *label,
490  unsigned int rd_count,
491  const struct GNUNET_GNSRECORD_Data *rd)
492 {
493  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
494  struct TicketRecordsEntry *le;
495  struct RevokedAttributeEntry *ae;
496  int has_changed = GNUNET_NO;
497 
499  for (int i = 0; i < rd_count; i++)
500  {
501  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
502  continue;
503  for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
504  {
505  if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
506  continue;
507  has_changed = GNUNET_YES;
508  break;
509  }
510  if (GNUNET_YES == has_changed)
511  break;
512  }
513  if (GNUNET_YES == has_changed)
514  {
515  le = GNUNET_new (struct TicketRecordsEntry);
516  le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
517  le->data = GNUNET_malloc (le->data_size);
518  le->rd_count = rd_count;
519  le->label = GNUNET_strdup (label);
520  GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
523  le);
524  }
526 }
527 
528 
534 static void
535 rvk_ns_iter_err (void *cls)
536 {
537  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
538 
539  rvk->ns_it = NULL;
540  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
541  cleanup_rvk (rvk);
542 }
543 
544 
550 static void
551 rvk_ns_err (void *cls)
552 {
553  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
554 
555  rvk->ns_qe = NULL;
556  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
557  cleanup_rvk (rvk);
558 }
559 
560 
570 static void
572 
573 
579 static void
580 move_attrs_cont (void *cls)
581 {
582  move_attrs ((struct RECLAIM_TICKETS_RevokeHandle *) cls);
583 }
584 
585 
594 static void
595 del_attr_finished (void *cls, int32_t success, const char *emsg)
596 {
597  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
598 
599  rvk->ns_qe = NULL;
600  if (GNUNET_SYSERR == success)
601  {
603  "Error removing attribute: %s\n",
604  emsg);
605  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
606  cleanup_rvk (rvk);
607  return;
608  }
609  rvk->move_attr = rvk->move_attr->next;
611 }
612 
613 
623 static void
624 move_attr_finished (void *cls, int32_t success, const char *emsg)
625 {
626  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
627  char *label;
628 
629  rvk->ns_qe = NULL;
630  if (GNUNET_SYSERR == success)
631  {
632  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error moving attribute: %s\n", emsg);
633  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
634  cleanup_rvk (rvk);
635  return;
636  }
638  sizeof(rvk->move_attr->old_id));
639  GNUNET_assert (NULL != label);
640  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
642  &rvk->identity,
643  label,
644  0,
645  NULL,
647  rvk);
648  GNUNET_free (label);
649 }
650 
651 
661 static void
662 rvk_move_attr_cb (void *cls,
663  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
664  const char *label,
665  unsigned int rd_count,
666  const struct GNUNET_GNSRECORD_Data *rd)
667 {
668  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
669  struct GNUNET_GNSRECORD_Data new_rd[rd_count];
670  struct RevokedAttributeEntry *le;
671  char *new_label;
672  char *attr_data;
673 
674  rvk->ns_qe = NULL;
675  if (0 == rd_count)
676  {
678  "The claim %s no longer exists!\n",
679  label);
680  le = rvk->move_attr;
681  rvk->move_attr = le->next;
683  GNUNET_free (le);
685  return;
686  }
688  new_label = NULL;
689  attr_data = NULL;
690  // new_rd = *rd;
691  for (int i = 0; i < rd_count; i++)
692  {
693  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type)
694  {
698  rd[i].data_size);
700  "Attribute to update: Name=%s\n",
701  claim->name);
702  claim->id = rvk->move_attr->new_id;
704  attr_data = GNUNET_malloc (rd[i].data_size);
706  attr_data);
707  new_rd[i].data = attr_data;
708  new_rd[i].record_type = rd[i].record_type;
709  new_rd[i].flags = rd[i].flags;
710  new_rd[i].expiration_time = rd[i].expiration_time;
711  new_label =
713  sizeof (rvk->move_attr->new_id));
714  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
715  GNUNET_free (claim);
716  }
717  else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION == rd[i].record_type)
718  {
719  struct GNUNET_RECLAIM_Attestation *attest;
721  rd[i].data_size);
723  "Attestation to update: Name=%s\n",
724  attest->name);
725  attest->id = rvk->move_attr->new_id;
726  new_rd[i].data_size =
728  attr_data = GNUNET_malloc (rd[i].data_size);
730  attr_data);
731  new_rd[i].data = attr_data;
732  new_rd[i].record_type = rd[i].record_type;
733  new_rd[i].flags = rd[i].flags;
734  new_rd[i].expiration_time = rd[i].expiration_time;
735  new_label =
737  sizeof (rvk->move_attr->new_id));
738  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation %s\n",
739  new_label);
740  GNUNET_free (attest);
741  }
742  }
744  &rvk->identity,
745  new_label,
746  rd_count,
747  new_rd,
749  rvk);
750  GNUNET_free (new_label);
751  GNUNET_free (attr_data);
752 }
753 
754 
763 static void
765 {
766  char *label;
767 
768  if (NULL == rvk->move_attr)
769  {
770  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n");
771  rvk->ns_it =
773  &rvk->identity,
775  rvk,
777  rvk,
779  rvk);
780  return;
781  }
783  sizeof (rvk->move_attr->old_id));
784  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label);
785 
787  &rvk->identity,
788  label,
789  &rvk_ns_err,
790  rvk,
792  rvk);
793  GNUNET_free (label);
794 }
795 
796 
808 static void
809 remove_ticket_cont (void *cls, int32_t success, const char *emsg)
810 {
811  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
812 
813  rvk->ns_qe = NULL;
814  if (GNUNET_SYSERR == success)
815  {
816  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg);
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 
845 static void
846 revoke_attrs_cb (void *cls,
847  const struct GNUNET_CRYPTO_EcdsaPrivateKey *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  {
863  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
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 
887 static void
888 rvk_attrs_err_cb (void *cls)
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 {
914  struct RECLAIM_TICKETS_RevokeHandle *rvk;
915  char *label;
916 
918  rvk->cb = cb;
919  rvk->cb_cls = cb_cls;
920  rvk->identity = *identity;
921  rvk->ticket = *ticket;
924  label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
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 
944 void
946 {
947  GNUNET_assert (NULL != rh);
948  cleanup_rvk (rh);
949 }
950 
951 
952 /*******************************
953 * Ticket consume
954 *******************************/
955 
961 static 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->attests)
985  GNUNET_free (cth);
986 }
987 
988 
996 static 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 
1010  cth->parallel_lookups_tail,
1011  parallel_lookup);
1012  GNUNET_free (parallel_lookup->label);
1013 
1014  GNUNET_STATISTICS_update (stats,
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  {
1031  attr_le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
1032  attr_le->attribute =
1035  cth->attrs->list_tail,
1036  attr_le);
1037  }
1038  else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION == rd[i].record_type)
1039  {
1042  ale->attestation =
1044  rd[i].data_size);
1046  cth->attests->list_tail,
1047  ale);
1048  }
1049  else
1050  {
1052  "Parallel Lookup of Reference without Attestation");
1053  continue;
1054  }
1055 
1056 
1057  }
1058  if (NULL != cth->parallel_lookups_head)
1059  return; // Wait for more
1060  /* Else we are done */
1061  cth->cb (cth->cb_cls, &cth->ticket.identity,
1062  cth->attrs, cth->attests, GNUNET_OK, NULL);
1063  cleanup_cth (cth);
1064 }
1065 
1066 
1072 static void
1074 {
1075  struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1076  struct ParallelLookup *lu;
1077  struct ParallelLookup *tmp;
1078 
1079  cth->kill_task = NULL;
1080  for (lu = cth->parallel_lookups_head; NULL != lu;)
1081  {
1083  GNUNET_free (lu->label);
1084  tmp = lu->next;
1086  cth->parallel_lookups_tail,
1087  lu);
1088  GNUNET_free (lu);
1089  lu = tmp;
1090  }
1091  cth->cb (cth->cb_cls, NULL, NULL, NULL, GNUNET_SYSERR, "Aborted");
1092 }
1093 
1094 
1104 static void
1105 lookup_authz_cb (void *cls,
1106  uint32_t rd_count,
1107  const struct GNUNET_GNSRECORD_Data *rd)
1108 {
1109  struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1110  struct ParallelLookup *parallel_lookup;
1111  char *lbl;
1112 
1113  cth->lookup_request = NULL;
1114 
1115  GNUNET_STATISTICS_update (stats,
1116  "reclaim_authz_lookup_time_total",
1118  cth->lookup_start_time)
1119  .rel_value_us,
1120  GNUNET_YES);
1121  GNUNET_STATISTICS_update (stats,
1122  "reclaim_authz_lookups_count",
1123  1,
1124  GNUNET_YES);
1125 
1126  for (int i = 0; i < rd_count; i++)
1127  {
1128  if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type) &&
1129  (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF != rd[i].record_type))
1130  continue;
1131  lbl = GNUNET_STRINGS_data_to_string_alloc (rd[i].data, rd[i].data_size);
1132  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ticket reference found %s\n", lbl);
1133  parallel_lookup = GNUNET_new (struct ParallelLookup);
1134  parallel_lookup->handle = cth;
1135  parallel_lookup->label = lbl;
1136  parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get ();
1137  parallel_lookup->lookup_request =
1138  GNUNET_GNS_lookup (gns,
1139  lbl,
1140  &cth->ticket.identity,
1144  parallel_lookup);
1146  cth->parallel_lookups_tail,
1147  parallel_lookup);
1148  }
1153  if (NULL != cth->parallel_lookups_head)
1154  {
1158  cth);
1159  return;
1160  }
1164  cth->cb (cth->cb_cls, &cth->ticket.identity,
1165  cth->attrs, cth->attests, GNUNET_OK, NULL);
1166  cleanup_cth (cth);
1167 }
1168 
1169 
1183  const struct GNUNET_RECLAIM_Ticket *ticket,
1185  void *cb_cls)
1186 {
1187  struct RECLAIM_TICKETS_ConsumeHandle *cth;
1188  char *label;
1189 
1191 
1192  cth->identity = *id;
1196  cth->ticket = *ticket;
1197  cth->cb = cb;
1198  cth->cb_cls = cb_cls;
1199  label =
1201  sizeof(cth->ticket.rnd));
1203  "Looking for AuthZ info under %s\n",
1204  label);
1206  cth->lookup_request =
1207  GNUNET_GNS_lookup (gns,
1208  label,
1209  &cth->ticket.identity,
1212  &lookup_authz_cb,
1213  cth);
1214  GNUNET_free (label);
1215  return cth;
1216 }
1217 
1218 
1224 void
1226 {
1227  cleanup_cth (cth);
1228  return;
1229 }
1230 
1231 
1232 /*******************************
1233 * Ticket issue
1234 *******************************/
1235 
1240 static void
1242 {
1243  if (NULL != handle->ns_qe)
1244  GNUNET_NAMESTORE_cancel (handle->ns_qe);
1245  GNUNET_free (handle);
1246 }
1247 
1248 
1257 static void
1258 store_ticket_issue_cont (void *cls, int32_t success, const char *emsg)
1259 {
1260  struct TicketIssueHandle *handle = cls;
1261 
1262  handle->ns_qe = NULL;
1263  if (GNUNET_SYSERR == success)
1264  {
1265  handle->cb (handle->cb_cls,
1266  &handle->ticket,
1267  GNUNET_SYSERR,
1268  "Error storing AuthZ ticket in GNS");
1269  return;
1270  }
1271  handle->cb (handle->cb_cls, &handle->ticket, GNUNET_OK, NULL);
1272  cleanup_issue_handle (handle);
1273 }
1274 
1275 
1283 static void
1285 {
1287  struct GNUNET_GNSRECORD_Data *attrs_record;
1288  char *label;
1289  int i;
1290  int attrs_count = 0;
1291 
1292  for (le = ih->attrs->list_head; NULL != le; le = le->next)
1293  attrs_count++;
1294 
1295  //Worst case we have one attestation per attribute
1296  attrs_record =
1297  GNUNET_malloc (2 * attrs_count * sizeof(struct GNUNET_GNSRECORD_Data));
1298  i = 0;
1299  for (le = ih->attrs->list_head; NULL != le; le = le->next)
1300  {
1301  attrs_record[i].data = &le->attribute->id;
1302  attrs_record[i].data_size = sizeof(le->attribute->id);
1306  i++;
1308  {
1309  int j;
1310  for (j = 0; j < i; j++)
1311  {
1312  if (attrs_record[j].record_type
1314  continue;
1315  if (0 == memcmp (attrs_record[j].data,
1316  &le->attribute->attestation,
1317  sizeof (le->attribute->attestation)))
1318  break;
1319  }
1320  if (j < i)
1321  continue; // Skip as we have already added this attestation.
1322  attrs_record[i].data = &le->attribute->attestation;
1323  attrs_record[i].data_size = sizeof(le->attribute->attestation);
1325  attrs_record[i].record_type =
1328  i++;
1329  }
1330  }
1331  attrs_record[i].data = &ih->ticket;
1332  attrs_record[i].data_size = sizeof(struct GNUNET_RECLAIM_Ticket);
1335  attrs_record[i].flags =
1337  i++;
1338 
1339  label =
1341  sizeof(ih->ticket.rnd));
1342  // Publish record
1344  &ih->identity,
1345  label,
1346  i,
1347  attrs_record,
1349  ih);
1350  GNUNET_free (attrs_record);
1351  GNUNET_free (label);
1352 }
1353 
1354 
1355 /*************************************************
1356 * Ticket iteration (finding a specific ticket)
1357 *************************************************/
1358 
1359 
1365 static void
1367 {
1368  struct TicketIssueHandle *tih = cls;
1369 
1370  tih->ns_it = NULL;
1371  tih->cb (tih->cb_cls,
1372  &tih->ticket,
1373  GNUNET_SYSERR,
1374  "Error storing AuthZ ticket in GNS");
1375  cleanup_issue_handle (tih);
1376 }
1377 
1378 
1391 static void
1393  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1394  const char *label,
1395  unsigned int rd_count,
1396  const struct GNUNET_GNSRECORD_Data *rd)
1397 {
1398  struct TicketIssueHandle *tih = cls;
1399  struct GNUNET_RECLAIM_Ticket *ticket = NULL;
1400 
1401  // figure out the number of requested attributes
1403  unsigned int attr_cnt = 0;
1404  unsigned int attest_cnt = 0;
1405 
1406  for (le = tih->attrs->list_head; NULL != le; le = le->next)
1407  {
1408  attr_cnt++;
1410  attest_cnt++;
1411  }
1412 
1413  // ticket search
1414  unsigned int found_attrs_cnt = 0;
1415  unsigned int found_attests_cnt = 0;
1416 
1417  for (int i = 0; i < rd_count; i++)
1418  {
1419  // found ticket
1420  if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET == rd[i].record_type)
1421  {
1422  ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1423  // cmp audience
1424  if (0 == memcmp (&tih->ticket.audience,
1425  &ticket->audience,
1426  sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
1427  {
1428  tih->ticket = *ticket;
1429  continue;
1430  }
1431  ticket = NULL;
1432  }
1433 
1434  // cmp requested attributes with ticket attributes
1435  if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type) &&
1437  continue;
1438  for (le = tih->attrs->list_head; NULL != le; le = le->next)
1439  {
1441  &le->attribute->id))
1442  found_attrs_cnt++;
1443  }
1444  for (le = tih->attrs->list_head; NULL != le; le = le->next)
1445  {
1447  &le->attribute->attestation))
1448  found_attests_cnt++;
1449  }
1450  }
1451 
1456  if ((attr_cnt == found_attrs_cnt) &&
1457  (attest_cnt == found_attests_cnt) &&
1458  (NULL != ticket))
1459  {
1461  tih->cb (tih->cb_cls, &tih->ticket, GNUNET_OK, NULL);
1462  cleanup_issue_handle (tih);
1463  return;
1464  }
1465 
1466  // ticket not found in current record, checking next record set
1468 }
1469 
1470 
1478 static void
1480 {
1481  struct TicketIssueHandle *tih = cls;
1482 
1485  issue_ticket (tih);
1486 }
1487 
1488 
1500 void
1502  const struct GNUNET_RECLAIM_AttributeList *attrs,
1503  const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
1505  void *cb_cls)
1506 {
1507  struct TicketIssueHandle *tih;
1508 
1509  tih = GNUNET_new (struct TicketIssueHandle);
1510  tih->cb = cb;
1511  tih->cb_cls = cb_cls;
1513  tih->identity = *identity;
1514  tih->ticket.audience = *audience;
1515 
1516  // First check whether the ticket has already been issued
1517  tih->ns_it =
1519  &tih->identity,
1521  tih,
1523  tih,
1525  tih);
1526 }
1527 
1528 
1529 /************************************
1530 * Ticket iteration
1531 ************************************/
1532 
1538 static void
1540 {
1541  if (NULL != iter->ns_it)
1543  GNUNET_free (iter);
1544 }
1545 
1546 
1558 static void
1560  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1561  const char *label,
1562  unsigned int rd_count,
1563  const struct GNUNET_GNSRECORD_Data *rd)
1564 {
1565  struct RECLAIM_TICKETS_Iterator *iter = cls;
1566 
1567  for (int i = 0; i < rd_count; i++)
1568  {
1569  if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET != rd[i].record_type)
1570  continue;
1571  iter->cb (iter->cb_cls, (struct GNUNET_RECLAIM_Ticket *) rd[i].data);
1572  return;
1573  }
1575 }
1576 
1577 
1583 static void
1585 {
1586  struct RECLAIM_TICKETS_Iterator *iter = cls;
1587 
1588  iter->ns_it = NULL;
1589  iter->cb (iter->cb_cls, NULL);
1590  cleanup_iter (iter);
1591 }
1592 
1593 
1599 static void
1601 {
1602  struct RECLAIM_TICKETS_Iterator *iter = cls;
1603 
1604  iter->ns_it = NULL;
1605  iter->cb (iter->cb_cls, NULL);
1606  cleanup_iter (iter);
1607 }
1608 
1609 
1615 void
1617 {
1619 }
1620 
1621 
1627 void
1629 {
1631  cleanup_iter (iter);
1632 }
1633 
1634 
1643 struct RECLAIM_TICKETS_Iterator *
1647  void *cb_cls)
1648 {
1649  struct RECLAIM_TICKETS_Iterator *iter;
1650 
1651  iter = GNUNET_new (struct RECLAIM_TICKETS_Iterator);
1652  iter->cb = cb;
1653  iter->cb_cls = cb_cls;
1654  iter->ns_it =
1656  identity,
1658  iter,
1660  iter,
1662  iter);
1663  return iter;
1664 }
1665 
1666 
1673 int
1675 {
1676  // Get ticket expiration time (relative) from config
1677  if (GNUNET_OK ==
1679  "reclaim",
1680  "TICKET_REFRESH_INTERVAL",
1682  {
1684  "Configured refresh interval for tickets: %s\n",
1686  GNUNET_YES));
1687  }
1688  else
1689  {
1691  }
1692  // Connect to identity and namestore services
1693  nsh = GNUNET_NAMESTORE_connect (c);
1694  if (NULL == nsh)
1695  {
1697  "error connecting to namestore");
1698  return GNUNET_SYSERR;
1699  }
1700  gns = GNUNET_GNS_connect (c);
1701  if (NULL == gns)
1702  {
1703  GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns");
1704  return GNUNET_SYSERR;
1705  }
1706  stats = GNUNET_STATISTICS_create ("reclaim", c);
1707  return GNUNET_OK;
1708 }
1709 
1710 
1715 void
1717 {
1718  if (NULL != nsh)
1720  nsh = NULL;
1721  if (NULL != gns)
1722  GNUNET_GNS_disconnect (gns);
1723  gns = NULL;
1724  if (NULL != stats)
1725  {
1727  stats = NULL;
1728  }
1729 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Connection to the GNS service.
Definition: gns_api.h:35
static void rvk_move_attr_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got the referenced attribute.
static void filter_tickets_finished_cb(void *cls)
Done iterating over tickets and we apparently did not find an existing, matching ticket.
static void cleanup_iter(struct RECLAIM_TICKETS_Iterator *iter)
Cleanup ticket iterator.
The authorization ticket.
static void abort_parallel_lookups(void *cls)
Cancel the lookups for attribute records.
struct TicketReference * prev
DLL.
struct GNUNET_RECLAIM_Ticket ticket
Tickets.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
GNUNET_NETWORK_STRUCT_END 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.
int 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.
void RECLAIM_TICKETS_issue(const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, RECLAIM_TICKETS_TicketResult cb, void *cb_cls)
Issue a new reclaim ticket, thereby authorizing the audience to access the set of provided attributes...
uint64_t rel_value_us
The actual value.
Ticket revocation request handle.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_RECLAIM_Identifier old_id
Old ID of the attribute.
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
size_t GNUNET_RECLAIM_attestation_serialize(const struct GNUNET_RECLAIM_Attestation *attestation, char *result)
Serialize an attestation.
void GNUNET_RECLAIM_attestation_list_destroy(struct GNUNET_RECLAIM_AttestationList *attestations)
Destroy claim list.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attribute_list_dup(const struct GNUNET_RECLAIM_AttributeList *attrs)
Make a (deep) copy of a claim list.
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
static void issue_ticket(struct TicketIssueHandle *ih)
Issue a new ticket.
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.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT)...
const char * name
The name of the attribute.
static void move_attr_finished(void *cls, int32_t success, const char *emsg)
Updated an attribute ID.
#define GNUNET_TIME_UNIT_MINUTES
One minute.
struct GNUNET_TIME_Absolute lookup_start_time
Lookup time.
static void ticket_processed(void *cls, int32_t success, const char *emsg)
Finished storing updated attribute references.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
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_iteration_stop(struct RECLAIM_TICKETS_Iterator *iter)
Stop a running ticket iteration.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static struct GNUNET_TIME_Relative ticket_refresh_interval
Ticket expiration interval.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_GNSRECORD_TYPE_ANY
Record type indicating any record/&#39;*&#39;.
static void move_attrs(struct RECLAIM_TICKETS_RevokeHandle *rh)
We change every attribute ID of the ticket attributes we want to revoke.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
static void store_ticket_issue_cont(void *cls, int32_t success, const char *emsg)
Store finished, abort on error.
Handle to a lookup request.
Definition: gns_api.c:48
struct ParallelLookup * prev
static void rvk_ns_iter_err(void *cls)
Error iterating namestore.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
struct RevokedAttributeEntry * attrs_tail
Revoked attributes.
struct GNUNET_RECLAIM_Attestation * attestation
The attestation.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Audience Key.
A list of GNUNET_RECLAIM_Attribute structures.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
struct GNUNET_SCHEDULER_Task * kill_task
Kill task.
size_t data_size
Number of bytes in data.
A list of GNUNET_RECLAIM_Attestation structures.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct RECLAIM_TICKETS_ConsumeHandle * handle
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...
Private ECC key encoded for transmission.
void(* RECLAIM_TICKETS_TicketIter)(void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
Continuation called with ticket.
struct RevokedAttributeEntry * next
DLL.
struct TicketReference * next
DLL.
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.
struct GNUNET_GNS_LookupRequest * lookup_request
static void filter_tickets_error_cb(void *cls)
Namestore error on issue.
static void collect_tickets_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Return each record of type to the caller and proceed with the iteration.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct RECLAIM_TICKETS_Iterator * RECLAIM_TICKETS_iteration_start(const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
Iterate over all tickets issued by an identity.
size_t GNUNET_RECLAIM_attribute_serialize(const struct GNUNET_RECLAIM_Attribute *attr, char *result)
Serialize an attribute.
Handle for the service.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
struct GNUNET_TIME_Absolute lookup_start_time
Lookup time.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
size_t GNUNET_RECLAIM_attribute_serialize_get_size(const struct GNUNET_RECLAIM_Attribute *attr)
Get required size for serialization buffer.
static void revoke_attrs_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
We found the attribute references.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
struct GNUNET_RECLAIM_AttributeList * attrs
Attributes.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
static void del_attr_finished(void *cls, int32_t success, const char *emsg)
Done deleting the old record.
static char * zone
Name of the zone we manage.
struct GNUNET_RECLAIM_Identifier attestation
Referenced ID of Attestation (may be 0 if self-attested)
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level &#39;level&#39; that indicates a failure of the command &#39;cmd&#39; with the mess...
struct GNUNET_RECLAIM_AttestationList * attests
Attestations.
struct RevokedAttributeEntry * move_attr
Current attribute to move.
Handle for a zone iterator operation.
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:1269
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF
Record type for an attestation reference in a ticket.
const void * data
Binary value stored in the DNS record.
RECLAIM_TICKETS_TicketIter cb
Iter callback.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF
Record type for reclaim records.
Connection to the NAMESTORE service.
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size)
Deserialize an attribute.
uint64_t expiration_time
Expiration time for the DNS record.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
static void rvk_ticket_update_finished(void *cls)
Done collecting tickets.
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:1296
unsigned int rd_count
Record count.
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
Definition: gns_api.c:290
static void move_attrs_cont(void *cls)
Delayed continuation for move_attrs.
Handle to a consume operation.
static void collect_tickets_error_cb(void *cls)
Cancel ticket iteration on namestore error.
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:701
struct GNUNET_RECLAIM_AttributeList * attrs
Attributes to issue.
static void cleanup_issue_handle(struct TicketIssueHandle *handle)
Cleanup ticket consume handle.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
void RECLAIM_TICKETS_iteration_next(struct RECLAIM_TICKETS_Iterator *iter)
Continue ticket iteration.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
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:442
struct GNUNET_RECLAIM_Identifier id
ID.
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
Definition: gns_api.c:268
This is a private record of this peer and it should thus not be handed out to other peers...
RECLAIM_TICKETS_RevokeCallback cb
Callback.
static void rvk_attrs_err_cb(void *cls)
Failed to query namestore.
#define DEFAULT_TICKET_REFRESH_INTERVAL
FIXME: the defaul ticket iteration interval should probably be the minimim attribute expiration...
static void cleanup_cth(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cleanup ticket consume handle.
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
struct GNUNET_RECLAIM_Attestation * GNUNET_RECLAIM_attestation_deserialize(const char *data, size_t data_size)
Deserialize an attestation.
size_t GNUNET_RECLAIM_attestation_serialize_get_size(const struct GNUNET_RECLAIM_Attestation *attestation)
Get required size for serialization buffer.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_Identifier id
ID.
struct RevokedAttributeEntry * attrs_head
Revoked attributes.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore Iterator.
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The ticket issuer (= the user)
A reclaim identifier FIXME maybe put this in a different namespace.
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
void RECLAIM_TICKETS_consume_cancel(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cancel a consume operation.
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION
Record type for an attribute attestation.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE
Record type for identity attributes (of RECLAIM).
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:176
struct ParallelLookup * next
An QueueEntry used to store information for a pending NAMESTORE record operation. ...
Definition: namestore_api.c:53
struct GNUNET_RECLAIM_AttestationListEntry * list_head
List head.
static struct GNUNET_NAMESTORE_Handle * nsh
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
void(* RECLAIM_TICKETS_ConsumeCallback)(void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_AttributeList *attributes, const struct GNUNET_RECLAIM_AttestationList *attestations, int32_t success, const char *emsg)
Consume callback.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.
struct GNUNET_GNS_LookupRequest * lookup_request
LookupRequest.
struct GNUNET_RECLAIM_Ticket ticket
Ticket.
void RECLAIM_TICKETS_revoke_cancel(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cancel a revocation.
void(* RECLAIM_TICKETS_TicketResult)(void *cls, struct GNUNET_RECLAIM_Ticket *ticket, int32_t success, const char *emsg)
Continuation called with ticket.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
struct GNUNET_RECLAIM_Identifier new_id
New ID of the attribute.
struct RevokedAttributeEntry * prev
DLL.
static void process_tickets(void *cls)
For each ticket, store new, updated attribute references (Implementation further below) ...
struct GNUNET_RECLAIM_AttestationListEntry * list_tail
List tail.
uint32_t record_type
Type of the GNS/DNS record.
struct RECLAIM_TICKETS_RevokeHandle * RECLAIM_TICKETS_revoke(const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls)
Revoke a ticket.
configuration data
Definition: configuration.c:84
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:375
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_CRYPTO_EcdsaPublicKey audience
The ticket audience (= relying party)
RECLAIM_TICKETS_ConsumeCallback cb
Callback.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
void RECLAIM_TICKETS_deinit(void)
Close handles and clean up.
#define GNUNET_RECLAIM_id_is_equal(a, b)
static void remove_ticket_cont(void *cls, int32_t success, const char *emsg)
Finished deleting ticket and attribute references.
struct RECLAIM_TICKETS_ConsumeHandle * RECLAIM_TICKETS_consume(const struct GNUNET_CRYPTO_EcdsaPrivateKey *id, const struct GNUNET_RECLAIM_Ticket *ticket, RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls)
Consume a ticket.
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Definition: scheduler.c:134
void * GNUNET_GNS_lookup_cancel(struct GNUNET_GNS_LookupRequest *lr)
Cancel pending lookup request.
Definition: gns_api.c:314
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
Record type for local ticket references.
Ticket issue request handle.
A reference to a ticket stored in GNS.
struct GNUNET_RECLAIM_AttributeList * attrs
Attributes.
Time for absolute times used by GNUnet, in microseconds.
RECLAIM_TICKETS_TicketResult cb
Callback.
Defaults, look in cache, then in DHT.
static void collect_tickets_finished_cb(void *cls)
Signal ticket iteration has finished.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:935
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
This expiration time of the record is a relative time (not an absolute time).
#define GNUNET_RECLAIM_id_generate(id)
static void filter_tickets_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Iterator over records.
struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup(struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_CRYPTO_EcdsaPublicKey *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:412
uint32_t data
The data value.
int RECLAIM_TICKETS_init(const struct GNUNET_CONFIGURATION_Handle *c)
Initialize tickets component.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
static void rvk_ticket_update(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
void(* RECLAIM_TICKETS_RevokeCallback)(void *cls, int32_t success)
Revocation callback.
struct ParallelLookup * parallel_lookups_tail
Lookup DLL.
static void lookup_authz_cb(void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
GNS result with attribute references.
unsigned int ticket_attrs
Number of attributes in ticket.
static struct GNUNET_STATISTICS_Handle * stats
static struct GNUNET_GNS_Handle * gns
static void rvk_ns_err(void *cls)
Error storing new attribute in namestore.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#define GNUNET_malloc(size)
Wrapper around malloc.
struct ParallelLookup * parallel_lookups_head
Lookup DLL.
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
#define GNUNET_RECLAIM_id_is_zero(a)
Handle for a parallel GNS lookup job.
struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub
Audience Key.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:972