aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-service-reclaim.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-05-02 11:27:09 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-05-02 11:27:09 +0200
commit70824dc0035428da3ec00ef7e6aca48eb1302527 (patch)
treee3f59870cdfa2c5491da625ee5c6938c64281e52 /src/reclaim/gnunet-service-reclaim.c
parent8dde46a0133e95c9fa2ba0b525b5d1ebbc75ccec (diff)
downloadgnunet-70824dc0035428da3ec00ef7e6aca48eb1302527.tar.gz
gnunet-70824dc0035428da3ec00ef7e6aca48eb1302527.zip
RECLAIM: cleanup, comments
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c328
1 files changed, 291 insertions, 37 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index d5aeff8d7..6db97fe87 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -24,9 +24,7 @@
24 * 24 *
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27
28#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
29
30#include "gnunet-service-reclaim_tickets.h" 28#include "gnunet-service-reclaim_tickets.h"
31#include "gnunet_constants.h" 29#include "gnunet_constants.h"
32#include "gnunet_gnsrecord_lib.h" 30#include "gnunet_gnsrecord_lib.h"
@@ -124,6 +122,7 @@ struct TicketIteration
124 struct RECLAIM_TICKETS_Iterator *iter; 122 struct RECLAIM_TICKETS_Iterator *iter;
125}; 123};
126 124
125
127/** 126/**
128 * An attribute iteration operation. 127 * An attribute iteration operation.
129 */ 128 */
@@ -160,6 +159,7 @@ struct AttributeIterator
160 uint32_t request_id; 159 uint32_t request_id;
161}; 160};
162 161
162
163/** 163/**
164 * An idp client 164 * An idp client
165 */ 165 */
@@ -251,6 +251,9 @@ struct IdpClient
251}; 251};
252 252
253 253
254/**
255 * Handle for attribute deletion request
256 */
254struct AttributeDeleteHandle 257struct AttributeDeleteHandle
255{ 258{
256 /** 259 /**
@@ -311,6 +314,9 @@ struct AttributeDeleteHandle
311}; 314};
312 315
313 316
317/**
318 * Handle for attribute store request
319 */
314struct AttributeStoreHandle 320struct AttributeStoreHandle
315{ 321{
316 /** 322 /**
@@ -359,6 +365,10 @@ struct AttributeStoreHandle
359 uint32_t r_id; 365 uint32_t r_id;
360}; 366};
361 367
368
369/**
370 * Handle for ticket consume request
371 */
362struct ConsumeTicketOperation 372struct ConsumeTicketOperation
363{ 373{
364 /** 374 /**
@@ -387,6 +397,7 @@ struct ConsumeTicketOperation
387 struct RECLAIM_TICKETS_ConsumeHandle *ch; 397 struct RECLAIM_TICKETS_ConsumeHandle *ch;
388}; 398};
389 399
400
390/** 401/**
391 * Updated attribute IDs 402 * Updated attribute IDs
392 */ 403 */
@@ -413,6 +424,7 @@ struct TicketAttributeUpdateEntry
413 uint64_t new_id; 424 uint64_t new_id;
414}; 425};
415 426
427
416/** 428/**
417 * Ticket revocation request handle 429 * Ticket revocation request handle
418 */ 430 */
@@ -444,6 +456,7 @@ struct TicketRevocationOperation
444 uint32_t r_id; 456 uint32_t r_id;
445}; 457};
446 458
459
447/** 460/**
448 * Ticket issue operation handle 461 * Ticket issue operation handle
449 */ 462 */
@@ -470,6 +483,7 @@ struct TicketIssueOperation
470 uint32_t r_id; 483 uint32_t r_id;
471}; 484};
472 485
486
473/** 487/**
474 * DLL for ego handles to egos containing the RECLAIM_ATTRS in a 488 * DLL for ego handles to egos containing the RECLAIM_ATTRS in a
475 * map in json_t format 489 * map in json_t format
@@ -498,6 +512,7 @@ struct EgoEntry
498 struct GNUNET_CONTAINER_MultiHashMap *attr_map; 512 struct GNUNET_CONTAINER_MultiHashMap *attr_map;
499}; 513};
500 514
515
501/** 516/**
502 * Cleanup task 517 * Cleanup task
503 */ 518 */
@@ -517,6 +532,7 @@ cleanup ()
517 GNUNET_NAMESTORE_disconnect (nsh); 532 GNUNET_NAMESTORE_disconnect (nsh);
518} 533}
519 534
535
520/** 536/**
521 * Shutdown task 537 * Shutdown task
522 * 538 *
@@ -530,6 +546,14 @@ do_shutdown (void *cls)
530} 546}
531 547
532 548
549/**
550 * Sends a ticket result message to the client
551 *
552 * @param client the client to send to
553 * @param r_id the request message ID to reply to
554 * @param ticket the ticket to include (may be NULL)
555 * @param success the success status of the request
556 */
533static void 557static void
534send_ticket_result (const struct IdpClient *client, 558send_ticket_result (const struct IdpClient *client,
535 uint32_t r_id, 559 uint32_t r_id,
@@ -555,6 +579,15 @@ send_ticket_result (const struct IdpClient *client,
555 GNUNET_MQ_send (client->mq, env); 579 GNUNET_MQ_send (client->mq, env);
556} 580}
557 581
582
583/**
584 * Issue ticket result
585 *
586 * @param cls out ticket issue operation handle
587 * @param ticket the issued ticket
588 * @param success issue success status (GNUNET_OK if successful)
589 * @param emsg error message (NULL of success is GNUNET_OK)
590 */
558static void 591static void
559issue_ticket_result_cb (void *cls, 592issue_ticket_result_cb (void *cls,
560 struct GNUNET_RECLAIM_Ticket *ticket, 593 struct GNUNET_RECLAIM_Ticket *ticket,
@@ -578,6 +611,14 @@ issue_ticket_result_cb (void *cls,
578 GNUNET_free (tio); 611 GNUNET_free (tio);
579} 612}
580 613
614
615/**
616 * Check issue ticket message
617 *
618 * @cls unused
619 * @im message to check
620 * @return GNUNET_OK if message is ok
621 */
581static int 622static int
582check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) 623check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
583{ 624{
@@ -591,6 +632,13 @@ check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
591 return GNUNET_OK; 632 return GNUNET_OK;
592} 633}
593 634
635
636/**
637 * Handle ticket issue message
638 *
639 * @param cls our client
640 * @param im the message
641 */
594static void 642static void
595handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) 643handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
596{ 644{
@@ -615,10 +663,18 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
615 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); 663 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
616} 664}
617 665
666
667
618/********************************************************** 668/**********************************************************
619 * Revocation 669 * Revocation
620 **********************************************************/ 670 **********************************************************/
621 671
672/**
673 * Handles revocation result
674 *
675 * @param cls our revocation operation handle
676 * @param success revocation result (GNUNET_OK if successful)
677 */
622static void 678static void
623revoke_result_cb (void *cls, int32_t success) 679revoke_result_cb (void *cls, int32_t success)
624{ 680{
@@ -639,6 +695,13 @@ revoke_result_cb (void *cls, int32_t success)
639} 695}
640 696
641 697
698/**
699 * Check revocation message format
700 *
701 * @param cls unused
702 * @param im the message to check
703 * @return GNUNET_OK if message is ok
704 */
642static int 705static int
643check_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *im) 706check_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *im)
644{ 707{
@@ -652,6 +715,13 @@ check_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *im)
652 return GNUNET_OK; 715 return GNUNET_OK;
653} 716}
654 717
718
719/**
720 * Handle a revocation message to a ticket.
721 *
722 * @param cls our client
723 * @param rm the message to handle
724 */
655static void 725static void
656handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm) 726handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
657{ 727{
@@ -670,19 +740,16 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
670 GNUNET_SERVICE_client_continue (idp->client); 740 GNUNET_SERVICE_client_continue (idp->client);
671} 741}
672 742
673static int
674check_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
675{
676 uint16_t size;
677
678 size = ntohs (cm->header.size);
679 if (size <= sizeof (struct ConsumeTicketMessage)) {
680 GNUNET_break (0);
681 return GNUNET_SYSERR;
682 }
683 return GNUNET_OK;
684}
685 743
744/**
745 * Handle a ticket consume result
746 *
747 * @param cls our consume ticket operation handle
748 * @param identity the attribute authority
749 * @param attrs the attribute/claim list
750 * @param success GNUNET_OK if successful
751 * @param emsg error message (NULL if success=GNUNET_OK)
752 */
686static void 753static void
687consume_result_cb (void *cls, 754consume_result_cb (void *cls,
688 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 755 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
@@ -716,6 +783,33 @@ consume_result_cb (void *cls,
716 GNUNET_free (cop); 783 GNUNET_free (cop);
717} 784}
718 785
786
787/**
788 * Check a consume ticket message
789 *
790 * @param cls unused
791 * @param cm the message to handle
792 */
793static int
794check_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
795{
796 uint16_t size;
797
798 size = ntohs (cm->header.size);
799 if (size <= sizeof (struct ConsumeTicketMessage)) {
800 GNUNET_break (0);
801 return GNUNET_SYSERR;
802 }
803 return GNUNET_OK;
804}
805
806
807/**
808 * Handle a consume ticket message
809 *
810 * @param cls our client handle
811 * @cm the message to handle
812 */
719static void 813static void
720handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm) 814handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
721{ 815{
@@ -753,6 +847,14 @@ cleanup_as_handle (struct AttributeStoreHandle *ash)
753 GNUNET_free (ash); 847 GNUNET_free (ash);
754} 848}
755 849
850
851/**
852 * Attribute store result handler
853 *
854 * @param cls our attribute store handle
855 * @param success GNUNET_OK if successful
856 * @param emsg error message (NULL if success=GNUNET_OK)
857 */
756static void 858static void
757attr_store_cont (void *cls, int32_t success, const char *emsg) 859attr_store_cont (void *cls, int32_t success, const char *emsg)
758{ 860{
@@ -782,8 +884,9 @@ attr_store_cont (void *cls, int32_t success, const char *emsg)
782 cleanup_as_handle (ash); 884 cleanup_as_handle (ash);
783} 885}
784 886
887
785/** 888/**
786 * Adds a new attribute 889 * Add a new attribute
787 * 890 *
788 * @param cls the AttributeStoreHandle 891 * @param cls the AttributeStoreHandle
789 */ 892 */
@@ -823,6 +926,13 @@ attr_store_task (void *cls)
823 GNUNET_free (buf); 926 GNUNET_free (buf);
824} 927}
825 928
929
930/**
931 * Check an attribute store message
932 *
933 * @param cls unused
934 * @param sam the message to check
935 */
826static int 936static int
827check_attribute_store_message (void *cls, 937check_attribute_store_message (void *cls,
828 const struct AttributeStoreMessage *sam) 938 const struct AttributeStoreMessage *sam)
@@ -837,6 +947,13 @@ check_attribute_store_message (void *cls,
837 return GNUNET_OK; 947 return GNUNET_OK;
838} 948}
839 949
950
951/**
952 * Handle an attribute store message
953 *
954 * @param cls our client
955 * @param sam the message to handle
956 */
840static void 957static void
841handle_attribute_store_message (void *cls, 958handle_attribute_store_message (void *cls,
842 const struct AttributeStoreMessage *sam) 959 const struct AttributeStoreMessage *sam)
@@ -863,6 +980,11 @@ handle_attribute_store_message (void *cls,
863} 980}
864 981
865 982
983/**
984 * Cleanup attribute delete handle
985 *
986 * @param adh the attribute to cleanup
987 */
866static void 988static void
867cleanup_adh (struct AttributeDeleteHandle *adh) 989cleanup_adh (struct AttributeDeleteHandle *adh)
868{ 990{
@@ -889,6 +1011,12 @@ cleanup_adh (struct AttributeDeleteHandle *adh)
889} 1011}
890 1012
891 1013
1014/**
1015 * Send a deletion success response
1016 *
1017 * @param adh our attribute deletion handle
1018 * @param success the success status
1019 */
892static void 1020static void
893send_delete_response (struct AttributeDeleteHandle *adh, int32_t success) 1021send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
894{ 1022{
@@ -907,6 +1035,16 @@ send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
907} 1035}
908 1036
909 1037
1038/**
1039 * Namestore iteration within attribute deletion.
1040 * We need to reissue tickets with the deleted attribute removed.
1041 *
1042 * @param cls our attribute deletion handle
1043 * @param zone the private key of the ticket issuer
1044 * @param label the label of the record
1045 * @param rd_count number of records
1046 * @param rd record data
1047 */
910static void 1048static void
911ticket_iter (void *cls, 1049ticket_iter (void *cls,
912 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1050 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
@@ -944,10 +1082,21 @@ ticket_iter (void *cls,
944} 1082}
945 1083
946 1084
1085/**
1086 * Recursion prototype for function
1087 * @param cls our deletion handle
1088 */
947static void 1089static void
948update_tickets (void *cls); 1090update_tickets (void *cls);
949 1091
950 1092
1093/**
1094 * Callback called when a ticket was updated
1095 *
1096 * @param cls our attribute deletion handle
1097 * @param success GNUNET_OK if successful
1098 * @param emsg error message (NULL if success=GNUNET_OK)
1099 */
951static void 1100static void
952ticket_updated (void *cls, int32_t success, const char *emsg) 1101ticket_updated (void *cls, int32_t success, const char *emsg)
953{ 1102{
@@ -956,6 +1105,14 @@ ticket_updated (void *cls, int32_t success, const char *emsg)
956 GNUNET_SCHEDULER_add_now (&update_tickets, adh); 1105 GNUNET_SCHEDULER_add_now (&update_tickets, adh);
957} 1106}
958 1107
1108
1109/**
1110 * Update tickets: Remove shared attribute which has just been deleted.
1111 * This method is called recursively until all tickets are processed.
1112 * Eventually, the updated tickets are stored using ``update_tickets''.
1113 *
1114 * @param cls our attribute deletion handle
1115 */
959static void 1116static void
960update_tickets (void *cls) 1117update_tickets (void *cls)
961{ 1118{
@@ -1002,6 +1159,11 @@ update_tickets (void *cls)
1002} 1159}
1003 1160
1004 1161
1162/**
1163 * Done collecting affected tickets, start updating.
1164 *
1165 * @param cls our attribute deletion handle
1166 */
1005static void 1167static void
1006ticket_iter_fin (void *cls) 1168ticket_iter_fin (void *cls)
1007{ 1169{
@@ -1011,6 +1173,11 @@ ticket_iter_fin (void *cls)
1011} 1173}
1012 1174
1013 1175
1176/**
1177 * Error collecting affected tickets. Abort.
1178 *
1179 * @param cls our attribute deletion handle
1180 */
1014static void 1181static void
1015ticket_iter_err (void *cls) 1182ticket_iter_err (void *cls)
1016{ 1183{
@@ -1024,6 +1191,12 @@ ticket_iter_err (void *cls)
1024} 1191}
1025 1192
1026 1193
1194/**
1195 * Start processing tickets which may still contain reference to deleted
1196 * attribute.
1197 *
1198 * @param cls attribute deletion handle
1199 */
1027static void 1200static void
1028start_ticket_update (void *cls) 1201start_ticket_update (void *cls)
1029{ 1202{
@@ -1039,6 +1212,13 @@ start_ticket_update (void *cls)
1039} 1212}
1040 1213
1041 1214
1215/**
1216 * Attribute deleted callback
1217 *
1218 * @param cls our handle
1219 * @param success success status
1220 * @param emsg error message (NULL if success=GNUNET_OK)
1221 */
1042static void 1222static void
1043attr_delete_cont (void *cls, int32_t success, const char *emsg) 1223attr_delete_cont (void *cls, int32_t success, const char *emsg)
1044{ 1224{
@@ -1052,11 +1232,17 @@ attr_delete_cont (void *cls, int32_t success, const char *emsg)
1052 cleanup_adh (adh); 1232 cleanup_adh (adh);
1053 return; 1233 return;
1054 } 1234 }
1055 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Updating tickets...\n"); 1235 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1056 GNUNET_SCHEDULER_add_now (&start_ticket_update, adh); 1236 GNUNET_SCHEDULER_add_now (&start_ticket_update, adh);
1057} 1237}
1058 1238
1059 1239
1240/**
1241 * Check attribute delete message format
1242 *
1243 * @cls unused
1244 * @dam message to check
1245 */
1060static int 1246static int
1061check_attribute_delete_message (void *cls, 1247check_attribute_delete_message (void *cls,
1062 const struct AttributeDeleteMessage *dam) 1248 const struct AttributeDeleteMessage *dam)
@@ -1072,6 +1258,12 @@ check_attribute_delete_message (void *cls,
1072} 1258}
1073 1259
1074 1260
1261/**
1262 * Handle attribute deletion
1263 *
1264 * @param cls our client
1265 * @param dam deletion message
1266 */
1075static void 1267static void
1076handle_attribute_delete_message (void *cls, 1268handle_attribute_delete_message (void *cls,
1077 const struct AttributeDeleteMessage *dam) 1269 const struct AttributeDeleteMessage *dam)
@@ -1107,24 +1299,12 @@ handle_attribute_delete_message (void *cls,
1107 * Attrubute iteration 1299 * Attrubute iteration
1108 *************************************************/ 1300 *************************************************/
1109 1301
1110static void
1111cleanup_attribute_iter_handle (struct AttributeIterator *ai)
1112{
1113 GNUNET_free (ai);
1114}
1115
1116static void
1117attr_iter_error (void *cls)
1118{
1119 struct AttributeIterator *ai = cls;
1120 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1121 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
1122 ai->client->attr_iter_tail,
1123 ai);
1124 cleanup_attribute_iter_handle (ai);
1125 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1126}
1127 1302
1303/**
1304 * Done iterating over attributes
1305 *
1306 * @param cls our iterator handle
1307 */
1128static void 1308static void
1129attr_iter_finished (void *cls) 1309attr_iter_finished (void *cls)
1130{ 1310{
@@ -1140,9 +1320,33 @@ attr_iter_finished (void *cls)
1140 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, 1320 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
1141 ai->client->attr_iter_tail, 1321 ai->client->attr_iter_tail,
1142 ai); 1322 ai);
1143 cleanup_attribute_iter_handle (ai); 1323 GNUNET_free (ai);
1324}
1325
1326/**
1327 * Error iterating over attributes. Abort.
1328 *
1329 * @param cls our attribute iteration handle
1330 */
1331static void
1332attr_iter_error (void *cls)
1333{
1334 struct AttributeIterator *ai = cls;
1335
1336 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1337 attr_iter_finished (ai);
1144} 1338}
1145 1339
1340
1341/**
1342 * Got record. Return if it is an attribute.
1343 *
1344 * @param cls our attribute iterator
1345 * @param zone zone we are iterating
1346 * @param label label of the records
1347 * @param rd_count record count
1348 * @param rd records
1349 */
1146static void 1350static void
1147attr_iter_cb (void *cls, 1351attr_iter_cb (void *cls,
1148 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1352 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
@@ -1177,6 +1381,13 @@ attr_iter_cb (void *cls,
1177 GNUNET_MQ_send (ai->client->mq, env); 1381 GNUNET_MQ_send (ai->client->mq, env);
1178} 1382}
1179 1383
1384
1385/**
1386 * Iterate over zone to get attributes
1387 *
1388 * @param cls our client
1389 * @param ais_msg the iteration message to start
1390 */
1180static void 1391static void
1181handle_iteration_start (void *cls, 1392handle_iteration_start (void *cls,
1182 const struct AttributeIterationStartMessage *ais_msg) 1393 const struct AttributeIterationStartMessage *ais_msg)
@@ -1203,6 +1414,13 @@ handle_iteration_start (void *cls,
1203 GNUNET_SERVICE_client_continue (idp->client); 1414 GNUNET_SERVICE_client_continue (idp->client);
1204} 1415}
1205 1416
1417
1418/**
1419 * Handle iteration stop message from client
1420 *
1421 * @param cls the client
1422 * @param ais_msg the stop message
1423 */
1206static void 1424static void
1207handle_iteration_stop (void *cls, 1425handle_iteration_stop (void *cls,
1208 const struct AttributeIterationStopMessage *ais_msg) 1426 const struct AttributeIterationStopMessage *ais_msg)
@@ -1228,6 +1446,13 @@ handle_iteration_stop (void *cls,
1228 GNUNET_SERVICE_client_continue (idp->client); 1446 GNUNET_SERVICE_client_continue (idp->client);
1229} 1447}
1230 1448
1449
1450/**
1451 * Client requests next attribute from iterator
1452 *
1453 * @param cls the client
1454 * @param ais_msg the message
1455 */
1231static void 1456static void
1232handle_iteration_next (void *cls, 1457handle_iteration_next (void *cls,
1233 const struct AttributeIterationNextMessage *ais_msg) 1458 const struct AttributeIterationNextMessage *ais_msg)
@@ -1255,6 +1480,12 @@ handle_iteration_next (void *cls,
1255 * Ticket iteration 1480 * Ticket iteration
1256 ******************************************************/ 1481 ******************************************************/
1257 1482
1483/**
1484 * Got a ticket. Return to client
1485 *
1486 * @param cls our ticket iterator
1487 * @param ticket the ticket
1488 */
1258static void 1489static void
1259ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket) 1490ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
1260{ 1491{
@@ -1281,6 +1512,13 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
1281 GNUNET_free (ti); 1512 GNUNET_free (ti);
1282} 1513}
1283 1514
1515
1516/**
1517 * Client requests a ticket iteration
1518 *
1519 * @param cls the client
1520 * @param tis_msg the iteration request message
1521 */
1284static void 1522static void
1285handle_ticket_iteration_start ( 1523handle_ticket_iteration_start (
1286 void *cls, 1524 void *cls,
@@ -1303,6 +1541,13 @@ handle_ticket_iteration_start (
1303 GNUNET_SERVICE_client_continue (client->client); 1541 GNUNET_SERVICE_client_continue (client->client);
1304} 1542}
1305 1543
1544
1545/**
1546 * Client has had enough tickets
1547 *
1548 * @param cls the client
1549 * @param tis_msg the stop message
1550 */
1306static void 1551static void
1307handle_ticket_iteration_stop (void *cls, 1552handle_ticket_iteration_stop (void *cls,
1308 const struct TicketIterationStopMessage *tis_msg) 1553 const struct TicketIterationStopMessage *tis_msg)
@@ -1331,6 +1576,13 @@ handle_ticket_iteration_stop (void *cls,
1331 GNUNET_SERVICE_client_continue (client->client); 1576 GNUNET_SERVICE_client_continue (client->client);
1332} 1577}
1333 1578
1579
1580/**
1581 * Client requests next result.
1582 *
1583 * @param cls the client
1584 * @param tis_msg the message
1585 */
1334static void 1586static void
1335handle_ticket_iteration_next (void *cls, 1587handle_ticket_iteration_next (void *cls,
1336 const struct TicketIterationNextMessage *tis_msg) 1588 const struct TicketIterationNextMessage *tis_msg)
@@ -1354,6 +1606,7 @@ handle_ticket_iteration_next (void *cls,
1354 GNUNET_SERVICE_client_continue (client->client); 1606 GNUNET_SERVICE_client_continue (client->client);
1355} 1607}
1356 1608
1609
1357/** 1610/**
1358 * Main function that will be run 1611 * Main function that will be run
1359 * 1612 *
@@ -1400,6 +1653,7 @@ run (void *cls,
1400 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); 1653 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
1401} 1654}
1402 1655
1656
1403/** 1657/**
1404 * Called whenever a client is disconnected. 1658 * Called whenever a client is disconnected.
1405 * 1659 *
@@ -1421,8 +1675,6 @@ client_disconnect_cb (void *cls,
1421 struct AttributeStoreHandle *as; 1675 struct AttributeStoreHandle *as;
1422 struct AttributeDeleteHandle *adh; 1676 struct AttributeDeleteHandle *adh;
1423 1677
1424 // TODO other operations
1425
1426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); 1678 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
1427 1679
1428 while (NULL != (iss = idp->issue_op_head)) { 1680 while (NULL != (iss = idp->issue_op_head)) {
@@ -1448,7 +1700,7 @@ client_disconnect_cb (void *cls,
1448 1700
1449 while (NULL != (ai = idp->attr_iter_head)) { 1701 while (NULL != (ai = idp->attr_iter_head)) {
1450 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai); 1702 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
1451 cleanup_attribute_iter_handle (ai); 1703 GNUNET_free (ai);
1452 } 1704 }
1453 while (NULL != (rop = idp->revoke_op_head)) { 1705 while (NULL != (rop = idp->revoke_op_head)) {
1454 GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, idp->revoke_op_tail, rop); 1706 GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, idp->revoke_op_tail, rop);
@@ -1465,6 +1717,7 @@ client_disconnect_cb (void *cls,
1465 GNUNET_free (idp); 1717 GNUNET_free (idp);
1466} 1718}
1467 1719
1720
1468/** 1721/**
1469 * Add a client to our list of active clients. 1722 * Add a client to our list of active clients.
1470 * 1723 *
@@ -1486,6 +1739,7 @@ client_connect_cb (void *cls,
1486 return idp; 1739 return idp;
1487} 1740}
1488 1741
1742
1489/** 1743/**
1490 * Define "main" method using service macro. 1744 * Define "main" method using service macro.
1491 */ 1745 */