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 
353 
358 
363 
368 
372  struct GNUNET_TIME_Relative exp;
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  {
558  GNUNET_CONTAINER_DLL_remove (idp->issue_op_head, idp->issue_op_tail, iss);
559  GNUNET_free (iss);
560  }
561  while (NULL != (ct = idp->consume_op_head))
562  {
563  GNUNET_CONTAINER_DLL_remove (idp->consume_op_head,
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  {
572  GNUNET_CONTAINER_DLL_remove (idp->store_op_head, idp->store_op_tail, as);
573  cleanup_as_handle (as);
574  }
575  while (NULL != (adh = idp->delete_op_head))
576  {
577  GNUNET_CONTAINER_DLL_remove (idp->delete_op_head, idp->delete_op_tail, adh);
578  cleanup_adh (adh);
579  }
580 
581  while (NULL != (ai = idp->attr_iter_head))
582  {
583  GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
584  GNUNET_free (ai);
585  }
586  while (NULL != (ai = idp->cred_iter_head))
587  {
588  GNUNET_CONTAINER_DLL_remove (idp->cred_iter_head, idp->cred_iter_tail,
589  ai);
590  GNUNET_free (ai);
591  }
592 
593  while (NULL != (rop = idp->revoke_op_head))
594  {
595  GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, idp->revoke_op_tail, rop);
596  if (NULL != rop->rh)
598  GNUNET_free (rop);
599  }
600  while (NULL != (ti = idp->ticket_iter_head))
601  {
602  GNUNET_CONTAINER_DLL_remove (idp->ticket_iter_head,
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)
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);
707  GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
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);
716  GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
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  size_t attrs_len;
735 
736  size = ntohs (im->header.size);
737  attrs_len = ntohs (im->attr_len);
738 
739  if (attrs_len > size - sizeof(struct IssueTicketMessage))
740  {
741  GNUNET_break (0);
742  return GNUNET_SYSERR;
743  }
744  return GNUNET_OK;
745 }
746 
747 
754 static void
755 handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
756 {
757  struct TicketIssueOperation *tio;
758  struct IdpClient *idp = cls;
759  struct GNUNET_RECLAIM_AttributeList *attrs;
761  size_t attrs_len;
762 
763  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
765  attrs_len = ntohs (im->attr_len);
766  attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1],
767  attrs_len);
768  for (le = attrs->list_head; NULL != le; le = le->next)
770  "List entry: %s\n", le->attribute->name);
771 
772  tio->r_id = ntohl (im->id);
773  tio->client = idp;
774  GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio);
776  attrs,
777  &im->rp,
779  tio);
782 }
783 
784 
785 /**********************************************************
786 * Revocation
787 **********************************************************/
788 
795 static void
796 revoke_result_cb (void *cls, int32_t success)
797 {
798  struct TicketRevocationOperation *rop = cls;
799  struct GNUNET_MQ_Envelope *env;
800  struct RevokeTicketResultMessage *trm;
801 
803  "Sending REVOKE_TICKET_RESULT message\n");
804  rop->rh = NULL;
806  trm->id = htonl (rop->r_id);
807  trm->success = htonl (success);
808  GNUNET_MQ_send (rop->client->mq, env);
810  rop->client->revoke_op_tail,
811  rop);
812  GNUNET_free (rop);
813 }
814 
815 
823 static int
825 {
826  uint16_t size;
827 
828  size = ntohs (im->header.size);
829  if (size != sizeof(struct RevokeTicketMessage))
830  {
831  GNUNET_break (0);
832  return GNUNET_SYSERR;
833  }
834  return GNUNET_OK;
835 }
836 
837 
844 static void
846 {
847  struct TicketRevocationOperation *rop;
848  struct IdpClient *idp = cls;
849 
850  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
851  rop = GNUNET_new (struct TicketRevocationOperation);
852  rop->r_id = ntohl (rm->id);
853  rop->client = idp;
854  GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop);
855  rop->rh
857  rop);
859 }
860 
861 
871 static void
872 consume_result_cb (void *cls,
873  const struct GNUNET_IDENTITY_PublicKey *identity,
874  const struct GNUNET_RECLAIM_AttributeList *attrs,
875  const struct GNUNET_RECLAIM_PresentationList *presentations,
876  int32_t success,
877  const char *emsg)
878 {
879  struct ConsumeTicketOperation *cop = cls;
880  struct ConsumeTicketResultMessage *crm;
881  struct GNUNET_MQ_Envelope *env;
882  char *data_tmp;
883  size_t attrs_len = 0;
884  size_t pres_len = 0;
885 
886  if (GNUNET_OK != success)
887  {
888  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
889  }
892  presentations);
894  "Sending CONSUME_TICKET_RESULT message\n");
895  env = GNUNET_MQ_msg_extra (crm,
896  attrs_len + pres_len,
898  crm->id = htonl (cop->r_id);
899  crm->attrs_len = htons (attrs_len);
900  crm->presentations_len = htons (pres_len);
901  crm->identity = *identity;
902  crm->result = htonl (success);
903  data_tmp = (char *) &crm[1];
904  GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp);
905  data_tmp += attrs_len;
906  GNUNET_RECLAIM_presentation_list_serialize (presentations, data_tmp);
907  GNUNET_MQ_send (cop->client->mq, env);
909  cop->client->consume_op_tail,
910  cop);
911  GNUNET_free (cop);
912 }
913 
914 
921 static int
923 {
924  uint16_t size;
925 
926  size = ntohs (cm->header.size);
927  if (size != sizeof(struct ConsumeTicketMessage))
928  {
929  GNUNET_break (0);
930  return GNUNET_SYSERR;
931  }
932  return GNUNET_OK;
933 }
934 
935 
942 static void
944 {
945  struct ConsumeTicketOperation *cop;
946  struct IdpClient *idp = cls;
947 
948  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
949  cop = GNUNET_new (struct ConsumeTicketOperation);
950  cop->r_id = ntohl (cm->id);
951  cop->client = idp;
952  cop->ch
954  cop);
955  GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop);
957 }
958 
959 
960 /*****************************************
961 * Attribute store
962 *****************************************/
963 
964 
972 static void
973 attr_store_cont (void *cls, int32_t success, const char *emsg)
974 {
975  struct AttributeStoreHandle *ash = cls;
976  struct GNUNET_MQ_Envelope *env;
977  struct SuccessResultMessage *acr_msg;
978 
979  ash->ns_qe = NULL;
981  ash->client->store_op_tail,
982  ash);
983 
984  if (GNUNET_SYSERR == success)
985  {
987  "Failed to store attribute %s\n",
988  emsg);
989  cleanup_as_handle (ash);
991  return;
992  }
993 
994  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
996  acr_msg->id = htonl (ash->r_id);
997  acr_msg->op_result = htonl (GNUNET_OK);
998  GNUNET_MQ_send (ash->client->mq, env);
999  cleanup_as_handle (ash);
1000 }
1001 
1002 
1008 static void
1009 attr_store_task (void *cls)
1010 {
1011  struct AttributeStoreHandle *ash = cls;
1012  struct GNUNET_GNSRECORD_Data rd[1];
1013  char *buf;
1014  char *label;
1015  size_t buf_size;
1016 
1017  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
1019  buf = GNUNET_malloc (buf_size);
1020  // Give the ash a new id if unset
1021  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->claim->id))
1024  label
1026  sizeof (ash->claim->id));
1027  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1028 
1029  rd[0].data_size = buf_size;
1030  rd[0].data = buf;
1033  rd[0].expiration_time = ash->exp.rel_value_us;
1035  &ash->identity,
1036  label,
1037  1,
1038  rd,
1039  &attr_store_cont,
1040  ash);
1041  GNUNET_free (buf);
1042  GNUNET_free (label);
1043 }
1044 
1045 
1052 static int
1054  const struct AttributeStoreMessage *sam)
1055 {
1056  uint16_t size;
1057 
1058  size = ntohs (sam->header.size);
1059  if (size <= sizeof(struct AttributeStoreMessage))
1060  {
1061  GNUNET_break (0);
1062  return GNUNET_SYSERR;
1063  }
1064  return GNUNET_OK;
1065 }
1066 
1067 
1074 static void
1076  const struct AttributeStoreMessage *sam)
1077 {
1078  struct AttributeStoreHandle *ash;
1079  struct IdpClient *idp = cls;
1080  size_t data_len;
1081 
1082  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
1083 
1084  data_len = ntohs (sam->attr_len);
1085 
1086  ash = GNUNET_new (struct AttributeStoreHandle);
1087  GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1],
1088  data_len,
1089  &ash->claim);
1090 
1091  ash->r_id = ntohl (sam->id);
1092  ash->identity = sam->identity;
1093  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1095 
1097  ash->client = idp;
1098  GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash);
1100 }
1101 
1102 
1110 static void
1111 cred_store_cont (void *cls, int32_t success, const char *emsg)
1112 {
1113  struct AttributeStoreHandle *ash = cls;
1114  struct GNUNET_MQ_Envelope *env;
1115  struct SuccessResultMessage *acr_msg;
1116 
1117  ash->ns_qe = NULL;
1119  ash->client->store_op_tail,
1120  ash);
1121 
1122  if (GNUNET_SYSERR == success)
1123  {
1125  "Failed to store credential: %s\n",
1126  emsg);
1127  cleanup_as_handle (ash);
1129  return;
1130  }
1131 
1132  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1134  acr_msg->id = htonl (ash->r_id);
1135  acr_msg->op_result = htonl (GNUNET_OK);
1136  GNUNET_MQ_send (ash->client->mq, env);
1137  cleanup_as_handle (ash);
1138 }
1139 
1140 
1146 static void
1147 cred_error (void *cls)
1148 {
1149  struct AttributeStoreHandle *ash = cls;
1151  "Failed to check for existing credential.\n");
1152  cleanup_as_handle (ash);
1154  return;
1155 }
1156 
1157 
1167 static void
1168 cred_add_cb (void *cls,
1169  const struct GNUNET_IDENTITY_PrivateKey *zone,
1170  const char *label,
1171  unsigned int rd_count,
1172  const struct GNUNET_GNSRECORD_Data *rd)
1173 {
1174  struct AttributeStoreHandle *ash = cls;
1175  struct GNUNET_GNSRECORD_Data rd_new[1];
1176  char *buf;
1177  size_t buf_size;
1178 
1180  buf = GNUNET_malloc (buf_size);
1183  "Storing new credential under `%s'.\n",
1184  label);
1185  rd_new[0].data_size = buf_size;
1186  rd_new[0].data = buf;
1189  rd_new[0].expiration_time = ash->exp.rel_value_us;
1191  &ash->identity,
1192  label,
1193  1,
1194  rd_new,
1195  &cred_store_cont,
1196  ash);
1197  GNUNET_free (buf);
1198  return;
1199 }
1200 
1201 
1207 static void
1208 cred_store_task (void *cls)
1209 {
1210  struct AttributeStoreHandle *ash = cls;
1211  char *label;
1212 
1213  // Give the ash a new id if unset
1217  sizeof (ash->credential->id));
1219  "Looking up existing data under label `%s'\n", label);
1221  &ash->identity,
1222  label,
1223  &cred_error,
1224  ash,
1225  &cred_add_cb,
1226  ash);
1227  GNUNET_free (label);
1228 }
1229 
1230 
1237 static int
1239  const struct AttributeStoreMessage *sam)
1240 {
1241  uint16_t size;
1242 
1243  size = ntohs (sam->header.size);
1244  if (size <= sizeof(struct AttributeStoreMessage))
1245  {
1246  GNUNET_break (0);
1247  return GNUNET_SYSERR;
1248  }
1249  return GNUNET_OK;
1250 }
1251 
1252 
1259 static void
1261  const struct AttributeStoreMessage *sam)
1262 {
1263  struct AttributeStoreHandle *ash;
1264  struct IdpClient *idp = cls;
1265  size_t data_len;
1266 
1267  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n");
1268 
1269  data_len = ntohs (sam->attr_len);
1270 
1271  ash = GNUNET_new (struct AttributeStoreHandle);
1272  ash->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &sam[1],
1273  data_len);
1274 
1275  ash->r_id = ntohl (sam->id);
1276  ash->identity = sam->identity;
1277  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1279 
1281  ash->client = idp;
1282  GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash);
1284 }
1285 
1286 
1293 static void
1294 send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
1295 {
1296  struct GNUNET_MQ_Envelope *env;
1297  struct SuccessResultMessage *acr_msg;
1298 
1300  adh->client->delete_op_tail,
1301  adh);
1302 
1303  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1305  acr_msg->id = htonl (adh->r_id);
1306  acr_msg->op_result = htonl (success);
1307  GNUNET_MQ_send (adh->client->mq, env);
1308 }
1309 
1310 
1321 static void
1322 consistency_iter (void *cls,
1323  const struct GNUNET_IDENTITY_PrivateKey *zone,
1324  const char *label,
1325  unsigned int rd_count,
1326  const struct GNUNET_GNSRECORD_Data *rd)
1327 {
1328  struct AttributeDeleteHandle *adh = cls;
1329  struct TicketRecordsEntry *le;
1332  int is_ticket = GNUNET_NO;
1333  for (int i = 0; i < rd_count; i++)
1334  {
1335  switch (rd[i].record_type)
1336  {
1340  rd[i].data_size,
1341  &ale->attribute);
1344  ale);
1345  break;
1349  rd[i].data_size);
1352  cle);
1353  break;
1356  "Ticket to delete found (%s)\n",
1357  label);
1358  is_ticket = GNUNET_YES;
1359  break;
1360  default:
1361  break;
1362  }
1363  if (GNUNET_YES == is_ticket)
1364  break;
1365  }
1366  if (GNUNET_YES == is_ticket)
1367  {
1368  le = GNUNET_new (struct TicketRecordsEntry);
1369  le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
1370  le->data = GNUNET_malloc (le->data_size);
1371  le->rd_count = rd_count;
1372  le->label = GNUNET_strdup (label);
1373  GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
1376  le);
1377  }
1379 }
1380 
1381 
1386 static void
1387 update_tickets (void *cls);
1388 
1389 
1397 static void
1398 ticket_updated (void *cls, int32_t success, const char *emsg)
1399 {
1400  struct AttributeDeleteHandle *adh = cls;
1401 
1402  adh->ns_qe = NULL;
1404 }
1405 
1406 
1414 static void
1415 update_tickets (void *cls)
1416 {
1417  struct AttributeDeleteHandle *adh = cls;
1418  struct TicketRecordsEntry *le;
1419 
1420  if (NULL == adh->tickets_to_update_head)
1421  {
1423  "Finished updating tickets, success\n");
1425  cleanup_adh (adh);
1426  return;
1427  }
1428  le = adh->tickets_to_update_head;
1431  le);
1432  struct GNUNET_GNSRECORD_Data rd[le->rd_count];
1433  struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1];
1435  le->data,
1436  le->rd_count,
1437  rd))
1438  {
1440  "Unable to deserialize record data!\n");
1442  cleanup_adh (adh);
1443  return;
1444  }
1445  int j = 0;
1446  int i = 0;
1449  struct GNUNET_RECLAIM_Presentation *presentation;
1450  for (i = 0; i < le->rd_count; i++)
1451  {
1452  switch (rd[i].record_type)
1453  {
1455  for (ale = adh->existing_attributes->list_head; NULL != ale; ale =
1456  ale->next)
1457  {
1459  &ale->attribute->id))
1460  {
1462  "Found attribute %s, readding...\n",
1463  ale->attribute->name);
1464  rd_new[j] = rd[i];
1465  j++;
1466  break; // Found and added
1467  }
1468  }
1469  break;
1471  presentation = GNUNET_RECLAIM_presentation_deserialize (rd[i].data,
1472  rd[i].data_size);
1473  for (cle = adh->existing_credentials->list_head; NULL != cle; cle =
1474  cle->next)
1475  {
1477  &presentation->credential_id,
1478  &cle->credential->id))
1479  {
1481  "Found presentation for credential %s, readding...\n",
1482  cle->credential->name);
1483  rd_new[j] = rd[i];
1484  j++;
1485  break; // Found and added
1486  }
1487  }
1488  GNUNET_free (presentation);
1489  break;
1491  rd_new[j] = rd[i];
1492  j++;
1493  break; // Found and added
1494  default:
1495  GNUNET_break (0);
1496  }
1497  }
1499  "Updating ticket with %d entries (%d before)...\n",
1500  j, i);
1502  &adh->identity,
1503  le->label,
1504  j,
1505  rd_new,
1506  &ticket_updated,
1507  adh);
1508  GNUNET_free (le->label);
1509  GNUNET_free (le->data);
1510  GNUNET_free (le);
1511 }
1512 
1513 
1518 static void
1519 purge_attributes (void *cls);;
1520 
1521 static void
1522 offending_attr_delete_cont (void *cls, int32_t success, const char *emsg)
1523 {
1524  struct AttributeDeleteHandle *adh = cls;
1525 
1526  adh->ns_qe = NULL;
1527  if (GNUNET_SYSERR == success)
1528  {
1530  "Error deleting attribute %s\n",
1531  adh->label);
1533  cleanup_adh (adh);
1534  return;
1535  }
1536  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Continuing consistency check...\n");
1538 }
1539 
1540 
1545 static void
1546 purge_attributes (void *cls)
1547 {
1548  struct AttributeDeleteHandle *adh = cls;
1551 
1552  for (ale = adh->existing_attributes->list_head; NULL != ale; ale = ale->next)
1553  {
1554  if (GNUNET_YES ==
1556  continue;
1557 
1558  for (cle = adh->existing_credentials->list_head;
1559  NULL != cle; cle = cle->next)
1560  {
1561  if (GNUNET_YES !=
1563  &ale->attribute->credential))
1564  continue;
1565  break;
1566  }
1567  if (NULL == cle)
1568  {
1570  "Found attribute with missing credential\n");
1571  break;
1572  }
1573  }
1574  if (NULL == ale)
1575  {
1577  "Attributes consistent, updating tickets.\n");
1579  return;
1580  }
1582  "Attributes inconsistent, deleting offending attribute.\n");
1583  char *label
1585  sizeof(ale->attribute->id));
1586 
1588  &adh->identity,
1589  label,
1590  0,
1591  NULL,
1593  adh);
1596  ale);
1597  GNUNET_free (ale);
1598  GNUNET_free (label);
1599 }
1600 
1601 
1607 static void
1609 {
1610  struct AttributeDeleteHandle *adh = cls;
1611  adh->ns_it = NULL;
1613 }
1614 
1615 
1621 static void
1623 {
1624  struct AttributeDeleteHandle *adh = cls;
1625 
1626  adh->ns_it = NULL;
1628  "Namestore error on consistency check\n");
1630  cleanup_adh (adh);
1631 }
1632 
1633 
1640 static void
1642 {
1643  struct AttributeDeleteHandle *adh = cls;
1644 
1647 
1649  &adh->identity,
1651  adh,
1653  adh,
1655  adh);
1656 }
1657 
1658 
1666 static void
1667 attr_delete_cont (void *cls, int32_t success, const char *emsg)
1668 {
1669  struct AttributeDeleteHandle *adh = cls;
1670 
1671  adh->ns_qe = NULL;
1672  if (GNUNET_SYSERR == success)
1673  {
1675  "Error deleting attribute %s\n",
1676  adh->label);
1678  cleanup_adh (adh);
1679  return;
1680  }
1681  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1683 }
1684 
1685 
1692 static int
1694  const struct AttributeDeleteMessage *dam)
1695 {
1696  uint16_t size;
1697 
1698  size = ntohs (dam->header.size);
1699  if (size <= sizeof(struct AttributeDeleteMessage))
1700  {
1701  GNUNET_break (0);
1702  return GNUNET_SYSERR;
1703  }
1704  return GNUNET_OK;
1705 }
1706 
1707 
1714 static void
1716  const struct AttributeDeleteMessage *dam)
1717 {
1718  struct AttributeDeleteHandle *adh;
1719  struct IdpClient *idp = cls;
1720  size_t data_len;
1721 
1722  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n");
1723 
1724  data_len = ntohs (dam->attr_len);
1725 
1726  adh = GNUNET_new (struct AttributeDeleteHandle);
1727  GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1],
1728  data_len,
1729  &adh->claim);
1730  adh->credential = NULL;
1731 
1732  adh->r_id = ntohl (dam->id);
1733  adh->identity = dam->identity;
1734  adh->label
1736  sizeof(adh->claim->id));
1738  adh->client = idp;
1739  GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh);
1741  &adh->identity,
1742  adh->label,
1743  0,
1744  NULL,
1746  adh);
1747 }
1748 
1749 
1757 static void
1758 cred_delete_cont (void *cls, int32_t success, const char *emsg)
1759 {
1760  struct AttributeDeleteHandle *adh = cls;
1761 
1762  adh->ns_qe = NULL;
1763  if (GNUNET_SYSERR == success)
1764  {
1766  "Error deleting credential `%s'\n",
1767  adh->label);
1769  cleanup_adh (adh);
1770  return;
1771  }
1772  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1774 }
1775 
1776 
1783 static int
1785  const struct AttributeDeleteMessage *dam)
1786 {
1787  uint16_t size;
1788 
1789  size = ntohs (dam->header.size);
1790  if (size <= sizeof(struct AttributeDeleteMessage))
1791  {
1792  GNUNET_break (0);
1793  return GNUNET_SYSERR;
1794  }
1795  return GNUNET_OK;
1796 }
1797 
1798 
1805 static void
1807  const struct AttributeDeleteMessage *dam)
1808 {
1809  struct AttributeDeleteHandle *adh;
1810  struct IdpClient *idp = cls;
1811  size_t data_len;
1812 
1813  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n");
1814 
1815  data_len = ntohs (dam->attr_len);
1816 
1817  adh = GNUNET_new (struct AttributeDeleteHandle);
1818  adh->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &dam[1],
1819  data_len);
1820  adh->claim = NULL;
1821 
1822  adh->r_id = ntohl (dam->id);
1823  adh->identity = dam->identity;
1824  adh->label
1826  sizeof(adh->credential->id));
1828  adh->client = idp;
1829  GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh);
1831  &adh->identity,
1832  adh->label,
1833  0,
1834  NULL,
1836  adh);
1837 }
1838 
1839 
1840 /*************************************************
1841  * Attribute iteration
1842  *************************************************/
1843 
1844 
1850 static void
1852 {
1853  struct Iterator *ai = cls;
1854  struct GNUNET_MQ_Envelope *env;
1855  struct AttributeResultMessage *arm;
1856 
1857  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
1859  arm->id = htonl (ai->request_id);
1860  arm->attr_len = htons (0);
1861  GNUNET_MQ_send (ai->client->mq, env);
1862  GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
1863  ai->client->attr_iter_tail,
1864  ai);
1865  GNUNET_free (ai);
1866 }
1867 
1868 
1874 static void
1875 attr_iter_error (void *cls)
1876 {
1877  struct Iterator *ai = cls;
1878 
1879  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1881 }
1882 
1883 
1893 static void
1894 attr_iter_cb (void *cls,
1895  const struct GNUNET_IDENTITY_PrivateKey *zone,
1896  const char *label,
1897  unsigned int rd_count,
1898  const struct GNUNET_GNSRECORD_Data *rd)
1899 {
1900  struct Iterator *ai = cls;
1901  struct GNUNET_MQ_Envelope *env;
1902  char *data_tmp;
1903 
1904  if ((rd_count != 1) ||
1906  {
1908  return;
1909  }
1910  struct AttributeResultMessage *arm;
1911  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
1912  label);
1914  "Sending ATTRIBUTE_RESULT message\n");
1915  env = GNUNET_MQ_msg_extra (arm,
1916  rd->data_size,
1918  arm->id = htonl (ai->request_id);
1919  arm->attr_len = htons (rd->data_size);
1921  data_tmp = (char *) &arm[1];
1922  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1923  GNUNET_MQ_send (ai->client->mq, env);
1924 }
1925 
1926 
1933 static void
1935  const struct AttributeIterationStartMessage *ais_msg)
1936 {
1937  struct IdpClient *idp = cls;
1938  struct Iterator *ai;
1939 
1941  "Received ATTRIBUTE_ITERATION_START message\n");
1942  ai = GNUNET_new (struct Iterator);
1943  ai->request_id = ntohl (ais_msg->id);
1944  ai->client = idp;
1945  ai->identity = ais_msg->identity;
1946 
1947  GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, idp->attr_iter_tail, ai);
1949  &ai->identity,
1950  &attr_iter_error,
1951  ai,
1952  &attr_iter_cb,
1953  ai,
1955  ai);
1957 }
1958 
1959 
1966 static void
1968  const struct AttributeIterationStopMessage *ais_msg)
1969 {
1970  struct IdpClient *idp = cls;
1971  struct Iterator *ai;
1972  uint32_t rid;
1973 
1975  "Received `%s' message\n",
1976  "ATTRIBUTE_ITERATION_STOP");
1977  rid = ntohl (ais_msg->id);
1978  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1979  if (ai->request_id == rid)
1980  break;
1981  if (NULL == ai)
1982  {
1983  GNUNET_break (0);
1985  return;
1986  }
1987  GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
1988  GNUNET_free (ai);
1990 }
1991 
1992 
1999 static void
2001  const struct AttributeIterationNextMessage *ais_msg)
2002 {
2003  struct IdpClient *idp = cls;
2004  struct Iterator *ai;
2005  uint32_t rid;
2006 
2008  "Received ATTRIBUTE_ITERATION_NEXT message\n");
2009  rid = ntohl (ais_msg->id);
2010  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
2011  if (ai->request_id == rid)
2012  break;
2013  if (NULL == ai)
2014  {
2015  GNUNET_break (0);
2017  return;
2018  }
2021 }
2022 
2023 
2024 /*************************************************
2025  * Credential iteration
2026  *************************************************/
2027 
2028 
2034 static void
2036 {
2037  struct Iterator *ai = cls;
2038  struct GNUNET_MQ_Envelope *env;
2039  struct CredentialResultMessage *arm;
2040 
2041  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n");
2043  arm->id = htonl (ai->request_id);
2044  arm->credential_len = htons (0);
2045  GNUNET_MQ_send (ai->client->mq, env);
2046  GNUNET_CONTAINER_DLL_remove (ai->client->cred_iter_head,
2047  ai->client->cred_iter_tail,
2048  ai);
2049  GNUNET_free (ai);
2050 }
2051 
2052 
2058 static void
2059 cred_iter_error (void *cls)
2060 {
2061  struct Iterator *ai = cls;
2062 
2063  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over credentials\n");
2065 }
2066 
2067 
2077 static void
2078 cred_iter_cb (void *cls,
2079  const struct GNUNET_IDENTITY_PrivateKey *zone,
2080  const char *label,
2081  unsigned int rd_count,
2082  const struct GNUNET_GNSRECORD_Data *rd)
2083 {
2084  struct Iterator *ai = cls;
2085  struct GNUNET_MQ_Envelope *env;
2086  struct CredentialResultMessage *arm;
2087  char *data_tmp;
2088 
2089  if ((rd_count != 1) ||
2091  {
2093  return;
2094  }
2095  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found credential under: %s\n",
2096  label);
2098  "Sending CREDENTIAL_RESULT message\n");
2099  env = GNUNET_MQ_msg_extra (arm,
2100  rd->data_size,
2102  arm->id = htonl (ai->request_id);
2103  arm->credential_len = htons (rd->data_size);
2105  data_tmp = (char *) &arm[1];
2106  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
2107 
2108  GNUNET_MQ_send (ai->client->mq, env);
2109 }
2110 
2111 
2118 static void
2120  const struct
2122 {
2123  struct IdpClient *idp = cls;
2124  struct Iterator *ai;
2125 
2127  "Received CREDENTIAL_ITERATION_START message\n");
2128  ai = GNUNET_new (struct Iterator);
2129  ai->request_id = ntohl (ais_msg->id);
2130  ai->client = idp;
2131  ai->identity = ais_msg->identity;
2132 
2133  GNUNET_CONTAINER_DLL_insert (idp->cred_iter_head, idp->cred_iter_tail,
2134  ai);
2136  &ai->identity,
2137  &cred_iter_error,
2138  ai,
2139  &cred_iter_cb,
2140  ai,
2142  ai);
2144 }
2145 
2146 
2153 static void
2155  const struct
2157 {
2158  struct IdpClient *idp = cls;
2159  struct Iterator *ai;
2160  uint32_t rid;
2161 
2163  "Received `%s' message\n",
2164  "CREDENTIAL_ITERATION_STOP");
2165  rid = ntohl (ais_msg->id);
2166  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2167  if (ai->request_id == rid)
2168  break;
2169  if (NULL == ai)
2170  {
2171  GNUNET_break (0);
2173  return;
2174  }
2175  GNUNET_CONTAINER_DLL_remove (idp->cred_iter_head, idp->cred_iter_tail,
2176  ai);
2177  GNUNET_free (ai);
2179 }
2180 
2181 
2188 static void
2190  const struct
2192 {
2193  struct IdpClient *idp = cls;
2194  struct Iterator *ai;
2195  uint32_t rid;
2196 
2198  "Received CREDENTIAL_ITERATION_NEXT message\n");
2199  rid = ntohl (ais_msg->id);
2200  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2201  if (ai->request_id == rid)
2202  break;
2203  if (NULL == ai)
2204  {
2205  GNUNET_break (0);
2207  return;
2208  }
2211 }
2212 
2213 
2214 /******************************************************
2215  * Ticket iteration
2216  ******************************************************/
2217 
2224 static void
2226 {
2227  struct TicketIteration *ti = cls;
2228  struct GNUNET_MQ_Envelope *env;
2229  struct TicketResultMessage *trm;
2230 
2232  if (NULL == ticket)
2233  {
2234  /* send empty response to indicate end of list */
2236  ti->client->ticket_iter_tail,
2237  ti);
2238  }
2239  else
2240  {
2241  trm->ticket = *ticket;
2242  }
2243  trm->id = htonl (ti->r_id);
2244  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
2245  GNUNET_MQ_send (ti->client->mq, env);
2246  if (NULL == ticket)
2247  GNUNET_free (ti);
2248 }
2249 
2250 
2257 static void
2259  void *cls,
2260  const struct TicketIterationStartMessage *tis_msg)
2261 {
2262  struct IdpClient *client = cls;
2263  struct TicketIteration *ti;
2264 
2266  "Received TICKET_ITERATION_START message\n");
2267  ti = GNUNET_new (struct TicketIteration);
2268  ti->r_id = ntohl (tis_msg->id);
2269  ti->client = client;
2270 
2273  ti);
2274  ti->iter
2277 }
2278 
2279 
2286 static void
2288  const struct TicketIterationStopMessage *tis_msg)
2289 {
2290  struct IdpClient *client = cls;
2291  struct TicketIteration *ti;
2292  uint32_t rid;
2293 
2295  "Received `%s' message\n",
2296  "TICKET_ITERATION_STOP");
2297  rid = ntohl (tis_msg->id);
2298  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2299  if (ti->r_id == rid)
2300  break;
2301  if (NULL == ti)
2302  {
2303  GNUNET_break (0);
2305  return;
2306  }
2310  ti);
2311  GNUNET_free (ti);
2313 }
2314 
2315 
2322 static void
2324  const struct TicketIterationNextMessage *tis_msg)
2325 {
2326  struct IdpClient *client = cls;
2327  struct TicketIteration *ti;
2328  uint32_t rid;
2329 
2331  "Received TICKET_ITERATION_NEXT message\n");
2332  rid = ntohl (tis_msg->id);
2333  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2334  if (ti->r_id == rid)
2335  break;
2336  if (NULL == ti)
2337  {
2338  GNUNET_break (0);
2340  return;
2341  }
2344 }
2345 
2346 
2354 static void
2355 run (void *cls,
2356  const struct GNUNET_CONFIGURATION_Handle *c,
2357  struct GNUNET_SERVICE_Handle *server)
2358 {
2359  cfg = c;
2360 
2362  {
2364  "Unable to initialize TICKETS subsystem.\n");
2366  return;
2367  }
2368  // Connect to identity and namestore services
2370  if (NULL == nsh)
2371  {
2373  "error connecting to namestore");
2374  }
2375 
2377 }
2378 
2379 
2387 static void
2389  struct GNUNET_SERVICE_Client *client,
2390  void *app_ctx)
2391 {
2392  struct IdpClient *idp = app_ctx;
2393 
2394  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
2397  idp);
2398  cleanup_client (idp);
2399 }
2400 
2401 
2410 static void *
2412  struct GNUNET_SERVICE_Client *client,
2413  struct GNUNET_MQ_Handle *mq)
2414 {
2415  struct IdpClient *idp;
2416 
2417  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
2418  idp = GNUNET_new (struct IdpClient);
2419  idp->client = client;
2420  idp->mq = mq;
2423  idp);
2424  return idp;
2425 }
2426 
2427 
2432  "reclaim",
2434  &run,
2437  NULL,
2438  GNUNET_MQ_hd_var_size (attribute_store_message,
2440  struct AttributeStoreMessage,
2441  NULL),
2442  GNUNET_MQ_hd_var_size (credential_store_message,
2444  struct AttributeStoreMessage,
2445  NULL),
2446  GNUNET_MQ_hd_var_size (attribute_delete_message,
2448  struct AttributeDeleteMessage,
2449  NULL),
2450  GNUNET_MQ_hd_var_size (credential_delete_message,
2452  struct AttributeDeleteMessage,
2453  NULL),
2457  NULL),
2458  GNUNET_MQ_hd_fixed_size (iteration_next,
2461  NULL),
2462  GNUNET_MQ_hd_fixed_size (iteration_stop,
2465  NULL),
2466  GNUNET_MQ_hd_fixed_size (credential_iteration_start,
2469  NULL),
2470  GNUNET_MQ_hd_fixed_size (credential_iteration_next,
2473  NULL),
2474  GNUNET_MQ_hd_fixed_size (credential_iteration_stop,
2477  NULL),
2478 
2479  GNUNET_MQ_hd_var_size (issue_ticket_message,
2481  struct IssueTicketMessage,
2482  NULL),
2483  GNUNET_MQ_hd_var_size (consume_ticket_message,
2485  struct ConsumeTicketMessage,
2486  NULL),
2487  GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
2490  NULL),
2491  GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
2494  NULL),
2495  GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
2498  NULL),
2499  GNUNET_MQ_hd_var_size (revoke_ticket_message,
2501  struct RevokeTicketMessage,
2502  NULL),
2504 /* end of gnunet-service-reclaim.c */
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE
identity attribute
#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION
Record type for a presentation of a credential.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF
for reclaim records
#define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL
Record type for an attribute attestation (e.g.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
local ticket reference
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static struct GNUNET_CADET_ListTunnels * tio
Active tunnel listing operation.
Definition: gnunet-cadet.c:112
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
uint32_t data
The data value.
static char * zone
Name of the zone being managed.
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static void handle_ticket_iteration_next(void *cls, const struct TicketIterationNextMessage *tis_msg)
Client requests next result.
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.
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 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.
static int check_consume_ticket_message(void *cls, const struct ConsumeTicketMessage *cm)
Check a consume ticket message.
static int check_issue_ticket_message(void *cls, const struct IssueTicketMessage *im)
Check issue ticket message.
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
static void handle_issue_ticket_message(void *cls, const struct IssueTicketMessage *im)
Handle ticket issue message.
static void update_tickets(void *cls)
Recursion prototype for function.
static void cred_store_task(void *cls)
Add a new credential.
static void attr_iter_finished(void *cls)
Done iterating over attributes.
static void handle_iteration_start(void *cls, const struct AttributeIterationStartMessage *ais_msg)
Iterate over zone to get attributes.
static int check_credential_store_message(void *cls, const struct AttributeStoreMessage *sam)
Check an credential store message.
static int check_revoke_ticket_message(void *cls, const struct RevokeTicketMessage *im)
Check revocation message format.
static void revoke_result_cb(void *cls, int32_t success)
Handles revocation result.
static void handle_credential_iteration_start(void *cls, const struct CredentialIterationStartMessage *ais_msg)
Iterate over zone to get attributes.
static int check_attribute_store_message(void *cls, const struct AttributeStoreMessage *sam)
Check an attribute store message.
static void cred_iter_error(void *cls)
Error iterating over credentials.
static struct IdpClient * client_list_tail
Client list.
static void handle_revoke_ticket_message(void *cls, const struct RevokeTicketMessage *rm)
Handle a revocation message to a ticket.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static void cleanup()
Cleanup task.
static void send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
Send a deletion success response.
static void cred_delete_cont(void *cls, int32_t success, const char *emsg)
Credential deleted callback.
static void consistency_iter_err(void *cls)
Error collecting affected tickets.
static void cred_error(void *cls)
Error looking up potential credential.
static void handle_attribute_delete_message(void *cls, const struct AttributeDeleteMessage *dam)
Handle attribute deletion.
static void purge_attributes(void *cls)
Delete all attributes which reference credentials that no longer exist.
static void handle_credential_delete_message(void *cls, const struct AttributeDeleteMessage *dam)
Handle credential deletion.
static void handle_credential_iteration_next(void *cls, const struct CredentialIterationNextMessage *ais_msg)
Client requests next credential from iterator.
static void run(void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *server)
Main function that will be run.
static void handle_ticket_iteration_start(void *cls, const struct TicketIterationStartMessage *tis_msg)
Client requests a ticket iteration.
static void do_shutdown(void *cls)
Shutdown task.
static void start_consistency_update(void *cls)
Start processing tickets which may still contain reference to deleted attribute.
static void consistency_iter_fin(void *cls)
Done collecting affected tickets, start updating.
static void ticket_iter_cb(void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
Got a ticket.
static void cred_store_cont(void *cls, int32_t success, const char *emsg)
Credential store result handler.
static void ticket_updated(void *cls, int32_t success, const char *emsg)
Callback called when a ticket was updated.
static void handle_credential_store_message(void *cls, const struct AttributeStoreMessage *sam)
Handle a credential store message.
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.
static void handle_consume_ticket_message(void *cls, const struct ConsumeTicketMessage *cm)
Handle a consume ticket message.
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
static int check_credential_delete_message(void *cls, const struct AttributeDeleteMessage *dam)
Check credential delete message format.
static void handle_attribute_store_message(void *cls, const struct AttributeStoreMessage *sam)
Handle an attribute store message.
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.
static void cred_iter_finished(void *cls)
Done iterating over credentials.
static struct IdpClient * client_list_head
Client list.
static struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task.
static void attr_iter_error(void *cls)
Error iterating over attributes.
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 int check_attribute_delete_message(void *cls, const struct AttributeDeleteMessage *dam)
Check attribute delete message format.
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.
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.
static void offending_attr_delete_cont(void *cls, int32_t success, const char *emsg)
static void handle_iteration_stop(void *cls, const struct AttributeIterationStopMessage *ais_msg)
Handle iteration stop message from client.
static void attr_store_task(void *cls)
Add a new attribute.
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx)
Called whenever a client is disconnected.
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.
static void handle_credential_iteration_stop(void *cls, const struct CredentialIterationStopMessage *ais_msg)
Handle iteration stop message from client.
static void cleanup_client(struct IdpClient *idp)
Cleanup client.
static void cleanup_as_handle(struct AttributeStoreHandle *ash)
Cleanup attribute store handle.
static void handle_iteration_next(void *cls, const struct AttributeIterationNextMessage *ais_msg)
Client requests next attribute from iterator.
static void handle_ticket_iteration_stop(void *cls, const struct TicketIterationStopMessage *tis_msg)
Client has had enough tickets.
static void attr_delete_cont(void *cls, int32_t success, const char *emsg)
Attribute deleted callback.
static void attr_store_cont(void *cls, int32_t success, const char *emsg)
Attribute store result handler.
void RECLAIM_TICKETS_iteration_stop(struct RECLAIM_TICKETS_Iterator *iter)
Stop a running ticket iteration.
void RECLAIM_TICKETS_consume_cancel(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cancel a consume operation.
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.
void RECLAIM_TICKETS_revoke_cancel(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cancel a revocation.
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.
int RECLAIM_TICKETS_init(const struct GNUNET_CONFIGURATION_Handle *c)
Initialize tickets component.
void RECLAIM_TICKETS_iteration_next(struct RECLAIM_TICKETS_Iterator *iter)
Continue ticket iteration.
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 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.
void RECLAIM_TICKETS_deinit(void)
Close handles and clean up.
static char buf[2048]
static void iteration_start()
#define GNUNET_log(kind,...)
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:53
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_OK
Definition: gnunet_common.h:95
@ GNUNET_YES
Definition: gnunet_common.h:97
@ GNUNET_NO
Definition: gnunet_common.h:94
@ GNUNET_SYSERR
Definition: gnunet_common.h:93
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
int GNUNET_GNSRECORD_records_deserialize(size_t len, const char *src, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *dest)
Deserialize the given records to the given destination.
ssize_t GNUNET_GNSRECORD_records_serialize(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest)
Serialize the given records to the given destination buffer.
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.
@ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION
This expiration time of the record is a relative time (not an absolute time).
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
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
@ GNUNET_ERROR_TYPE_INFO
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
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
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#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
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
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 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.
void GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it, uint64_t limit)
Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_start for the next record.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
struct GNUNET_NAMESTORE_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.
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
#define GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT
#define GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP
#define GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT
#define GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET
#define GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE
#define GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
#define GNUNET_RECLAIM_id_is_equal(a, b)
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
void GNUNET_RECLAIM_credential_list_destroy(struct GNUNET_RECLAIM_CredentialList *credentials)
Destroy claim list.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_deserialize(const char *data, size_t data_size)
Deserialize an credential.
#define GNUNET_RECLAIM_id_is_zero(a)
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_deserialize(const char *data, size_t data_size)
Deserialize a presentation.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attribute_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
#define GNUNET_RECLAIM_id_generate(id)
size_t GNUNET_RECLAIM_attribute_serialize_get_size(const struct GNUNET_RECLAIM_Attribute *attr)
Get required size for serialization buffer.
size_t GNUNET_RECLAIM_attribute_list_serialize(const struct GNUNET_RECLAIM_AttributeList *attrs, char *result)
Serialize an attribute list.
ssize_t GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size, struct GNUNET_RECLAIM_Attribute **attr)
Deserialize an attribute.
size_t GNUNET_RECLAIM_presentation_list_serialize(const struct GNUNET_RECLAIM_PresentationList *presentations, char *result)
Serialize a presentation list.
size_t GNUNET_RECLAIM_credential_serialize(const struct GNUNET_RECLAIM_Credential *credential, char *result)
Serialize an credential.
size_t GNUNET_RECLAIM_presentation_list_serialize_get_size(const struct GNUNET_RECLAIM_PresentationList *presentations)
Get required size for serialization buffer.
size_t GNUNET_RECLAIM_attribute_list_serialize_get_size(const struct GNUNET_RECLAIM_AttributeList *attrs)
Get required size for serialization buffer.
size_t GNUNET_RECLAIM_credential_serialize_get_size(const struct GNUNET_RECLAIM_Credential *credential)
Get required size for serialization buffer.
size_t GNUNET_RECLAIM_attribute_serialize(const struct GNUNET_RECLAIM_Attribute *attr, char *result)
Serialize an attribute.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:531
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_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,...
Definition: scheduler.c:1331
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:972
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2325
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2244
@ GNUNET_SERVICE_OPTION_NONE
Use defaults.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:750
static unsigned int size
Size of the "table".
Definition: peer.c:67
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
Common type definitions for the identity provider service and API.
Handle for attribute deletion request.
struct GNUNET_RECLAIM_CredentialList * existing_credentials
Existing credentials.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
struct AttributeDeleteHandle * next
DLL.
struct IdpClient * client
Client connection.
char * label
Attribute label.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
struct GNUNET_RECLAIM_AttributeList * existing_attributes
Existing attributes.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct AttributeDeleteHandle * prev
DLL.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
struct GNUNET_RECLAIM_Credential * credential
The credential to delete.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
Use to delete an identity attribute.
Definition: reclaim.h:75
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT.
Definition: reclaim.h:79
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:89
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:94
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:84
Ask for next result of attribute iteration for the given operation.
Definition: reclaim.h:223
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:232
Start a attribute iteration for the given identity.
Definition: reclaim.h:201
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:215
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:210
Stop attribute iteration for the given operation.
Definition: reclaim.h:296
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:305
Attribute is returned from the idp.
Definition: reclaim.h:125
struct GNUNET_IDENTITY_PublicKey identity
The public key of the identity.
Definition: reclaim.h:154
uint16_t attr_len
Length of serialized attribute data.
Definition: reclaim.h:139
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:134
Handle for attribute store request.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct IdpClient * client
Client connection.
struct GNUNET_RECLAIM_Credential * credential
The credential to store.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
struct GNUNET_TIME_Relative exp
The attribute expiration interval.
struct AttributeStoreHandle * prev
DLL.
struct GNUNET_IDENTITY_PublicKey identity_pkey
Identity pubkey.
struct AttributeStoreHandle * next
DLL.
struct GNUNET_RECLAIM_Attribute * claim
The attribute to store.
Use to store an identity attribute.
Definition: reclaim.h:41
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT.
Definition: reclaim.h:45
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:55
uint64_t exp
The expiration interval of the attribute.
Definition: reclaim.h:60
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:65
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:50
Ticket consume message.
Definition: reclaim.h:482
struct GNUNET_RECLAIM_Ticket ticket
The ticket to consume.
Definition: reclaim.h:501
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:491
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET.
Definition: reclaim.h:486
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:496
Handle for ticket consume request.
struct ConsumeTicketOperation * next
DLL.
struct IdpClient * client
Client connection.
struct ConsumeTicketOperation * prev
DLL.
struct RECLAIM_TICKETS_ConsumeHandle * ch
Ticket consume handle.
Attribute list is returned from the idp.
Definition: reclaim.h:508
uint16_t attrs_len
Length of serialized attribute data.
Definition: reclaim.h:527
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:517
uint32_t result
Result.
Definition: reclaim.h:522
struct GNUNET_IDENTITY_PublicKey identity
The public key of the identity.
Definition: reclaim.h:542
Ask for next result of credential iteration for the given operation.
Definition: reclaim.h:262
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:271
Start a credential iteration for the given identity.
Definition: reclaim.h:240
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:249
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:254
Stop credential iteration for the given operation.
Definition: reclaim.h:279
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:288
Credential is returned from the idp.
Definition: reclaim.h:165
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:174
struct GNUNET_IDENTITY_PublicKey identity
The public key of the identity.
Definition: reclaim.h:189
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
uint64_t expiration_time
Expiration time for the DNS record.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Handle to a message queue.
Definition: mq.c:86
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
Connection to the NAMESTORE service.
An QueueEntry used to store information for a pending NAMESTORE record operation.
Definition: namestore_api.c:54
Handle for a zone iterator operation.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
A list of GNUNET_RECLAIM_Attribute structures.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
struct GNUNET_RECLAIM_Identifier id
ID.
struct GNUNET_RECLAIM_CredentialListEntry * next
DLL.
struct GNUNET_RECLAIM_Credential * credential
The credential.
A list of GNUNET_RECLAIM_Credential structures.
struct GNUNET_RECLAIM_CredentialListEntry * list_head
List head.
struct GNUNET_RECLAIM_CredentialListEntry * list_tail
List tail.
const char * name
The name of the credential.
struct GNUNET_RECLAIM_Identifier id
ID.
struct GNUNET_CLIENT_Connection * client
Socket (if available).
Definition: reclaim_api.c:327
struct GNUNET_MQ_Handle * mq
Connection to service (if available).
Definition: reclaim_api.c:392
A list of GNUNET_RECLAIM_Presentation structures.
A credential presentation.
struct GNUNET_RECLAIM_Identifier credential_id
The credential id of which this is a presentation.
The authorization ticket.
Entry in list of pending tasks.
Definition: scheduler.c:135
Handle to a client that is connected to a service.
Definition: service.c:251
Handle to a service.
Definition: service.c:117
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
struct GNUNET_TRANSPORT_AddressIdentifier * next
Kept in a DLL.
An idp client.
struct IdpClient * next
DLL.
struct TicketIteration * ticket_iter_tail
Tail of DLL of ticket iteration ops.
struct GNUNET_SERVICE_Client * client
The client.
struct Iterator * attr_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
struct IdpClient * prev
DLL.
struct TicketRevocationOperation * revoke_op_head
Head of DLL of ticket revocation ops.
struct AttributeStoreHandle * store_op_head
Head of DLL of attribute store ops.
struct TicketIssueOperation * issue_op_tail
Tail of DLL of ticket issue ops.
struct Iterator * cred_iter_tail
Tail of the DLL of Credential iteration operations in progress initiated by this client.
struct AttributeDeleteHandle * delete_op_tail
Tail of DLL of attribute delete ops.
struct TicketRevocationOperation * revoke_op_tail
Tail of DLL of ticket revocation ops.
struct TicketIssueOperation * issue_op_head
Head of DLL of ticket issue ops.
struct AttributeDeleteHandle * delete_op_head
Head of DLL of attribute delete ops.
struct Iterator * cred_iter_head
Head of the DLL of Credential iteration operations in progress initiated by this client.
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
struct AttributeStoreHandle * store_op_tail
Tail of DLL of attribute store ops.
struct ConsumeTicketOperation * consume_op_head
Head of DLL of ticket consume ops.
struct ConsumeTicketOperation * consume_op_tail
Tail of DLL of ticket consume ops.
struct TicketIteration * ticket_iter_head
Head of DLL of ticket iteration ops.
struct Iterator * attr_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
Ticket issue message.
Definition: reclaim.h:368
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:377
uint32_t attr_len
length of serialized attribute list
Definition: reclaim.h:392
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET.
Definition: reclaim.h:372
struct GNUNET_IDENTITY_PublicKey rp
Requesting party.
Definition: reclaim.h:387
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:382
An attribute iteration operation.
struct Iterator * prev
Previous element in the DLL.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
struct GNUNET_IDENTITY_PrivateKey identity
Key of the zone we are iterating over.
struct IdpClient * client
IDP client which intiated this zone iteration.
void * ctx
Context.
struct Iterator * next
Next element in the DLL.
uint32_t request_id
The operation id for the zone iteration in the response for the client.
Ticket revocation request handle.
Ticket revoke message.
Definition: reclaim.h:401
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:415
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:410
struct GNUNET_RECLAIM_Ticket ticket
The ticket to revoke.
Definition: reclaim.h:425
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET.
Definition: reclaim.h:405
Ticket revoke message.
Definition: reclaim.h:432
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:441
uint32_t success
Revocation result.
Definition: reclaim.h:446
Attribute store/delete response message.
Definition: reclaim.h:104
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:113
int32_t op_result
GNUNET_SYSERR on failure, GNUNET_OK on success
Definition: reclaim.h:118
Ticket issue operation handle.
struct TicketIssueOperation * next
DLL.
struct IdpClient * client
Client connection.
struct TicketIssueOperation * prev
DLL.
Ask for next result of ticket iteration for the given operation.
Definition: reclaim.h:334
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:343
Start a ticket iteration for the given identity.
Definition: reclaim.h:312
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:326
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:321
Stop ticket iteration for the given operation.
Definition: reclaim.h:351
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:360
A ticket iteration operation.
struct TicketIteration * next
DLL.
struct IdpClient * client
Client which intiated this zone iteration.
uint32_t r_id
The operation id for the iteration in the response for the client.
struct RECLAIM_TICKETS_Iterator * iter
The ticket iterator.
struct TicketIteration * prev
DLL.
unsigned int rd_count
Record count.
Ticket result message.
Definition: reclaim.h:454
struct GNUNET_RECLAIM_Ticket ticket
The new ticket.
Definition: reclaim.h:473
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:463
uint32_t presentations_len
Length of new presentations created.
Definition: reclaim.h:468
Ticket revocation request handle.
struct TicketRevocationOperation * next
DLL.
struct RECLAIM_TICKETS_RevokeHandle * rh
Revocation handle.
struct TicketRevocationOperation * prev
DLL.
struct IdpClient * client
Client connection.