aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-service-reclaim.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-04-26 20:30:48 +0200
committerChristian Grothoff <christian@grothoff.org>2021-04-26 20:30:48 +0200
commit7908094663ed24359c71669ecda2e37135f4395f (patch)
tree46d945be2ca2405327772839c1fe1e8a5e1b94fd /src/reclaim/gnunet-service-reclaim.c
parentaa78134a557079ce570345e751e4c36c4b2ba79a (diff)
downloadgnunet-7908094663ed24359c71669ecda2e37135f4395f.tar.gz
gnunet-7908094663ed24359c71669ecda2e37135f4395f.zip
-fix many more typos
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c308
1 files changed, 161 insertions, 147 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index 105187c26..84a98d1e4 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -76,7 +76,7 @@ struct TicketIteration
76 struct IdpClient *client; 76 struct IdpClient *client;
77 77
78 /** 78 /**
79 * The operation id fot the iteration in the response for the client 79 * The operation id for the iteration in the response for the client
80 */ 80 */
81 uint32_t r_id; 81 uint32_t r_id;
82 82
@@ -118,7 +118,7 @@ struct Iterator
118 struct GNUNET_NAMESTORE_ZoneIterator *ns_it; 118 struct GNUNET_NAMESTORE_ZoneIterator *ns_it;
119 119
120 /** 120 /**
121 * The operation id fot the zone iteration in the response for the client 121 * The operation id for the zone iteration in the response for the client
122 */ 122 */
123 uint32_t request_id; 123 uint32_t request_id;
124 124
@@ -888,7 +888,8 @@ consume_result_cb (void *cls,
888 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg); 888 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
889 } 889 }
890 attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); 890 attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs);
891 pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations); 891 pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size (
892 presentations);
892 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 893 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
893 "Sending CONSUME_TICKET_RESULT message\n"); 894 "Sending CONSUME_TICKET_RESULT message\n");
894 env = GNUNET_MQ_msg_extra (crm, 895 env = GNUNET_MQ_msg_extra (crm,
@@ -1257,7 +1258,7 @@ check_credential_store_message (void *cls,
1257*/ 1258*/
1258static void 1259static void
1259handle_credential_store_message (void *cls, 1260handle_credential_store_message (void *cls,
1260 const struct AttributeStoreMessage *sam) 1261 const struct AttributeStoreMessage *sam)
1261{ 1262{
1262 struct AttributeStoreHandle *ash; 1263 struct AttributeStoreHandle *ash;
1263 struct IdpClient *idp = cls; 1264 struct IdpClient *idp = cls;
@@ -1319,10 +1320,10 @@ send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
1319 */ 1320 */
1320static void 1321static void
1321consistency_iter (void *cls, 1322consistency_iter (void *cls,
1322 const struct GNUNET_IDENTITY_PrivateKey *zone, 1323 const struct GNUNET_IDENTITY_PrivateKey *zone,
1323 const char *label, 1324 const char *label,
1324 unsigned int rd_count, 1325 unsigned int rd_count,
1325 const struct GNUNET_GNSRECORD_Data *rd) 1326 const struct GNUNET_GNSRECORD_Data *rd)
1326{ 1327{
1327 struct AttributeDeleteHandle *adh = cls; 1328 struct AttributeDeleteHandle *adh = cls;
1328 struct TicketRecordsEntry *le; 1329 struct TicketRecordsEntry *le;
@@ -1331,32 +1332,33 @@ consistency_iter (void *cls,
1331 int is_ticket = GNUNET_NO; 1332 int is_ticket = GNUNET_NO;
1332 for (int i = 0; i < rd_count; i++) 1333 for (int i = 0; i < rd_count; i++)
1333 { 1334 {
1334 switch (rd[i].record_type) { 1335 switch (rd[i].record_type)
1335 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE: 1336 {
1336 ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); 1337 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE:
1337 GNUNET_RECLAIM_attribute_deserialize (rd[i].data, 1338 ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
1338 rd[i].data_size, 1339 GNUNET_RECLAIM_attribute_deserialize (rd[i].data,
1339 &ale->attribute); 1340 rd[i].data_size,
1340 GNUNET_CONTAINER_DLL_insert (adh->existing_attributes->list_head, 1341 &ale->attribute);
1341 adh->existing_attributes->list_tail, 1342 GNUNET_CONTAINER_DLL_insert (adh->existing_attributes->list_head,
1342 ale); 1343 adh->existing_attributes->list_tail,
1343 break; 1344 ale);
1344 case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL: 1345 break;
1345 cle = GNUNET_new (struct GNUNET_RECLAIM_CredentialListEntry); 1346 case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL:
1346 cle->credential = GNUNET_RECLAIM_credential_deserialize (rd[i].data, 1347 cle = GNUNET_new (struct GNUNET_RECLAIM_CredentialListEntry);
1347 rd[i].data_size); 1348 cle->credential = GNUNET_RECLAIM_credential_deserialize (rd[i].data,
1348 GNUNET_CONTAINER_DLL_insert (adh->existing_credentials->list_head, 1349 rd[i].data_size);
1349 adh->existing_credentials->list_tail, 1350 GNUNET_CONTAINER_DLL_insert (adh->existing_credentials->list_head,
1350 cle); 1351 adh->existing_credentials->list_tail,
1351 break; 1352 cle);
1352 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: 1353 break;
1353 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1354 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
1354 "Ticket to delete found (%s)\n", 1355 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1355 label); 1356 "Ticket to delete found (%s)\n",
1356 is_ticket = GNUNET_YES; 1357 label);
1357 break; 1358 is_ticket = GNUNET_YES;
1358 default: 1359 break;
1359 break; 1360 default:
1361 break;
1360 } 1362 }
1361 if (GNUNET_YES == is_ticket) 1363 if (GNUNET_YES == is_ticket)
1362 break; 1364 break;
@@ -1447,47 +1449,55 @@ update_tickets (void *cls)
1447 struct GNUNET_RECLAIM_Presentation *presentation; 1449 struct GNUNET_RECLAIM_Presentation *presentation;
1448 for (i = 0; i < le->rd_count; i++) 1450 for (i = 0; i < le->rd_count; i++)
1449 { 1451 {
1450 switch (rd[i].record_type) { 1452 switch (rd[i].record_type)
1451 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF: 1453 {
1452 for (ale = adh->existing_attributes->list_head; NULL != ale; ale = ale->next) { 1454 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF:
1453 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, 1455 for (ale = adh->existing_attributes->list_head; NULL != ale; ale =
1454 &ale->attribute->id)) { 1456 ale->next)
1455 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1457 {
1456 "Found attribute %s, readding...\n", 1458 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
1457 ale->attribute->name); 1459 &ale->attribute->id))
1458 rd_new[j] = rd[i]; 1460 {
1459 j++; 1461 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1460 break; //Found and added 1462 "Found attribute %s, readding...\n",
1461 } 1463 ale->attribute->name);
1464 rd_new[j] = rd[i];
1465 j++;
1466 break; // Found and added
1462 } 1467 }
1463 break; 1468 }
1464 case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION: 1469 break;
1465 presentation = GNUNET_RECLAIM_presentation_deserialize (rd[i].data, 1470 case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION:
1466 rd[i].data_size); 1471 presentation = GNUNET_RECLAIM_presentation_deserialize (rd[i].data,
1467 for (cle = adh->existing_credentials->list_head; NULL != cle; cle = cle->next) { 1472 rd[i].data_size);
1468 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&presentation->credential_id, 1473 for (cle = adh->existing_credentials->list_head; NULL != cle; cle =
1469 &cle->credential->id)) { 1474 cle->next)
1470 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1475 {
1471 "Found presentation for credential %s, readding...\n", 1476 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (
1472 cle->credential->name); 1477 &presentation->credential_id,
1473 rd_new[j] = rd[i]; 1478 &cle->credential->id))
1474 j++; 1479 {
1475 break; //Found and added 1480 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1476 } 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
1477 } 1486 }
1478 GNUNET_free (presentation); 1487 }
1479 break; 1488 GNUNET_free (presentation);
1480 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: 1489 break;
1481 rd_new[j] = rd[i]; 1490 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
1482 j++; 1491 rd_new[j] = rd[i];
1483 break; //Found and added 1492 j++;
1484 default: 1493 break; // Found and added
1485 GNUNET_break (0); 1494 default:
1495 GNUNET_break (0);
1486 } 1496 }
1487 } 1497 }
1488 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1489 "Updating ticket with %d entries (%d before)...\n", 1499 "Updating ticket with %d entries (%d before)...\n",
1490 j, i); 1500 j, i);
1491 adh->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 1501 adh->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1492 &adh->identity, 1502 &adh->identity,
1493 le->label, 1503 le->label,
@@ -1500,6 +1510,7 @@ update_tickets (void *cls)
1500 GNUNET_free (le); 1510 GNUNET_free (le);
1501} 1511}
1502 1512
1513
1503/** 1514/**
1504 * Delete all attributes which reference credentials 1515 * Delete all attributes which reference credentials
1505 * that no longer exist 1516 * that no longer exist
@@ -1527,7 +1538,6 @@ offending_attr_delete_cont (void *cls, int32_t success, const char *emsg)
1527} 1538}
1528 1539
1529 1540
1530
1531/** 1541/**
1532 * Delete all attributes which reference credentials 1542 * Delete all attributes which reference credentials
1533 * that no longer exist 1543 * that no longer exist
@@ -1546,20 +1556,23 @@ purge_attributes (void *cls)
1546 continue; 1556 continue;
1547 1557
1548 for (cle = adh->existing_credentials->list_head; 1558 for (cle = adh->existing_credentials->list_head;
1549 NULL != cle; cle = cle->next) { 1559 NULL != cle; cle = cle->next)
1560 {
1550 if (GNUNET_YES != 1561 if (GNUNET_YES !=
1551 GNUNET_RECLAIM_id_is_equal (&cle->credential->id, 1562 GNUNET_RECLAIM_id_is_equal (&cle->credential->id,
1552 &ale->attribute->credential)) 1563 &ale->attribute->credential))
1553 continue; 1564 continue;
1554 break; 1565 break;
1555 } 1566 }
1556 if (NULL == cle) { 1567 if (NULL == cle)
1568 {
1557 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1569 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1558 "Found attribute with missing credential\n"); 1570 "Found attribute with missing credential\n");
1559 break; 1571 break;
1560 } 1572 }
1561 } 1573 }
1562 if (NULL == ale) { 1574 if (NULL == ale)
1575 {
1563 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1576 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1564 "Attributes consistent, updating tickets.\n"); 1577 "Attributes consistent, updating tickets.\n");
1565 GNUNET_SCHEDULER_add_now (&update_tickets, adh); 1578 GNUNET_SCHEDULER_add_now (&update_tickets, adh);
@@ -1585,6 +1598,7 @@ purge_attributes (void *cls)
1585 GNUNET_free (label); 1598 GNUNET_free (label);
1586} 1599}
1587 1600
1601
1588/** 1602/**
1589 * Done collecting affected tickets, start updating. 1603 * Done collecting affected tickets, start updating.
1590 * 1604 *
@@ -2242,8 +2256,8 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
2242 */ 2256 */
2243static void 2257static void
2244handle_ticket_iteration_start ( 2258handle_ticket_iteration_start (
2245 void *cls, 2259 void *cls,
2246 const struct TicketIterationStartMessage *tis_msg) 2260 const struct TicketIterationStartMessage *tis_msg)
2247{ 2261{
2248 struct IdpClient *client = cls; 2262 struct IdpClient *client = cls;
2249 struct TicketIteration *ti; 2263 struct TicketIteration *ti;
@@ -2415,76 +2429,76 @@ client_connect_cb (void *cls,
2415 * Define "main" method using service macro. 2429 * Define "main" method using service macro.
2416 */ 2430 */
2417GNUNET_SERVICE_MAIN ( 2431GNUNET_SERVICE_MAIN (
2418 "reclaim", 2432 "reclaim",
2419 GNUNET_SERVICE_OPTION_NONE, 2433 GNUNET_SERVICE_OPTION_NONE,
2420 &run, 2434 &run,
2421 &client_connect_cb, 2435 &client_connect_cb,
2422 &client_disconnect_cb, 2436 &client_disconnect_cb,
2423 NULL, 2437 NULL,
2424 GNUNET_MQ_hd_var_size (attribute_store_message, 2438 GNUNET_MQ_hd_var_size (attribute_store_message,
2425 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, 2439 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
2426 struct AttributeStoreMessage, 2440 struct AttributeStoreMessage,
2427 NULL), 2441 NULL),
2428 GNUNET_MQ_hd_var_size (credential_store_message, 2442 GNUNET_MQ_hd_var_size (credential_store_message,
2429 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE, 2443 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE,
2430 struct AttributeStoreMessage, 2444 struct AttributeStoreMessage,
2431 NULL), 2445 NULL),
2432 GNUNET_MQ_hd_var_size (attribute_delete_message, 2446 GNUNET_MQ_hd_var_size (attribute_delete_message,
2433 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, 2447 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE,
2434 struct AttributeDeleteMessage, 2448 struct AttributeDeleteMessage,
2435 NULL), 2449 NULL),
2436 GNUNET_MQ_hd_var_size (credential_delete_message, 2450 GNUNET_MQ_hd_var_size (credential_delete_message,
2437 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE, 2451 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE,
2438 struct AttributeDeleteMessage, 2452 struct AttributeDeleteMessage,
2439 NULL), 2453 NULL),
2440 GNUNET_MQ_hd_fixed_size (iteration_start, 2454 GNUNET_MQ_hd_fixed_size (iteration_start,
2441 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, 2455 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
2442 struct AttributeIterationStartMessage, 2456 struct AttributeIterationStartMessage,
2443 NULL), 2457 NULL),
2444 GNUNET_MQ_hd_fixed_size (iteration_next, 2458 GNUNET_MQ_hd_fixed_size (iteration_next,
2445 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, 2459 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
2446 struct AttributeIterationNextMessage, 2460 struct AttributeIterationNextMessage,
2447 NULL), 2461 NULL),
2448 GNUNET_MQ_hd_fixed_size (iteration_stop, 2462 GNUNET_MQ_hd_fixed_size (iteration_stop,
2449 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, 2463 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
2450 struct AttributeIterationStopMessage, 2464 struct AttributeIterationStopMessage,
2451 NULL), 2465 NULL),
2452 GNUNET_MQ_hd_fixed_size (credential_iteration_start, 2466 GNUNET_MQ_hd_fixed_size (credential_iteration_start,
2453 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, 2467 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START,
2454 struct CredentialIterationStartMessage, 2468 struct CredentialIterationStartMessage,
2455 NULL), 2469 NULL),
2456 GNUNET_MQ_hd_fixed_size (credential_iteration_next, 2470 GNUNET_MQ_hd_fixed_size (credential_iteration_next,
2457 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, 2471 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT,
2458 struct CredentialIterationNextMessage, 2472 struct CredentialIterationNextMessage,
2459 NULL), 2473 NULL),
2460 GNUNET_MQ_hd_fixed_size (credential_iteration_stop, 2474 GNUNET_MQ_hd_fixed_size (credential_iteration_stop,
2461 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP, 2475 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP,
2462 struct CredentialIterationStopMessage, 2476 struct CredentialIterationStopMessage,
2463 NULL), 2477 NULL),
2464 2478
2465 GNUNET_MQ_hd_var_size (issue_ticket_message, 2479 GNUNET_MQ_hd_var_size (issue_ticket_message,
2466 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, 2480 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
2467 struct IssueTicketMessage, 2481 struct IssueTicketMessage,
2468 NULL), 2482 NULL),
2469 GNUNET_MQ_hd_var_size (consume_ticket_message, 2483 GNUNET_MQ_hd_var_size (consume_ticket_message,
2470 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, 2484 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
2471 struct ConsumeTicketMessage, 2485 struct ConsumeTicketMessage,
2472 NULL), 2486 NULL),
2473 GNUNET_MQ_hd_fixed_size (ticket_iteration_start, 2487 GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
2474 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, 2488 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
2475 struct TicketIterationStartMessage, 2489 struct TicketIterationStartMessage,
2476 NULL), 2490 NULL),
2477 GNUNET_MQ_hd_fixed_size (ticket_iteration_next, 2491 GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
2478 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, 2492 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
2479 struct TicketIterationNextMessage, 2493 struct TicketIterationNextMessage,
2480 NULL), 2494 NULL),
2481 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop, 2495 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
2482 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, 2496 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
2483 struct TicketIterationStopMessage, 2497 struct TicketIterationStopMessage,
2484 NULL), 2498 NULL),
2485 GNUNET_MQ_hd_var_size (revoke_ticket_message, 2499 GNUNET_MQ_hd_var_size (revoke_ticket_message,
2486 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, 2500 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
2487 struct RevokeTicketMessage, 2501 struct RevokeTicketMessage,
2488 NULL), 2502 NULL),
2489 GNUNET_MQ_handler_end ()); 2503 GNUNET_MQ_handler_end ());
2490/* end of gnunet-service-reclaim.c */ 2504/* end of gnunet-service-reclaim.c */