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 
305  char *label;
306 
310  uint32_t r_id;
311 };
312 
313 
318 {
323 
328 
332  struct IdpClient *client;
333 
338 
342  struct GNUNET_CRYPTO_EcdsaPublicKey identity_pkey;
343 
348 
353 
358 
363 
367  uint32_t r_id;
368 };
369 
370 
375 {
380 
385 
389  struct IdpClient *client;
390 
394  uint32_t r_id;
395 
400 };
401 
402 
407 {
412 
417 
421  struct IdpClient *client;
422 
427 
431  uint32_t r_id;
432 };
433 
434 
439 {
444 
449 
453  struct IdpClient *client;
454 
458  uint32_t r_id;
459 };
460 
461 
465 static struct IdpClient *client_list_head = NULL;
466 
470 static struct IdpClient *client_list_tail = NULL;
471 
472 
478 static void
480 {
481  struct TicketRecordsEntry *le;
482 
483  if (NULL != adh->ns_it)
485  if (NULL != adh->ns_qe)
487  if (NULL != adh->label)
488  GNUNET_free (adh->label);
489  if (NULL != adh->claim)
490  GNUNET_free (adh->claim);
491  if (NULL != adh->credential)
492  GNUNET_free (adh->credential);
493  while (NULL != (le = adh->tickets_to_update_head))
494  {
497  le);
498  if (NULL != le->label)
499  GNUNET_free (le->label);
500  if (NULL != le->data)
501  GNUNET_free (le->data);
502  GNUNET_free (le);
503  }
504  GNUNET_free (adh);
505 }
506 
507 
513 static void
515 {
516  if (NULL != ash->ns_qe)
518  if (NULL != ash->claim)
519  GNUNET_free (ash->claim);
520  if (NULL != ash->credential)
521  GNUNET_free (ash->credential);
522  GNUNET_free (ash);
523 }
524 
525 
531 static void
533 {
534  struct Iterator *ai;
535  struct TicketIteration *ti;
536  struct TicketRevocationOperation *rop;
537  struct TicketIssueOperation *iss;
538  struct ConsumeTicketOperation *ct;
539  struct AttributeStoreHandle *as;
540  struct AttributeDeleteHandle *adh;
541 
542  while (NULL != (iss = idp->issue_op_head))
543  {
545  GNUNET_free (iss);
546  }
547  while (NULL != (ct = idp->consume_op_head))
548  {
550  idp->consume_op_tail,
551  ct);
552  if (NULL != ct->ch)
554  GNUNET_free (ct);
555  }
556  while (NULL != (as = idp->store_op_head))
557  {
559  cleanup_as_handle (as);
560  }
561  while (NULL != (adh = idp->delete_op_head))
562  {
564  cleanup_adh (adh);
565  }
566 
567  while (NULL != (ai = idp->attr_iter_head))
568  {
570  GNUNET_free (ai);
571  }
572  while (NULL != (ai = idp->cred_iter_head))
573  {
575  ai);
576  GNUNET_free (ai);
577  }
578 
579  while (NULL != (rop = idp->revoke_op_head))
580  {
582  if (NULL != rop->rh)
584  GNUNET_free (rop);
585  }
586  while (NULL != (ti = idp->ticket_iter_head))
587  {
589  idp->ticket_iter_tail,
590  ti);
591  if (NULL != ti->iter)
593  GNUNET_free (ti);
594  }
595  GNUNET_free (idp);
596 }
597 
598 
602 static void
604 {
605  struct IdpClient *cl;
606 
607  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
608 
609  while (NULL != (cl = client_list_head))
610  {
611  GNUNET_CONTAINER_DLL_remove (client_list_head,
612  client_list_tail,
613  cl);
614  cleanup_client (cl);
615  }
617  if (NULL != timeout_task)
618  GNUNET_SCHEDULER_cancel (timeout_task);
619  if (NULL != nsh)
621 }
622 
623 
629 static void
630 do_shutdown (void *cls)
631 {
632  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n");
633  cleanup ();
634 }
635 
636 
645 static void
647  uint32_t r_id,
648  const struct GNUNET_RECLAIM_Ticket *ticket,
649  const struct GNUNET_RECLAIM_PresentationList *presentations,
650  uint32_t success)
651 {
652  struct TicketResultMessage *irm;
653  struct GNUNET_MQ_Envelope *env;
654  size_t pres_len = 0;
655 
656  if (NULL != presentations)
657  {
658  pres_len =
660  }
661  env = GNUNET_MQ_msg_extra (irm,
662  pres_len,
664  if (NULL != ticket)
665  {
666  irm->ticket = *ticket;
667  }
668  // TODO add success member
669  irm->id = htonl (r_id);
670  irm->presentations_len = htons (pres_len);
671  if (NULL != presentations)
672  {
674  (char*) &irm[1]);
675  }
676  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
677  GNUNET_MQ_send (client->mq, env);
678 }
679 
680 
690 static void
693  struct GNUNET_RECLAIM_PresentationList *presentations,
694  int32_t success,
695  const char *emsg)
696 {
697  struct TicketIssueOperation *tio = cls;
698 
699  if (GNUNET_OK != success)
700  {
701  send_ticket_result (tio->client, tio->r_id, NULL, NULL, GNUNET_SYSERR);
703  tio->client->issue_op_tail,
704  tio);
705  GNUNET_free (tio);
706  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg);
707  return;
708  }
709  send_ticket_result (tio->client, tio->r_id,
710  ticket, presentations, GNUNET_SYSERR);
712  tio->client->issue_op_tail,
713  tio);
714  GNUNET_free (tio);
715 }
716 
717 
725 static int
726 check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
727 {
728  uint16_t size;
729 
730  size = ntohs (im->header.size);
731  if (size <= sizeof(struct IssueTicketMessage))
732  {
733  GNUNET_break (0);
734  return GNUNET_SYSERR;
735  }
736  return GNUNET_OK;
737 }
738 
739 
746 static void
747 handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
748 {
749  struct TicketIssueOperation *tio;
750  struct IdpClient *idp = cls;
751  struct GNUNET_RECLAIM_AttributeList *attrs;
753  size_t attrs_len;
754 
755  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
756  tio = GNUNET_new (struct TicketIssueOperation);
757  attrs_len = ntohs (im->attr_len);
758  attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1],
759  attrs_len);
760  for (le = attrs->list_head; NULL != le; le = le->next)
762  "List entry: %s\n", le->attribute->name);
763 
764  tio->r_id = ntohl (im->id);
765  tio->client = idp;
767  RECLAIM_TICKETS_issue (&im->identity,
768  attrs,
769  &im->rp,
771  tio);
774 }
775 
776 
777 /**********************************************************
778 * Revocation
779 **********************************************************/
780 
787 static void
788 revoke_result_cb (void *cls, int32_t success)
789 {
790  struct TicketRevocationOperation *rop = cls;
791  struct GNUNET_MQ_Envelope *env;
792  struct RevokeTicketResultMessage *trm;
793 
795  "Sending REVOKE_TICKET_RESULT message\n");
796  rop->rh = NULL;
798  trm->id = htonl (rop->r_id);
799  trm->success = htonl (success);
800  GNUNET_MQ_send (rop->client->mq, env);
802  rop->client->revoke_op_tail,
803  rop);
804  GNUNET_free (rop);
805 }
806 
807 
815 static int
817 {
818  uint16_t size;
819 
820  size = ntohs (im->header.size);
821  if (size != sizeof(struct RevokeTicketMessage))
822  {
823  GNUNET_break (0);
824  return GNUNET_SYSERR;
825  }
826  return GNUNET_OK;
827 }
828 
829 
836 static void
838 {
839  struct TicketRevocationOperation *rop;
840  struct IdpClient *idp = cls;
841 
842  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
843  rop = GNUNET_new (struct TicketRevocationOperation);
844  rop->r_id = ntohl (rm->id);
845  rop->client = idp;
847  rop->rh
849  rop);
851 }
852 
853 
863 static void
864 consume_result_cb (void *cls,
866  const struct GNUNET_RECLAIM_AttributeList *attrs,
867  const struct GNUNET_RECLAIM_PresentationList *presentations,
868  int32_t success,
869  const char *emsg)
870 {
871  struct ConsumeTicketOperation *cop = cls;
872  struct ConsumeTicketResultMessage *crm;
873  struct GNUNET_MQ_Envelope *env;
874  char *data_tmp;
875  size_t attrs_len = 0;
876  size_t pres_len = 0;
877 
878  if (GNUNET_OK != success)
879  {
880  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
881  }
883  pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations);
885  "Sending CONSUME_TICKET_RESULT message\n");
886  env = GNUNET_MQ_msg_extra (crm,
887  attrs_len + pres_len,
889  crm->id = htonl (cop->r_id);
890  crm->attrs_len = htons (attrs_len);
891  crm->presentations_len = htons (pres_len);
892  crm->identity = *identity;
893  crm->result = htonl (success);
894  data_tmp = (char *) &crm[1];
895  GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp);
896  data_tmp += attrs_len;
897  GNUNET_RECLAIM_presentation_list_serialize (presentations, data_tmp);
898  GNUNET_MQ_send (cop->client->mq, env);
900  cop->client->consume_op_tail,
901  cop);
902  GNUNET_free (cop);
903 }
904 
905 
912 static int
914 {
915  uint16_t size;
916 
917  size = ntohs (cm->header.size);
918  if (size != sizeof(struct ConsumeTicketMessage))
919  {
920  GNUNET_break (0);
921  return GNUNET_SYSERR;
922  }
923  return GNUNET_OK;
924 }
925 
926 
933 static void
935 {
936  struct ConsumeTicketOperation *cop;
937  struct IdpClient *idp = cls;
938 
939  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
940  cop = GNUNET_new (struct ConsumeTicketOperation);
941  cop->r_id = ntohl (cm->id);
942  cop->client = idp;
943  cop->ch
945  cop);
948 }
949 
950 
951 /*****************************************
952 * Attribute store
953 *****************************************/
954 
955 
963 static void
964 attr_store_cont (void *cls, int32_t success, const char *emsg)
965 {
966  struct AttributeStoreHandle *ash = cls;
967  struct GNUNET_MQ_Envelope *env;
968  struct SuccessResultMessage *acr_msg;
969 
970  ash->ns_qe = NULL;
972  ash->client->store_op_tail,
973  ash);
974 
975  if (GNUNET_SYSERR == success)
976  {
978  "Failed to store attribute %s\n",
979  emsg);
980  cleanup_as_handle (ash);
982  return;
983  }
984 
985  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
987  acr_msg->id = htonl (ash->r_id);
988  acr_msg->op_result = htonl (GNUNET_OK);
989  GNUNET_MQ_send (ash->client->mq, env);
990  cleanup_as_handle (ash);
991 }
992 
993 
999 static void
1000 attr_store_task (void *cls)
1001 {
1002  struct AttributeStoreHandle *ash = cls;
1003  struct GNUNET_GNSRECORD_Data rd[1];
1004  char *buf;
1005  char *label;
1006  size_t buf_size;
1007 
1008  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
1010  buf = GNUNET_malloc (buf_size);
1011  // Give the ash a new id if unset
1012  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->claim->id))
1015  label
1017  sizeof (ash->claim->id));
1018  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1019 
1020  rd[0].data_size = buf_size;
1021  rd[0].data = buf;
1024  rd[0].expiration_time = ash->exp.rel_value_us;
1026  &ash->identity,
1027  label,
1028  1,
1029  rd,
1030  &attr_store_cont,
1031  ash);
1032  GNUNET_free (buf);
1033  GNUNET_free (label);
1034 }
1035 
1036 
1043 static int
1045  const struct AttributeStoreMessage *sam)
1046 {
1047  uint16_t size;
1048 
1049  size = ntohs (sam->header.size);
1050  if (size <= sizeof(struct AttributeStoreMessage))
1051  {
1052  GNUNET_break (0);
1053  return GNUNET_SYSERR;
1054  }
1055  return GNUNET_OK;
1056 }
1057 
1058 
1065 static void
1067  const struct AttributeStoreMessage *sam)
1068 {
1069  struct AttributeStoreHandle *ash;
1070  struct IdpClient *idp = cls;
1071  size_t data_len;
1072 
1073  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
1074 
1075  data_len = ntohs (sam->attr_len);
1076 
1077  ash = GNUNET_new (struct AttributeStoreHandle);
1078  GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1],
1079  data_len,
1080  &ash->claim);
1081 
1082  ash->r_id = ntohl (sam->id);
1083  ash->identity = sam->identity;
1084  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1085  GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, &ash->identity_pkey);
1086 
1088  ash->client = idp;
1091 }
1092 
1093 
1101 static void
1102 cred_store_cont (void *cls, int32_t success, const char *emsg)
1103 {
1104  struct AttributeStoreHandle *ash = cls;
1105  struct GNUNET_MQ_Envelope *env;
1106  struct SuccessResultMessage *acr_msg;
1107 
1108  ash->ns_qe = NULL;
1110  ash->client->store_op_tail,
1111  ash);
1112 
1113  if (GNUNET_SYSERR == success)
1114  {
1116  "Failed to store credential: %s\n",
1117  emsg);
1118  cleanup_as_handle (ash);
1120  return;
1121  }
1122 
1123  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1125  acr_msg->id = htonl (ash->r_id);
1126  acr_msg->op_result = htonl (GNUNET_OK);
1127  GNUNET_MQ_send (ash->client->mq, env);
1128  cleanup_as_handle (ash);
1129 }
1130 
1131 
1137 static void
1138 cred_error (void *cls)
1139 {
1140  struct AttributeStoreHandle *ash = cls;
1142  "Failed to check for existing credential.\n");
1143  cleanup_as_handle (ash);
1145  return;
1146 }
1147 
1148 
1158 static void
1159 cred_add_cb (void *cls,
1160  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1161  const char *label,
1162  unsigned int rd_count,
1163  const struct GNUNET_GNSRECORD_Data *rd)
1164 {
1165  struct AttributeStoreHandle *ash = cls;
1166  struct GNUNET_GNSRECORD_Data rd_new[1];
1167  char *buf;
1168  size_t buf_size;
1169 
1171  buf = GNUNET_malloc (buf_size);
1174  "Storing new credential under `%s'.\n",
1175  label);
1176  rd_new[0].data_size = buf_size;
1177  rd_new[0].data = buf;
1180  rd_new[0].expiration_time = ash->exp.rel_value_us;
1182  &ash->identity,
1183  label,
1184  1,
1185  rd_new,
1186  &cred_store_cont,
1187  ash);
1188  GNUNET_free (buf);
1189  return;
1190 }
1191 
1192 
1198 static void
1199 cred_store_task (void *cls)
1200 {
1201  struct AttributeStoreHandle *ash = cls;
1202  char *label;
1203 
1204  // Give the ash a new id if unset
1208  sizeof (ash->credential->id));
1210  "Looking up existing data under label `%s'\n", label);
1212  &ash->identity,
1213  label,
1214  &cred_error,
1215  ash,
1216  &cred_add_cb,
1217  ash);
1218  GNUNET_free (label);
1219 }
1220 
1221 
1228 static int
1230  const struct AttributeStoreMessage *sam)
1231 {
1232  uint16_t size;
1233 
1234  size = ntohs (sam->header.size);
1235  if (size <= sizeof(struct AttributeStoreMessage))
1236  {
1237  GNUNET_break (0);
1238  return GNUNET_SYSERR;
1239  }
1240  return GNUNET_OK;
1241 }
1242 
1243 
1250 static void
1252  const struct AttributeStoreMessage *sam)
1253 {
1254  struct AttributeStoreHandle *ash;
1255  struct IdpClient *idp = cls;
1256  size_t data_len;
1257 
1258  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n");
1259 
1260  data_len = ntohs (sam->attr_len);
1261 
1262  ash = GNUNET_new (struct AttributeStoreHandle);
1263  ash->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &sam[1],
1264  data_len);
1265 
1266  ash->r_id = ntohl (sam->id);
1267  ash->identity = sam->identity;
1268  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1269  GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, &ash->identity_pkey);
1270 
1272  ash->client = idp;
1275 }
1276 
1277 
1284 static void
1285 send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
1286 {
1287  struct GNUNET_MQ_Envelope *env;
1288  struct SuccessResultMessage *acr_msg;
1289 
1291  adh->client->delete_op_tail,
1292  adh);
1293 
1294  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1296  acr_msg->id = htonl (adh->r_id);
1297  acr_msg->op_result = htonl (success);
1298  GNUNET_MQ_send (adh->client->mq, env);
1299 }
1300 
1301 
1312 static void
1313 ticket_iter (void *cls,
1314  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1315  const char *label,
1316  unsigned int rd_count,
1317  const struct GNUNET_GNSRECORD_Data *rd)
1318 {
1319  struct AttributeDeleteHandle *adh = cls;
1320  struct TicketRecordsEntry *le;
1321  int has_changed = GNUNET_NO;
1322  for (int i = 0; i < rd_count; i++)
1323  {
1324  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
1325  continue;
1326  if (adh->claim != NULL)
1328  &adh->claim->id))
1329  continue;
1330  if (adh->credential != NULL)
1331  if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data,
1332  &adh->credential->id))
1333  continue;
1335  "Attribute to delete found (%s)\n",
1336  adh->label);
1337  has_changed = GNUNET_YES;
1338  break;
1339  }
1340  if (GNUNET_YES == has_changed)
1341  {
1342  le = GNUNET_new (struct TicketRecordsEntry);
1343  le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
1344  le->data = GNUNET_malloc (le->data_size);
1345  le->rd_count = rd_count;
1346  le->label = GNUNET_strdup (label);
1347  GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
1350  le);
1351  }
1353 }
1354 
1355 
1360 static void
1361 update_tickets (void *cls);
1362 
1363 
1371 static void
1372 ticket_updated (void *cls, int32_t success, const char *emsg)
1373 {
1374  struct AttributeDeleteHandle *adh = cls;
1375 
1376  adh->ns_qe = NULL;
1378 }
1379 
1380 
1388 static void
1389 update_tickets (void *cls)
1390 {
1391  struct AttributeDeleteHandle *adh = cls;
1392  struct TicketRecordsEntry *le;
1393 
1394  if (NULL == adh->tickets_to_update_head)
1395  {
1397  "Finished updating tickets, success\n");
1399  cleanup_adh (adh);
1400  return;
1401  }
1403  "Updating %s\n",
1405  le = adh->tickets_to_update_head;
1408  le);
1409  struct GNUNET_GNSRECORD_Data rd[le->rd_count];
1410  struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1];
1412  le->data,
1413  le->rd_count,
1414  rd))
1415  {
1417  "Unable to deserialize record data!\n");
1419  cleanup_adh (adh);
1420  return;
1421  }
1422  int j = 0;
1423  for (int i = 0; i < le->rd_count; i++)
1424  {
1425  if (adh->claim != NULL)
1428  &adh->claim->id)))
1429  continue;
1430  if (adh->credential != NULL)
1431  if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1432  && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
1433  &adh->credential->id)))
1434  continue;
1435  rd_new[j] = rd[i];
1436  j++;
1437  }
1439  &adh->identity,
1440  le->label,
1441  j,
1442  rd_new,
1443  &ticket_updated,
1444  adh);
1445  GNUNET_free (le->label);
1446  GNUNET_free (le->data);
1447  GNUNET_free (le);
1448 }
1449 
1450 
1456 static void
1457 ticket_iter_fin (void *cls)
1458 {
1459  struct AttributeDeleteHandle *adh = cls;
1460  adh->ns_it = NULL;
1462 }
1463 
1464 
1470 static void
1471 ticket_iter_err (void *cls)
1472 {
1473  struct AttributeDeleteHandle *adh = cls;
1474 
1475  adh->ns_it = NULL;
1477  "Namestore error on delete %s\n",
1478  adh->label);
1480  cleanup_adh (adh);
1481 }
1482 
1483 
1490 static void
1492 {
1493  struct AttributeDeleteHandle *adh = cls;
1494 
1496  &adh->identity,
1497  &ticket_iter_err,
1498  adh,
1499  &ticket_iter,
1500  adh,
1501  &ticket_iter_fin,
1502  adh);
1503 }
1504 
1505 
1513 static void
1514 attr_delete_cont (void *cls, int32_t success, const char *emsg)
1515 {
1516  struct AttributeDeleteHandle *adh = cls;
1517 
1518  adh->ns_qe = NULL;
1519  if (GNUNET_SYSERR == success)
1520  {
1522  "Error deleting attribute %s\n",
1523  adh->label);
1525  cleanup_adh (adh);
1526  return;
1527  }
1528  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1530 }
1531 
1532 
1539 static int
1541  const struct AttributeDeleteMessage *dam)
1542 {
1543  uint16_t size;
1544 
1545  size = ntohs (dam->header.size);
1546  if (size <= sizeof(struct AttributeDeleteMessage))
1547  {
1548  GNUNET_break (0);
1549  return GNUNET_SYSERR;
1550  }
1551  return GNUNET_OK;
1552 }
1553 
1554 
1561 static void
1563  const struct AttributeDeleteMessage *dam)
1564 {
1565  struct AttributeDeleteHandle *adh;
1566  struct IdpClient *idp = cls;
1567  size_t data_len;
1568 
1569  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n");
1570 
1571  data_len = ntohs (dam->attr_len);
1572 
1573  adh = GNUNET_new (struct AttributeDeleteHandle);
1574  GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1],
1575  data_len,
1576  &adh->claim);
1577  adh->credential = NULL;
1578 
1579  adh->r_id = ntohl (dam->id);
1580  adh->identity = dam->identity;
1581  adh->label
1583  sizeof(adh->claim->id));
1585  adh->client = idp;
1588  &adh->identity,
1589  adh->label,
1590  0,
1591  NULL,
1593  adh);
1594 }
1595 
1596 
1604 static void
1605 cred_delete_cont (void *cls, int32_t success, const char *emsg)
1606 {
1607  struct AttributeDeleteHandle *adh = cls;
1608 
1609  adh->ns_qe = NULL;
1610  if (GNUNET_SYSERR == success)
1611  {
1613  "Error deleting credential `%s'\n",
1614  adh->label);
1616  cleanup_adh (adh);
1617  return;
1618  }
1619  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1621 }
1622 
1623 
1630 static int
1632  const struct AttributeDeleteMessage *dam)
1633 {
1634  uint16_t size;
1635 
1636  size = ntohs (dam->header.size);
1637  if (size <= sizeof(struct AttributeDeleteMessage))
1638  {
1639  GNUNET_break (0);
1640  return GNUNET_SYSERR;
1641  }
1642  return GNUNET_OK;
1643 }
1644 
1645 
1652 static void
1654  const struct AttributeDeleteMessage *dam)
1655 {
1656  struct AttributeDeleteHandle *adh;
1657  struct IdpClient *idp = cls;
1658  size_t data_len;
1659 
1660  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n");
1661 
1662  data_len = ntohs (dam->attr_len);
1663 
1664  adh = GNUNET_new (struct AttributeDeleteHandle);
1665  adh->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &dam[1],
1666  data_len);
1667  adh->claim = NULL;
1668 
1669  adh->r_id = ntohl (dam->id);
1670  adh->identity = dam->identity;
1671  adh->label
1673  sizeof(adh->credential->id));
1675  adh->client = idp;
1678  &adh->identity,
1679  adh->label,
1680  0,
1681  NULL,
1683  adh);
1684 }
1685 
1686 
1687 /*************************************************
1688 * Attrubute iteration
1689 *************************************************/
1690 
1691 
1697 static void
1699 {
1700  struct Iterator *ai = cls;
1701  struct GNUNET_MQ_Envelope *env;
1702  struct AttributeResultMessage *arm;
1703 
1704  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
1706  arm->id = htonl (ai->request_id);
1707  arm->attr_len = htons (0);
1708  GNUNET_MQ_send (ai->client->mq, env);
1710  ai->client->attr_iter_tail,
1711  ai);
1712  GNUNET_free (ai);
1713 }
1714 
1715 
1721 static void
1722 attr_iter_error (void *cls)
1723 {
1724  struct Iterator *ai = cls;
1725 
1726  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1727  attr_iter_finished (ai);
1728 }
1729 
1730 
1740 static void
1741 attr_iter_cb (void *cls,
1742  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1743  const char *label,
1744  unsigned int rd_count,
1745  const struct GNUNET_GNSRECORD_Data *rd)
1746 {
1747  struct Iterator *ai = cls;
1748  struct GNUNET_MQ_Envelope *env;
1749  char *data_tmp;
1750 
1751  if ((rd_count != 1) ||
1753  {
1755  return;
1756  }
1757  struct AttributeResultMessage *arm;
1758  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
1759  label);
1761  "Sending ATTRIBUTE_RESULT message\n");
1762  env = GNUNET_MQ_msg_extra (arm,
1763  rd->data_size,
1765  arm->id = htonl (ai->request_id);
1766  arm->attr_len = htons (rd->data_size);
1768  data_tmp = (char *) &arm[1];
1769  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1770  GNUNET_MQ_send (ai->client->mq, env);
1771 }
1772 
1773 
1780 static void
1782  const struct AttributeIterationStartMessage *ais_msg)
1783 {
1784  struct IdpClient *idp = cls;
1785  struct Iterator *ai;
1786 
1788  "Received ATTRIBUTE_ITERATION_START message\n");
1789  ai = GNUNET_new (struct Iterator);
1790  ai->request_id = ntohl (ais_msg->id);
1791  ai->client = idp;
1792  ai->identity = ais_msg->identity;
1793 
1796  &ai->identity,
1797  &attr_iter_error,
1798  ai,
1799  &attr_iter_cb,
1800  ai,
1802  ai);
1804 }
1805 
1806 
1813 static void
1815  const struct AttributeIterationStopMessage *ais_msg)
1816 {
1817  struct IdpClient *idp = cls;
1818  struct Iterator *ai;
1819  uint32_t rid;
1820 
1822  "Received `%s' message\n",
1823  "ATTRIBUTE_ITERATION_STOP");
1824  rid = ntohl (ais_msg->id);
1825  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1826  if (ai->request_id == rid)
1827  break;
1828  if (NULL == ai)
1829  {
1830  GNUNET_break (0);
1832  return;
1833  }
1835  GNUNET_free (ai);
1837 }
1838 
1839 
1846 static void
1848  const struct AttributeIterationNextMessage *ais_msg)
1849 {
1850  struct IdpClient *idp = cls;
1851  struct Iterator *ai;
1852  uint32_t rid;
1853 
1855  "Received ATTRIBUTE_ITERATION_NEXT message\n");
1856  rid = ntohl (ais_msg->id);
1857  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1858  if (ai->request_id == rid)
1859  break;
1860  if (NULL == ai)
1861  {
1862  GNUNET_break (0);
1864  return;
1865  }
1868 }
1869 
1870 
1871 /*************************************************
1872 * Credential iteration
1873 *************************************************/
1874 
1875 
1881 static void
1883 {
1884  struct Iterator *ai = cls;
1885  struct GNUNET_MQ_Envelope *env;
1886  struct CredentialResultMessage *arm;
1887 
1888  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n");
1890  arm->id = htonl (ai->request_id);
1891  arm->credential_len = htons (0);
1892  GNUNET_MQ_send (ai->client->mq, env);
1894  ai->client->cred_iter_tail,
1895  ai);
1896  GNUNET_free (ai);
1897 }
1898 
1899 
1905 static void
1906 cred_iter_error (void *cls)
1907 {
1908  struct Iterator *ai = cls;
1909 
1910  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over credentials\n");
1911  cred_iter_finished (ai);
1912 }
1913 
1914 
1924 static void
1925 cred_iter_cb (void *cls,
1926  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1927  const char *label,
1928  unsigned int rd_count,
1929  const struct GNUNET_GNSRECORD_Data *rd)
1930 {
1931  struct Iterator *ai = cls;
1932  struct GNUNET_MQ_Envelope *env;
1933  struct CredentialResultMessage *arm;
1934  char *data_tmp;
1935 
1936  if ((rd_count != 1) ||
1938  {
1940  return;
1941  }
1942  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found credential under: %s\n",
1943  label);
1945  "Sending CREDENTIAL_RESULT message\n");
1946  env = GNUNET_MQ_msg_extra (arm,
1947  rd->data_size,
1949  arm->id = htonl (ai->request_id);
1950  arm->credential_len = htons (rd->data_size);
1952  data_tmp = (char *) &arm[1];
1953  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1954 
1955  GNUNET_MQ_send (ai->client->mq, env);
1956 }
1957 
1958 
1965 static void
1967  const struct
1969 {
1970  struct IdpClient *idp = cls;
1971  struct Iterator *ai;
1972 
1974  "Received CREDENTIAL_ITERATION_START message\n");
1975  ai = GNUNET_new (struct Iterator);
1976  ai->request_id = ntohl (ais_msg->id);
1977  ai->client = idp;
1978  ai->identity = ais_msg->identity;
1979 
1981  ai);
1983  &ai->identity,
1984  &cred_iter_error,
1985  ai,
1986  &cred_iter_cb,
1987  ai,
1989  ai);
1991 }
1992 
1993 
2000 static void
2002  const struct
2004 {
2005  struct IdpClient *idp = cls;
2006  struct Iterator *ai;
2007  uint32_t rid;
2008 
2010  "Received `%s' message\n",
2011  "CREDENTIAL_ITERATION_STOP");
2012  rid = ntohl (ais_msg->id);
2013  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2014  if (ai->request_id == rid)
2015  break;
2016  if (NULL == ai)
2017  {
2018  GNUNET_break (0);
2020  return;
2021  }
2023  ai);
2024  GNUNET_free (ai);
2026 }
2027 
2028 
2035 static void
2037  const struct
2039 {
2040  struct IdpClient *idp = cls;
2041  struct Iterator *ai;
2042  uint32_t rid;
2043 
2045  "Received CREDENTIAL_ITERATION_NEXT message\n");
2046  rid = ntohl (ais_msg->id);
2047  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2048  if (ai->request_id == rid)
2049  break;
2050  if (NULL == ai)
2051  {
2052  GNUNET_break (0);
2054  return;
2055  }
2058 }
2059 
2060 
2061 /******************************************************
2062 * Ticket iteration
2063 ******************************************************/
2064 
2071 static void
2073 {
2074  struct TicketIteration *ti = cls;
2075  struct GNUNET_MQ_Envelope *env;
2076  struct TicketResultMessage *trm;
2077 
2079  if (NULL == ticket)
2080  {
2081  /* send empty response to indicate end of list */
2083  ti->client->ticket_iter_tail,
2084  ti);
2085  }
2086  else
2087  {
2088  trm->ticket = *ticket;
2089  }
2090  trm->id = htonl (ti->r_id);
2091  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
2092  GNUNET_MQ_send (ti->client->mq, env);
2093  if (NULL == ticket)
2094  GNUNET_free (ti);
2095 }
2096 
2097 
2104 static void
2106  void *cls,
2107  const struct TicketIterationStartMessage *tis_msg)
2108 {
2109  struct IdpClient *client = cls;
2110  struct TicketIteration *ti;
2111 
2113  "Received TICKET_ITERATION_START message\n");
2114  ti = GNUNET_new (struct TicketIteration);
2115  ti->r_id = ntohl (tis_msg->id);
2116  ti->client = client;
2117 
2119  client->ticket_iter_tail,
2120  ti);
2121  ti->iter
2124 }
2125 
2126 
2133 static void
2135  const struct TicketIterationStopMessage *tis_msg)
2136 {
2137  struct IdpClient *client = cls;
2138  struct TicketIteration *ti;
2139  uint32_t rid;
2140 
2142  "Received `%s' message\n",
2143  "TICKET_ITERATION_STOP");
2144  rid = ntohl (tis_msg->id);
2145  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2146  if (ti->r_id == rid)
2147  break;
2148  if (NULL == ti)
2149  {
2150  GNUNET_break (0);
2152  return;
2153  }
2156  client->ticket_iter_tail,
2157  ti);
2158  GNUNET_free (ti);
2160 }
2161 
2162 
2169 static void
2171  const struct TicketIterationNextMessage *tis_msg)
2172 {
2173  struct IdpClient *client = cls;
2174  struct TicketIteration *ti;
2175  uint32_t rid;
2176 
2178  "Received TICKET_ITERATION_NEXT message\n");
2179  rid = ntohl (tis_msg->id);
2180  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2181  if (ti->r_id == rid)
2182  break;
2183  if (NULL == ti)
2184  {
2185  GNUNET_break (0);
2187  return;
2188  }
2191 }
2192 
2193 
2201 static void
2202 run (void *cls,
2203  const struct GNUNET_CONFIGURATION_Handle *c,
2204  struct GNUNET_SERVICE_Handle *server)
2205 {
2206  cfg = c;
2207 
2208  if (GNUNET_OK != RECLAIM_TICKETS_init (cfg))
2209  {
2211  "Unable to initialize TICKETS subsystem.\n");
2213  return;
2214  }
2215  // Connect to identity and namestore services
2216  nsh = GNUNET_NAMESTORE_connect (cfg);
2217  if (NULL == nsh)
2218  {
2220  "error connecting to namestore");
2221  }
2222 
2224 }
2225 
2226 
2234 static void
2236  struct GNUNET_SERVICE_Client *client,
2237  void *app_ctx)
2238 {
2239  struct IdpClient *idp = app_ctx;
2240 
2241  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
2242  GNUNET_CONTAINER_DLL_remove (client_list_head,
2243  client_list_tail,
2244  idp);
2245  cleanup_client (idp);
2246 }
2247 
2248 
2257 static void *
2259  struct GNUNET_SERVICE_Client *client,
2260  struct GNUNET_MQ_Handle *mq)
2261 {
2262  struct IdpClient *idp;
2263 
2264  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
2265  idp = GNUNET_new (struct IdpClient);
2266  idp->client = client;
2267  idp->mq = mq;
2268  GNUNET_CONTAINER_DLL_insert (client_list_head,
2269  client_list_tail,
2270  idp);
2271  return idp;
2272 }
2273 
2274 
2279  "reclaim",
2281  &run,
2284  NULL,
2285  GNUNET_MQ_hd_var_size (attribute_store_message,
2287  struct AttributeStoreMessage,
2288  NULL),
2289  GNUNET_MQ_hd_var_size (credential_store_message,
2291  struct AttributeStoreMessage,
2292  NULL),
2293  GNUNET_MQ_hd_var_size (attribute_delete_message,
2295  struct AttributeDeleteMessage,
2296  NULL),
2297  GNUNET_MQ_hd_var_size (credential_delete_message,
2299  struct AttributeDeleteMessage,
2300  NULL),
2304  NULL),
2305  GNUNET_MQ_hd_fixed_size (iteration_next,
2308  NULL),
2309  GNUNET_MQ_hd_fixed_size (iteration_stop,
2312  NULL),
2313  GNUNET_MQ_hd_fixed_size (credential_iteration_start,
2316  NULL),
2317  GNUNET_MQ_hd_fixed_size (credential_iteration_next,
2320  NULL),
2321  GNUNET_MQ_hd_fixed_size (credential_iteration_stop,
2324  NULL),
2325 
2326  GNUNET_MQ_hd_var_size (issue_ticket_message,
2328  struct IssueTicketMessage,
2329  NULL),
2330  GNUNET_MQ_hd_var_size (consume_ticket_message,
2332  struct ConsumeTicketMessage,
2333  NULL),
2334  GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
2337  NULL),
2338  GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
2341  NULL),
2342  GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
2345  NULL),
2346  GNUNET_MQ_hd_var_size (revoke_ticket_message,
2348  struct RevokeTicketMessage,
2349  NULL),
2351 /* 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.
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.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
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
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:415
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 GNUNET_RECLAIM_Identifier id
ID.
void RECLAIM_TICKETS_issue(const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, RECLAIM_TICKETS_TicketResult cb, void *cb_cls)
Issue a new reclaim ticket, thereby authorizing the audience to access the set of provided attributes...
struct TicketIssueOperation * prev
DLL.
Attribute list is returned from the idp.
Definition: reclaim.h:507
static void ticket_iter_err(void *cls)
Error collecting affected tickets.
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
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:326
Ticket consume message.
Definition: reclaim.h:481
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
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
static void ticket_iter(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Namestore iteration within attribute deletion.
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
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls)
Lookup an item in the namestore.
static 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.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT)...
const char * name
The name of the attribute.
static void 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.
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
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
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_CRYPTO_EcdsaPublicKey identity
The public key of the identity.
Definition: reclaim.h:189
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attribute_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
struct TicketRevocationOperation * revoke_op_tail
Tail of DLL of ticket revocation ops.
#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 IdpClient * client
Client connection.
struct Iterator * attr_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
#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.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
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...
Private ECC key encoded for transmission.
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
static void cred_iter_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got record.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
struct RECLAIM_TICKETS_Iterator * RECLAIM_TICKETS_iteration_start(const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
Iterate over all tickets issued by an identity.
size_t GNUNET_RECLAIM_attribute_serialize(const struct GNUNET_RECLAIM_Attribute *attr, char *result)
Serialize an attribute.
uint32_t r_id
request id
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:531
static void consume_result_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_PresentationList *presentations, int32_t success, const char *emsg)
Handle a ticket consume result.
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.
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 GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
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.
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 GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:254
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.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF
Record type for reclaim records.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
static void ticket_iter_fin(void *cls)
Done collecting affected tickets, start updating.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:496
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_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.
static struct IdpClient * client_list_head
Client list.
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE
Handle for attribute store request.
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 id
ID.
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 GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:215
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.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Key of the zone we are iterating over.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:210
Ticket issue message.
Definition: reclaim.h:367
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:2323
struct GNUNET_CRYPTO_EcdsaPublicKey identity_pkey
Identity pubkey.
struct IdpClient * client
Client connection.
struct TicketRevocationOperation * next
DLL.
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
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.
static void start_ticket_update(void *cls)
Start processing tickets which may still contain reference to deleted attribute.
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.
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:176
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
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
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 ConsumeTicketOperation * consume_op_tail
Tail of DLL of ticket consume ops.
struct TicketRevocationOperation * revoke_op_head
Head of DLL of ticket revocation ops.
static void iteration_start()
struct TicketRevocationOperation * prev
DLL.
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.
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.
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The public key of the identity.
Definition: reclaim.h:542
#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
struct RECLAIM_TICKETS_RevokeHandle * RECLAIM_TICKETS_revoke(const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls)
Revoke a ticket.
configuration data
Definition: configuration.c:84
struct AttributeStoreHandle * next
DLL.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:321
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
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 RECLAIM_TICKETS_ConsumeHandle * RECLAIM_TICKETS_consume(const struct GNUNET_CRYPTO_EcdsaPrivateKey *id, const struct GNUNET_RECLAIM_Ticket *ticket, RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls)
Consume a ticket.
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.
static void attr_iter_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got record.
Handle for ticket consume request.
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The public key of the identity.
Definition: reclaim.h:154
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.
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
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
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
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:936
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.
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 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:2242
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
static void cred_add_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Check for existing record before storing credential.
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.
#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