From 93522adc0728de13e94a7b13730781345144e434 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 7 Oct 2011 11:08:40 +0000 Subject: [PATCH] removing 'publicKey' argument from CORE init callback --- src/chat/gnunet-service-chat.c | 4 +--- src/core/core.h | 2 +- src/core/core_api.c | 6 ++---- src/core/gnunet-service-core.c | 3 +-- src/core/gnunet-service-core_clients.c | 2 +- src/core/test_core_api.c | 3 +-- src/core/test_core_api_preferences.c | 3 +-- src/core/test_core_api_reliability.c | 3 +-- src/core/test_core_api_start_only.c | 3 +-- src/core/test_core_quota_compliance.c | 3 +-- src/dht/gnunet-service-dht_neighbours.c | 4 +--- src/dv/gnunet-service-dv.c | 3 +-- src/dv/test_transport_api_dv.c | 8 ++------ src/fs/gnunet-service-fs.c | 5 +---- src/hostlist/gnunet-daemon-hostlist.c | 3 +-- src/include/gnunet_core_service.h | 17 ++++++----------- src/include/gnunet_transport_service.h | 2 +- src/mesh/gnunet-service-mesh.c | 4 +--- src/mesh/mesh_api.c | 4 +--- src/nse/gnunet-service-nse.c | 4 +--- src/testing/test_testing_large_topology.c | 8 ++------ src/testing/test_testing_topology.c | 8 ++------ src/testing/testing.c | 5 +---- src/testing/testing_group.c | 4 +--- src/topology/gnunet-daemon-topology.c | 4 +--- 25 files changed, 34 insertions(+), 81 deletions(-) diff --git a/src/chat/gnunet-service-chat.c b/src/chat/gnunet-service-chat.c index ed8dfb9e9..2d6f192ec 100644 --- a/src/chat/gnunet-service-chat.c +++ b/src/chat/gnunet-service-chat.c @@ -1641,12 +1641,10 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param cls closure, NULL * @param server handle to the server for this service * @param my_identity the public identity of this peer - * @param publicKey the public key of this peer */ static void core_init (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Core initialized\n"); me = my_identity; diff --git a/src/core/core.h b/src/core/core.h index 17a4c8fd4..8c208a2ed 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -95,7 +95,7 @@ struct InitReplyMessage /** * Public key of the local peer. */ - struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded publicKey; + struct GNUNET_PeerIdentity my_identity; }; diff --git a/src/core/core_api.c b/src/core/core_api.c index 3624a6e7f..24013b7cf 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c @@ -870,9 +870,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) trigger_next_request (h, GNUNET_NO); } h->retry_backoff = GNUNET_TIME_UNIT_MILLISECONDS; - GNUNET_CRYPTO_hash (&m->publicKey, - sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), - &h->me.hashPubKey); + h->me = m->my_identity; if (NULL != (init = h->init)) { /* mark so we don't call init on reconnect */ @@ -882,7 +880,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) "Connected to core service of peer `%s'.\n", GNUNET_i2s (&h->me)); #endif - init (h->cls, h, &h->me, &m->publicKey); + init (h->cls, h, &h->me); } else { diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 76ed02d2f..34b35f92a 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c @@ -1393,8 +1393,7 @@ handle_client_init (void *cls, struct GNUNET_SERVER_Client *client, irm.header.size = htons (sizeof (struct InitReplyMessage)); irm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_INIT_REPLY); irm.reserved = htonl (0); - memcpy (&irm.publicKey, &my_public_key, - sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); + irm.my_identity = my_identity; #if DEBUG_CORE_CLIENT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n", "INIT_REPLY"); diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c index 7b884f44f..94fecb4ca 100644 --- a/src/core/gnunet-service-core_clients.c +++ b/src/core/gnunet-service-core_clients.c @@ -289,7 +289,7 @@ handle_client_init (void *cls, struct GNUNET_SERVER_Client *client, irm.header.size = htons (sizeof (struct InitReplyMessage)); irm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_INIT_REPLY); irm.reserved = htonl (0); - irm.publicKey = GSC_my_public_key; + irm.my_identity = GSC_my_identity; send_to_client (c, &irm.header, GNUNET_NO); if (0 != (c->options & GNUNET_CORE_OPTION_SEND_CONNECT)) GSC_SESSIONS_notify_client_about_sessions (c); diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 3028f32b0..7695f9e86 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c @@ -283,8 +283,7 @@ connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void init_notify (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct PeerContext *p = cls; diff --git a/src/core/test_core_api_preferences.c b/src/core/test_core_api_preferences.c index 3aeb92572..19d51ef60 100644 --- a/src/core/test_core_api_preferences.c +++ b/src/core/test_core_api_preferences.c @@ -346,8 +346,7 @@ ask_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void init_notify (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct PeerContext *p = cls; diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index 7627a32c0..a696c7cbd 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c @@ -365,8 +365,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = { static void init_notify (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct PeerContext *p = cls; diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index ff4b564bf..6b1f3da1c 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c @@ -116,8 +116,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void init_notify (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct PeerContext *p = cls; diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 6f10635fe..5fce06b31 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c @@ -504,8 +504,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = { static void init_notify (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct PeerContext *p = cls; diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 418474c74..9d4885b78 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -1527,12 +1527,10 @@ GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target, * @param cls service closure * @param server handle to the server for this service * @param identity the public identity of this peer - * @param publicKey the public key of this peer */ static void core_init (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *identity) { GNUNET_assert (server != NULL); my_identity = *identity; diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 6699fef11..0940fd9f0 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c @@ -2286,8 +2286,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) */ void core_init (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *identity) { if (server == NULL) diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index 0e8444bd4..21fe7225e 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c @@ -560,9 +560,7 @@ connect_notify_peer2 (void *cls, const struct GNUNET_PeerIdentity *peer, static void init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded - *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { #if VERBOSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -605,9 +603,7 @@ connect_notify_peer1 (void *cls, const struct GNUNET_PeerIdentity *peer, static void init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded - *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { total_server_connections++; #if VERBOSE diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 2e3c7742f..f2770df3e 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -462,13 +462,10 @@ peer_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, * @param cls closure * @param server handle to the server, NULL if we failed * @param my_identity ID of this peer, NULL if we failed - * @param publicKey public key of this peer, NULL if we failed */ static void peer_init_handler (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded - *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { my_id = *my_identity; } diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index 9d47dfa9c..859f8498c 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -129,8 +129,7 @@ static struct GNUNET_PeerIdentity me; static void core_init (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { me = *my_identity; } diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 11514ae29..f33a78926 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h @@ -153,24 +153,19 @@ struct GNUNET_CORE_MessageHandler /** - * Function called after GNUNET_CORE_connect has succeeded - * (or failed for good). Note that the private key of the - * peer is intentionally not exposed here; if you need it, - * your process should try to read the private key file - * directly (which should work if you are authorized...). + * Function called after GNUNET_CORE_connect has succeeded (or failed + * for good). Note that the private key of the peer is intentionally + * not exposed here; if you need it, your process should try to read + * the private key file directly (which should work if you are + * authorized...). * * @param cls closure * @param server handle to the server, NULL if we failed * @param my_identity ID of this peer, NULL if we failed - * @param publicKey public key of this peer, NULL if we failed */ typedef void (*GNUNET_CORE_StartupCallback) (void *cls, struct GNUNET_CORE_Handle * server, - const struct GNUNET_PeerIdentity * - my_identity, - const struct - GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded - * publicKey); + const struct GNUNET_PeerIdentity *my_identity); /** diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 8b9472cdb..2b6675c89 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h @@ -547,7 +547,7 @@ struct GNUNET_TRANSPORT_TransmitHandle; * @param handle connection to transport service * @param target who should receive the message * @param size how big is the message we want to transmit? - * @param priority how important is the message? + * @param priority how important is the message? @deprecated - remove? * @param timeout after how long should we give up (and call * notify with buf NULL and size 0)? * @param notify function to call when we are ready to diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index c9ac99708..a35ef9a66 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -3141,12 +3141,10 @@ static struct GNUNET_SERVER_MessageHandler client_handlers[] = { * @param cls service closure * @param server handle to the server for this service * @param identity the public identity of this peer - * @param publicKey the public key of this peer */ static void core_init (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *identity) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Core init\n"); core_handle = server; diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index a1396cd08..4e510e596 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c @@ -182,9 +182,7 @@ call_connect_handler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void core_startup (void *cls, struct GNUNET_CORE_Handle *core __attribute__ ((unused)), - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey - __attribute__ ((unused))) + const struct GNUNET_PeerIdentity *my_identity) { struct GNUNET_MESH_Handle *handle = cls; diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 543e4794a..47014fd60 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -1211,12 +1211,10 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param cls service closure * @param server handle to the server for this service * @param identity the public identity of this peer - * @param publicKey the public key of this peer */ static void core_init (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *identity) { struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Absolute prev_time; diff --git a/src/testing/test_testing_large_topology.c b/src/testing/test_testing_large_topology.c index 9581dc9b2..33a9eb787 100644 --- a/src/testing/test_testing_large_topology.c +++ b/src/testing/test_testing_large_topology.c @@ -459,9 +459,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = { static void init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded - *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct TestMessageContext *pos = cls; @@ -547,9 +545,7 @@ connect_notify_peers (void *cls, const struct GNUNET_PeerIdentity *peer, static void init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded - *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct TestMessageContext *pos = cls; diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index 152b5cdcc..e29a3ff32 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c @@ -498,9 +498,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = { static void init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded - *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct TestMessageContext *pos = cls; @@ -586,9 +584,7 @@ connect_notify_peers (void *cls, const struct GNUNET_PeerIdentity *peer, static void init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded - *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct TestMessageContext *pos = cls; diff --git a/src/testing/testing.c b/src/testing/testing.c index 8b080d800..ca7ed6376 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -1952,13 +1952,10 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param cls a ConnectContext * @param server handle to the core service * @param my_identity the peer identity of this peer - * @param publicKey the public key of the peer */ void core_init_notify (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded - *publicKey) + const struct GNUNET_PeerIdentity *my_identity) { struct GNUNET_TESTING_ConnectContext *connect_ctx = cls; diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 3f31c6e1a..1889cf7df 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -3483,12 +3483,10 @@ core_connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, * @param cls a struct SendHelloContext * * @param server handle to the core service * @param my_identity the peer identity of this peer - * @param publicKey the public key of the peer */ void core_init (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + struct GNUNET_PeerIdentity *my_identity) { struct SendHelloContext *send_hello_context = cls; diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 6f55419d9..e8704552b 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c @@ -938,12 +938,10 @@ process_peer (void *cls, const struct GNUNET_PeerIdentity *peer, * @param cls closure * @param server handle to the server, NULL if we failed * @param my_id ID of this peer, NULL if we failed - * @param publicKey public key of this peer, NULL if we failed */ static void core_init (void *cls, struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_id, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_PeerIdentity *my_id) { if (server == NULL) { -- 2.25.1