GNUnet  0.11.x
gnunet-service-reclaim.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  */
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
29 #include "gnunet_constants.h"
30 #include "gnunet_gnsrecord_lib.h"
31 #include "gnunet_protocols.h"
32 #include "gnunet_reclaim_lib.h"
33 #include "gnunet_reclaim_service.h"
34 #include "gnunet_signatures.h"
35 #include "reclaim.h"
36 
37 
42 
47 
51 static const struct GNUNET_CONFIGURATION_Handle *cfg;
52 
56 struct IdpClient;
57 
62 {
67 
72 
76  struct IdpClient *client;
77 
81  uint32_t r_id;
82 
87 };
88 
89 
93 struct Iterator
94 {
98  struct Iterator *next;
99 
103  struct Iterator *prev;
104 
108  struct IdpClient *client;
109 
114 
119 
123  uint32_t request_id;
124 
128  void *ctx;
129 };
130 
131 
135 struct IdpClient
136 {
140  struct IdpClient *prev;
141 
145  struct IdpClient *next;
146 
151 
156 
163 
170 
177 
184 
189 
194 
199 
204 
209 
214 
219 
224 
229 
238 
243 };
244 
245 
250 {
255 
260 
264  struct IdpClient *client;
265 
270 
271 
276 
281 
286 
291 
296 
301 
306 
311 
315  char *label;
316 
320  uint32_t r_id;
321 };
322 
323 
328 {
333 
338 
342  struct IdpClient *client;
343 
348 
352  struct GNUNET_IDENTITY_PublicKey identity_pkey;
353 
358 
363 
368 
373 
377  uint32_t r_id;
378 };
379 
380 
385 {
390 
395 
399  struct IdpClient *client;
400 
404  uint32_t r_id;
405 
410 };
411 
412 
417 {
422 
427 
431  struct IdpClient *client;
432 
437 
441  uint32_t r_id;
442 };
443 
444 
449 {
454 
459 
463  struct IdpClient *client;
464 
468  uint32_t r_id;
469 };
470 
471 
475 static struct IdpClient *client_list_head = NULL;
476 
480 static struct IdpClient *client_list_tail = NULL;
481 
482 
488 static void
490 {
491  struct TicketRecordsEntry *le;
492 
493  if (NULL != adh->ns_it)
495  if (NULL != adh->ns_qe)
497  if (NULL != adh->label)
498  GNUNET_free (adh->label);
499  if (NULL != adh->claim)
500  GNUNET_free (adh->claim);
501  if (NULL != adh->credential)
502  GNUNET_free (adh->credential);
503  if (NULL != adh->existing_credentials)
505  if (NULL != adh->existing_attributes)
507  while (NULL != (le = adh->tickets_to_update_head))
508  {
511  le);
512  if (NULL != le->label)
513  GNUNET_free (le->label);
514  if (NULL != le->data)
515  GNUNET_free (le->data);
516  GNUNET_free (le);
517  }
518  GNUNET_free (adh);
519 }
520 
521 
527 static void
529 {
530  if (NULL != ash->ns_qe)
532  if (NULL != ash->claim)
533  GNUNET_free (ash->claim);
534  if (NULL != ash->credential)
535  GNUNET_free (ash->credential);
536  GNUNET_free (ash);
537 }
538 
539 
545 static void
547 {
548  struct Iterator *ai;
549  struct TicketIteration *ti;
550  struct TicketRevocationOperation *rop;
551  struct TicketIssueOperation *iss;
552  struct ConsumeTicketOperation *ct;
553  struct AttributeStoreHandle *as;
554  struct AttributeDeleteHandle *adh;
555 
556  while (NULL != (iss = idp->issue_op_head))
557  {
559  GNUNET_free (iss);
560  }
561  while (NULL != (ct = idp->consume_op_head))
562  {
564  idp->consume_op_tail,
565  ct);
566  if (NULL != ct->ch)
568  GNUNET_free (ct);
569  }
570  while (NULL != (as = idp->store_op_head))
571  {
573  cleanup_as_handle (as);
574  }
575  while (NULL != (adh = idp->delete_op_head))
576  {
578  cleanup_adh (adh);
579  }
580 
581  while (NULL != (ai = idp->attr_iter_head))
582  {
584  GNUNET_free (ai);
585  }
586  while (NULL != (ai = idp->cred_iter_head))
587  {
589  ai);
590  GNUNET_free (ai);
591  }
592 
593  while (NULL != (rop = idp->revoke_op_head))
594  {
596  if (NULL != rop->rh)
598  GNUNET_free (rop);
599  }
600  while (NULL != (ti = idp->ticket_iter_head))
601  {
603  idp->ticket_iter_tail,
604  ti);
605  if (NULL != ti->iter)
607  GNUNET_free (ti);
608  }
609  GNUNET_free (idp);
610 }
611 
612 
616 static void
618 {
619  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
620 
622  if (NULL != timeout_task)
623  GNUNET_SCHEDULER_cancel (timeout_task);
624  if (NULL != nsh)
626 }
627 
628 
634 static void
635 do_shutdown (void *cls)
636 {
637  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n");
638  cleanup ();
639 }
640 
641 
650 static void
652  uint32_t r_id,
653  const struct GNUNET_RECLAIM_Ticket *ticket,
654  const struct GNUNET_RECLAIM_PresentationList *presentations,
655  uint32_t success)
656 {
657  struct TicketResultMessage *irm;
658  struct GNUNET_MQ_Envelope *env;
659  size_t pres_len = 0;
660 
661  if (NULL != presentations)
662  {
663  pres_len =
665  }
666  env = GNUNET_MQ_msg_extra (irm,
667  pres_len,
669  if (NULL != ticket)
670  {
671  irm->ticket = *ticket;
672  }
673  // TODO add success member
674  irm->id = htonl (r_id);
675  irm->presentations_len = htons (pres_len);
676  if (NULL != presentations)
677  {
679  (char*) &irm[1]);
680  }
681  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
682  GNUNET_MQ_send (client->mq, env);
683 }
684 
685 
695 static void
698  struct GNUNET_RECLAIM_PresentationList *presentations,
699  int32_t success,
700  const char *emsg)
701 {
702  struct TicketIssueOperation *tio = cls;
703 
704  if (GNUNET_OK != success)
705  {
706  send_ticket_result (tio->client, tio->r_id, NULL, NULL, GNUNET_SYSERR);
708  tio->client->issue_op_tail,
709  tio);
710  GNUNET_free (tio);
711  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg);
712  return;
713  }
714  send_ticket_result (tio->client, tio->r_id,
715  ticket, presentations, GNUNET_SYSERR);
717  tio->client->issue_op_tail,
718  tio);
719  GNUNET_free (tio);
720 }
721 
722 
730 static int
731 check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
732 {
733  uint16_t size;
734 
735  size = ntohs (im->header.size);
736  if (size <= sizeof(struct IssueTicketMessage))
737  {
738  GNUNET_break (0);
739  return GNUNET_SYSERR;
740  }
741  return GNUNET_OK;
742 }
743 
744 
751 static void
752 handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
753 {
754  struct TicketIssueOperation *tio;
755  struct IdpClient *idp = cls;
756  struct GNUNET_RECLAIM_AttributeList *attrs;
758  size_t attrs_len;
759 
760  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
761  tio = GNUNET_new (struct TicketIssueOperation);
762  attrs_len = ntohs (im->attr_len);
763  attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1],
764  attrs_len);
765  for (le = attrs->list_head; NULL != le; le = le->next)
767  "List entry: %s\n", le->attribute->name);
768 
769  tio->r_id = ntohl (im->id);
770  tio->client = idp;
772  RECLAIM_TICKETS_issue (&im->identity,
773  attrs,
774  &im->rp,
776  tio);
779 }
780 
781 
782 /**********************************************************
783 * Revocation
784 **********************************************************/
785 
792 static void
793 revoke_result_cb (void *cls, int32_t success)
794 {
795  struct TicketRevocationOperation *rop = cls;
796  struct GNUNET_MQ_Envelope *env;
797  struct RevokeTicketResultMessage *trm;
798 
800  "Sending REVOKE_TICKET_RESULT message\n");
801  rop->rh = NULL;
803  trm->id = htonl (rop->r_id);
804  trm->success = htonl (success);
805  GNUNET_MQ_send (rop->client->mq, env);
807  rop->client->revoke_op_tail,
808  rop);
809  GNUNET_free (rop);
810 }
811 
812 
820 static int
822 {
823  uint16_t size;
824 
825  size = ntohs (im->header.size);
826  if (size != sizeof(struct RevokeTicketMessage))
827  {
828  GNUNET_break (0);
829  return GNUNET_SYSERR;
830  }
831  return GNUNET_OK;
832 }
833 
834 
841 static void
843 {
844  struct TicketRevocationOperation *rop;
845  struct IdpClient *idp = cls;
846 
847  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
848  rop = GNUNET_new (struct TicketRevocationOperation);
849  rop->r_id = ntohl (rm->id);
850  rop->client = idp;
852  rop->rh
854  rop);
856 }
857 
858 
868 static void
869 consume_result_cb (void *cls,
870  const struct GNUNET_IDENTITY_PublicKey *identity,
871  const struct GNUNET_RECLAIM_AttributeList *attrs,
872  const struct GNUNET_RECLAIM_PresentationList *presentations,
873  int32_t success,
874  const char *emsg)
875 {
876  struct ConsumeTicketOperation *cop = cls;
877  struct ConsumeTicketResultMessage *crm;
878  struct GNUNET_MQ_Envelope *env;
879  char *data_tmp;
880  size_t attrs_len = 0;
881  size_t pres_len = 0;
882 
883  if (GNUNET_OK != success)
884  {
885  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
886  }
888  pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations);
890  "Sending CONSUME_TICKET_RESULT message\n");
891  env = GNUNET_MQ_msg_extra (crm,
892  attrs_len + pres_len,
894  crm->id = htonl (cop->r_id);
895  crm->attrs_len = htons (attrs_len);
896  crm->presentations_len = htons (pres_len);
897  crm->identity = *identity;
898  crm->result = htonl (success);
899  data_tmp = (char *) &crm[1];
900  GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp);
901  data_tmp += attrs_len;
902  GNUNET_RECLAIM_presentation_list_serialize (presentations, data_tmp);
903  GNUNET_MQ_send (cop->client->mq, env);
905  cop->client->consume_op_tail,
906  cop);
907  GNUNET_free (cop);
908 }
909 
910 
917 static int
919 {
920  uint16_t size;
921 
922  size = ntohs (cm->header.size);
923  if (size != sizeof(struct ConsumeTicketMessage))
924  {
925  GNUNET_break (0);
926  return GNUNET_SYSERR;
927  }
928  return GNUNET_OK;
929 }
930 
931 
938 static void
940 {
941  struct ConsumeTicketOperation *cop;
942  struct IdpClient *idp = cls;
943 
944  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
945  cop = GNUNET_new (struct ConsumeTicketOperation);
946  cop->r_id = ntohl (cm->id);
947  cop->client = idp;
948  cop->ch
950  cop);
953 }
954 
955 
956 /*****************************************
957 * Attribute store
958 *****************************************/
959 
960 
968 static void
969 attr_store_cont (void *cls, int32_t success, const char *emsg)
970 {
971  struct AttributeStoreHandle *ash = cls;
972  struct GNUNET_MQ_Envelope *env;
973  struct SuccessResultMessage *acr_msg;
974 
975  ash->ns_qe = NULL;
977  ash->client->store_op_tail,
978  ash);
979 
980  if (GNUNET_SYSERR == success)
981  {
983  "Failed to store attribute %s\n",
984  emsg);
985  cleanup_as_handle (ash);
987  return;
988  }
989 
990  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
992  acr_msg->id = htonl (ash->r_id);
993  acr_msg->op_result = htonl (GNUNET_OK);
994  GNUNET_MQ_send (ash->client->mq, env);
995  cleanup_as_handle (ash);
996 }
997 
998 
1004 static void
1005 attr_store_task (void *cls)
1006 {
1007  struct AttributeStoreHandle *ash = cls;
1008  struct GNUNET_GNSRECORD_Data rd[1];
1009  char *buf;
1010  char *label;
1011  size_t buf_size;
1012 
1013  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
1015  buf = GNUNET_malloc (buf_size);
1016  // Give the ash a new id if unset
1017  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->claim->id))
1020  label
1022  sizeof (ash->claim->id));
1023  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1024 
1025  rd[0].data_size = buf_size;
1026  rd[0].data = buf;
1029  rd[0].expiration_time = ash->exp.rel_value_us;
1031  &ash->identity,
1032  label,
1033  1,
1034  rd,
1035  &attr_store_cont,
1036  ash);
1037  GNUNET_free (buf);
1038  GNUNET_free (label);
1039 }
1040 
1041 
1048 static int
1050  const struct AttributeStoreMessage *sam)
1051 {
1052  uint16_t size;
1053 
1054  size = ntohs (sam->header.size);
1055  if (size <= sizeof(struct AttributeStoreMessage))
1056  {
1057  GNUNET_break (0);
1058  return GNUNET_SYSERR;
1059  }
1060  return GNUNET_OK;
1061 }
1062 
1063 
1070 static void
1072  const struct AttributeStoreMessage *sam)
1073 {
1074  struct AttributeStoreHandle *ash;
1075  struct IdpClient *idp = cls;
1076  size_t data_len;
1077 
1078  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
1079 
1080  data_len = ntohs (sam->attr_len);
1081 
1082  ash = GNUNET_new (struct AttributeStoreHandle);
1083  GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1],
1084  data_len,
1085  &ash->claim);
1086 
1087  ash->r_id = ntohl (sam->id);
1088  ash->identity = sam->identity;
1089  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1090  GNUNET_IDENTITY_key_get_public (&sam->identity, &ash->identity_pkey);
1091 
1093  ash->client = idp;
1096 }
1097 
1098 
1106 static void
1107 cred_store_cont (void *cls, int32_t success, const char *emsg)
1108 {
1109  struct AttributeStoreHandle *ash = cls;
1110  struct GNUNET_MQ_Envelope *env;
1111  struct SuccessResultMessage *acr_msg;
1112 
1113  ash->ns_qe = NULL;
1115  ash->client->store_op_tail,
1116  ash);
1117 
1118  if (GNUNET_SYSERR == success)
1119  {
1121  "Failed to store credential: %s\n",
1122  emsg);
1123  cleanup_as_handle (ash);
1125  return;
1126  }
1127 
1128  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1130  acr_msg->id = htonl (ash->r_id);
1131  acr_msg->op_result = htonl (GNUNET_OK);
1132  GNUNET_MQ_send (ash->client->mq, env);
1133  cleanup_as_handle (ash);
1134 }
1135 
1136 
1142 static void
1143 cred_error (void *cls)
1144 {
1145  struct AttributeStoreHandle *ash = cls;
1147  "Failed to check for existing credential.\n");
1148  cleanup_as_handle (ash);
1150  return;
1151 }
1152 
1153 
1163 static void
1164 cred_add_cb (void *cls,
1165  const struct GNUNET_IDENTITY_PrivateKey *zone,
1166  const char *label,
1167  unsigned int rd_count,
1168  const struct GNUNET_GNSRECORD_Data *rd)
1169 {
1170  struct AttributeStoreHandle *ash = cls;
1171  struct GNUNET_GNSRECORD_Data rd_new[1];
1172  char *buf;
1173  size_t buf_size;
1174 
1176  buf = GNUNET_malloc (buf_size);
1179  "Storing new credential under `%s'.\n",
1180  label);
1181  rd_new[0].data_size = buf_size;
1182  rd_new[0].data = buf;
1185  rd_new[0].expiration_time = ash->exp.rel_value_us;
1187  &ash->identity,
1188  label,
1189  1,
1190  rd_new,
1191  &cred_store_cont,
1192  ash);
1193  GNUNET_free (buf);
1194  return;
1195 }
1196 
1197 
1203 static void
1204 cred_store_task (void *cls)
1205 {
1206  struct AttributeStoreHandle *ash = cls;
1207  char *label;
1208 
1209  // Give the ash a new id if unset
1213  sizeof (ash->credential->id));
1215  "Looking up existing data under label `%s'\n", label);
1217  &ash->identity,
1218  label,
1219  &cred_error,
1220  ash,
1221  &cred_add_cb,
1222  ash);
1223  GNUNET_free (label);
1224 }
1225 
1226 
1233 static int
1235  const struct AttributeStoreMessage *sam)
1236 {
1237  uint16_t size;
1238 
1239  size = ntohs (sam->header.size);
1240  if (size <= sizeof(struct AttributeStoreMessage))
1241  {
1242  GNUNET_break (0);
1243  return GNUNET_SYSERR;
1244  }
1245  return GNUNET_OK;
1246 }
1247 
1248 
1255 static void
1257  const struct AttributeStoreMessage *sam)
1258 {
1259  struct AttributeStoreHandle *ash;
1260  struct IdpClient *idp = cls;
1261  size_t data_len;
1262 
1263  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n");
1264 
1265  data_len = ntohs (sam->attr_len);
1266 
1267  ash = GNUNET_new (struct AttributeStoreHandle);
1268  ash->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &sam[1],
1269  data_len);
1270 
1271  ash->r_id = ntohl (sam->id);
1272  ash->identity = sam->identity;
1273  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1274  GNUNET_IDENTITY_key_get_public (&sam->identity, &ash->identity_pkey);
1275 
1277  ash->client = idp;
1280 }
1281 
1282 
1289 static void
1290 send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
1291 {
1292  struct GNUNET_MQ_Envelope *env;
1293  struct SuccessResultMessage *acr_msg;
1294 
1296  adh->client->delete_op_tail,
1297  adh);
1298 
1299  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1301  acr_msg->id = htonl (adh->r_id);
1302  acr_msg->op_result = htonl (success);
1303  GNUNET_MQ_send (adh->client->mq, env);
1304 }
1305 
1306 
1317 static void
1318 consistency_iter (void *cls,
1319  const struct GNUNET_IDENTITY_PrivateKey *zone,
1320  const char *label,
1321  unsigned int rd_count,
1322  const struct GNUNET_GNSRECORD_Data *rd)
1323 {
1324  struct AttributeDeleteHandle *adh = cls;
1325  struct TicketRecordsEntry *le;
1328  int is_ticket = GNUNET_NO;
1329  for (int i = 0; i < rd_count; i++)
1330  {
1331  switch (rd[i].record_type) {
1335  rd[i].data_size,
1336  &ale->attribute);
1339  ale);
1340  break;
1344  rd[i].data_size);
1347  cle);
1348  break;
1351  "Ticket to delete found (%s)\n",
1352  label);
1353  is_ticket = GNUNET_YES;
1354  break;
1355  default:
1356  break;
1357  }
1358  if (GNUNET_YES == is_ticket)
1359  break;
1360  }
1361  if (GNUNET_YES == is_ticket)
1362  {
1363  le = GNUNET_new (struct TicketRecordsEntry);
1364  le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
1365  le->data = GNUNET_malloc (le->data_size);
1366  le->rd_count = rd_count;
1367  le->label = GNUNET_strdup (label);
1368  GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
1371  le);
1372  }
1374 }
1375 
1376 
1381 static void
1382 update_tickets (void *cls);
1383 
1384 
1392 static void
1393 ticket_updated (void *cls, int32_t success, const char *emsg)
1394 {
1395  struct AttributeDeleteHandle *adh = cls;
1396 
1397  adh->ns_qe = NULL;
1399 }
1400 
1401 
1409 static void
1410 update_tickets (void *cls)
1411 {
1412  struct AttributeDeleteHandle *adh = cls;
1413  struct TicketRecordsEntry *le;
1414 
1415  if (NULL == adh->tickets_to_update_head)
1416  {
1418  "Finished updating tickets, success\n");
1420  cleanup_adh (adh);
1421  return;
1422  }
1423  le = adh->tickets_to_update_head;
1426  le);
1427  struct GNUNET_GNSRECORD_Data rd[le->rd_count];
1428  struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1];
1430  le->data,
1431  le->rd_count,
1432  rd))
1433  {
1435  "Unable to deserialize record data!\n");
1437  cleanup_adh (adh);
1438  return;
1439  }
1440  int j = 0;
1441  int i = 0;
1444  struct GNUNET_RECLAIM_Presentation *presentation;
1445  for (i = 0; i < le->rd_count; i++)
1446  {
1447  switch (rd[i].record_type) {
1449  for (ale = adh->existing_attributes->list_head; NULL != ale; ale = ale->next) {
1451  &ale->attribute->id)) {
1453  "Found attribute %s, readding...\n",
1454  ale->attribute->name);
1455  rd_new[j] = rd[i];
1456  j++;
1457  break; //Found and added
1458  }
1459  }
1460  break;
1462  presentation = GNUNET_RECLAIM_presentation_deserialize (rd[i].data,
1463  rd[i].data_size);
1464  for (cle = adh->existing_credentials->list_head; NULL != cle; cle = cle->next) {
1465  if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&presentation->credential_id,
1466  &cle->credential->id)) {
1468  "Found presentation for credential %s, readding...\n",
1469  cle->credential->name);
1470  rd_new[j] = rd[i];
1471  j++;
1472  break; //Found and added
1473  }
1474  }
1475  GNUNET_free (presentation);
1476  break;
1478  rd_new[j] = rd[i];
1479  j++;
1480  break; //Found and added
1481  default:
1482  GNUNET_break (0);
1483  }
1484  }
1486  "Updating ticket with %d entries (%d before)...\n",
1487  j, i);
1489  &adh->identity,
1490  le->label,
1491  j,
1492  rd_new,
1493  &ticket_updated,
1494  adh);
1495  GNUNET_free (le->label);
1496  GNUNET_free (le->data);
1497  GNUNET_free (le);
1498 }
1499 
1504 static void
1505 purge_attributes (void *cls);;
1506 
1507 static void
1508 offending_attr_delete_cont (void *cls, int32_t success, const char *emsg)
1509 {
1510  struct AttributeDeleteHandle *adh = cls;
1511 
1512  adh->ns_qe = NULL;
1513  if (GNUNET_SYSERR == success)
1514  {
1516  "Error deleting attribute %s\n",
1517  adh->label);
1519  cleanup_adh (adh);
1520  return;
1521  }
1522  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Continuing consistency check...\n");
1524 }
1525 
1526 
1527 
1532 static void
1533 purge_attributes (void *cls)
1534 {
1535  struct AttributeDeleteHandle *adh = cls;
1538 
1539  for (ale = adh->existing_attributes->list_head; NULL != ale; ale = ale->next)
1540  {
1541  if (GNUNET_YES ==
1543  continue;
1544 
1545  for (cle = adh->existing_credentials->list_head;
1546  NULL != cle; cle = cle->next) {
1547  if (GNUNET_YES !=
1549  &ale->attribute->credential))
1550  continue;
1551  break;
1552  }
1553  if (NULL == cle) {
1555  "Found attribute with missing credential\n");
1556  break;
1557  }
1558  }
1559  if (NULL == ale) {
1561  "Attributes consistent, updating tickets.\n");
1563  return;
1564  }
1566  "Attributes inconsistent, deleting offending attribute.\n");
1567  char *label
1569  sizeof(ale->attribute->id));
1570 
1572  &adh->identity,
1573  label,
1574  0,
1575  NULL,
1577  adh);
1580  ale);
1581  GNUNET_free (ale);
1582  GNUNET_free (label);
1583 }
1584 
1590 static void
1592 {
1593  struct AttributeDeleteHandle *adh = cls;
1594  adh->ns_it = NULL;
1596 }
1597 
1598 
1604 static void
1606 {
1607  struct AttributeDeleteHandle *adh = cls;
1608 
1609  adh->ns_it = NULL;
1611  "Namestore error on consistency check\n");
1613  cleanup_adh (adh);
1614 }
1615 
1616 
1623 static void
1625 {
1626  struct AttributeDeleteHandle *adh = cls;
1627 
1630 
1632  &adh->identity,
1634  adh,
1636  adh,
1638  adh);
1639 }
1640 
1641 
1649 static void
1650 attr_delete_cont (void *cls, int32_t success, const char *emsg)
1651 {
1652  struct AttributeDeleteHandle *adh = cls;
1653 
1654  adh->ns_qe = NULL;
1655  if (GNUNET_SYSERR == success)
1656  {
1658  "Error deleting attribute %s\n",
1659  adh->label);
1661  cleanup_adh (adh);
1662  return;
1663  }
1664  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1666 }
1667 
1668 
1675 static int
1677  const struct AttributeDeleteMessage *dam)
1678 {
1679  uint16_t size;
1680 
1681  size = ntohs (dam->header.size);
1682  if (size <= sizeof(struct AttributeDeleteMessage))
1683  {
1684  GNUNET_break (0);
1685  return GNUNET_SYSERR;
1686  }
1687  return GNUNET_OK;
1688 }
1689 
1690 
1697 static void
1699  const struct AttributeDeleteMessage *dam)
1700 {
1701  struct AttributeDeleteHandle *adh;
1702  struct IdpClient *idp = cls;
1703  size_t data_len;
1704 
1705  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n");
1706 
1707  data_len = ntohs (dam->attr_len);
1708 
1709  adh = GNUNET_new (struct AttributeDeleteHandle);
1710  GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1],
1711  data_len,
1712  &adh->claim);
1713  adh->credential = NULL;
1714 
1715  adh->r_id = ntohl (dam->id);
1716  adh->identity = dam->identity;
1717  adh->label
1719  sizeof(adh->claim->id));
1721  adh->client = idp;
1724  &adh->identity,
1725  adh->label,
1726  0,
1727  NULL,
1729  adh);
1730 }
1731 
1732 
1740 static void
1741 cred_delete_cont (void *cls, int32_t success, const char *emsg)
1742 {
1743  struct AttributeDeleteHandle *adh = cls;
1744 
1745  adh->ns_qe = NULL;
1746  if (GNUNET_SYSERR == success)
1747  {
1749  "Error deleting credential `%s'\n",
1750  adh->label);
1752  cleanup_adh (adh);
1753  return;
1754  }
1755  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1757 }
1758 
1759 
1766 static int
1768  const struct AttributeDeleteMessage *dam)
1769 {
1770  uint16_t size;
1771 
1772  size = ntohs (dam->header.size);
1773  if (size <= sizeof(struct AttributeDeleteMessage))
1774  {
1775  GNUNET_break (0);
1776  return GNUNET_SYSERR;
1777  }
1778  return GNUNET_OK;
1779 }
1780 
1781 
1788 static void
1790  const struct AttributeDeleteMessage *dam)
1791 {
1792  struct AttributeDeleteHandle *adh;
1793  struct IdpClient *idp = cls;
1794  size_t data_len;
1795 
1796  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n");
1797 
1798  data_len = ntohs (dam->attr_len);
1799 
1800  adh = GNUNET_new (struct AttributeDeleteHandle);
1801  adh->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &dam[1],
1802  data_len);
1803  adh->claim = NULL;
1804 
1805  adh->r_id = ntohl (dam->id);
1806  adh->identity = dam->identity;
1807  adh->label
1809  sizeof(adh->credential->id));
1811  adh->client = idp;
1814  &adh->identity,
1815  adh->label,
1816  0,
1817  NULL,
1819  adh);
1820 }
1821 
1822 
1823 /*************************************************
1824  * Attrubute iteration
1825  *************************************************/
1826 
1827 
1833 static void
1835 {
1836  struct Iterator *ai = cls;
1837  struct GNUNET_MQ_Envelope *env;
1838  struct AttributeResultMessage *arm;
1839 
1840  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
1842  arm->id = htonl (ai->request_id);
1843  arm->attr_len = htons (0);
1844  GNUNET_MQ_send (ai->client->mq, env);
1846  ai->client->attr_iter_tail,
1847  ai);
1848  GNUNET_free (ai);
1849 }
1850 
1851 
1857 static void
1858 attr_iter_error (void *cls)
1859 {
1860  struct Iterator *ai = cls;
1861 
1862  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1863  attr_iter_finished (ai);
1864 }
1865 
1866 
1876 static void
1877 attr_iter_cb (void *cls,
1878  const struct GNUNET_IDENTITY_PrivateKey *zone,
1879  const char *label,
1880  unsigned int rd_count,
1881  const struct GNUNET_GNSRECORD_Data *rd)
1882 {
1883  struct Iterator *ai = cls;
1884  struct GNUNET_MQ_Envelope *env;
1885  char *data_tmp;
1886 
1887  if ((rd_count != 1) ||
1889  {
1891  return;
1892  }
1893  struct AttributeResultMessage *arm;
1894  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
1895  label);
1897  "Sending ATTRIBUTE_RESULT message\n");
1898  env = GNUNET_MQ_msg_extra (arm,
1899  rd->data_size,
1901  arm->id = htonl (ai->request_id);
1902  arm->attr_len = htons (rd->data_size);
1904  data_tmp = (char *) &arm[1];
1905  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1906  GNUNET_MQ_send (ai->client->mq, env);
1907 }
1908 
1909 
1916 static void
1918  const struct AttributeIterationStartMessage *ais_msg)
1919 {
1920  struct IdpClient *idp = cls;
1921  struct Iterator *ai;
1922 
1924  "Received ATTRIBUTE_ITERATION_START message\n");
1925  ai = GNUNET_new (struct Iterator);
1926  ai->request_id = ntohl (ais_msg->id);
1927  ai->client = idp;
1928  ai->identity = ais_msg->identity;
1929 
1932  &ai->identity,
1933  &attr_iter_error,
1934  ai,
1935  &attr_iter_cb,
1936  ai,
1938  ai);
1940 }
1941 
1942 
1949 static void
1951  const struct AttributeIterationStopMessage *ais_msg)
1952 {
1953  struct IdpClient *idp = cls;
1954  struct Iterator *ai;
1955  uint32_t rid;
1956 
1958  "Received `%s' message\n",
1959  "ATTRIBUTE_ITERATION_STOP");
1960  rid = ntohl (ais_msg->id);
1961  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1962  if (ai->request_id == rid)
1963  break;
1964  if (NULL == ai)
1965  {
1966  GNUNET_break (0);
1968  return;
1969  }
1971  GNUNET_free (ai);
1973 }
1974 
1975 
1982 static void
1984  const struct AttributeIterationNextMessage *ais_msg)
1985 {
1986  struct IdpClient *idp = cls;
1987  struct Iterator *ai;
1988  uint32_t rid;
1989 
1991  "Received ATTRIBUTE_ITERATION_NEXT message\n");
1992  rid = ntohl (ais_msg->id);
1993  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1994  if (ai->request_id == rid)
1995  break;
1996  if (NULL == ai)
1997  {
1998  GNUNET_break (0);
2000  return;
2001  }
2004 }
2005 
2006 
2007 /*************************************************
2008  * Credential iteration
2009  *************************************************/
2010 
2011 
2017 static void
2019 {
2020  struct Iterator *ai = cls;
2021  struct GNUNET_MQ_Envelope *env;
2022  struct CredentialResultMessage *arm;
2023 
2024  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n");
2026  arm->id = htonl (ai->request_id);
2027  arm->credential_len = htons (0);
2028  GNUNET_MQ_send (ai->client->mq, env);
2030  ai->client->cred_iter_tail,
2031  ai);
2032  GNUNET_free (ai);
2033 }
2034 
2035 
2041 static void
2042 cred_iter_error (void *cls)
2043 {
2044  struct Iterator *ai = cls;
2045 
2046  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over credentials\n");
2047  cred_iter_finished (ai);
2048 }
2049 
2050 
2060 static void
2061 cred_iter_cb (void *cls,
2062  const struct GNUNET_IDENTITY_PrivateKey *zone,
2063  const char *label,
2064  unsigned int rd_count,
2065  const struct GNUNET_GNSRECORD_Data *rd)
2066 {
2067  struct Iterator *ai = cls;
2068  struct GNUNET_MQ_Envelope *env;
2069  struct CredentialResultMessage *arm;
2070  char *data_tmp;
2071 
2072  if ((rd_count != 1) ||
2074  {
2076  return;
2077  }
2078  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found credential under: %s\n",
2079  label);
2081  "Sending CREDENTIAL_RESULT message\n");
2082  env = GNUNET_MQ_msg_extra (arm,
2083  rd->data_size,
2085  arm->id = htonl (ai->request_id);
2086  arm->credential_len = htons (rd->data_size);
2088  data_tmp = (char *) &arm[1];
2089  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
2090 
2091  GNUNET_MQ_send (ai->client->mq, env);
2092 }
2093 
2094 
2101 static void
2103  const struct
2105 {
2106  struct IdpClient *idp = cls;
2107  struct Iterator *ai;
2108 
2110  "Received CREDENTIAL_ITERATION_START message\n");
2111  ai = GNUNET_new (struct Iterator);
2112  ai->request_id = ntohl (ais_msg->id);
2113  ai->client = idp;
2114  ai->identity = ais_msg->identity;
2115 
2117  ai);
2119  &ai->identity,
2120  &cred_iter_error,
2121  ai,
2122  &cred_iter_cb,
2123  ai,
2125  ai);
2127 }
2128 
2129 
2136 static void
2138  const struct
2140 {
2141  struct IdpClient *idp = cls;
2142  struct Iterator *ai;
2143  uint32_t rid;
2144 
2146  "Received `%s' message\n",
2147  "CREDENTIAL_ITERATION_STOP");
2148  rid = ntohl (ais_msg->id);
2149  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2150  if (ai->request_id == rid)
2151  break;
2152  if (NULL == ai)
2153  {
2154  GNUNET_break (0);
2156  return;
2157  }
2159  ai);
2160  GNUNET_free (ai);
2162 }
2163 
2164 
2171 static void
2173  const struct
2175 {
2176  struct IdpClient *idp = cls;
2177  struct Iterator *ai;
2178  uint32_t rid;
2179 
2181  "Received CREDENTIAL_ITERATION_NEXT message\n");
2182  rid = ntohl (ais_msg->id);
2183  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2184  if (ai->request_id == rid)
2185  break;
2186  if (NULL == ai)
2187  {
2188  GNUNET_break (0);
2190  return;
2191  }
2194 }
2195 
2196 
2197 /******************************************************
2198  * Ticket iteration
2199  ******************************************************/
2200 
2207 static void
2209 {
2210  struct TicketIteration *ti = cls;
2211  struct GNUNET_MQ_Envelope *env;
2212  struct TicketResultMessage *trm;
2213 
2215  if (NULL == ticket)
2216  {
2217  /* send empty response to indicate end of list */
2219  ti->client->ticket_iter_tail,
2220  ti);
2221  }
2222  else
2223  {
2224  trm->ticket = *ticket;
2225  }
2226  trm->id = htonl (ti->r_id);
2227  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
2228  GNUNET_MQ_send (ti->client->mq, env);
2229  if (NULL == ticket)
2230  GNUNET_free (ti);
2231 }
2232 
2233 
2240 static void
2242  void *cls,
2243  const struct TicketIterationStartMessage *tis_msg)
2244 {
2245  struct IdpClient *client = cls;
2246  struct TicketIteration *ti;
2247 
2249  "Received TICKET_ITERATION_START message\n");
2250  ti = GNUNET_new (struct TicketIteration);
2251  ti->r_id = ntohl (tis_msg->id);
2252  ti->client = client;
2253 
2255  client->ticket_iter_tail,
2256  ti);
2257  ti->iter
2260 }
2261 
2262 
2269 static void
2271  const struct TicketIterationStopMessage *tis_msg)
2272 {
2273  struct IdpClient *client = cls;
2274  struct TicketIteration *ti;
2275  uint32_t rid;
2276 
2278  "Received `%s' message\n",
2279  "TICKET_ITERATION_STOP");
2280  rid = ntohl (tis_msg->id);
2281  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2282  if (ti->r_id == rid)
2283  break;
2284  if (NULL == ti)
2285  {
2286  GNUNET_break (0);
2288  return;
2289  }
2292  client->ticket_iter_tail,
2293  ti);
2294  GNUNET_free (ti);
2296 }
2297 
2298 
2305 static void
2307  const struct TicketIterationNextMessage *tis_msg)
2308 {
2309  struct IdpClient *client = cls;
2310  struct TicketIteration *ti;
2311  uint32_t rid;
2312 
2314  "Received TICKET_ITERATION_NEXT message\n");
2315  rid = ntohl (tis_msg->id);
2316  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2317  if (ti->r_id == rid)
2318  break;
2319  if (NULL == ti)
2320  {
2321  GNUNET_break (0);
2323  return;
2324  }
2327 }
2328 
2329 
2337 static void
2338 run (void *cls,
2339  const struct GNUNET_CONFIGURATION_Handle *c,
2340  struct GNUNET_SERVICE_Handle *server)
2341 {
2342  cfg = c;
2343 
2344  if (GNUNET_OK != RECLAIM_TICKETS_init (cfg))
2345  {
2347  "Unable to initialize TICKETS subsystem.\n");
2349  return;
2350  }
2351  // Connect to identity and namestore services
2352  nsh = GNUNET_NAMESTORE_connect (cfg);
2353  if (NULL == nsh)
2354  {
2356  "error connecting to namestore");
2357  }
2358 
2360 }
2361 
2362 
2370 static void
2372  struct GNUNET_SERVICE_Client *client,
2373  void *app_ctx)
2374 {
2375  struct IdpClient *idp = app_ctx;
2376 
2377  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
2378  GNUNET_CONTAINER_DLL_remove (client_list_head,
2379  client_list_tail,
2380  idp);
2381  cleanup_client (idp);
2382 }
2383 
2384 
2393 static void *
2395  struct GNUNET_SERVICE_Client *client,
2396  struct GNUNET_MQ_Handle *mq)
2397 {
2398  struct IdpClient *idp;
2399 
2400  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
2401  idp = GNUNET_new (struct IdpClient);
2402  idp->client = client;
2403  idp->mq = mq;
2404  GNUNET_CONTAINER_DLL_insert (client_list_head,
2405  client_list_tail,
2406  idp);
2407  return idp;
2408 }
2409 
2410 
2415  "reclaim",
2417  &run,
2420  NULL,
2421  GNUNET_MQ_hd_var_size (attribute_store_message,
2423  struct AttributeStoreMessage,
2424  NULL),
2425  GNUNET_MQ_hd_var_size (credential_store_message,
2427  struct AttributeStoreMessage,
2428  NULL),
2429  GNUNET_MQ_hd_var_size (attribute_delete_message,
2431  struct AttributeDeleteMessage,
2432  NULL),
2433  GNUNET_MQ_hd_var_size (credential_delete_message,
2435  struct AttributeDeleteMessage,
2436  NULL),
2440  NULL),
2441  GNUNET_MQ_hd_fixed_size (iteration_next,
2444  NULL),
2445  GNUNET_MQ_hd_fixed_size (iteration_stop,
2448  NULL),
2449  GNUNET_MQ_hd_fixed_size (credential_iteration_start,
2452  NULL),
2453  GNUNET_MQ_hd_fixed_size (credential_iteration_next,
2456  NULL),
2457  GNUNET_MQ_hd_fixed_size (credential_iteration_stop,
2460  NULL),
2461 
2462  GNUNET_MQ_hd_var_size (issue_ticket_message,
2464  struct IssueTicketMessage,
2465  NULL),
2466  GNUNET_MQ_hd_var_size (consume_ticket_message,
2468  struct ConsumeTicketMessage,
2469  NULL),
2470  GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
2473  NULL),
2474  GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
2477  NULL),
2478  GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
2481  NULL),
2482  GNUNET_MQ_hd_var_size (revoke_ticket_message,
2484  struct RevokeTicketMessage,
2485  NULL),
2487 /* end of gnunet-service-reclaim.c */
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle for attribute deletion request.
static void consistency_iter_fin(void *cls)
Done collecting affected tickets, start updating.
struct TicketIteration * ticket_iter_tail
Tail of DLL of ticket iteration ops.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET
static void cred_error(void *cls)
Error looking up potential credential.
ssize_t GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size, struct GNUNET_RECLAIM_Attribute **attr)
Deserialize an attribute.
uint16_t credential_len
Length of serialized attribute data.
Definition: reclaim.h:179
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:463
static void attr_delete_cont(void *cls, int32_t success, const char *emsg)
Attribute deleted callback.
Ticket result message.
Definition: reclaim.h:453
static void consistency_iter_err(void *cls)
Error collecting affected tickets.
struct GNUNET_IDENTITY_PrivateKey identity
Key of the zone we are iterating over.
The authorization ticket.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:288
static void send_ticket_result(const struct IdpClient *client, uint32_t r_id, const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_RECLAIM_PresentationList *presentations, uint32_t success)
Sends a ticket result message to the client.
static void update_tickets(void *cls)
Recursion prototype for function.
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.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_deserialize(const char *data, size_t data_size)
Deserialize an credential.
static void revoke_result_cb(void *cls, int32_t success)
Handles revocation result.
static struct GNUNET_CADET_ListTunnels * tio
Active tunnel listing operation.
Definition: gnunet-cadet.c:112
struct GNUNET_RECLAIM_Ticket ticket
The new ticket.
Definition: reclaim.h:473
static void handle_ticket_iteration_start(void *cls, const struct TicketIterationStartMessage *tis_msg)
Client requests a ticket iteration.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
static void cred_store_cont(void *cls, int32_t success, const char *emsg)
Credential store result handler.
struct RECLAIM_TICKETS_Iterator * RECLAIM_TICKETS_iteration_start(const struct GNUNET_IDENTITY_PrivateKey *identity, RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
Iterate over all tickets issued by an identity.
struct GNUNET_RECLAIM_Identifier id
ID.
struct TicketIssueOperation * prev
DLL.
Attribute list is returned from the idp.
Definition: reclaim.h:507
uint64_t rel_value_us
The actual value.
struct IdpClient * client
Client connection.
Ticket revocation request handle.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET.
Definition: reclaim.h:405
#define GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT
Ticket consume message.
Definition: reclaim.h:481
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:496
static void start_consistency_update(void *cls)
Start processing tickets which may still contain reference to deleted attribute.
uint32_t presentations_len
Length of new presentations created.
Definition: reclaim.h:468
size_t GNUNET_RECLAIM_credential_serialize_get_size(const struct GNUNET_RECLAIM_Credential *credential)
Get required size for serialization buffer.
Handle to a service.
Definition: service.c:116
struct ConsumeTicketOperation * consume_op_head
Head of DLL of ticket consume ops.
An idp client.
Stop credential iteration for the given operation.
Definition: reclaim.h:278
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:271
Start a attribute iteration for the given identity.
Definition: reclaim.h:200
static const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Ticket issue operation handle.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1331
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.
const char * name
The name of the attribute.
static void attr_iter_error(void *cls)
Error iterating over attributes.
static int check_attribute_store_message(void *cls, const struct AttributeStoreMessage *sam)
Check an attribute store message.
static void cred_store_task(void *cls)
Add a new credential.
struct GNUNET_RECLAIM_Credential * credential
The credential.
Stop attribute iteration for the given operation.
Definition: reclaim.h:295
int32_t op_result
GNUNET_SYSERR on failure, GNUNET_OK on success
Definition: reclaim.h:118
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
void RECLAIM_TICKETS_iteration_stop(struct RECLAIM_TICKETS_Iterator *iter)
Stop a running ticket iteration.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:410
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
struct RECLAIM_TICKETS_Iterator * iter
The ticket iterator.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:134
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:517
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attribute_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
struct GNUNET_RECLAIM_CredentialListEntry * list_tail
List tail.
struct TicketRevocationOperation * revoke_op_tail
Tail of DLL of ticket revocation ops.
struct GNUNET_RECLAIM_AttributeList * existing_attributes
Existing attributes.
#define GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
struct AttributeDeleteHandle * prev
DLL.
static void attr_store_cont(void *cls, int32_t success, const char *emsg)
Attribute store result handler.
Use to delete an identity attribute.
Definition: reclaim.h:74
struct GNUNET_RECLAIM_CredentialListEntry * next
DLL.
struct IdpClient * client
Client connection.
struct Iterator * attr_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
A private key for an identity as per LSD0001.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
static void handle_attribute_store_message(void *cls, const struct AttributeStoreMessage *sam)
Handle an attribute store message.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx)
Called whenever a client is disconnected.
An attribute iteration operation.
static int check_credential_delete_message(void *cls, const struct AttributeDeleteMessage *dam)
Check credential delete message format.
static void handle_attribute_delete_message(void *cls, const struct AttributeDeleteMessage *dam)
Handle attribute deletion.
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT
A list of GNUNET_RECLAIM_Attribute structures.
size_t data_size
Number of bytes in data.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_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.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void consume_result_cb(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_PresentationList *presentations, int32_t success, const char *emsg)
Handle a ticket consume result.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
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...
struct TicketIssueOperation * issue_op_head
Head of DLL of ticket issue ops.
static void cleanup_client(struct IdpClient *idp)
Cleanup client.
uint32_t r_id
The operation id fot the iteration in the response for the client.
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:89
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.
uint32_t result
Result.
Definition: reclaim.h:522
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
size_t GNUNET_RECLAIM_attribute_serialize(const struct GNUNET_RECLAIM_Attribute *attr, char *result)
Serialize an attribute.
uint32_t r_id
request id
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:531
Use to store an identity attribute.
Definition: reclaim.h:40
static void issue_ticket_result_cb(void *cls, struct GNUNET_RECLAIM_Ticket *ticket, struct GNUNET_RECLAIM_PresentationList *presentations, int32_t success, const char *emsg)
Issue ticket result.
struct AttributeStoreHandle * store_op_head
Head of DLL of attribute store ops.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL
Record type for an attribute attestation.
struct IdpClient * client
IDP client which intiated this zone iteration.
static void cred_iter_error(void *cls)
Error iterating over credentials.
static void * client_connect_cb(void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
Add a client to our list of active clients.
struct GNUNET_IDENTITY_PublicKey identity
The public key of the identity.
Definition: reclaim.h:189
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:174
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET.
Definition: reclaim.h:372
struct IdpClient * client
Client which intiated this zone iteration.
size_t GNUNET_RECLAIM_attribute_serialize_get_size(const struct GNUNET_RECLAIM_Attribute *attr)
Get required size for serialization buffer.
static void handle_consume_ticket_message(void *cls, const struct ConsumeTicketMessage *cm)
Handle a consume ticket message.
struct RECLAIM_TICKETS_RevokeHandle * rh
Revocation handle.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
Ask for next result of ticket iteration for the given operation.
Definition: reclaim.h:333
struct GNUNET_SERVICE_Client * client
The client.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT
struct TicketIteration * ticket_iter_head
Head of DLL of ticket iteration ops.
static void cleanup_as_handle(struct AttributeStoreHandle *ash)
Cleanup attribute store handle.
Handle to a client that is connected to a service.
Definition: service.c:250
Common type definitions for the identity provider service and API.
static char * zone
Name of the zone we manage.
static void handle_iteration_start(void *cls, const struct AttributeIterationStartMessage *ais_msg)
Iterate over zone to get attributes.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:343
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
struct GNUNET_RECLAIM_Credential * credential
The credential to store.
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...
static void handle_ticket_iteration_next(void *cls, const struct TicketIterationNextMessage *tis_msg)
Client requests next result.
static void purge_attributes(void *cls)
Delete all attributes which reference credentials that no longer exist.
struct AttributeStoreHandle * prev
DLL.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
Handle for a zone iterator operation.
uint32_t r_id
request id
static void cleanup()
Cleanup task.
static void attr_store_task(void *cls)
Add a new attribute.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:305
const void * data
Binary value stored in the DNS record.
struct GNUNET_TIME_Relative exp
The attribute expiration interval.
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT.
Definition: reclaim.h:79
struct RECLAIM_TICKETS_ConsumeHandle * RECLAIM_TICKETS_consume(const struct GNUNET_IDENTITY_PrivateKey *id, const struct GNUNET_RECLAIM_Ticket *ticket, RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls)
Consume a ticket.
static void send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
Send a deletion success response.
static void handle_credential_delete_message(void *cls, const struct AttributeDeleteMessage *dam)
Handle credential deletion.
struct GNUNET_IDENTITY_PublicKey identity
The public key of the identity.
Definition: reclaim.h:542
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF
Record type for reclaim records.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
Connection to the NAMESTORE service.
struct TicketIteration * prev
DLL.
Stop ticket iteration for the given operation.
Definition: reclaim.h:350
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:232
struct GNUNET_RECLAIM_Credential * credential
The credential to delete.
uint64_t expiration_time
Expiration time for the DNS record.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
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
struct GNUNET_RECLAIM_Ticket ticket
The ticket to revoke.
Definition: reclaim.h:425
unsigned int rd_count
Record count.
Handle to a consume operation.
struct GNUNET_IDENTITY_PublicKey identity_pkey
Identity pubkey.
static struct IdpClient * client_list_head
Client list.
void GNUNET_RECLAIM_credential_list_destroy(struct GNUNET_RECLAIM_CredentialList *credentials)
Destroy claim list.
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE
Handle for attribute store request.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:215
static void attr_iter_cb(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got record.
static void handle_credential_iteration_start(void *cls, const struct CredentialIterationStartMessage *ais_msg)
Iterate over zone to get attributes.
struct ConsumeTicketOperation * next
DLL.
static char buf[2048]
void RECLAIM_TICKETS_iteration_next(struct RECLAIM_TICKETS_Iterator *iter)
Continue ticket iteration.
struct AttributeStoreHandle * store_op_tail
Tail of DLL of attribute store ops.
size_t GNUNET_RECLAIM_presentation_list_serialize_get_size(const struct GNUNET_RECLAIM_PresentationList *presentations)
Get required size for serialization buffer.
struct GNUNET_RECLAIM_Identifier credential_id
The credential id of which this is a presentation.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: identity_api.c:175
struct GNUNET_RECLAIM_Identifier id
ID.
static void cred_add_cb(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Check for existing record before storing credential.
struct Iterator * cred_iter_head
Head of the DLL of Credential iteration operations in progress initiated by this client.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT
struct IdpClient * client
Client connection.
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:55
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:210
Ticket issue message.
Definition: reclaim.h:367
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_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)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT)...
struct IdpClient * prev
DLL.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2325
#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION
Record type for a presentation of a credential (used in a ticket record set)
struct IdpClient * client
Client connection.
struct TicketRevocationOperation * next
DLL.
void RECLAIM_TICKETS_issue(const struct GNUNET_IDENTITY_PrivateKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_IDENTITY_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...
struct TicketIteration * next
DLL.
Attribute store/delete response message.
Definition: reclaim.h:103
size_t GNUNET_RECLAIM_credential_serialize(const struct GNUNET_RECLAIM_Credential *credential, char *result)
Serialize an credential.
static int check_credential_store_message(void *cls, const struct AttributeStoreMessage *sam)
Check an credential store message.
GNUNET_SERVICE_MAIN("reclaim", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_var_size(attribute_store_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, struct AttributeStoreMessage, NULL), GNUNET_MQ_hd_var_size(credential_store_message, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE, struct AttributeStoreMessage, NULL), GNUNET_MQ_hd_var_size(attribute_delete_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, struct AttributeDeleteMessage, NULL), GNUNET_MQ_hd_var_size(credential_delete_message, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE, struct AttributeDeleteMessage, NULL), GNUNET_MQ_hd_fixed_size(iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, struct AttributeIterationStartMessage, NULL), GNUNET_MQ_hd_fixed_size(iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, struct AttributeIterationNextMessage, NULL), GNUNET_MQ_hd_fixed_size(iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, struct AttributeIterationStopMessage, NULL), GNUNET_MQ_hd_fixed_size(credential_iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, struct CredentialIterationStartMessage, NULL), GNUNET_MQ_hd_fixed_size(credential_iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, struct CredentialIterationNextMessage, NULL), GNUNET_MQ_hd_fixed_size(credential_iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP, struct CredentialIterationStopMessage, NULL), GNUNET_MQ_hd_var_size(issue_ticket_message, GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, struct IssueTicketMessage, NULL), GNUNET_MQ_hd_var_size(consume_ticket_message, GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, struct ConsumeTicketMessage, NULL), GNUNET_MQ_hd_fixed_size(ticket_iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, struct TicketIterationStartMessage, NULL), GNUNET_MQ_hd_fixed_size(ticket_iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, struct TicketIterationNextMessage, NULL), GNUNET_MQ_hd_fixed_size(ticket_iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, struct TicketIterationStopMessage, NULL), GNUNET_MQ_hd_var_size(revoke_ticket_message, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, struct RevokeTicketMessage, NULL), GNUNET_MQ_handler_end())
Define "main" method using service macro.
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT.
Definition: reclaim.h:45
A credential presentation.
static void handle_credential_store_message(void *cls, const struct AttributeStoreMessage *sam)
Handle a credential store message.
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.
static void handle_revoke_ticket_message(void *cls, const struct RevokeTicketMessage *rm)
Handle a revocation message to a ticket.
uint32_t attr_len
length of serialized attribute list
Definition: reclaim.h:392
struct RECLAIM_TICKETS_ConsumeHandle * ch
Ticket consume handle.
char * label
Attribute label.
struct GNUNET_RECLAIM_Ticket ticket
The ticket to consume.
Definition: reclaim.h:501
static unsigned int size
Size of the "table".
Definition: peer.c:67
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE
Record type for identity attributes (of RECLAIM).
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
An QueueEntry used to store information for a pending NAMESTORE record operation. ...
Definition: namestore_api.c:53
size_t GNUNET_RECLAIM_attribute_list_serialize(const struct GNUNET_RECLAIM_AttributeList *attrs, char *result)
Serialize an attribute list.
Ask for next result of attribute iteration for the given operation.
Definition: reclaim.h:222
struct GNUNET_RECLAIM_CredentialListEntry * list_head
List head.
const char * name
The name of the credential.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:415
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START
struct IdpClient * client
Client connection.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
Start a credential iteration for the given identity.
Definition: reclaim.h:239
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:326
struct ConsumeTicketOperation * consume_op_tail
Tail of DLL of ticket consume ops.
struct TicketRevocationOperation * revoke_op_head
Head of DLL of ticket revocation ops.
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_deserialize(const char *data, size_t data_size)
Deserialize a presentation.
static void iteration_start()
struct TicketRevocationOperation * prev
DLL.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
struct Iterator * prev
Previous element in the DLL.
static void handle_credential_iteration_stop(void *cls, const struct CredentialIterationStopMessage *ais_msg)
Handle iteration stop message from client.
static void ticket_updated(void *cls, int32_t success, const char *emsg)
Callback called when a ticket was updated.
uint16_t presentations_len
Length of presentation data.
Definition: reclaim.h:532
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:249
static void handle_ticket_iteration_stop(void *cls, const struct TicketIterationStopMessage *tis_msg)
Client has had enough tickets.
void RECLAIM_TICKETS_revoke_cancel(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cancel a revocation.
struct Iterator * cred_iter_tail
Tail of the DLL of Credential iteration operations in progress initiated by this client.
struct AttributeDeleteHandle * delete_op_head
Head of DLL of attribute delete ops.
struct TicketIssueOperation * issue_op_tail
Tail of DLL of ticket issue ops.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START
struct Iterator * next
Next element in the DLL.
#define GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE
Handle to a message queue.
Definition: mq.c:85
void * ctx
Context.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_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.
Ask for next result of credential iteration for the given operation.
Definition: reclaim.h:261
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
A ticket iteration operation.
An identity key as per LSD0001.
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START
Ticket revocation request handle.
A list of GNUNET_RECLAIM_Presentation structures.
static void handle_iteration_next(void *cls, const struct AttributeIterationNextMessage *ais_msg)
Client requests next attribute from iterator.
uint32_t record_type
Type of the GNS/DNS record.
Ticket revoke message.
Definition: reclaim.h:431
configuration data
Definition: configuration.c:84
static void consistency_iter(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Namestore iteration within attribute deletion.
struct AttributeStoreHandle * next
DLL.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
A list of GNUNET_RECLAIM_Credential structures.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:321
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:441
void RECLAIM_TICKETS_deinit(void)
Close handles and clean up.
Attribute is returned from the idp.
Definition: reclaim.h:124
uint16_t attr_len
Length of serialized attribute data.
Definition: reclaim.h:139
#define GNUNET_RECLAIM_id_is_equal(a, b)
Start a ticket iteration for the given identity.
Definition: reclaim.h:311
struct AttributeDeleteHandle * next
DLL.
struct GNUNET_RECLAIM_CredentialList * existing_credentials
Existing credentials.
uint16_t attrs_len
Length of serialized attribute data.
Definition: reclaim.h:527
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
static struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task.
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Definition: scheduler.c:134
struct AttributeDeleteHandle * delete_op_tail
Tail of DLL of attribute delete ops.
Handle for ticket consume request.
static void cred_iter_cb(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got record.
size_t GNUNET_RECLAIM_attribute_list_serialize_get_size(const struct GNUNET_RECLAIM_AttributeList *attrs)
Get required size for serialization buffer.
static void handle_issue_ticket_message(void *cls, const struct IssueTicketMessage *im)
Handle ticket issue message.
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
Record type for local ticket references.
static void handle_credential_iteration_next(void *cls, const struct CredentialIterationNextMessage *ais_msg)
Client requests next credential from iterator.
#define GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
static int check_consume_ticket_message(void *cls, const struct ConsumeTicketMessage *cm)
Check a consume ticket message.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:360
static void offending_attr_delete_cont(void *cls, int32_t success, const char *emsg)
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:937
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET.
Definition: reclaim.h:486
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
static void do_shutdown(void *cls)
Shutdown task.
This expiration time of the record is a relative time (not an absolute time).
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
#define GNUNET_RECLAIM_id_generate(id)
static void run(void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *server)
Main function that will be run.
struct IdpClient * next
DLL.
struct TicketIssueOperation * next
DLL.
static int check_revoke_ticket_message(void *cls, const struct RevokeTicketMessage *im)
Check revocation message format.
struct RECLAIM_TICKETS_RevokeHandle * RECLAIM_TICKETS_revoke(const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_IDENTITY_PrivateKey *identity, RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls)
Revoke a ticket.
static void attr_iter_finished(void *cls)
Done iterating over attributes.
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE
size_t GNUNET_RECLAIM_presentation_list_serialize(const struct GNUNET_RECLAIM_PresentationList *presentations, char *result)
Serialize a presentation list.
uint32_t data
The data value.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:254
struct Iterator * attr_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
Credential is returned from the idp.
Definition: reclaim.h:164
struct GNUNET_RECLAIM_Attribute * claim
The attribute to store.
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
static void ticket_iter_cb(void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
Got a ticket.
int RECLAIM_TICKETS_init(const struct GNUNET_CONFIGURATION_Handle *c)
Initialize tickets component.
uint32_t success
Revocation result.
Definition: reclaim.h:446
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP
static void cred_delete_cont(void *cls, int32_t success, const char *emsg)
Credential deleted callback.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2244
static int check_attribute_delete_message(void *cls, const struct AttributeDeleteMessage *dam)
Check attribute delete message format.
struct ConsumeTicketOperation * prev
DLL.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:491
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
static struct IdpClient * client_list_tail
Client list.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#define GNUNET_malloc(size)
Wrapper around malloc.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:53
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:113
static int check_issue_ticket_message(void *cls, const struct IssueTicketMessage *im)
Check issue ticket message.
#define GNUNET_free(ptr)
Wrapper around free.
static void handle_iteration_stop(void *cls, const struct AttributeIterationStopMessage *ais_msg)
Handle iteration stop message from client.
Ticket revoke message.
Definition: reclaim.h:400
Time for relative time used by GNUnet, in microseconds.
static void cred_iter_finished(void *cls)
Done iterating over credentials.
struct GNUNET_IDENTITY_PublicKey identity
The public key of the identity.
Definition: reclaim.h:154
#define GNUNET_RECLAIM_id_is_zero(a)
#define GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:972