diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
commit | 61c39c60565b386e0e12ea669556b030e8cd7180 (patch) | |
tree | 59109aeab8297bdc996faca8c4e38ec7426c36cf /src/namestore | |
parent | 780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff) |
-remove trailing whitespace
Diffstat (limited to 'src/namestore')
23 files changed, 436 insertions, 436 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index 4b110a5484..7455c0ba52 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c @@ -120,7 +120,7 @@ struct Request struct MHD_PostProcessor *pp; /** - * URL to serve in response to this POST (if this request + * URL to serve in response to this POST (if this request * was a 'POST') */ const char *post_url; @@ -129,7 +129,7 @@ struct Request * Active request with the namestore. */ struct GNUNET_NAMESTORE_QueueEntry *qe; - + /** * Current processing phase. */ @@ -171,7 +171,7 @@ struct ZoneinfoRequest * Buffer length */ size_t buf_len; - + /** * Buffer write offset */ @@ -270,8 +270,8 @@ iterate_cb (void *cls, MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, MIME_HTML); - MHD_queue_response (zr->connection, - MHD_HTTP_OK, + MHD_queue_response (zr->connection, + MHD_HTTP_OK, response); MHD_destroy_response (response); GNUNET_free (zr->zoneinfo); @@ -305,9 +305,9 @@ iterate_cb (void *cls, zr->zoneinfo = new_buf; zr->buf_len *= 2; } - sprintf (zr->zoneinfo + zr->write_offset, - "<tr><td>%s</td><td>%s</td></tr>", - name, + sprintf (zr->zoneinfo + zr->write_offset, + "<tr><td>%s</td><td>%s</td></tr>", + name, pkey); zr->write_offset = strlen (zr->zoneinfo); GNUNET_NAMESTORE_zone_iterator_next (zr->list_it); @@ -359,8 +359,8 @@ serve_main_page (struct MHD_Connection *connection) MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, MIME_HTML); - ret = MHD_queue_response (connection, - MHD_HTTP_OK, + ret = MHD_queue_response (connection, + MHD_HTTP_OK, response); MHD_destroy_response (response); return ret; @@ -394,8 +394,8 @@ fill_s_reply (const char *info, MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, MIME_HTML); - ret = MHD_queue_response (connection, - MHD_HTTP_OK, + ret = MHD_queue_response (connection, + MHD_HTTP_OK, response); MHD_destroy_response (response); return ret; @@ -471,7 +471,7 @@ post_iterator (void *cls, * GNUNET_YES (or other positive value) on success * @param emsg NULL on success, otherwise an error message */ -static void +static void put_continuation (void *cls, int32_t success, const char *emsg) @@ -502,7 +502,7 @@ put_continuation (void *cls, * @param rd_count number of entries in 'rd' array * @param rd array of records with data to store */ -static void +static void zone_to_name_cb (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, const char *name, @@ -512,7 +512,7 @@ zone_to_name_cb (void *cls, struct Request *request = cls; struct GNUNET_NAMESTORE_RecordData r; struct GNUNET_CRYPTO_EccPublicSignKey pub; - + request->qe = NULL; if (NULL != name) { @@ -548,14 +548,14 @@ zone_to_name_cb (void *cls, * @param rd_count number of entries in 'rd' array * @param rd array of records with data to store */ -static void +static void lookup_result_processor (void *cls, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) { struct Request *request = cls; struct GNUNET_CRYPTO_EccPublicSignKey pub; - + if (0 != rd_count) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -606,7 +606,7 @@ lookup_block_processor (void *cls, } GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey, &pub); - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_NAMESTORE_block_decrypt (block, &pub, request->domain_name, @@ -650,7 +650,7 @@ create_response (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, + const char *upload_data, size_t *upload_data_size, void **ptr) { @@ -688,7 +688,7 @@ create_response (void *cls, _("Failed to setup post processor for `%s'\n"), url); return MHD_NO; /* internal error */ - } + } return MHD_YES; } if (NULL != request->pp) @@ -759,14 +759,14 @@ create_response (void *cls, GNUNET_break (0); return MHD_NO; } - return MHD_YES; /* will have a reply later... */ + return MHD_YES; /* will have a reply later... */ } /* unsupported HTTP method */ response = MHD_create_response_from_buffer (strlen (METHOD_ERROR), (void *) METHOD_ERROR, MHD_RESPMEM_PERSISTENT); - ret = MHD_queue_response (connection, - MHD_HTTP_METHOD_NOT_ACCEPTABLE, + ret = MHD_queue_response (connection, + MHD_HTTP_METHOD_NOT_ACCEPTABLE, response); MHD_destroy_response (response); return ret; @@ -900,7 +900,7 @@ do_shutdown (void *cls, } -/** +/** * Method called to inform about the egos of this peer. * * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, @@ -908,7 +908,7 @@ do_shutdown (void *cls, * @a ego does indicate an error (i.e. name is taken or no default * value is known). If @a ego is non-NULL and if '*ctx' * is set in those callbacks, the value WILL be passed to a subsequent - * call to the identity callback of #GNUNET_IDENTITY_connect (if + * call to the identity callback of #GNUNET_IDENTITY_connect (if * that one was not NULL). * * @param cls closure, NULL @@ -941,12 +941,12 @@ identity_cb (void *cls, { httpd = MHD_start_daemon (options, (uint16_t) port, - NULL, NULL, - &create_response, NULL, + NULL, NULL, + &create_response, NULL, MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128, MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1, MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16, - MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024), + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024), MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, MHD_OPTION_END); if (MHD_USE_DEBUG == options) @@ -1026,7 +1026,7 @@ main (int argc, char *const *argv) ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "fcfsd", - _("GNU Name System First Come First Serve name registration service"), + _("GNU Name System First Come First Serve name registration service"), options, &run, NULL)) ? 0 : 1; GNUNET_free ((void*) argv); diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 37995e8c60..ceedadc243 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c @@ -336,7 +336,7 @@ display_record (void *cls, if ( (NULL == del_qe) && (NULL == list_qe) && (NULL == add_qe_uri) && - (NULL == add_qe) ) + (NULL == add_qe) ) GNUNET_SCHEDULER_shutdown (); return; } @@ -365,12 +365,12 @@ display_record (void *cls, at.abs_value_us = rd[i].expiration_time; ets = GNUNET_STRINGS_absolute_time_to_string (at); } - FPRINTF (stdout, + FPRINTF (stdout, "\t%s: %s (%s)\n", - typestring, + typestring, s, ets); - GNUNET_free (s); + GNUNET_free (s); } FPRINTF (stdout, "%s", "\n"); GNUNET_NAMESTORE_zone_iterator_next (list_it); @@ -435,7 +435,7 @@ get_existing_record (void *cls, } else if (GNUNET_NO == etime_is_rel) rde->expiration_time = etime_abs.abs_value_us; - else + else rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; GNUNET_assert (NULL != name); add_qe = GNUNET_NAMESTORE_records_store (ns, @@ -479,7 +479,7 @@ display_records_from_block (void *cls, } FPRINTF (stdout, "%s:\n", - name); + name); for (i=0;i<rd_len;i++) { typestring = GNUNET_NAMESTORE_number_to_typename (rd[i].record_type); @@ -492,11 +492,11 @@ display_records_from_block (void *cls, (unsigned int) rd[i].record_type); continue; } - FPRINTF (stdout, + FPRINTF (stdout, "\t%s: %s\n", - typestring, + typestring, s); - GNUNET_free (s); + GNUNET_free (s); } FPRINTF (stdout, "%s", "\n"); } @@ -521,7 +521,7 @@ handle_block (void *cls, { fprintf (stderr, "No matching block found\n"); - } + } else if (GNUNET_OK != GNUNET_NAMESTORE_block_decrypt (block, &zone_pubkey, @@ -535,7 +535,7 @@ handle_block (void *cls, if ( (NULL == del_qe) && (NULL == list_it) && (NULL == add_qe_uri) && - (NULL == add_qe) ) + (NULL == add_qe) ) GNUNET_SCHEDULER_shutdown (); } @@ -558,17 +558,17 @@ testservice_task (void *cls, if (GNUNET_YES != result) { - FPRINTF (stderr, _("Service `%s' is not running\n"), + FPRINTF (stderr, _("Service `%s' is not running\n"), "namestore"); return; } if (! (add|del|list|(NULL != uri))) { - /* nothing more to be done */ + /* nothing more to be done */ fprintf (stderr, _("No options given\n")); GNUNET_SCHEDULER_shutdown (); - return; + return; } GNUNET_CRYPTO_ecc_key_get_public_for_signature (&zone_pkey, &pub); @@ -588,8 +588,8 @@ testservice_task (void *cls, _("Missing option `%s' for operation `%s'\n"), "-n", _("add")); GNUNET_SCHEDULER_shutdown (); - ret = 1; - return; + ret = 1; + return; } if (NULL == typestring) { @@ -598,7 +598,7 @@ testservice_task (void *cls, "-t", _("add")); GNUNET_SCHEDULER_shutdown (); ret = 1; - return; + return; } type = GNUNET_NAMESTORE_typename_to_number (typestring); if (UINT32_MAX == type) @@ -613,9 +613,9 @@ testservice_task (void *cls, fprintf (stderr, _("Missing option `%s' for operation `%s'\n"), "-V", _("add")); - ret = 1; + ret = 1; GNUNET_SCHEDULER_shutdown (); - return; + return; } if (GNUNET_OK != GNUNET_NAMESTORE_string_to_value (type, @@ -636,8 +636,8 @@ testservice_task (void *cls, _("Missing option `%s' for operation `%s'\n"), "-e", _("add")); GNUNET_SCHEDULER_shutdown (); - ret = 1; - return; + ret = 1; + return; } if (0 == strcmp (expirationstring, "never")) { @@ -650,7 +650,7 @@ testservice_task (void *cls, { etime_is_rel = GNUNET_YES; } - else if (GNUNET_OK == + else if (GNUNET_OK == GNUNET_STRINGS_fancy_time_to_absolute (expirationstring, &etime_abs)) { @@ -663,7 +663,7 @@ testservice_task (void *cls, expirationstring); GNUNET_SCHEDULER_shutdown (); ret = 1; - return; + return; } add_zit = GNUNET_NAMESTORE_zone_iteration_start (ns, &zone_pkey, @@ -679,7 +679,7 @@ testservice_task (void *cls, "-n", _("del")); GNUNET_SCHEDULER_shutdown (); ret = 1; - return; + return; } del_qe = GNUNET_NAMESTORE_records_store (ns, &zone_pkey, @@ -726,7 +726,7 @@ testservice_task (void *cls, (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (sh, strlen (sh), &pkey)) ) { - fprintf (stderr, + fprintf (stderr, _("Invalid URI `%s'\n"), uri); GNUNET_SCHEDULER_shutdown (); @@ -744,7 +744,7 @@ testservice_task (void *cls, } else if (GNUNET_NO == etime_is_rel) rd.expiration_time = etime_abs.abs_value_us; - else + else rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; if (1 != shadow) rd.flags |= GNUNET_NAMESTORE_RF_SHADOW_RECORD; @@ -772,7 +772,7 @@ testservice_task (void *cls, * An @a ego of NULL means the ego was not found. * * @param cls closure with the configuration - * @param ego an ego known to identity service, or NULL + * @param ego an ego known to identity service, or NULL */ static void identity_cb (void *cls, @@ -783,7 +783,7 @@ identity_cb (void *cls, el = NULL; if (NULL == ego) { - fprintf (stderr, + fprintf (stderr, _("Ego `%s' not known to identity service\n"), ego_name); GNUNET_SCHEDULER_shutdown (); @@ -813,7 +813,7 @@ run (void *cls, char *const *args, const char *cfgfile, { if (NULL == ego_name) { - fprintf (stderr, + fprintf (stderr, _("You must specify which zone should be accessed\n")); return; } @@ -846,28 +846,28 @@ main (int argc, char *const *argv) &GNUNET_GETOPT_set_one, &add}, {'d', "delete", NULL, gettext_noop ("delete record"), 0, - &GNUNET_GETOPT_set_one, &del}, + &GNUNET_GETOPT_set_one, &del}, {'D', "display", NULL, gettext_noop ("display records"), 0, - &GNUNET_GETOPT_set_one, &list}, + &GNUNET_GETOPT_set_one, &list}, {'e', "expiration", "TIME", gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1, - &GNUNET_GETOPT_set_string, &expirationstring}, + &GNUNET_GETOPT_set_string, &expirationstring}, {'m', "monitor", NULL, gettext_noop ("monitor changes in the namestore"), 0, - &GNUNET_GETOPT_set_one, &monitor}, + &GNUNET_GETOPT_set_one, &monitor}, {'n', "name", "NAME", gettext_noop ("name of the record to add/delete/display"), 1, - &GNUNET_GETOPT_set_string, &name}, + &GNUNET_GETOPT_set_string, &name}, {'t', "type", "TYPE", gettext_noop ("type of the record to add/delete/display"), 1, - &GNUNET_GETOPT_set_string, &typestring}, + &GNUNET_GETOPT_set_string, &typestring}, {'u', "uri", "URI", gettext_noop ("URI to import into our zone"), 1, - &GNUNET_GETOPT_set_string, &uri}, + &GNUNET_GETOPT_set_string, &uri}, {'V', "value", "VALUE", gettext_noop ("value of the record to add/delete"), 1, - &GNUNET_GETOPT_set_string, &value}, + &GNUNET_GETOPT_set_string, &value}, {'p', "public", NULL, gettext_noop ("create or list public record"), 0, &GNUNET_GETOPT_set_one, &public}, @@ -876,7 +876,7 @@ main (int argc, char *const *argv) &GNUNET_GETOPT_set_one, &shadow}, {'z', "zone", "EGO", gettext_noop ("name of the ego controlling the zone"), 1, - &GNUNET_GETOPT_set_string, &ego_name}, + &GNUNET_GETOPT_set_string, &ego_name}, GNUNET_GETOPT_OPTION_END }; @@ -886,7 +886,7 @@ main (int argc, char *const *argv) GNUNET_log_setup ("gnunet-namestore", "WARNING", NULL); if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "gnunet-namestore", - _("GNUnet zone manipulation tool"), + _("GNUnet zone manipulation tool"), options, &run, NULL)) { diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 8251a41fa7..ef200a8f43 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -260,7 +260,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param client identification of the client */ static void -client_disconnect_notification (void *cls, +client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client) { struct ZoneIteration *no; @@ -269,8 +269,8 @@ client_disconnect_notification (void *cls, if (NULL == client) return; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Client %p disconnected\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Client %p disconnected\n", client); if (NULL == (nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient))) return; @@ -315,7 +315,7 @@ client_lookup (struct GNUNET_SERVER_Client *client) nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient); if (NULL != nc) return nc; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client); nc = GNUNET_new (struct NamestoreClient); @@ -361,7 +361,7 @@ handle_lookup_block_it (void *cls, size_t esize; esize = ntohl (block->purpose.size) - - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) - sizeof (struct GNUNET_TIME_AbsoluteNBO); r = GNUNET_malloc (sizeof (struct LookupBlockResponseMessage) + esize); r->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE); @@ -369,15 +369,15 @@ handle_lookup_block_it (void *cls, r->gns_header.r_id = htonl (lnc->request_id); r->expire = block->expiration_time; r->signature = block->signature; - r->derived_key = block->derived_key; + r->derived_key = block->derived_key; memcpy (&r[1], &block[1], esize); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message with expiration time %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message with expiration time %s\n", "NAMESTORE_LOOKUP_BLOCK_RESPONSE", GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (r->expire))); - GNUNET_SERVER_notification_context_unicast (snc, - lnc->nc->client, - &r->gns_header.header, + GNUNET_SERVER_notification_context_unicast (snc, + lnc->nc->client, + &r->gns_header.header, GNUNET_NO); GNUNET_free (r); } @@ -401,38 +401,38 @@ handle_lookup_block (void *cls, struct LookupBlockResponseMessage zir_end; int ret; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received `%s' message\n", "NAMESTORE_LOOKUP_BLOCK"); nc = client_lookup(client); ln_msg = (const struct LookupBlockMessage *) message; lnc.request_id = ntohl (ln_msg->gns_header.r_id); lnc.nc = nc; if (GNUNET_SYSERR == - (ret = GSN_database->lookup_block (GSN_database->cls, + (ret = GSN_database->lookup_block (GSN_database->cls, &ln_msg->query, &handle_lookup_block_it, &lnc))) { /* internal error (in database plugin); might be best to just hang up on - plugin rather than to signal that there are 'no' results, which + plugin rather than to signal that there are 'no' results, which might also be false... */ - GNUNET_break (0); + GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; - } + } if (0 == ret) { /* no records match at all, generate empty response */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending empty `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending empty `%s' message\n", "NAMESTORE_LOOKUP_BLOCK_RESPONSE"); memset (&zir_end, 0, sizeof (zir_end)); zir_end.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE); zir_end.gns_header.header.size = htons (sizeof (struct LookupBlockResponseMessage)); zir_end.gns_header.r_id = ln_msg->gns_header.r_id; - GNUNET_SERVER_notification_context_unicast (snc, - client, - &zir_end.gns_header.header, + GNUNET_SERVER_notification_context_unicast (snc, + client, + &zir_end.gns_header.header, GNUNET_NO); } @@ -453,7 +453,7 @@ handle_block_cache (void *cls, const struct GNUNET_MessageHeader *message) { struct NamestoreClient *nc; - const struct BlockCacheMessage *rp_msg; + const struct BlockCacheMessage *rp_msg; struct BlockCacheResponseMessage rpr_msg; struct GNUNET_NAMESTORE_Block *block; size_t esize; @@ -475,7 +475,7 @@ handle_block_cache (void *cls, sizeof (struct GNUNET_TIME_AbsoluteNBO) + esize); block->expiration_time = rp_msg->expire; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message with expiration time %s\n", "NAMESTORE_BLOCK_CACHE", GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time))); @@ -488,9 +488,9 @@ handle_block_cache (void *cls, rpr_msg.gns_header.header.size = htons (sizeof (struct BlockCacheResponseMessage)); rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id; rpr_msg.op_result = htonl (res); - GNUNET_SERVER_notification_context_unicast (snc, - nc->client, - &rpr_msg.gns_header.header, + GNUNET_SERVER_notification_context_unicast (snc, + nc->client, + &rpr_msg.gns_header.header, GNUNET_NO); GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -525,7 +525,7 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc, char *rd_ser; name_len = strlen (name) + 1; - rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); + rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); msg_size = sizeof (struct RecordResultMessage) + name_len + rd_ser_len; zir_msg = GNUNET_malloc (msg_size); @@ -540,13 +540,13 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc, memcpy (name_tmp, name, name_len); rd_ser = &name_tmp[name_len]; GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_ser); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message with %u records and size %u\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message with %u records and size %u\n", "RECORD_RESULT", rd_count, msg_size); GNUNET_SERVER_notification_context_unicast (nc, - client, + client, &zir_msg->gns_header.header, GNUNET_NO); GNUNET_free (zir_msg); @@ -569,7 +569,7 @@ refresh_block (const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, const struct GNUNET_NAMESTORE_RecordData *rd) { struct GNUNET_NAMESTORE_Block *block; - + if (0 == rd_count) block = GNUNET_NAMESTORE_block_create (zone_key, GNUNET_TIME_UNIT_ZERO_ABS, @@ -589,7 +589,7 @@ refresh_block (const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, _("Failed to cache encrypted block of my own zone!\n")); } GNUNET_free (block); -} +} /** @@ -620,8 +620,8 @@ handle_record_store (void *cls, struct GNUNET_CRYPTO_EccPublicSignKey pubkey; struct ZoneMonitor *zm; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received `%s' message\n", "NAMESTORE_RECORD_STORE"); if (ntohs (message->size) < sizeof (struct RecordStoreMessage)) { @@ -686,9 +686,9 @@ handle_record_store (void *cls, conv_name, GNUNET_NAMESTORE_z2s (&pubkey)); - if ( (0 == rd_count) && - (GNUNET_NO == - GSN_database->iterate_records (GSN_database->cls, + if ( (0 == rd_count) && + (GNUNET_NO == + GSN_database->iterate_records (GSN_database->cls, &rp_msg->private_key, 0, NULL, 0)) ) { /* This name does not exist, so cannot be removed */ @@ -701,15 +701,15 @@ handle_record_store (void *cls, { res = GSN_database->store_records (GSN_database->cls, &rp_msg->private_key, - conv_name, + conv_name, rd_count, rd); if (GNUNET_OK == res) { refresh_block (&rp_msg->private_key, conv_name, rd_count, rd); - - for (zm = monitor_head; NULL != zm; zm = zm->next) + + for (zm = monitor_head; NULL != zm; zm = zm->next) if (0 == memcmp (&rp_msg->private_key, &zm->zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) send_lookup_response (monitor_nc, @@ -722,10 +722,10 @@ handle_record_store (void *cls, GNUNET_free (conv_name); } } - + /* Send response */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message\n", "RECORD_STORE_RESPONSE"); rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE); rcr_msg.gns_header.header.size = htons (sizeof (struct RecordStoreResponseMessage)); @@ -788,8 +788,8 @@ handle_zone_to_name_it (void *cls, char *name_tmp; char *rd_tmp; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Found result for zone-to-name lookup: `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Found result for zone-to-name lookup: `%s'\n", name); res = GNUNET_YES; name_len = (NULL == name) ? 0 : strlen (name) + 1; @@ -840,7 +840,7 @@ handle_zone_to_name (void *cls, struct ZoneToNameCtx ztn_ctx; struct ZoneToNameResponseMessage ztnr_msg; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_TO_NAME"); ztn_msg = (const struct ZoneToNameMessage *) message; @@ -849,7 +849,7 @@ handle_zone_to_name (void *cls, ztn_ctx.nc = nc; ztn_ctx.success = GNUNET_NO; if (GNUNET_SYSERR == - GSN_database->zone_to_name (GSN_database->cls, + GSN_database->zone_to_name (GSN_database->cls, &ztn_msg->zone, &ztn_msg->value_zone, &handle_zone_to_name_it, &ztn_ctx)) @@ -858,7 +858,7 @@ handle_zone_to_name (void *cls, that might be wrong */ GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } if (GNUNET_NO == ztn_ctx.success) { @@ -945,17 +945,17 @@ zone_iteraterate_proc (void *cls, if ((NULL == zone_key) && (NULL == name)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Iteration done\n"); proc->res_iteration_finished = IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE; return; } - if ((NULL == zone_key) || (NULL == name)) + if ((NULL == zone_key) || (NULL == name)) { /* what is this!? should never happen */ proc->res_iteration_finished = IT_START; GNUNET_break (0); - return; + return; } proc->res_iteration_finished = IT_SUCCESS_MORE_AVAILABLE; send_lookup_response (snc, @@ -1001,11 +1001,11 @@ run_zone_iteration_round (struct ZoneIteration *zi) while (IT_START == proc.res_iteration_finished) { if (GNUNET_SYSERR == - (ret = GSN_database->iterate_records (GSN_database->cls, - (0 == memcmp (&zi->zone, &zero, sizeof (zero))) - ? NULL + (ret = GSN_database->iterate_records (GSN_database->cls, + (0 == memcmp (&zi->zone, &zero, sizeof (zero))) + ? NULL : &zi->zone, - zi->offset, + zi->offset, &zone_iteraterate_proc, &proc))) { GNUNET_break (0); @@ -1027,10 +1027,10 @@ run_zone_iteration_round (struct ZoneIteration *zi) rrm.gns_header.header.size = htons (sizeof (rrm)); rrm.gns_header.r_id = htonl (zi->request_id); GNUNET_SERVER_notification_context_unicast (snc, - zi->client->client, + zi->client->client, &rrm.gns_header.header, GNUNET_NO); - GNUNET_CONTAINER_DLL_remove (zi->client->op_head, + GNUNET_CONTAINER_DLL_remove (zi->client->op_head, zi->client->op_tail, zi); GNUNET_free (zi); @@ -1159,7 +1159,7 @@ handle_iteration_next (void *cls, * Send 'sync' message to zone monitor, we're now in sync. * * @param zm monitor that is now in sync - */ + */ static void monitor_sync (struct ZoneMonitor *zm) { @@ -1234,8 +1234,8 @@ handle_monitor_start (void *cls, { const struct ZoneMonitorStartMessage *zis_msg; struct ZoneMonitor *zm; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_MONITOR_START"); zis_msg = (const struct ZoneMonitorStartMessage *) message; @@ -1249,7 +1249,7 @@ handle_monitor_start (void *cls, GNUNET_SERVER_disable_receive_done_warning (client); GNUNET_SERVER_notification_context_add (monitor_nc, client); - zm->task = GNUNET_SCHEDULER_add_now (&monitor_next, zm); + zm->task = GNUNET_SCHEDULER_add_now (&monitor_next, zm); } @@ -1265,7 +1265,7 @@ monitor_next (void *cls, { struct ZoneMonitor *zm = cls; int ret; - + zm->task = GNUNET_SCHEDULER_NO_TASK; ret = GSN_database->iterate_records (GSN_database->cls, &zm->zone, @@ -1332,7 +1332,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_free (database); if (NULL == GSN_database) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not load database backend `%s'\n", db_lib_name); GNUNET_SCHEDULER_add_now (&cleanup_task, NULL); diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index a4b01a9604..a8851e104d 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h @@ -171,7 +171,7 @@ struct RecordStoreMessage uint16_t rd_len GNUNET_PACKED; /** - * Number of records contained + * Number of records contained */ uint16_t rd_count GNUNET_PACKED; @@ -221,12 +221,12 @@ struct ZoneToNameMessage struct GNUNET_NAMESTORE_Header gns_header; /** - * The private key of the zone to look up in + * The private key of the zone to look up in */ struct GNUNET_CRYPTO_EccPrivateKey zone; /** - * The public key of the target zone + * The public key of the target zone */ struct GNUNET_CRYPTO_EccPublicSignKey value_zone; }; @@ -259,7 +259,7 @@ struct ZoneToNameResponseMessage /** * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no - * results, #GNUNET_SYSERR on error + * results, #GNUNET_SYSERR on error */ int16_t res GNUNET_PACKED; @@ -297,7 +297,7 @@ struct RecordResultMessage uint16_t rd_len GNUNET_PACKED; /** - * Number of records contained + * Number of records contained */ uint16_t rd_count GNUNET_PACKED; diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index a1d17835f7..3df6f8210f 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c @@ -272,11 +272,11 @@ handle_lookup_block_response (struct GNUNET_NAMESTORE_QueueEntry *qe, size_t size) { struct GNUNET_NAMESTORE_Block *block; - char buf[size + sizeof (struct GNUNET_NAMESTORE_Block) + char buf[size + sizeof (struct GNUNET_NAMESTORE_Block) - sizeof (struct LookupBlockResponseMessage)]; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received `%s'\n", + "Received `%s'\n", "LOOKUP_BLOCK_RESPONSE"); if (0 == GNUNET_TIME_absolute_ntoh (msg->expire).abs_value_us) { @@ -290,7 +290,7 @@ handle_lookup_block_response (struct GNUNET_NAMESTORE_QueueEntry *qe, block->signature = msg->signature; block->derived_key = msg->derived_key; block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); - block->purpose.size = htonl (size - sizeof (struct LookupBlockResponseMessage) + + block->purpose.size = htonl (size - sizeof (struct LookupBlockResponseMessage) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); block->expiration_time = msg->expire; @@ -332,11 +332,11 @@ handle_block_cache_response (struct GNUNET_NAMESTORE_QueueEntry *qe, "BLOCK_CACHE_RESPONSE"); res = ntohl (msg->op_result); /* TODO: add actual error message from namestore to response... */ - if (NULL != qe->cont) - qe->cont (qe->cont_cls, - res, - (GNUNET_OK == res) ? - NULL + if (NULL != qe->cont) + qe->cont (qe->cont_cls, + res, + (GNUNET_OK == res) ? + NULL : _("Namestore failed to cache block")); return GNUNET_OK; } @@ -358,8 +358,8 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, { int res; const char *emsg; - - LOG (GNUNET_ERROR_TYPE_DEBUG, + + LOG (GNUNET_ERROR_TYPE_DEBUG, "Received `%s'\n", "RECORD_STORE_RESPONSE"); /* TODO: add actual error message from namestore to response... */ @@ -368,7 +368,7 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, emsg = _("Namestore failed to store record\n"); else emsg = NULL; - if (NULL != qe->cont) + if (NULL != qe->cont) qe->cont (qe->cont_cls, res, emsg); return GNUNET_OK; } @@ -397,7 +397,7 @@ handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe, unsigned int rd_count; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received `%s'\n", + "Received `%s'\n", "RECORD_RESULT"); rd_len = ntohs (msg->rd_len); rd_count = ntohs (msg->rd_count); @@ -429,11 +429,11 @@ handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe, if (0 == name_len) name = NULL; if (NULL != qe->proc) - qe->proc (qe->proc_cls, + qe->proc (qe->proc_cls, &msg->private_key, name, rd_count, - (rd_count > 0) ? rd : NULL); + (rd_count > 0) ? rd : NULL); } return GNUNET_OK; } @@ -461,7 +461,7 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, const char *name_tmp; const char *rd_tmp; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Received `%s'\n", "ZONE_TO_NAME_RESPONSE"); res = ntohs (msg->res); @@ -472,11 +472,11 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, "An error occured during zone to name operation\n"); break; case GNUNET_NO: - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Namestore has no result for zone to name mapping \n"); break; case GNUNET_YES: - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Namestore has result for zone to name mapping \n"); name_len = ntohs (msg->name_len); rd_count = ntohs (msg->rd_count); @@ -499,10 +499,10 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, } /* normal end, call continuation with result */ if (NULL != qe->proc) - qe->proc (qe->proc_cls, + qe->proc (qe->proc_cls, &msg->zone, - name_tmp, - rd_count, rd); + name_tmp, + rd_count, rd); /* return is important here: break would call continuation with error! */ return GNUNET_OK; } @@ -530,11 +530,11 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, static int manage_record_operations (struct GNUNET_NAMESTORE_QueueEntry *qe, const struct GNUNET_MessageHeader *msg, - uint16_t type, + uint16_t type, size_t size) { /* handle different message type */ - switch (type) + switch (type) { case GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE: if (size < sizeof (struct LookupBlockResponseMessage)) @@ -601,7 +601,7 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, const char *name_tmp; const char *rd_ser_tmp; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Received `%s'\n", "ZONE_ITERATION_RESPONSE"); msg_len = ntohs (msg->gns_header.header.size); @@ -614,8 +614,8 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, GNUNET_break (0); return GNUNET_SYSERR; } - if ( (0 == name_len) && - (0 == (memcmp (&msg->private_key, + if ( (0 == name_len) && + (0 == (memcmp (&msg->private_key, &priv_dummy, sizeof (priv_dummy)))) ) { @@ -635,18 +635,18 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, { struct GNUNET_NAMESTORE_RecordData rd[rd_count]; - if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (rd_len, - rd_ser_tmp, - rd_count, + if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (rd_len, + rd_ser_tmp, + rd_count, rd)) { GNUNET_break (0); return GNUNET_SYSERR; } if (NULL != ze->proc) - ze->proc (ze->proc_cls, - &msg->private_key, - name_tmp, + ze->proc (ze->proc_cls, + &msg->private_key, + name_tmp, rd_count, rd); return GNUNET_YES; } @@ -669,7 +669,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze, int type, size_t size) { /* handle different message type */ - switch (type) + switch (type) { case GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT: if (size < sizeof (struct RecordResultMessage)) @@ -678,7 +678,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze, return GNUNET_SYSERR; } return handle_zone_iteration_response (ze, - (const struct RecordResultMessage *) msg, + (const struct RecordResultMessage *) msg, size); default: GNUNET_break (0); @@ -695,7 +695,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze, * @param msg message received, NULL on timeout or fatal error */ static void -process_namestore_message (void *cls, +process_namestore_message (void *cls, const struct GNUNET_MessageHeader *msg) { struct GNUNET_NAMESTORE_Handle *h = cls; @@ -717,7 +717,7 @@ process_namestore_message (void *cls, if (size < sizeof (struct GNUNET_NAMESTORE_Header)) { GNUNET_break_op (0); - GNUNET_CLIENT_receive (h->client, + GNUNET_CLIENT_receive (h->client, &process_namestore_message, h, GNUNET_TIME_UNIT_FOREVER_REL); return; @@ -726,9 +726,9 @@ process_namestore_message (void *cls, r_id = ntohl (gm->r_id); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received message type %u size %u op %u\n", + "Received message type %u size %u op %u\n", (unsigned int) type, - (unsigned int) size, + (unsigned int) size, (unsigned int) r_id); /* Is it a record related operation ? */ @@ -738,7 +738,7 @@ process_namestore_message (void *cls, if (NULL != qe) { ret = manage_record_operations (qe, msg, type, size); - if (GNUNET_SYSERR == ret) + if (GNUNET_SYSERR == ret) { /* protocol error, need to reconnect */ h->reconnect = GNUNET_YES; @@ -802,8 +802,8 @@ do_transmit (struct GNUNET_NAMESTORE_Handle *h); * @return number of bytes copied into @a buf */ static size_t -transmit_message_to_namestore (void *cls, - size_t size, +transmit_message_to_namestore (void *cls, + size_t size, void *buf) { struct GNUNET_NAMESTORE_Handle *h = cls; @@ -819,14 +819,14 @@ transmit_message_to_namestore (void *cls, } ret = 0; cbuf = buf; - while ( (NULL != (p = h->pending_head)) && + while ( (NULL != (p = h->pending_head)) && (p->size <= size) ) { memcpy (&cbuf[ret], &p[1], p->size); ret += p->size; size -= p->size; GNUNET_CONTAINER_DLL_remove (h->pending_head, - h->pending_tail, + h->pending_tail, p); if (GNUNET_NO == h->is_receiving) { @@ -889,7 +889,7 @@ reconnect (struct GNUNET_NAMESTORE_Handle *h) * @param tc scheduler context */ static void -reconnect_task (void *cls, +reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_NAMESTORE_Handle *h = cls; @@ -1010,7 +1010,7 @@ GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h) /** * Store an item in the namestore. If the item is already present, - * it is replaced with the new record. + * it is replaced with the new record. * * @param h handle to the namestore * @param block block to store @@ -1032,8 +1032,8 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h, size_t msg_size; GNUNET_assert (NULL != h); - blen = ntohl (block->purpose.size) - - sizeof (struct GNUNET_TIME_AbsoluteNBO) + blen = ntohl (block->purpose.size) + - sizeof (struct GNUNET_TIME_AbsoluteNBO) - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose); rid = get_op_id (h); qe = GNUNET_new (struct GNUNET_NAMESTORE_QueueEntry); @@ -1055,9 +1055,9 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h, msg->signature = block->signature; msg->derived_key = block->derived_key; memcpy (&msg[1], &block[1], blen); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message with size %u and expiration %s\n", - "NAMESTORE_BLOCK_CACHE", + "NAMESTORE_BLOCK_CACHE", (unsigned int) msg_size, GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (msg->expire))); GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); @@ -1134,12 +1134,12 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, name_tmp = (char *) &msg[1]; memcpy (name_tmp, label, name_len); rd_ser = &name_tmp[name_len]; - GNUNET_break (rd_ser_len == - GNUNET_NAMESTORE_records_serialize (rd_count, rd, - rd_ser_len, + GNUNET_break (rd_ser_len == + GNUNET_NAMESTORE_records_serialize (rd_count, rd, + rd_ser_len, rd_ser)); - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message for name `%s' with size %u and %u records\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message for name `%s' with size %u and %u records\n", "NAMESTORE_RECORD_STORE", label, msg_size, rd_count); GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); @@ -1150,7 +1150,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, /** * Get a result for a particular key from the namestore. The processor - * will only be called once. + * will only be called once. * * @param h handle to the namestore * @param derived_hash hash of zone key combined with name to lookup @@ -1160,7 +1160,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, * @return a handle that can be used to cancel */ struct GNUNET_NAMESTORE_QueueEntry * -GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, +GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_HashCode *derived_hash, GNUNET_NAMESTORE_BlockProcessor proc, void *proc_cls) { @@ -1328,7 +1328,7 @@ GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator *it) msg->gns_header.header.size = htons (msg_size); msg->gns_header.r_id = htonl (it->op_id); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message\n", + "Sending `%s' message\n", "ZONE_ITERATION_NEXT"); GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); do_transmit (h); @@ -1360,8 +1360,8 @@ GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it) msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP); msg->gns_header.header.size = htons (msg_size); msg->gns_header.r_id = htonl (it->op_id); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message\n", "ZONE_ITERATION_STOP"); GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); do_transmit (h); diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c index 5cadf89977..bf853ccdf4 100644 --- a/src/namestore/namestore_api_common.c +++ b/src/namestore/namestore_api_common.c @@ -68,7 +68,7 @@ struct NetworkRecord * Flags for the record, network byte order. */ uint32_t flags GNUNET_PACKED; - + }; GNUNET_NETWORK_STRUCT_END @@ -103,7 +103,7 @@ GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z) static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8]; char *end; - end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, + end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), buf, sizeof (buf)); if (NULL == end) @@ -137,7 +137,7 @@ GNUNET_NAMESTORE_records_get_size (unsigned int rd_count, GNUNET_assert ((ret + rd[i].data_size) >= ret); ret += rd[i].data_size; } - return ret; + return ret; } @@ -159,7 +159,7 @@ GNUNET_NAMESTORE_records_serialize (unsigned int rd_count, struct NetworkRecord rec; unsigned int i; size_t off; - + off = 0; for (i=0;i<rd_count;i++) { @@ -211,11 +211,11 @@ GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a, { LOG (GNUNET_ERROR_TYPE_DEBUG, "Expiration time %llu != %llu\n", - a->expiration_time, + a->expiration_time, b->expiration_time); return GNUNET_NO; } - if ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS) + if ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS) != (b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS)) { LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -227,8 +227,8 @@ GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a, if (a->data_size != b->data_size) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "Data size %lu != %lu\n", - a->data_size, + "Data size %lu != %lu\n", + a->data_size, b->data_size); return GNUNET_NO; } @@ -262,7 +262,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len, struct NetworkRecord rec; unsigned int i; size_t off; - + off = 0; for (i=0;i<rd_count;i++) { @@ -284,7 +284,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len, dest[i].flags, (unsigned long long) dest[i].expiration_time); } - return GNUNET_OK; + return GNUNET_OK; } @@ -298,7 +298,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len, * @return absolute expiration time */ struct GNUNET_TIME_Absolute -GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, +GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) { unsigned int c; @@ -309,7 +309,7 @@ GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, if (NULL == rd) return GNUNET_TIME_UNIT_ZERO_ABS; expire = GNUNET_TIME_UNIT_FOREVER_ABS; - for (c = 0; c < rd_count; c++) + for (c = 0; c < rd_count; c++) { if (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) { @@ -320,7 +320,7 @@ GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, { at.abs_value_us = rd[c].expiration_time; } - expire = GNUNET_TIME_absolute_min (at, expire); + expire = GNUNET_TIME_absolute_min (at, expire); } LOG (GNUNET_ERROR_TYPE_DEBUG, "Determined expiration time for block with %u records to be %s\n", @@ -392,10 +392,10 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, memcpy (payload, &rd_count_nbo, sizeof (uint32_t)); GNUNET_assert (payload_len == GNUNET_NAMESTORE_records_serialize (rd_count, rd, - payload_len, &payload[sizeof (uint32_t)])); + payload_len, &payload[sizeof (uint32_t)])); block = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Block) + sizeof (uint32_t) + payload_len); - block->purpose.size = htonl (sizeof (uint32_t) + payload_len + + block->purpose.size = htonl (sizeof (uint32_t) + payload_len + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct GNUNET_TIME_AbsoluteNBO)); block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); @@ -436,8 +436,8 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, */ int GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) -{ - return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, +{ + return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, &block->purpose, &block->signature, &block->derived_key); @@ -452,7 +452,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) * @param label the name for the records * @param proc function to call with the result * @param proc_cls closure for proc - * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was + * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was * not well-formed */ int @@ -468,7 +468,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct GNUNET_CRYPTO_SymmetricSessionKey skey; - if (ntohl (block->purpose.size) < + if (ntohl (block->purpose.size) < sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct GNUNET_TIME_AbsoluteNBO)) { @@ -477,7 +477,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, } derive_block_aes_key (&iv, &skey, label, zone_key); { - char payload[payload_len]; + char payload[payload_len]; uint32_t rd_count; GNUNET_break (payload_len == @@ -496,7 +496,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, } { struct GNUNET_NAMESTORE_RecordData rd[rd_count]; - + if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (payload_len - sizeof (uint32_t), &payload[sizeof (uint32_t)], @@ -555,7 +555,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, { GNUNET_break_op (0); return NULL; - } + } return ns; } case GNUNET_DNSPARSER_TYPE_CNAME: @@ -572,7 +572,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, { GNUNET_break_op (0); return NULL; - } + } return cname; } case GNUNET_DNSPARSER_TYPE_SOA: @@ -590,13 +590,13 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, GNUNET_break_op (0); return NULL; } - GNUNET_asprintf (&result, + GNUNET_asprintf (&result, "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", - soa->rname, + soa->rname, soa->mname, - soa->serial, + soa->serial, soa->refresh, - soa->retry, + soa->retry, soa->expire, soa->minimum_ttl); GNUNET_DNSPARSER_free_soa (soa); @@ -616,7 +616,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, { GNUNET_break_op (0); return NULL; - } + } return ptr; } case GNUNET_DNSPARSER_TYPE_MX: @@ -634,8 +634,8 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, GNUNET_break_op (0); return NULL; } - GNUNET_asprintf (&result, - "%hu,%s", + GNUNET_asprintf (&result, + "%hu,%s", mx->preference, mx->mxhost); GNUNET_DNSPARSER_free_mx (mx); @@ -710,7 +710,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, { GNUNET_break_op (0); return NULL; - } + } return ns; } case GNUNET_DNSPARSER_TYPE_SRV: @@ -729,7 +729,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, GNUNET_break_op (0); return NULL; } - GNUNET_asprintf (&result, + GNUNET_asprintf (&result, "%d %d %d _%s._%s.%s", srv->priority, srv->weight, @@ -750,7 +750,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, ('\0' != cdata[data_size - 1]) ) return NULL; /* malformed */ tlsa = data; - if (0 == GNUNET_asprintf (&tlsa_str, + if (0 == GNUNET_asprintf (&tlsa_str, "%c %c %c %s", tlsa->usage, tlsa->selector, @@ -794,7 +794,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, char s_peer[103 + 1]; char s_serv[253 + 1]; unsigned int proto; - + if (NULL == s) return GNUNET_SYSERR; switch (type) @@ -820,7 +820,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, { char nsbuf[256]; size_t off; - + off = 0; if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (nsbuf, @@ -842,7 +842,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, { char cnamebuf[256]; size_t off; - + off = 0; if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (cnamebuf, @@ -873,7 +873,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, unsigned int soa_min; size_t off; - if (7 != SSCANF (s, + if (7 != SSCANF (s, "rname=%253s mname=%253s %u,%u,%u,%u,%u", soa_rname, soa_mname, &soa_serial, &soa_refresh, &soa_retry, &soa_expire, &soa_min)) @@ -912,7 +912,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, { char ptrbuf[256]; size_t off; - + off = 0; if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (ptrbuf, @@ -970,7 +970,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, *data_size = strlen (s); return GNUNET_OK; case GNUNET_DNSPARSER_TYPE_AAAA: - if (1 != inet_pton (AF_INET6, s, &value_aaaa)) + if (1 != inet_pton (AF_INET6, s, &value_aaaa)) { LOG (GNUNET_ERROR_TYPE_ERROR, _("Unable to parse IPv6 address `%s'\n"), @@ -1005,7 +1005,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, (1 != sscanf (s, "%u-", &line)) || (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1, - strlen (dash + 1), + strlen (dash + 1), &peer.public_key)) ) { LOG (GNUNET_ERROR_TYPE_ERROR, @@ -1055,7 +1055,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, { char nsbuf[256]; size_t off; - + off = 0; if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (nsbuf, @@ -1083,7 +1083,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, (char*)&tlsa[1])) { LOG (GNUNET_ERROR_TYPE_ERROR, - _("Unable to parse TLSA record string `%s'\n"), + _("Unable to parse TLSA record string `%s'\n"), s); *data_size = 0; GNUNET_free (tlsa); @@ -1103,9 +1103,9 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, * Mapping of record type numbers to human-readable * record type names. */ -static struct { - const char *name; - uint32_t number; +static struct { + const char *name; + uint32_t number; } name_map[] = { { "A", GNUNET_DNSPARSER_TYPE_A }, { "NS", GNUNET_DNSPARSER_TYPE_NS }, @@ -1141,7 +1141,7 @@ GNUNET_NAMESTORE_typename_to_number (const char *dns_typename) while ( (name_map[i].name != NULL) && (0 != strcasecmp (dns_typename, name_map[i].name)) ) i++; - return name_map[i].number; + return name_map[i].number; } @@ -1160,13 +1160,13 @@ GNUNET_NAMESTORE_number_to_typename (uint32_t type) while ( (name_map[i].name != NULL) && (type != name_map[i].number) ) i++; - return name_map[i].name; + return name_map[i].name; } /** * Test if a given record is expired. - * + * * @return #GNUNET_YES if the record is expired, * #GNUNET_NO if not */ @@ -1184,7 +1184,7 @@ GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd) /** * Calculate the DHT query for a given @a label in a given @a zone. - * + * * @param zone private key of the zone * @param label label of the record * @param query hash to use for the query @@ -1203,7 +1203,7 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe /** * Calculate the DHT query for a given @a label in a given @a zone. - * + * * @param pub public key of the zone * @param label label of the record * @param query hash to use for the query @@ -1222,12 +1222,12 @@ GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSign /** * Convert public key to the respective absolute domain name in the - * ".zkey" pTLD. + * ".zkey" pTLD. * This is one of the very few calls in the entire API that is * NOT reentrant! - * - * @param pkey a public key with a point on the eliptic curve - * @return string "X.zkey" where X is the public + * + * @param pkey a public key with a point on the eliptic curve + * @return string "X.zkey" where X is the public * key in an encoding suitable for DNS labels. */ const char * @@ -1249,10 +1249,10 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey /** * Convert an absolute domain name in the ".zkey" pTLD to the * respective public key. - * + * * @param zkey string "X.zkey" where X is the coordinates of the public * key in an encoding suitable for DNS labels. - * @param pkey set to a public key on the eliptic curve + * @param pkey set to a public key on the eliptic curve * @return #GNUNET_SYSERR if @a zkey has the wrong syntax */ int @@ -1262,13 +1262,13 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, char *cpy; char *dot; const char *x; - + cpy = GNUNET_strdup (zkey); x = cpy; if (NULL == (dot = strchr (x, (int) '.'))) goto error; *dot = '\0'; - if (0 != strcasecmp (dot + 1, + if (0 != strcasecmp (dot + 1, "zkey")) goto error; diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c index c6509941fc..ccf556abd8 100644 --- a/src/namestore/namestore_api_monitor.c +++ b/src/namestore/namestore_api_monitor.c @@ -193,14 +193,14 @@ handle_updates (void *cls, GNUNET_break (0); reconnect (zm); return; - } + } GNUNET_CLIENT_receive (zm->h, &handle_updates, zm, GNUNET_TIME_UNIT_FOREVER_REL); - zm->monitor (zm->cls, + zm->monitor (zm->cls, &lrm->private_key, - name_tmp, + name_tmp, rd_count, rd); } } @@ -224,7 +224,7 @@ transmit_monitor_message (void *cls, zm->th = NULL; if (size < sizeof (struct ZoneMonitorStartMessage)) - { + { reconnect (zm); return 0; } diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index b3a8f59ea4..92e3a8d8a7 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c @@ -91,7 +91,7 @@ create_indices (PGconn * dbh) GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_name_rv ON ns091records (record_name_hash,rvalue)")) || (GNUNET_OK != GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_rv ON ns091records (rvalue)")) ) - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, _("Failed to create indices\n")); } @@ -113,7 +113,7 @@ database_setup (struct Plugin *plugin) "namestore-postgres"); if (NULL == plugin->dbh) return GNUNET_SYSERR; - if (GNUNET_YES == + if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg, "namestore-postgres", "TEMPORARY_TABLE")) @@ -121,15 +121,15 @@ database_setup (struct Plugin *plugin) res = PQexec (plugin->dbh, "CREATE TEMPORARY TABLE ns091records (" - " zone_key BYTEA NOT NULL DEFAULT ''," - " zone_delegation BYTEA NOT NULL DEFAULT ''," - " zone_hash BYTEA NOT NULL DEFAULT ''," + " zone_key BYTEA NOT NULL DEFAULT ''," + " zone_delegation BYTEA NOT NULL DEFAULT ''," + " zone_hash BYTEA NOT NULL DEFAULT ''," " record_count INTEGER NOT NULL DEFAULT 0," " record_data BYTEA NOT NULL DEFAULT ''," - " block_expiration_time BIGINT NOT NULL DEFAULT 0," + " block_expiration_time BIGINT NOT NULL DEFAULT 0," " signature BYTEA NOT NULL DEFAULT ''," - " record_name TEXT NOT NULL DEFAULT ''," - " record_name_hash BYTEA NOT NULL DEFAULT ''," + " record_name TEXT NOT NULL DEFAULT ''," + " record_name_hash BYTEA NOT NULL DEFAULT ''," " rvalue BIGINT NOT NULL DEFAULT 0" ")" "WITH OIDS"); } @@ -137,15 +137,15 @@ database_setup (struct Plugin *plugin) res = PQexec (plugin->dbh, "CREATE TABLE ns091records (" - " zone_key BYTEA NOT NULL DEFAULT ''," - " zone_delegation BYTEA NOT NULL DEFAULT ''," - " zone_hash BYTEA NOT NULL DEFAULT ''," + " zone_key BYTEA NOT NULL DEFAULT ''," + " zone_delegation BYTEA NOT NULL DEFAULT ''," + " zone_hash BYTEA NOT NULL DEFAULT ''," " record_count INTEGER NOT NULL DEFAULT 0," " record_data BYTEA NOT NULL DEFAULT ''," - " block_expiration_time BIGINT NOT NULL DEFAULT 0," + " block_expiration_time BIGINT NOT NULL DEFAULT 0," " signature BYTEA NOT NULL DEFAULT ''," - " record_name TEXT NOT NULL DEFAULT ''," - " record_name_hash BYTEA NOT NULL DEFAULT ''," + " record_name TEXT NOT NULL DEFAULT ''," + " record_name_hash BYTEA NOT NULL DEFAULT ''," " rvalue BIGINT NOT NULL DEFAULT 0" ")" "WITH OIDS"); @@ -167,7 +167,7 @@ database_setup (struct Plugin *plugin) if ((GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "put_records", - "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature" ", zone_delegation, zone_hash, record_name_hash, rvalue) VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", 10)) || (GNUNET_OK != @@ -177,22 +177,22 @@ database_setup (struct Plugin *plugin) (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "iterate_records", - "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" " FROM ns091records WHERE zone_hash=$1 AND record_name_hash=$2 ORDER BY rvalue LIMIT 1 OFFSET $3", 3)) || (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "iterate_by_zone", - "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" " FROM ns091records WHERE zone_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "iterate_by_name", - "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" " FROM ns091records WHERE record_name_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "iterate_all", - "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" " FROM ns091records ORDER BY rvalue LIMIT 1 OFFSET $1", 1)) || (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, @@ -223,8 +223,8 @@ TODO: removed * @param name name to remove (at most 255 characters long) * @return GNUNET_OK on success */ -static int -namestore_postgres_remove_records (void *cls, +static int +namestore_postgres_remove_records (void *cls, const struct GNUNET_CRYPTO_ShortHashCode *zone, const char *name) { @@ -267,12 +267,12 @@ namestore_postgres_remove_records (void *cls, * @param name name that is being mapped (at most 255 characters long) * @param rd_count number of entries in 'rd' array * @param rd array of records with data to store - * @param signature signature of the record block, NULL if signature is unavailable (i.e. + * @param signature signature of the record block, NULL if signature is unavailable (i.e. * because the user queried for a particular record type only) * @return GNUNET_OK on success, else GNUNET_SYSERR */ -static int -namestore_postgres_put_records (void *cls, +static int +namestore_postgres_put_records (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key, struct GNUNET_TIME_Absolute expire, const char *name, @@ -290,7 +290,7 @@ namestore_postgres_put_records (void *cls, size_t data_size; unsigned int i; - GNUNET_CRYPTO_short_hash (zone_key, + GNUNET_CRYPTO_short_hash (zone_key, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), &zone); (void) namestore_postgres_remove_records (plugin, &zone, name); @@ -336,7 +336,7 @@ namestore_postgres_put_records (void *cls, sizeof (uint32_t), data_size, sizeof (uint64_t), - sizeof (struct GNUNET_CRYPTO_EccSignature), + sizeof (struct GNUNET_CRYPTO_EccSignature), sizeof (struct GNUNET_CRYPTO_ShortHashCode), sizeof (struct GNUNET_CRYPTO_ShortHashCode), sizeof (struct GNUNET_CRYPTO_ShortHashCode), @@ -358,7 +358,7 @@ namestore_postgres_put_records (void *cls, return GNUNET_SYSERR; PQclear (ret); } - return GNUNET_OK; + return GNUNET_OK; } #endif @@ -404,7 +404,7 @@ get_record_and_call_iterator (struct Plugin *plugin, if (0 == (cnt = PQntuples (res))) { /* no result */ - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Ending iteration (no more results)\n"); PQclear (res); @@ -412,10 +412,10 @@ get_record_and_call_iterator (struct Plugin *plugin, return GNUNET_NO; } GNUNET_assert (1 == cnt); - if ((6 != PQnfields (res)) || - (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != PQgetlength (res, 0, 0)) || - (sizeof (uint32_t) != PQfsize (res, 2)) || - (sizeof (uint64_t) != PQfsize (res, 4)) || + if ((6 != PQnfields (res)) || + (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != PQgetlength (res, 0, 0)) || + (sizeof (uint32_t) != PQfsize (res, 2)) || + (sizeof (uint64_t) != PQfsize (res, 4)) || (sizeof (struct GNUNET_CRYPTO_EccSignature) != PQgetlength (res, 0, 5))) { GNUNET_break (0); @@ -444,7 +444,7 @@ get_record_and_call_iterator (struct Plugin *plugin, { struct GNUNET_NAMESTORE_RecordData rd[record_count]; char buf[name_len + 1]; - + memcpy (buf, name, name_len); buf[name_len] = '\0'; if (GNUNET_OK != @@ -461,7 +461,7 @@ get_record_and_call_iterator (struct Plugin *plugin, return GNUNET_OK; } #endif - + /** * Iterate over the results for a particular key and zone in the * datastore. Will return at most one result to the iterator. @@ -474,8 +474,8 @@ get_record_and_call_iterator (struct Plugin *plugin, * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' */ -static int -namestore_postgres_iterate_records (void *cls, +static int +namestore_postgres_iterate_records (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, uint64_t offset, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) @@ -537,7 +537,7 @@ namestore_postgres_iterate_records (void *cls, first_param = 0; } res = - PQexecPrepared (plugin->dbh, stmt_name, num_params, + PQexecPrepared (plugin->dbh, stmt_name, num_params, ¶mValues[first_param], ¶mLengths[first_param], ¶mFormats[first_param], 1); @@ -561,7 +561,7 @@ namestore_postgres_iterate_records (void *cls, * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' */ static int -namestore_postgres_zone_to_name (void *cls, +namestore_postgres_zone_to_name (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) @@ -595,7 +595,7 @@ namestore_postgres_zone_to_name (void *cls, * @param cls closure (internal context for the plugin) * @param zone zone to delete */ -static void +static void namestore_postgres_delete_zone (void *cls, const struct GNUNET_CRYPTO_ShortHashCode *zone) { @@ -717,7 +717,7 @@ libgnunet_plugin_namestore_postgres_init (void *cls) if (NULL != plugin.cfg) return NULL; /* can only initialize once! */ memset (&plugin, 0, sizeof (struct Plugin)); - plugin.cfg = cfg; + plugin.cfg = cfg; if (GNUNET_OK != database_setup (&plugin)) { database_shutdown (&plugin); @@ -733,7 +733,7 @@ libgnunet_plugin_namestore_postgres_init (void *cls) api->iterate_records = &namestore_postgres_iterate_records; api->zone_to_name = &namestore_postgres_zone_to_name; /* api->delete_zone = &namestore_postgres_delete_zone; */ - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, _("Postgres database running\n")); return api; } @@ -754,7 +754,7 @@ libgnunet_plugin_namestore_postgres_done (void *cls) database_shutdown (plugin); plugin->cfg = NULL; GNUNET_free (api); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "postgres plugin is finished\n"); return NULL; } diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 493981c063..1acb5aff2d 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c @@ -136,7 +136,7 @@ sq_prepare (sqlite3 * dbh, const char *zSql, sqlite3_stmt ** ppStmt) result = sqlite3_prepare_v2 (dbh, zSql, strlen (zSql), ppStmt, (const char **) &dummy); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Prepared `%s' / %p: %d\n", zSql, *ppStmt, result); return result; } @@ -166,7 +166,7 @@ create_indices (sqlite3 * dbh) (SQLITE_OK != sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS it_iter ON ns096records (rvalue)", NULL, NULL, NULL)) ) - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to create indices: %s\n", sqlite3_errmsg (dbh)); } @@ -262,11 +262,11 @@ database_setup (struct Plugin *plugin) if ((sqlite3_step (stmt) == SQLITE_DONE) && (sqlite3_exec (plugin->dbh, - "CREATE TABLE ns096blocks (" - " query BLOB NOT NULL DEFAULT ''," - " block BLOB NOT NULL DEFAULT ''," - " expiration_time INT8 NOT NULL DEFAULT 0" - ")", + "CREATE TABLE ns096blocks (" + " query BLOB NOT NULL DEFAULT ''," + " block BLOB NOT NULL DEFAULT ''," + " expiration_time INT8 NOT NULL DEFAULT 0" + ")", NULL, NULL, NULL) != SQLITE_OK)) { LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); @@ -282,14 +282,14 @@ database_setup (struct Plugin *plugin) if ((sqlite3_step (stmt) == SQLITE_DONE) && (sqlite3_exec (plugin->dbh, - "CREATE TABLE ns096records (" - " zone_private_key BLOB NOT NULL DEFAULT ''," - " pkey_hash BLOB," + "CREATE TABLE ns096records (" + " zone_private_key BLOB NOT NULL DEFAULT ''," + " pkey_hash BLOB," " rvalue INT8 NOT NULL DEFAULT ''," " record_count INT NOT NULL DEFAULT 0," " record_data BLOB NOT NULL DEFAULT ''," - " label TEXT NOT NULL DEFAULT ''" - ")", + " label TEXT NOT NULL DEFAULT ''" + ")", NULL, NULL, NULL) != SQLITE_OK)) { LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); @@ -332,14 +332,14 @@ database_setup (struct Plugin *plugin) &plugin->zone_to_name) != SQLITE_OK) || (sq_prepare (plugin->dbh, - "SELECT record_count,record_data,label" + "SELECT record_count,record_data,label" " FROM ns096records WHERE zone_private_key=? ORDER BY rvalue LIMIT 1 OFFSET ?", &plugin->iterate_zone) != SQLITE_OK) || (sq_prepare (plugin->dbh, - "SELECT record_count,record_data,label,zone_private_key" + "SELECT record_count,record_data,label,zone_private_key" " FROM ns096records ORDER BY rvalue LIMIT 1 OFFSET ?", - &plugin->iterate_all_zones) != SQLITE_OK) + &plugin->iterate_all_zones) != SQLITE_OK) ) { LOG_SQLITE (plugin,GNUNET_ERROR_TYPE_ERROR, "precompiling"); @@ -415,7 +415,7 @@ namestore_sqlite_expire_blocks (struct Plugin *plugin) int n; now = GNUNET_TIME_absolute_get (); - if (SQLITE_OK != sqlite3_bind_int64 (plugin->expire_blocks, + if (SQLITE_OK != sqlite3_bind_int64 (plugin->expire_blocks, 1, now.abs_value_us)) { LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, @@ -454,8 +454,8 @@ namestore_sqlite_expire_blocks (struct Plugin *plugin) * @param block block to cache * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ -static int -namestore_sqlite_cache_block (void *cls, +static int +namestore_sqlite_cache_block (void *cls, const struct GNUNET_NAMESTORE_Block *block) { struct Plugin *plugin = cls; @@ -466,16 +466,16 @@ namestore_sqlite_cache_block (void *cls, int n; namestore_sqlite_expire_blocks (plugin); - GNUNET_CRYPTO_hash (&block->derived_key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + GNUNET_CRYPTO_hash (&block->derived_key, + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), &query); expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time); dval = (int64_t) expiration.abs_value_us; if (dval < 0) dval = INT64_MAX; - block_size = ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccSignature); + block_size = ntohl (block->purpose.size) + + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + sizeof (struct GNUNET_CRYPTO_EccSignature); if (block_size > 64 * 65536) { GNUNET_break (0); @@ -483,11 +483,11 @@ namestore_sqlite_cache_block (void *cls, } /* delete old version of the block */ - if ( (SQLITE_OK != - sqlite3_bind_blob (plugin->delete_block, 1, - &query, sizeof (struct GNUNET_HashCode), + if ( (SQLITE_OK != + sqlite3_bind_blob (plugin->delete_block, 1, + &query, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) || - (SQLITE_OK != + (SQLITE_OK != sqlite3_bind_int64 (plugin->delete_block, 2, dval)) ) { @@ -519,30 +519,30 @@ namestore_sqlite_cache_block (void *cls, "sqlite3_reset"); /* insert new version of the block */ - if ((SQLITE_OK != - sqlite3_bind_blob (plugin->cache_block, 1, - &query, sizeof (struct GNUNET_HashCode), + if ((SQLITE_OK != + sqlite3_bind_blob (plugin->cache_block, 1, + &query, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) || - (SQLITE_OK != - sqlite3_bind_blob (plugin->cache_block, 2, - block, block_size, + (SQLITE_OK != + sqlite3_bind_blob (plugin->cache_block, 2, + block, block_size, SQLITE_STATIC)) || - (SQLITE_OK != - sqlite3_bind_int64 (plugin->cache_block, 3, + (SQLITE_OK != + sqlite3_bind_int64 (plugin->cache_block, 3, dval))) { - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_bind_XXXX"); if (SQLITE_OK != sqlite3_reset (plugin->cache_block)) - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - + } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Caching block under derived key `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Caching block under derived key `%s'\n", GNUNET_h2s_full (&query)); n = sqlite3_step (plugin->cache_block); if (SQLITE_OK != sqlite3_reset (plugin->cache_block)) @@ -551,7 +551,7 @@ namestore_sqlite_cache_block (void *cls, switch (n) { case SQLITE_DONE: - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Record stored\n"); return GNUNET_OK; case SQLITE_BUSY: @@ -561,7 +561,7 @@ namestore_sqlite_cache_block (void *cls, default: LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_step"); - return GNUNET_SYSERR; + return GNUNET_SYSERR; } } @@ -577,7 +577,7 @@ namestore_sqlite_cache_block (void *cls, * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ static int -namestore_sqlite_lookup_block (void *cls, +namestore_sqlite_lookup_block (void *cls, const struct GNUNET_HashCode *query, GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls) { @@ -598,26 +598,26 @@ namestore_sqlite_lookup_block (void *cls, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - } + } ret = GNUNET_NO; if (SQLITE_ROW == (sret = sqlite3_step (plugin->lookup_block))) - { + { block = sqlite3_column_blob (plugin->lookup_block, 0); block_size = sqlite3_column_bytes (plugin->lookup_block, 0); if ( (block_size < sizeof (struct GNUNET_NAMESTORE_Block)) || - (ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + (ntohl (block->purpose.size) + + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + sizeof (struct GNUNET_CRYPTO_EccSignature) != block_size) ) { GNUNET_break (0); - ret = GNUNET_SYSERR; + ret = GNUNET_SYSERR; } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Found block under derived key `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Found block under derived key `%s'\n", GNUNET_h2s_full (query)); - iter (iter_cls, block); + iter (iter_cls, block); ret = GNUNET_YES; } } @@ -625,13 +625,13 @@ namestore_sqlite_lookup_block (void *cls, { if (SQLITE_DONE != sret) { - LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); ret = GNUNET_SYSERR; } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "No block found under derived key `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "No block found under derived key `%s'\n", GNUNET_h2s_full (query)); } } @@ -654,8 +654,8 @@ namestore_sqlite_lookup_block (void *cls, * @param rd array of records with data to store * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ -static int -namestore_sqlite_store_records (void *cls, +static int +namestore_sqlite_store_records (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, const char *label, unsigned int rd_count, @@ -696,19 +696,19 @@ namestore_sqlite_store_records (void *cls, } /* First delete 'old' records */ - if ((SQLITE_OK != sqlite3_bind_blob (plugin->delete_records, 1, + if ((SQLITE_OK != sqlite3_bind_blob (plugin->delete_records, 1, zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_text (plugin->delete_records, 2, label, -1, SQLITE_STATIC))) { - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_bind_XXXX"); if (SQLITE_OK != sqlite3_reset (plugin->delete_records)) - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - + } n = sqlite3_step (plugin->delete_records); if (SQLITE_OK != sqlite3_reset (plugin->delete_records)) @@ -717,7 +717,7 @@ namestore_sqlite_store_records (void *cls, if (0 != rd_count) { - if ((SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 1, + if ((SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 1, zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 2, &pkey_hash, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) || @@ -726,11 +726,11 @@ namestore_sqlite_store_records (void *cls, (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 5, data, data_size, SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_text (plugin->store_records, 6, label, -1, SQLITE_STATIC))) { - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_bind_XXXX"); if (SQLITE_OK != sqlite3_reset (plugin->store_records)) - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; @@ -756,7 +756,7 @@ namestore_sqlite_store_records (void *cls, default: LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_step"); - return GNUNET_SYSERR; + return GNUNET_SYSERR; } } @@ -775,7 +775,7 @@ namestore_sqlite_store_records (void *cls, */ static int get_record_and_call_iterator (struct Plugin *plugin, - sqlite3_stmt *stmt, + sqlite3_stmt *stmt, const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) { @@ -788,7 +788,7 @@ get_record_and_call_iterator (struct Plugin *plugin, ret = GNUNET_NO; if (SQLITE_ROW == (sret = sqlite3_step (stmt))) - { + { record_count = sqlite3_column_int (stmt, 0); data_size = sqlite3_column_bytes (stmt, 1); data = sqlite3_column_blob (stmt, 1); @@ -813,7 +813,7 @@ get_record_and_call_iterator (struct Plugin *plugin, because database might contain a large value here */ GNUNET_break (0); ret = GNUNET_SYSERR; - } + } else { struct GNUNET_NAMESTORE_RecordData rd[record_count]; @@ -857,8 +857,8 @@ get_record_and_call_iterator (struct Plugin *plugin, * @param iter_cls closure for @a iter * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ -static int -namestore_sqlite_iterate_records (void *cls, +static int +namestore_sqlite_iterate_records (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, uint64_t offset, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) @@ -876,7 +876,7 @@ namestore_sqlite_iterate_records (void *cls, else { stmt = plugin->iterate_zone; - err = ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, + err = ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_int64 (stmt, 2, @@ -891,7 +891,7 @@ namestore_sqlite_iterate_records (void *cls, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - } + } return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls); } @@ -908,7 +908,7 @@ namestore_sqlite_iterate_records (void *cls, * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ static int -namestore_sqlite_zone_to_name (void *cls, +namestore_sqlite_zone_to_name (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) @@ -917,10 +917,10 @@ namestore_sqlite_zone_to_name (void *cls, sqlite3_stmt *stmt; stmt = plugin->zone_to_name; - if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, + if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || - (SQLITE_OK != sqlite3_bind_blob (stmt, 2, + (SQLITE_OK != sqlite3_bind_blob (stmt, 2, value_zone, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), SQLITE_STATIC)) ) { @@ -931,7 +931,7 @@ namestore_sqlite_zone_to_name (void *cls, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - } + } return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls); } @@ -952,7 +952,7 @@ libgnunet_plugin_namestore_sqlite_init (void *cls) if (NULL != plugin.cfg) return NULL; /* can only initialize once! */ memset (&plugin, 0, sizeof (struct Plugin)); - plugin.cfg = cfg; + plugin.cfg = cfg; if (GNUNET_OK != database_setup (&plugin)) { database_shutdown (&plugin); @@ -965,7 +965,7 @@ libgnunet_plugin_namestore_sqlite_init (void *cls) api->store_records = &namestore_sqlite_store_records; api->iterate_records = &namestore_sqlite_iterate_records; api->zone_to_name = &namestore_sqlite_zone_to_name; - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, _("Sqlite database running\n")); return api; } @@ -986,7 +986,7 @@ libgnunet_plugin_namestore_sqlite_done (void *cls) database_shutdown (plugin); plugin->cfg = NULL; GNUNET_free (api); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "sqlite plugin is finished\n"); return NULL; } diff --git a/src/namestore/test_namestore_api_cache_block.c b/src/namestore/test_namestore_api_cache_block.c index c3b4fb87fd..8ed010abd3 100644 --- a/src/namestore/test_namestore_api_cache_block.c +++ b/src/namestore/test_namestore_api_cache_block.c @@ -144,7 +144,7 @@ name_lookup_proc (void *cls, &pubkey, name, &rd_decrypt_cb, (void *) name)); } -static void +static void cache_cont (void *cls, int32_t success, const char *emsg) { const char *name = cls; @@ -166,7 +166,7 @@ cache_cont (void *cls, int32_t success, const char *emsg) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -175,7 +175,7 @@ run (void *cls, char *hostkey_file; const char * name = "dummy.dummy.gnunet"; - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL); GNUNET_asprintf (&hostkey_file, "zonefiles%s%s", @@ -224,7 +224,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c index 3106c1c4f6..f2b009ac53 100644 --- a/src/namestore/test_namestore_api_lookup_public.c +++ b/src/namestore/test_namestore_api_lookup_public.c @@ -144,7 +144,7 @@ name_lookup_proc (void *cls, &pubkey, name, &rd_decrypt_cb, (void *) name)); } -static void +static void put_cont (void *cls, int32_t success, const char *emsg) { const char *name = cls; @@ -154,7 +154,7 @@ put_cont (void *cls, int32_t success, const char *emsg) GNUNET_assert (NULL != cls); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Name store added record for `%s': %s\n", + "Name store added record for `%s': %s\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); @@ -168,7 +168,7 @@ put_cont (void *cls, int32_t success, const char *emsg) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -176,7 +176,7 @@ run (void *cls, char *hostkey_file; const char * name = "dummy.dummy.gnunet"; - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL); GNUNET_asprintf (&hostkey_file, "zonefiles%s%s", @@ -213,7 +213,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index bf410fe425..d0662617e4 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c @@ -153,7 +153,7 @@ zone_proc (void *cls, static int returned_records; static int fail = GNUNET_NO; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Comparing results name %s\n", + "Comparing results name %s\n", name); if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) @@ -191,7 +191,7 @@ zone_proc (void *cls, } if (2 == ++returned_records) - { + { if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (endbadly_task); @@ -254,7 +254,7 @@ create_record (unsigned int count) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -266,7 +266,7 @@ run (void *cls, "zonefiles%s%s", DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); @@ -334,7 +334,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-monitoring", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index 3958e4d6c5..4db1c6d62a 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c @@ -154,7 +154,7 @@ zone_proc (void *cls, static int returned_records; static int fail = GNUNET_NO; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Comparing results name %s\n", + "Comparing results name %s\n", name); if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) @@ -192,7 +192,7 @@ zone_proc (void *cls, } if (2 == ++returned_records) - { + { if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (endbadly_task); @@ -272,7 +272,7 @@ create_record (unsigned int count) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, struct GNUNET_TESTING_Peer *peer) { @@ -284,7 +284,7 @@ run (void *cls, "zonefiles%s%s", DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); @@ -339,7 +339,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-monitoring", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_put.c b/src/namestore/test_namestore_api_put.c index 647b5e6af5..e3610ccaf4 100644 --- a/src/namestore/test_namestore_api_put.c +++ b/src/namestore/test_namestore_api_put.c @@ -100,8 +100,8 @@ put_cont (void *cls, int32_t success, const char *emsg) { const char * name = cls; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Name store added record for `%s': %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Name store added record for `%s': %s\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); if (success == GNUNET_OK) res = 0; @@ -131,7 +131,7 @@ create_record (unsigned int count) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 568a0cd8b6..3f3823e897 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c @@ -96,8 +96,8 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -remove_cont (void *cls, - int32_t success, +remove_cont (void *cls, + int32_t success, const char *emsg) { if (GNUNET_YES != success) @@ -128,16 +128,16 @@ rd_decrypt_cb (void *cls, GNUNET_assert (GNUNET_NO == removed); GNUNET_assert (1 == rd_count); - GNUNET_assert (NULL != rd); + GNUNET_assert (NULL != rd); memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); - + GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Block was decrypted successfully, removing records \n"); - + nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 0, NULL, &remove_cont, (void *) name); } @@ -178,14 +178,14 @@ name_lookup_proc (void *cls, } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore returned block, decrypting \n"); - GNUNET_assert (GNUNET_OK == + GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_block_decrypt (block, &pubkey, name, &rd_decrypt_cb, (void *) name)); } static void -put_cont (void *cls, int32_t success, +put_cont (void *cls, int32_t success, const char *emsg) { const char *name = cls; @@ -195,7 +195,7 @@ put_cont (void *cls, int32_t success, { GNUNET_break (0); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Namestore could not store record: `%s'\n", + "Namestore could not store record: `%s'\n", emsg); if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (endbadly_task); @@ -229,7 +229,7 @@ put_cont (void *cls, int32_t success, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -274,7 +274,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index cf1c3c3a9a..86cf47e269 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c @@ -169,7 +169,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index 1bb85ac477..69c47337fc 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c @@ -144,7 +144,7 @@ name_lookup_proc (void *cls, &pubkey, name, &rd_decrypt_cb, (void *) name)); } -static void +static void put_cont (void *cls, int32_t success, const char *emsg) { const char *name = cls; @@ -153,7 +153,7 @@ put_cont (void *cls, int32_t success, const char *emsg) GNUNET_assert (NULL != cls); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Name store added record for `%s': %s\n", + "Name store added record for `%s': %s\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); @@ -166,7 +166,7 @@ put_cont (void *cls, int32_t success, const char *emsg) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -174,7 +174,7 @@ run (void *cls, char *hostkey_file; const char * name = "dummy.dummy.gnunet"; - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL); GNUNET_asprintf (&hostkey_file, "zonefiles%s%s", @@ -211,7 +211,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c index 1a08635edf..8b10763c09 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c @@ -123,21 +123,21 @@ rd_decrypt_cb (void *cls, { char rd_cmp_data[TEST_RECORD_DATALEN]; memset (rd_cmp_data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); - + GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Block was decrypted successfully, updating record \n"); - + rd_new.flags = GNUNET_NAMESTORE_RF_NONE; rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; rd_new.record_type = TEST_RECORD_TYPE2; rd_new.data_size = TEST_RECORD_DATALEN2; rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2); memset ((char *) rd_new.data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2); - + nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 1, &rd_new, &put_cont, (void *) name); update_performed = GNUNET_YES; @@ -146,11 +146,11 @@ rd_decrypt_cb (void *cls, { char rd_cmp_data[TEST_RECORD_DATALEN2]; memset (rd_cmp_data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2); - + GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type); GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size); GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN2)); - + GNUNET_SCHEDULER_add_now (&end, NULL); } } @@ -210,7 +210,7 @@ put_cont (void *cls, int32_t success, const char *emsg) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -218,7 +218,7 @@ run (void *cls, char *hostkey_file; update_performed = GNUNET_NO; - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL); GNUNET_asprintf (&hostkey_file, "zonefiles%s%s", @@ -255,7 +255,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-store-update", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index d496fe6182..94fd6d008b 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c @@ -173,7 +173,7 @@ zone_proc (void *cls, else res = 1; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received last result, iteration done after receing %u results\n", returned_records ); GNUNET_SCHEDULER_add_now (&end, NULL); @@ -414,7 +414,7 @@ empty_zone_proc (void *cls, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -438,7 +438,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 1f201ce461..a34e742f08 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c @@ -416,7 +416,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index 3e5014d8eb..ebc26db795 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c @@ -450,7 +450,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration-stop", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index e3df0bd223..1eeed10012 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c @@ -207,7 +207,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-zone-to-name", "namestore", "test_namestore_api.conf", diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c index d7742373a8..5274e8bca6 100644 --- a/src/namestore/test_plugin_namestore.c +++ b/src/namestore/test_plugin_namestore.c @@ -79,7 +79,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg) } -static void +static void test_record (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *private_key, const char *label, @@ -134,7 +134,7 @@ put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id) rd[i].data_size = id % 10; rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; rd[i].record_type = 1 + (id % 13); - rd[i].flags = (id % 7); + rd[i].flags = (id % 7); } memset (&zone_private_key, (id % 241), sizeof (zone_private_key)); memset (&signature, (id % 243), sizeof (signature)); @@ -150,14 +150,14 @@ static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { - struct GNUNET_NAMESTORE_PluginFunctions *nsp; - + struct GNUNET_NAMESTORE_PluginFunctions *nsp; + ok = 0; nsp = load_plugin (cfg); if (NULL == nsp) { FPRINTF (stderr, - "%s", + "%s", "Failed to initialize namestore. Database likely not setup, skipping test.\n"); return; } |