diff options
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 183 |
1 files changed, 100 insertions, 83 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index a6be01af0..e7ae25bff 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -51,7 +51,7 @@ struct GNUNET_NAMESTORE_ZoneIteration | |||
51 | /** | 51 | /** |
52 | * Namestore client which intiated this zone iteration | 52 | * Namestore client which intiated this zone iteration |
53 | */ | 53 | */ |
54 | struct GNUNET_NAMESTORE_Client * client; | 54 | struct GNUNET_NAMESTORE_Client *client; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * GNUNET_YES if we iterate over a specific zone | 57 | * GNUNET_YES if we iterate over a specific zone |
@@ -110,7 +110,7 @@ struct GNUNET_NAMESTORE_Client | |||
110 | /** | 110 | /** |
111 | * The client | 111 | * The client |
112 | */ | 112 | */ |
113 | struct GNUNET_SERVER_Client * client; | 113 | struct GNUNET_SERVER_Client *client; |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Head of the DLL of | 116 | * Head of the DLL of |
@@ -134,7 +134,7 @@ struct GNUNET_NAMESTORE_CryptoContainer | |||
134 | /** | 134 | /** |
135 | * Filename where to store the container | 135 | * Filename where to store the container |
136 | */ | 136 | */ |
137 | char * filename; | 137 | char *filename; |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * Short hash of the zone's public key | 140 | * Short hash of the zone's public key |
@@ -206,7 +206,7 @@ struct GNUNET_CONTAINER_MultiHashMap *zonekeys; | |||
206 | * @return GNUNET_OK on success, GNUNET_SYSERR on fail | 206 | * @return GNUNET_OK on success, GNUNET_SYSERR on fail |
207 | */ | 207 | */ |
208 | 208 | ||
209 | int | 209 | static int |
210 | write_key_to_file (const char *filename, struct GNUNET_NAMESTORE_CryptoContainer *c) | 210 | write_key_to_file (const char *filename, struct GNUNET_NAMESTORE_CryptoContainer *c) |
211 | { | 211 | { |
212 | struct GNUNET_CRYPTO_RsaPrivateKey *ret = c->privkey; | 212 | struct GNUNET_CRYPTO_RsaPrivateKey *ret = c->privkey; |
@@ -217,7 +217,7 @@ write_key_to_file (const char *filename, struct GNUNET_NAMESTORE_CryptoContainer | |||
217 | { | 217 | { |
218 | struct GNUNET_CRYPTO_ShortHashCode zone; | 218 | struct GNUNET_CRYPTO_ShortHashCode zone; |
219 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 219 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
220 | struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 220 | struct GNUNET_CRYPTO_RsaPrivateKey *privkey; |
221 | 221 | ||
222 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file(filename); | 222 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file(filename); |
223 | if (privkey == NULL) | 223 | if (privkey == NULL) |
@@ -282,11 +282,12 @@ write_key_to_file (const char *filename, struct GNUNET_NAMESTORE_CryptoContainer | |||
282 | return GNUNET_OK; | 282 | return GNUNET_OK; |
283 | } | 283 | } |
284 | 284 | ||
285 | int zone_to_disk_it (void *cls, | 285 | static int |
286 | const struct GNUNET_HashCode *key, | 286 | zone_to_disk_it (void *cls, |
287 | void *value) | 287 | const struct GNUNET_HashCode *key, |
288 | void *value) | ||
288 | { | 289 | { |
289 | struct GNUNET_NAMESTORE_CryptoContainer * c = value; | 290 | struct GNUNET_NAMESTORE_CryptoContainer *c = value; |
290 | if (c->filename != NULL) | 291 | if (c->filename != NULL) |
291 | write_key_to_file(c->filename, c); | 292 | write_key_to_file(c->filename, c); |
292 | else | 293 | else |
@@ -342,10 +343,10 @@ static void | |||
342 | cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 343 | cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
343 | { | 344 | { |
344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping namestore service\n"); | 345 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping namestore service\n"); |
345 | struct GNUNET_NAMESTORE_ZoneIteration * no; | 346 | struct GNUNET_NAMESTORE_ZoneIteration *no; |
346 | struct GNUNET_NAMESTORE_ZoneIteration * tmp; | 347 | struct GNUNET_NAMESTORE_ZoneIteration *tmp; |
347 | struct GNUNET_NAMESTORE_Client * nc; | 348 | struct GNUNET_NAMESTORE_Client *nc; |
348 | struct GNUNET_NAMESTORE_Client * next; | 349 | struct GNUNET_NAMESTORE_Client *next; |
349 | 350 | ||
350 | if (NULL != snc) | 351 | if (NULL != snc) |
351 | { | 352 | { |
@@ -377,7 +378,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
377 | static struct GNUNET_NAMESTORE_Client * | 378 | static struct GNUNET_NAMESTORE_Client * |
378 | client_lookup (struct GNUNET_SERVER_Client *client) | 379 | client_lookup (struct GNUNET_SERVER_Client *client) |
379 | { | 380 | { |
380 | struct GNUNET_NAMESTORE_Client * nc; | 381 | struct GNUNET_NAMESTORE_Client *nc; |
381 | 382 | ||
382 | GNUNET_assert (NULL != client); | 383 | GNUNET_assert (NULL != client); |
383 | 384 | ||
@@ -390,7 +391,7 @@ client_lookup (struct GNUNET_SERVER_Client *client) | |||
390 | } | 391 | } |
391 | 392 | ||
392 | /** | 393 | /** |
393 | * Called whenever a client is disconnected. Frees our | 394 | * Called whenever a client is disconnected. Frees our |
394 | * resources associated with that client. | 395 | * resources associated with that client. |
395 | * | 396 | * |
396 | * @param cls closure | 397 | * @param cls closure |
@@ -399,8 +400,8 @@ client_lookup (struct GNUNET_SERVER_Client *client) | |||
399 | static void | 400 | static void |
400 | client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client) | 401 | client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client) |
401 | { | 402 | { |
402 | struct GNUNET_NAMESTORE_ZoneIteration * no; | 403 | struct GNUNET_NAMESTORE_ZoneIteration *no; |
403 | struct GNUNET_NAMESTORE_Client * nc; | 404 | struct GNUNET_NAMESTORE_Client *nc; |
404 | if (NULL == client) | 405 | if (NULL == client) |
405 | return; | 406 | return; |
406 | 407 | ||
@@ -427,13 +428,14 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client) | |||
427 | 428 | ||
428 | 429 | ||
429 | 430 | ||
430 | static void handle_start (void *cls, | 431 | static void |
431 | struct GNUNET_SERVER_Client * client, | 432 | handle_start (void *cls, |
432 | const struct GNUNET_MessageHeader * message) | 433 | struct GNUNET_SERVER_Client *client, |
434 | const struct GNUNET_MessageHeader *message) | ||
433 | { | 435 | { |
434 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client); | 436 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client); |
435 | 437 | ||
436 | struct GNUNET_NAMESTORE_Client * nc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Client)); | 438 | struct GNUNET_NAMESTORE_Client *nc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Client)); |
437 | nc->client = client; | 439 | nc->client = client; |
438 | GNUNET_SERVER_notification_context_add (snc, client); | 440 | GNUNET_SERVER_notification_context_add (snc, client); |
439 | GNUNET_CONTAINER_DLL_insert(client_head, client_tail, nc); | 441 | GNUNET_CONTAINER_DLL_insert(client_head, client_tail, nc); |
@@ -441,25 +443,28 @@ static void handle_start (void *cls, | |||
441 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 443 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
442 | } | 444 | } |
443 | 445 | ||
446 | |||
444 | struct LookupNameContext | 447 | struct LookupNameContext |
445 | { | 448 | { |
449 | |||
446 | struct GNUNET_NAMESTORE_Client *nc; | 450 | struct GNUNET_NAMESTORE_Client *nc; |
447 | uint32_t request_id; | 451 | uint32_t request_id; |
448 | uint32_t record_type; | 452 | uint32_t record_type; |
449 | struct GNUNET_CRYPTO_ShortHashCode *zone; | 453 | struct GNUNET_CRYPTO_ShortHashCode *zone; |
450 | char * name; | 454 | char *name; |
451 | }; | 455 | }; |
452 | 456 | ||
453 | void drop_iterator (void *cls, | 457 | static void |
454 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 458 | drop_iterator (void *cls, |
455 | struct GNUNET_TIME_Absolute expire, | 459 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, |
456 | const char *name, | 460 | struct GNUNET_TIME_Absolute expire, |
457 | unsigned int rd_len, | 461 | const char *name, |
458 | const struct GNUNET_NAMESTORE_RecordData *rd, | 462 | unsigned int rd_len, |
459 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 463 | const struct GNUNET_NAMESTORE_RecordData *rd, |
464 | const struct GNUNET_CRYPTO_RsaSignature *signature) | ||
460 | { | 465 | { |
461 | struct GNUNET_CRYPTO_ShortHashCode zone_hash; | 466 | struct GNUNET_CRYPTO_ShortHashCode zone_hash; |
462 | int * stop = cls; | 467 | int *stop = cls; |
463 | if (NULL != zone_key) | 468 | if (NULL != zone_key) |
464 | { | 469 | { |
465 | GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash); | 470 | GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash); |
@@ -625,15 +630,16 @@ handle_lookup_name_it (void *cls, | |||
625 | GNUNET_free (lnr_msg); | 630 | GNUNET_free (lnr_msg); |
626 | } | 631 | } |
627 | 632 | ||
628 | static void handle_lookup_name (void *cls, | 633 | static void |
629 | struct GNUNET_SERVER_Client * client, | 634 | handle_lookup_name (void *cls, |
630 | const struct GNUNET_MessageHeader * message) | 635 | struct GNUNET_SERVER_Client *client, |
636 | const struct GNUNET_MessageHeader *message) | ||
631 | { | 637 | { |
632 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_LOOKUP_NAME"); | 638 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_LOOKUP_NAME"); |
633 | struct LookupNameContext lnc; | 639 | struct LookupNameContext lnc; |
634 | struct GNUNET_NAMESTORE_Client *nc; | 640 | struct GNUNET_NAMESTORE_Client *nc; |
635 | size_t name_len; | 641 | size_t name_len; |
636 | char * name; | 642 | char *name; |
637 | uint32_t rid = 0; | 643 | uint32_t rid = 0; |
638 | uint32_t type = 0; | 644 | uint32_t type = 0; |
639 | 645 | ||
@@ -652,7 +658,7 @@ static void handle_lookup_name (void *cls, | |||
652 | return; | 658 | return; |
653 | } | 659 | } |
654 | 660 | ||
655 | struct LookupNameMessage * ln_msg = (struct LookupNameMessage *) message; | 661 | struct LookupNameMessage *ln_msg = (struct LookupNameMessage *) message; |
656 | rid = ntohl (ln_msg->gns_header.r_id); | 662 | rid = ntohl (ln_msg->gns_header.r_id); |
657 | name_len = ntohl (ln_msg->name_len); | 663 | name_len = ntohl (ln_msg->name_len); |
658 | type = ntohl (ln_msg->record_type); | 664 | type = ntohl (ln_msg->record_type); |
@@ -688,9 +694,10 @@ static void handle_lookup_name (void *cls, | |||
688 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 694 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
689 | } | 695 | } |
690 | 696 | ||
691 | static void handle_record_put (void *cls, | 697 | static void |
692 | struct GNUNET_SERVER_Client * client, | 698 | handle_record_put (void *cls, |
693 | const struct GNUNET_MessageHeader * message) | 699 | struct GNUNET_SERVER_Client *client, |
700 | const struct GNUNET_MessageHeader *message) | ||
694 | { | 701 | { |
695 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_PUT"); | 702 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_PUT"); |
696 | struct GNUNET_NAMESTORE_Client *nc; | 703 | struct GNUNET_NAMESTORE_Client *nc; |
@@ -700,8 +707,8 @@ static void handle_record_put (void *cls, | |||
700 | size_t name_len; | 707 | size_t name_len; |
701 | size_t msg_size; | 708 | size_t msg_size; |
702 | size_t msg_size_exp; | 709 | size_t msg_size_exp; |
703 | char * name; | 710 | char *name; |
704 | char * rd_ser; | 711 | char *rd_ser; |
705 | uint32_t rid = 0; | 712 | uint32_t rid = 0; |
706 | uint32_t rd_ser_len; | 713 | uint32_t rd_ser_len; |
707 | uint32_t rd_count; | 714 | uint32_t rd_count; |
@@ -722,7 +729,7 @@ static void handle_record_put (void *cls, | |||
722 | return; | 729 | return; |
723 | } | 730 | } |
724 | 731 | ||
725 | struct RecordPutMessage * rp_msg = (struct RecordPutMessage *) message; | 732 | struct RecordPutMessage *rp_msg = (struct RecordPutMessage *) message; |
726 | 733 | ||
727 | rid = ntohl (rp_msg->gns_header.r_id); | 734 | rid = ntohl (rp_msg->gns_header.r_id); |
728 | msg_size = ntohs (rp_msg->gns_header.header.size); | 735 | msg_size = ntohs (rp_msg->gns_header.header.size); |
@@ -828,7 +835,7 @@ handle_create_record_it (void *cls, | |||
828 | const struct GNUNET_NAMESTORE_RecordData *rd, | 835 | const struct GNUNET_NAMESTORE_RecordData *rd, |
829 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 836 | const struct GNUNET_CRYPTO_RsaSignature *signature) |
830 | { | 837 | { |
831 | struct CreateRecordContext * crc = cls; | 838 | struct CreateRecordContext *crc = cls; |
832 | struct GNUNET_NAMESTORE_RecordData *rd_new = NULL; | 839 | struct GNUNET_NAMESTORE_RecordData *rd_new = NULL; |
833 | struct GNUNET_CRYPTO_RsaSignature dummy_signature; | 840 | struct GNUNET_CRYPTO_RsaSignature dummy_signature; |
834 | struct GNUNET_TIME_Absolute block_expiration; | 841 | struct GNUNET_TIME_Absolute block_expiration; |
@@ -965,9 +972,10 @@ end: | |||
965 | 972 | ||
966 | } | 973 | } |
967 | 974 | ||
968 | static void handle_record_create (void *cls, | 975 | static void |
969 | struct GNUNET_SERVER_Client * client, | 976 | handle_record_create (void *cls, |
970 | const struct GNUNET_MessageHeader * message) | 977 | struct GNUNET_SERVER_Client *client, |
978 | const struct GNUNET_MessageHeader *message) | ||
971 | { | 979 | { |
972 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_CREATE"); | 980 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_CREATE"); |
973 | struct GNUNET_NAMESTORE_Client *nc; | 981 | struct GNUNET_NAMESTORE_Client *nc; |
@@ -1007,7 +1015,7 @@ static void handle_record_create (void *cls, | |||
1007 | return; | 1015 | return; |
1008 | } | 1016 | } |
1009 | 1017 | ||
1010 | struct RecordCreateMessage * rp_msg = (struct RecordCreateMessage *) message; | 1018 | struct RecordCreateMessage *rp_msg = (struct RecordCreateMessage *) message; |
1011 | rid = ntohl (rp_msg->gns_header.r_id); | 1019 | rid = ntohl (rp_msg->gns_header.r_id); |
1012 | name_len = ntohs (rp_msg->name_len); | 1020 | name_len = ntohs (rp_msg->name_len); |
1013 | msg_size = ntohs (message->size); | 1021 | msg_size = ntohs (message->size); |
@@ -1223,20 +1231,20 @@ handle_record_remove_it (void *cls, | |||
1223 | 1231 | ||
1224 | static void | 1232 | static void |
1225 | handle_record_remove (void *cls, | 1233 | handle_record_remove (void *cls, |
1226 | struct GNUNET_SERVER_Client * client, | 1234 | struct GNUNET_SERVER_Client *client, |
1227 | const struct GNUNET_MessageHeader * message) | 1235 | const struct GNUNET_MessageHeader *message) |
1228 | { | 1236 | { |
1229 | struct GNUNET_NAMESTORE_Client *nc; | 1237 | struct GNUNET_NAMESTORE_Client *nc; |
1230 | const struct RecordRemoveMessage * rr_msg; | 1238 | const struct RecordRemoveMessage *rr_msg; |
1231 | struct RecordRemoveResponseMessage rrr_msg; | 1239 | struct RecordRemoveResponseMessage rrr_msg; |
1232 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; | 1240 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; |
1233 | struct GNUNET_NAMESTORE_CryptoContainer *cc; | 1241 | struct GNUNET_NAMESTORE_CryptoContainer *cc; |
1234 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | 1242 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; |
1235 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; | 1243 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; |
1236 | struct GNUNET_HashCode long_hash; | 1244 | struct GNUNET_HashCode long_hash; |
1237 | const char * pkey_tmp; | 1245 | const char *pkey_tmp; |
1238 | const char * name_tmp; | 1246 | const char *name_tmp; |
1239 | const char * rd_ser; | 1247 | const char *rd_ser; |
1240 | size_t key_len; | 1248 | size_t key_len; |
1241 | size_t name_len; | 1249 | size_t name_len; |
1242 | size_t rd_ser_len; | 1250 | size_t rd_ser_len; |
@@ -1409,7 +1417,7 @@ handle_zone_to_name_it (void *cls, | |||
1409 | const struct GNUNET_NAMESTORE_RecordData *rd, | 1417 | const struct GNUNET_NAMESTORE_RecordData *rd, |
1410 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 1418 | const struct GNUNET_CRYPTO_RsaSignature *signature) |
1411 | { | 1419 | { |
1412 | struct ZoneToNameCtx * ztn_ctx = cls; | 1420 | struct ZoneToNameCtx *ztn_ctx = cls; |
1413 | struct ZoneToNameResponseMessage *ztnr_msg; | 1421 | struct ZoneToNameResponseMessage *ztnr_msg; |
1414 | int16_t res = GNUNET_SYSERR; | 1422 | int16_t res = GNUNET_SYSERR; |
1415 | uint16_t name_len = 0; | 1423 | uint16_t name_len = 0; |
@@ -1489,9 +1497,10 @@ handle_zone_to_name_it (void *cls, | |||
1489 | } | 1497 | } |
1490 | 1498 | ||
1491 | 1499 | ||
1492 | static void handle_zone_to_name (void *cls, | 1500 | static void |
1493 | struct GNUNET_SERVER_Client * client, | 1501 | handle_zone_to_name (void *cls, |
1494 | const struct GNUNET_MessageHeader * message) | 1502 | struct GNUNET_SERVER_Client *client, |
1503 | const struct GNUNET_MessageHeader *message) | ||
1495 | { | 1504 | { |
1496 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_TO_NAME"); | 1505 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_TO_NAME"); |
1497 | struct GNUNET_NAMESTORE_Client *nc; | 1506 | struct GNUNET_NAMESTORE_Client *nc; |
@@ -1543,7 +1552,7 @@ static void handle_zone_to_name (void *cls, | |||
1543 | /** | 1552 | /** |
1544 | * Copy record, data has to be free separetely | 1553 | * Copy record, data has to be free separetely |
1545 | */ | 1554 | */ |
1546 | void | 1555 | static void |
1547 | copy_record (const struct GNUNET_NAMESTORE_RecordData *src, struct GNUNET_NAMESTORE_RecordData *dest) | 1556 | copy_record (const struct GNUNET_NAMESTORE_RecordData *src, struct GNUNET_NAMESTORE_RecordData *dest) |
1548 | { | 1557 | { |
1549 | 1558 | ||
@@ -1569,17 +1578,18 @@ struct ZoneIterationProcResult | |||
1569 | }; | 1578 | }; |
1570 | 1579 | ||
1571 | 1580 | ||
1572 | void zone_iteraterate_proc (void *cls, | 1581 | static void |
1573 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 1582 | zone_iteraterate_proc (void *cls, |
1574 | struct GNUNET_TIME_Absolute expire, | 1583 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, |
1575 | const char *name, | 1584 | struct GNUNET_TIME_Absolute expire, |
1576 | unsigned int rd_count, | 1585 | const char *name, |
1577 | const struct GNUNET_NAMESTORE_RecordData *rd, | 1586 | unsigned int rd_count, |
1578 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 1587 | const struct GNUNET_NAMESTORE_RecordData *rd, |
1588 | const struct GNUNET_CRYPTO_RsaSignature *signature) | ||
1579 | { | 1589 | { |
1580 | struct ZoneIterationProcResult *proc = cls; | 1590 | struct ZoneIterationProcResult *proc = cls; |
1581 | struct GNUNET_NAMESTORE_RecordData *rd_filtered; | 1591 | struct GNUNET_NAMESTORE_RecordData *rd_filtered; |
1582 | struct GNUNET_CRYPTO_RsaSignature * new_signature; | 1592 | struct GNUNET_CRYPTO_RsaSignature *new_signature; |
1583 | struct GNUNET_NAMESTORE_CryptoContainer *cc; | 1593 | struct GNUNET_NAMESTORE_CryptoContainer *cc; |
1584 | struct GNUNET_CRYPTO_ShortHashCode hash; | 1594 | struct GNUNET_CRYPTO_ShortHashCode hash; |
1585 | struct GNUNET_HashCode long_hash; | 1595 | struct GNUNET_HashCode long_hash; |
@@ -1694,7 +1704,8 @@ void zone_iteraterate_proc (void *cls, | |||
1694 | 1704 | ||
1695 | } | 1705 | } |
1696 | 1706 | ||
1697 | void find_next_zone_iteration_result (struct ZoneIterationProcResult *proc) | 1707 | static void |
1708 | find_next_zone_iteration_result (struct ZoneIterationProcResult *proc) | ||
1698 | { | 1709 | { |
1699 | 1710 | ||
1700 | struct GNUNET_CRYPTO_ShortHashCode *zone; | 1711 | struct GNUNET_CRYPTO_ShortHashCode *zone; |
@@ -1713,7 +1724,8 @@ void find_next_zone_iteration_result (struct ZoneIterationProcResult *proc) | |||
1713 | } | 1724 | } |
1714 | 1725 | ||
1715 | 1726 | ||
1716 | void send_zone_iteration_result (struct ZoneIterationProcResult *proc) | 1727 | static void |
1728 | send_zone_iteration_result (struct ZoneIterationProcResult *proc) | ||
1717 | { | 1729 | { |
1718 | struct GNUNET_NAMESTORE_ZoneIteration *zi = proc->zi; | 1730 | struct GNUNET_NAMESTORE_ZoneIteration *zi = proc->zi; |
1719 | 1731 | ||
@@ -1790,7 +1802,8 @@ void send_zone_iteration_result (struct ZoneIterationProcResult *proc) | |||
1790 | } | 1802 | } |
1791 | } | 1803 | } |
1792 | 1804 | ||
1793 | void clean_up_zone_iteration_result (struct ZoneIterationProcResult *proc) | 1805 | static void |
1806 | clean_up_zone_iteration_result (struct ZoneIterationProcResult *proc) | ||
1794 | { | 1807 | { |
1795 | int c; | 1808 | int c; |
1796 | GNUNET_free_non_null (proc->name); | 1809 | GNUNET_free_non_null (proc->name); |
@@ -1803,13 +1816,14 @@ void clean_up_zone_iteration_result (struct ZoneIterationProcResult *proc) | |||
1803 | proc->rd = NULL; | 1816 | proc->rd = NULL; |
1804 | } | 1817 | } |
1805 | 1818 | ||
1806 | static void handle_iteration_start (void *cls, | 1819 | static void |
1807 | struct GNUNET_SERVER_Client * client, | 1820 | handle_iteration_start (void *cls, |
1808 | const struct GNUNET_MessageHeader * message) | 1821 | struct GNUNET_SERVER_Client *client, |
1822 | const struct GNUNET_MessageHeader *message) | ||
1809 | { | 1823 | { |
1810 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_ITERATION_START"); | 1824 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_ITERATION_START"); |
1811 | 1825 | ||
1812 | struct ZoneIterationStartMessage * zis_msg = (struct ZoneIterationStartMessage *) message; | 1826 | struct ZoneIterationStartMessage *zis_msg = (struct ZoneIterationStartMessage *) message; |
1813 | struct GNUNET_NAMESTORE_Client *nc; | 1827 | struct GNUNET_NAMESTORE_Client *nc; |
1814 | struct GNUNET_NAMESTORE_ZoneIteration *zi; | 1828 | struct GNUNET_NAMESTORE_ZoneIteration *zi; |
1815 | 1829 | ||
@@ -1863,15 +1877,16 @@ static void handle_iteration_start (void *cls, | |||
1863 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1877 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1864 | } | 1878 | } |
1865 | 1879 | ||
1866 | static void handle_iteration_stop (void *cls, | 1880 | static void |
1867 | struct GNUNET_SERVER_Client * client, | 1881 | handle_iteration_stop (void *cls, |
1868 | const struct GNUNET_MessageHeader * message) | 1882 | struct GNUNET_SERVER_Client *client, |
1883 | const struct GNUNET_MessageHeader *message) | ||
1869 | { | 1884 | { |
1870 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_ITERATION_STOP"); | 1885 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_ITERATION_STOP"); |
1871 | 1886 | ||
1872 | struct GNUNET_NAMESTORE_Client *nc; | 1887 | struct GNUNET_NAMESTORE_Client *nc; |
1873 | struct GNUNET_NAMESTORE_ZoneIteration *zi; | 1888 | struct GNUNET_NAMESTORE_ZoneIteration *zi; |
1874 | struct ZoneIterationStopMessage * zis_msg = (struct ZoneIterationStopMessage *) message; | 1889 | struct ZoneIterationStopMessage *zis_msg = (struct ZoneIterationStopMessage *) message; |
1875 | uint32_t rid; | 1890 | uint32_t rid; |
1876 | 1891 | ||
1877 | nc = client_lookup(client); | 1892 | nc = client_lookup(client); |
@@ -1905,15 +1920,16 @@ static void handle_iteration_stop (void *cls, | |||
1905 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1920 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1906 | } | 1921 | } |
1907 | 1922 | ||
1908 | static void handle_iteration_next (void *cls, | 1923 | static void |
1909 | struct GNUNET_SERVER_Client * client, | 1924 | handle_iteration_next (void *cls, |
1910 | const struct GNUNET_MessageHeader * message) | 1925 | struct GNUNET_SERVER_Client *client, |
1926 | const struct GNUNET_MessageHeader *message) | ||
1911 | { | 1927 | { |
1912 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_ITERATION_NEXT"); | 1928 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_ITERATION_NEXT"); |
1913 | 1929 | ||
1914 | struct GNUNET_NAMESTORE_Client *nc; | 1930 | struct GNUNET_NAMESTORE_Client *nc; |
1915 | struct GNUNET_NAMESTORE_ZoneIteration *zi; | 1931 | struct GNUNET_NAMESTORE_ZoneIteration *zi; |
1916 | struct ZoneIterationStopMessage * zis_msg = (struct ZoneIterationStopMessage *) message; | 1932 | struct ZoneIterationStopMessage *zis_msg = (struct ZoneIterationStopMessage *) message; |
1917 | uint32_t rid; | 1933 | uint32_t rid; |
1918 | 1934 | ||
1919 | nc = client_lookup(client); | 1935 | nc = client_lookup(client); |
@@ -1955,13 +1971,14 @@ static void handle_iteration_next (void *cls, | |||
1955 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1971 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1956 | } | 1972 | } |
1957 | 1973 | ||
1958 | int zonekey_file_it (void *cls, const char *filename) | 1974 | static int |
1975 | zonekey_file_it (void *cls, const char *filename) | ||
1959 | { | 1976 | { |
1960 | struct GNUNET_HashCode long_hash; | 1977 | struct GNUNET_HashCode long_hash; |
1961 | int *counter = cls; | 1978 | int *counter = cls; |
1962 | if ((filename != NULL) && (NULL != strstr(filename, ".zkey"))) | 1979 | if ((filename != NULL) && (NULL != strstr(filename, ".zkey"))) |
1963 | { | 1980 | { |
1964 | struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 1981 | struct GNUNET_CRYPTO_RsaPrivateKey *privkey; |
1965 | struct GNUNET_NAMESTORE_CryptoContainer *c; | 1982 | struct GNUNET_NAMESTORE_CryptoContainer *c; |
1966 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file(filename); | 1983 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file(filename); |
1967 | if (privkey == NULL) | 1984 | if (privkey == NULL) |
@@ -1993,7 +2010,7 @@ static void | |||
1993 | run (void *cls, struct GNUNET_SERVER_Handle *server, | 2010 | run (void *cls, struct GNUNET_SERVER_Handle *server, |
1994 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 2011 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
1995 | { | 2012 | { |
1996 | char * database; | 2013 | char *database; |
1997 | int counter = 0; | 2014 | int counter = 0; |
1998 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting namestore service\n"); | 2015 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting namestore service\n"); |
1999 | 2016 | ||