From: Christian Grothoff Date: Sat, 22 Oct 2011 21:59:27 +0000 (+0000) Subject: replacing 0-terminated atsi-array with array+length in core API (and the core-connect... X-Git-Tag: initial-import-from-subversion-38251~16331 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f44c0036572d5557d2496748a4190a61e40e61ff;p=oweals%2Fgnunet.git replacing 0-terminated atsi-array with array+length in core API (and the core-connect IPC) --- diff --git a/src/core/core.h b/src/core/core.h index 71969c3e0..b76528a8e 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -119,12 +119,6 @@ struct ConnectNotifyMessage */ struct GNUNET_PeerIdentity peer; - /** - * First of the ATS information blocks (we must have at least - * one due to the 0-termination requirement). - */ - struct GNUNET_ATS_Information ats; - }; diff --git a/src/core/core_api.c b/src/core/core_api.c index b903d73bb..3349f79ab 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c @@ -781,6 +781,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) const struct GNUNET_MessageHeader *em; const struct SendMessageReady *smr; const struct GNUNET_CORE_MessageHandler *mh; + const struct GNUNET_ATS_Information* ats; GNUNET_CORE_StartupCallback init; struct PeerRecord *pr; struct GNUNET_CORE_TransmitHandle *th; @@ -851,7 +852,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) &h->me.hashPubKey, pr, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); if (NULL != h->connects) - h->connects (h->cls, &h->me, NULL); + h->connects (h->cls, &h->me, NULL, 0); break; case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT: if (msize < sizeof (struct ConnectNotifyMessage)) @@ -862,11 +863,9 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) } cnm = (const struct ConnectNotifyMessage *) msg; ats_count = ntohl (cnm->ats_count); - if ((msize != - sizeof (struct ConnectNotifyMessage) + - ats_count * sizeof (struct GNUNET_ATS_Information)) || - (GNUNET_ATS_ARRAY_TERMINATOR != - ntohl ((&cnm->ats)[ats_count].type))) + if (msize != + sizeof (struct ConnectNotifyMessage) + + ats_count * sizeof (struct GNUNET_ATS_Information)) { GNUNET_break (0); reconnect_later (h); @@ -897,8 +896,11 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_CONTAINER_multihashmap_put (h->peers, &cnm->peer.hashPubKey, pr, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); + ats = (const struct GNUNET_ATS_Information*) &cnm[1]; if (NULL != h->connects) - h->connects (h->cls, &cnm->peer, &cnm->ats); + h->connects (h->cls, &cnm->peer, + ats, + ats_count); break; case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT: if (msize != sizeof (struct DisconnectNotifyMessage)) @@ -988,14 +990,16 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) continue; } if (GNUNET_OK != - h->handlers[hpos].callback (h->cls, &ntm->peer, em, &ntm->ats)) + h->handlers[hpos].callback (h->cls, &ntm->peer, em, &ntm->ats, + ats_count)) { /* error in processing, do not process other messages! */ break; } } if (NULL != h->inbound_notify) - h->inbound_notify (h->cls, &ntm->peer, em, &ntm->ats); + h->inbound_notify (h->cls, &ntm->peer, em, &ntm->ats, + ats_count); break; case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND: if (msize < sizeof (struct NotifyTrafficMessage)) @@ -1050,7 +1054,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_break (0); break; } - h->outbound_notify (h->cls, &ntm->peer, em, &ntm->ats); + h->outbound_notify (h->cls, &ntm->peer, em, &ntm->ats, ats_count); break; case GNUNET_MESSAGE_TYPE_CORE_SEND_READY: if (msize != sizeof (struct SendMessageReady)) diff --git a/src/core/core_api_iterate_peers.c b/src/core/core_api_iterate_peers.c index ed9ea175e..7bf40a678 100644 --- a/src/core/core_api_iterate_peers.c +++ b/src/core/core_api_iterate_peers.c @@ -79,7 +79,7 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg) (ntohs (msg->size) == sizeof (struct GNUNET_MessageHeader)))) { if (request_context->peer_cb != NULL) - request_context->peer_cb (request_context->cb_cls, NULL, NULL); + request_context->peer_cb (request_context->cb_cls, NULL, NULL, 0); GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO); GNUNET_free (request_context); return; @@ -92,22 +92,20 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg) { GNUNET_break (0); if (request_context->peer_cb != NULL) - request_context->peer_cb (request_context->cb_cls, NULL, NULL); + request_context->peer_cb (request_context->cb_cls, NULL, NULL, 0); GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO); GNUNET_free (request_context); return; } connect_message = (const struct ConnectNotifyMessage *) msg; ats_count = ntohl (connect_message->ats_count); - if ((msize != - sizeof (struct ConnectNotifyMessage) + - ats_count * sizeof (struct GNUNET_ATS_Information)) || - (GNUNET_ATS_ARRAY_TERMINATOR != - ntohl ((&connect_message->ats)[ats_count].type))) + if (msize != + sizeof (struct ConnectNotifyMessage) + + ats_count * sizeof (struct GNUNET_ATS_Information)) { GNUNET_break (0); if (request_context->peer_cb != NULL) - request_context->peer_cb (request_context->cb_cls, NULL, NULL); + request_context->peer_cb (request_context->cb_cls, NULL, NULL, 0); GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO); GNUNET_free (request_context); return; @@ -115,7 +113,8 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg) /* Normal case */ if (request_context->peer_cb != NULL) request_context->peer_cb (request_context->cb_cls, &connect_message->peer, - &connect_message->ats); + (const struct GNUNET_ATS_Information *) &connect_message[1], + ats_count); GNUNET_CLIENT_receive (request_context->client, &receive_info, request_context, GNUNET_TIME_UNIT_FOREVER_REL); } diff --git a/src/core/gnunet-core-list-connections.c b/src/core/gnunet-core-list-connections.c index ae7feb915..9665110a3 100644 --- a/src/core/gnunet-core-list-connections.c +++ b/src/core/gnunet-core-list-connections.c @@ -123,7 +123,8 @@ process_resolved_address (void *cls, const char *address) */ static void connected_peer_callback (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct PrintContext *pc; diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c index 146b251be..47bbd98db 100644 --- a/src/core/gnunet-service-core_clients.c +++ b/src/core/gnunet-service-core_clients.c @@ -658,11 +658,9 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, cnm->header.size = htons (size); cnm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); cnm->ats_count = htonl (atsi_count); - a = &cnm->ats; + a = (struct GNUNET_ATS_Information* ) &cnm[1]; memcpy (a, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count); - a[atsi_count].type = htonl (GNUNET_ATS_ARRAY_TERMINATOR); - a[atsi_count].value = htonl (0); #if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n", diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index fc9576a93..61532ac9c 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c @@ -672,17 +672,13 @@ queue_connect_message (void *cls, const GNUNET_HashCode * key, void *value) struct GNUNET_SERVER_TransmitContext *tc = cls; struct Session *session = value; struct ConnectNotifyMessage cnm; - struct GNUNET_ATS_Information *a; /* FIXME: code duplication with clients... */ cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); + // FIXME: full ats... cnm.ats_count = htonl (0); cnm.peer = session->peer; - a = &cnm.ats; - // FIXME: full ats... - a[0].type = htonl (GNUNET_ATS_ARRAY_TERMINATOR); - a[0].value = htonl (0); GNUNET_SERVER_transmit_context_append_message (tc, &cnm.header); return GNUNET_OK; } diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 56b7412c3..be3edf974 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c @@ -165,7 +165,7 @@ transmit_ready (void *cls, size_t size, void *buf) static void connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { struct PeerContext *pc = cls; @@ -218,7 +218,7 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) static int inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core provides inbound data from `%4s'.\n", GNUNET_i2s (other)); @@ -229,7 +229,7 @@ inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, static int outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core notifies about outbound data for `%4s'.\n", @@ -242,7 +242,7 @@ outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, static int process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving message from `%4s'.\n", GNUNET_i2s (peer)); diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index f40b61660..6a764c126 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c @@ -239,7 +239,7 @@ transmit_ready (void *cls, size_t size, void *buf) static void connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { struct PeerContext *pc = cls; @@ -284,7 +284,7 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) static int inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { #if VERBOSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -297,7 +297,7 @@ inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, static int outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { #if VERBOSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -314,7 +314,7 @@ transmit_ready (void *cls, size_t size, void *buf); static int process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { static int n; unsigned int s; diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c index a1c361376..cf9608ede 100644 --- a/src/core/test_core_api_send_to_self.c +++ b/src/core/test_core_api_send_to_self.c @@ -90,7 +90,7 @@ cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tskctx) static int receive (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { if (die_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (die_task); @@ -134,7 +134,7 @@ init (void *cls, struct GNUNET_CORE_Handle *core, static void connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected to peer %s.\n", GNUNET_i2s (peer)); diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index 9825131be..f27866c19 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c @@ -67,7 +67,8 @@ static int ok; static void connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { } @@ -81,7 +82,8 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) static int inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { return GNUNET_OK; } @@ -90,7 +92,8 @@ inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, static int outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { return GNUNET_OK; } diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index c8dcfad86..be875c235 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c @@ -364,7 +364,7 @@ transmit_ready (void *cls, size_t size, void *buf) static void connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { struct PeerContext *pc = cls; @@ -431,7 +431,7 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) static int inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { #if DEBUG_TRANSMISSION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -446,7 +446,7 @@ inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, static int outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { #if DEBUG_TRANSMISSION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -463,7 +463,7 @@ transmit_ready (void *cls, size_t size, void *buf); static int process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) { static int n; const struct TestMessage *hdr; diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 9d0bd996d..45df22b89 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -600,10 +600,12 @@ send_find_peer_message (void *cls, * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' */ static void handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct PeerInfo *ret; int peer_bucket; @@ -1508,6 +1510,7 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, * @param message message * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -1516,7 +1519,8 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information - *atsi) + *atsi, + unsigned int atsi_count) { const struct PeerPutMessage *put; const struct GNUNET_PeerIdentity *put_path; @@ -1729,6 +1733,7 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, * @param message message * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -1736,7 +1741,8 @@ static int handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information - *atsi) + *atsi, + unsigned int atsi_count) { struct PeerGetMessage *get; uint32_t xquery_size; @@ -1865,13 +1871,15 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, * @param message message * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' * @return GNUNET_YES (do not cut p2p connection) */ static int handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information - *atsi) + *atsi, + unsigned int atsi_count) { const struct PeerResultMessage *prm; const struct GNUNET_PeerIdentity *put_path; diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 6ea47c2e2..c5933d989 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -220,13 +220,15 @@ GSF_test_get_load_too_high_ (uint32_t priority) * for loopback messages where we are both sender and receiver) * @param message the actual message * @param atsi performance information + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ static int handle_p2p_put (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GSF_ConnectedPeer *cp; @@ -299,13 +301,15 @@ consider_forwarding (void *cls, struct GSF_PendingRequest *pr, * for loopback messages where we are both sender and receiver) * @param message the actual message * @param atsi performance information + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ static int handle_p2p_get (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GSF_PendingRequest *pr; @@ -456,16 +460,18 @@ consider_peer_for_forwarding (void *cls, const GNUNET_HashCode * key, * @param cls closure, not used * @param peer peer identity this notification is about * @param atsi performance information + * @param atsi_count number of records in 'atsi' */ static void peer_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GSF_ConnectedPeer *cp; if (0 == memcmp (&my_id, peer, sizeof (struct GNUNET_PeerIdentity))) return; - cp = GSF_peer_connect_handler_ (peer, atsi); + cp = GSF_peer_connect_handler_ (peer, atsi, atsi_count); if (NULL == cp) return; GSF_iterate_pending_requests_ (&consider_peer_for_forwarding, cp); diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index b9302e645..fc9c44785 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -328,25 +328,20 @@ get_trust_filename (const struct GNUNET_PeerIdentity *id) * Find latency information in 'atsi'. * * @param atsi performance data + * @param atsi_count number of records in 'atsi' * @return connection latency */ static struct GNUNET_TIME_Relative -get_latency (const struct GNUNET_ATS_Information *atsi) +get_latency (const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { - if (atsi == NULL) - return GNUNET_TIME_UNIT_SECONDS; - while ((ntohl (atsi->type) != GNUNET_ATS_ARRAY_TERMINATOR) && - (ntohl (atsi->type) != GNUNET_ATS_QUALITY_NET_DELAY)) - atsi++; - if (ntohl (atsi->type) == GNUNET_ATS_ARRAY_TERMINATOR) - { - /* We sometime have no latency data, i.e. if the address came from - peerinfo and we never had a chance to play transport-level - PING/PONG yet. Assume 1s in that case. */ - return GNUNET_TIME_UNIT_SECONDS; - } - return GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, - ntohl (atsi->value)); + unsigned int i; + + for (i=0;itype) == GNUNET_ATS_QUALITY_NET_DELAY) + return GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, + ntohl (atsi->value)); + return GNUNET_TIME_UNIT_SECONDS; } @@ -355,14 +350,16 @@ get_latency (const struct GNUNET_ATS_Information *atsi) * * @param cp peer record to update * @param atsi transport performance data + * @param atsi_count number of records in 'atsi' */ static void update_atsi (struct GSF_ConnectedPeer *cp, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_TIME_Relative latency; - latency = get_latency (atsi); + latency = get_latency (atsi, atsi_count); GNUNET_LOAD_value_set_decline (cp->ppd.transmission_delay, latency); /* LATER: merge atsi into cp's performance data (if we ever care...) */ } @@ -584,11 +581,13 @@ ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, * * @param peer identity of peer that connected * @param atsi performance data for the connection + * @param atsi_count number of records in 'atsi' * @return handle to connected peer entry */ struct GSF_ConnectedPeer * GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GSF_ConnectedPeer *cp; char *fn; @@ -619,7 +618,7 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer, ("# peers connected"), GNUNET_CONTAINER_multihashmap_size (cp_map), GNUNET_NO); - update_atsi (cp, atsi); + update_atsi (cp, atsi, atsi_count); GSF_push_start_ (cp); return cp; } @@ -674,6 +673,7 @@ GSF_peer_get_ (const struct GNUNET_PeerIdentity *peer) * for loopback messages where we are both sender and receiver) * @param message the actual message * @param atsi performance information + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -682,7 +682,8 @@ GSF_handle_p2p_migration_stop_ (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information - *atsi) + *atsi, + unsigned int atsi_count) { struct GSF_ConnectedPeer *cp; const struct MigrationStopMessage *msm; @@ -710,7 +711,7 @@ GSF_handle_p2p_migration_stop_ (void *cls, cp->mig_revive_task = GNUNET_SCHEDULER_add_delayed (bt, &revive_migration, cp); } - update_atsi (cp, atsi); + update_atsi (cp, atsi, atsi_count); return GNUNET_OK; } diff --git a/src/fs/gnunet-service-fs_cp.h b/src/fs/gnunet-service-fs_cp.h index c725dee75..8923513c7 100644 --- a/src/fs/gnunet-service-fs_cp.h +++ b/src/fs/gnunet-service-fs_cp.h @@ -168,11 +168,13 @@ struct GSF_PeerTransmitHandle; * * @param peer identity of peer that connected * @param atsi performance data for the connection + * @param atsi_count number of records in 'atsi' * @return handle to connected peer entry */ struct GSF_ConnectedPeer * GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi); + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count); /** @@ -260,6 +262,7 @@ GSF_peer_update_responder_peer_ (struct GSF_ConnectedPeer *cp, * for loopback messages where we are both sender and receiver) * @param message the actual message * @param atsi performance information + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -268,7 +271,8 @@ GSF_handle_p2p_migration_stop_ (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information - *atsi); + *atsi, + unsigned int atsi_count); /** diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index fb23d2345..2ef807444 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -136,14 +136,17 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, /** * Core handler for p2p hostlist advertisements + * + * @param atsi_count number of records in 'atsi' */ static int advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { GNUNET_assert (NULL != client_adv_handler); - return (*client_adv_handler) (cls, peer, message, atsi); + return (*client_adv_handler) (cls, peer, message, atsi, atsi_count); } @@ -153,20 +156,22 @@ advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer, * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' */ static void connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { if (0 == memcmp (&me, peer, sizeof (struct GNUNET_PeerIdentity))) return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "A new peer connected, notifying client and server\n"); if (NULL != client_ch) - (*client_ch) (cls, peer, atsi); + (*client_ch) (cls, peer, atsi, atsi_count); #if HAVE_MHD if (NULL != server_ch) - (*server_ch) (cls, peer, atsi); + (*server_ch) (cls, peer, atsi, atsi_count); #endif } diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index 1f3ad2a7c..ba5093779 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c @@ -1107,10 +1107,12 @@ task_hostlist_saving (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' */ static void handler_connect (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { GNUNET_assert (stat_connection_count < UINT_MAX); stat_connection_count++; @@ -1142,13 +1144,15 @@ handler_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) * @param peer the peer sending the message * @param message the actual message * @param atsi performance data + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ static int handler_advertisement (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { size_t size; size_t uri_size; diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index fb4c1b1b9..a6d9c126c 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c @@ -362,10 +362,12 @@ adv_transmit_ready (void *cls, size_t size, void *buf) * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' */ static void connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { size_t size; diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index 9d72433ce..dfeca8d57 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c @@ -298,7 +298,8 @@ check_statistics (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static int ad_arrive_handler (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { char *hostname; char *expected_uri; diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index d0adf127b..24c9aa598 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h @@ -57,13 +57,15 @@ struct GNUNET_CORE_Handle; * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data for the connection + * @param atsi_count number of records in 'atsi' */ typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, const struct GNUNET_PeerIdentity * peer, const struct GNUNET_ATS_Information - * atsi); + * atsi, + unsigned int atsi_count); /** @@ -86,6 +88,7 @@ typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, * for loopback messages where we are both sender and receiver) * @param message the actual message * @param atsi performance data for the connection + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -96,7 +99,8 @@ typedef int (*GNUNET_CORE_MessageCallback) (void *cls, message, const struct GNUNET_ATS_Information * - atsi); + atsi, + unsigned int atsi_count); /** diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h index ab573557c..914bc2dc6 100644 --- a/src/include/gnunet_mesh_service.h +++ b/src/include/gnunet_mesh_service.h @@ -64,6 +64,7 @@ struct GNUNET_MESH_Tunnel; * @param sender who sent the message * @param message the actual message * @param atsi performance data for the connection + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -76,7 +77,8 @@ typedef int (*GNUNET_MESH_MessageCallback) (void *cls, message, const struct GNUNET_ATS_Information * - atsi); + atsi, + unsigned int atsi_count); /** @@ -184,13 +186,15 @@ typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls, * @param cls closure * @param peer peer identity the tunnel was created to, NULL on timeout * @param atsi performance data for the connection + * @param atsi_count number of records in 'atsi' */ typedef void (*GNUNET_MESH_TunnelConnectHandler) (void *cls, const struct GNUNET_PeerIdentity * peer, const struct GNUNET_ATS_Information - * atsi); + * atsi, + unsigned int atsi_count); diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 94196be84..19650dcb6 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -2265,6 +2265,7 @@ send_core_path_ack (void *cls, size_t size, void *buf) * @param message message * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) @@ -2272,7 +2273,8 @@ send_core_path_ack (void *cls, size_t size, void *buf) static int handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { unsigned int own_pos; uint16_t size; @@ -2462,6 +2464,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, * @param message message * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) @@ -2469,7 +2472,8 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, static int handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_MESH_ManipulatePath *msg; struct GNUNET_PeerIdentity *pi; @@ -2546,6 +2550,7 @@ handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, * @param message message * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) @@ -2553,7 +2558,8 @@ handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, static int handle_mesh_tunnel_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_MESH_TunnelDestroy *msg; struct MeshTunnel *t; @@ -2596,13 +2602,15 @@ handle_mesh_tunnel_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, * @param peer peer identity this notification is about * @param message message * @param atsi performance data + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ static int handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_MESH_Unicast *msg; struct MeshTunnel *t; @@ -2654,6 +2662,7 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, * @param message message * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) * @@ -2662,7 +2671,8 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, static int handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_MESH_Multicast *msg; struct MeshTunnel *t; @@ -2707,6 +2717,7 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer, * @param message message * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) @@ -2714,7 +2725,8 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer, static int handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_MESH_ToOrigin *msg; struct GNUNET_PeerIdentity id; @@ -2794,6 +2806,7 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, * @param message message * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) @@ -2801,7 +2814,8 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, static int handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_MESH_PathACK *msg; struct GNUNET_PeerIdentity id; @@ -3739,7 +3753,7 @@ handle_local_unicast (void *cls, struct GNUNET_SERVER_Client *client, copy->tid = htonl (t->id.tid); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: calling generic handler...\n"); - handle_mesh_data_unicast (NULL, &my_full_id, ©->header, NULL); + handle_mesh_data_unicast (NULL, &my_full_id, ©->header, NULL, 0); } GNUNET_SERVER_receive_done (client, GNUNET_OK); return; @@ -3825,7 +3839,7 @@ handle_local_to_origin (void *cls, struct GNUNET_SERVER_Client *client, copy->sender = my_full_id; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: calling generic handler...\n"); - handle_mesh_data_to_orig (NULL, &my_full_id, ©->header, NULL); + handle_mesh_data_to_orig (NULL, &my_full_id, ©->header, NULL, 0); } GNUNET_SERVER_receive_done (client, GNUNET_OK); return; @@ -3896,7 +3910,7 @@ handle_local_multicast (void *cls, struct GNUNET_SERVER_Client *client, copy->tid = htonl(t->id.tid); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: calling generic handler...\n"); - handle_mesh_data_multicast(client, &my_full_id, ©->header, NULL); + handle_mesh_data_multicast(client, &my_full_id, ©->header, NULL, 0); } /* receive done gets called when last copy is sent to a neighbor */ @@ -3961,10 +3975,12 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data for the connection + * @param atsi_count number of records in 'atsi' */ static void core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct MeshPeerInfo *peer_info; struct MeshPeerPath *path; diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 2067b7b6c..0f7592056 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c @@ -113,7 +113,6 @@ struct peer_list_element /* list of application-types */ struct type_list_element *type_head, *type_tail; - struct GNUNET_ATS_Information atsi; struct peer_list_element *next, *prev; /* The handle that sends the hellos to this peer */ @@ -154,7 +153,7 @@ send_end_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_MESH_Tunnel *tunnel = cls; - tunnel->connect_handler (tunnel->handler_cls, NULL, NULL); + tunnel->connect_handler (tunnel->handler_cls, NULL, NULL, 0); } static void @@ -165,7 +164,7 @@ send_self_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_MESH_Tunnel *tunnel = cls; - tunnel->connect_handler (tunnel->handler_cls, &tunnel->handle->myself, NULL); + tunnel->connect_handler (tunnel->handler_cls, &tunnel->handle->myself, NULL, 0); GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); } @@ -177,7 +176,7 @@ call_connect_handler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_MESH_Tunnel *tunnel = cls; - tunnel->connect_handler (tunnel->handler_cls, &tunnel->peer, NULL); + tunnel->connect_handler (tunnel->handler_cls, &tunnel->peer, NULL, 0); GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); } @@ -254,7 +253,8 @@ schedule_hello_message (void *cls, */ static void core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_MESH_Handle *handle = cls; @@ -269,11 +269,6 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, /* Send a hello to this peer */ element->sched = GNUNET_SCHEDULER_add_now (schedule_hello_message, element); - - if (NULL != atsi) - memcpy (&element->atsi, atsi, - sizeof (struct GNUNET_ATS_Information)); - GNUNET_CONTAINER_DLL_insert_after (handle->connected_peers.head, handle->connected_peers.tail, handle->connected_peers.tail, element); @@ -294,7 +289,7 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, handle->established_tunnels.tail, handle->established_tunnels.tail, tunnel); - tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, peer, atsi); + tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, peer, atsi, atsi_count); GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); tunnel = next; } @@ -383,7 +378,8 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) static int receive_hello (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_MESH_Handle *handle = cls; uint16_t *num = (uint16_t *) (message + 1); @@ -450,7 +446,7 @@ receive_hello (void *cls, const struct GNUNET_PeerIdentity *other, memcpy (&tunnel->tunnel.peer, other, sizeof (struct GNUNET_PeerIdentity)); tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, - &tunnel->tunnel.peer, atsi); + &tunnel->tunnel.peer, atsi, atsi_count); GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); break; } @@ -469,7 +465,8 @@ receive_hello (void *cls, const struct GNUNET_PeerIdentity *other, static int core_receive (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_MESH_Handle *handle = cls; struct tunnel_message *tmessage = (struct tunnel_message *) message; @@ -539,7 +536,7 @@ core_receive (void *cls, const struct GNUNET_PeerIdentity *other, GNUNET_i2s (other), ntohs (rmessage->type)); return handler->callback (handle->cls, &tunnel->tunnel, &tunnel->tunnel.ctx, - other, rmessage, atsi); + other, rmessage, atsi, atsi_count); } struct GNUNET_MESH_Tunnel * diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index ce48ecfc4..d9687acd2 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -938,12 +938,13 @@ update_flood_times (void *cls, const GNUNET_HashCode * key, void *value) * @param message message * @param peer peer identity this message is from (ignored) * @param atsi performance data (ignored) - * + * @param atsi_count number of records in 'atsi' */ static int handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { const struct GNUNET_NSE_FloodMessage *incoming_flood; struct GNUNET_TIME_Absolute ts; @@ -1094,10 +1095,12 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer, * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' */ static void handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct NSEPeerEntry *peer_entry; diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index b83a8cf3c..e563f4d64 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c @@ -348,7 +348,8 @@ topology_cb (void *cls, const struct GNUNET_PeerIdentity *first, static int process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { char *dotOutFileNameFinished; FILE *dotOutFileFinished; @@ -537,10 +538,12 @@ init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server, * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data for the connection + * @param atsi_count number of records in 'atsi' */ static void connect_notify_peers (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct TestMessageContext *pos = cls; diff --git a/src/testing/testing.c b/src/testing/testing.c index 1798a1af6..e81a92fb5 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -1882,11 +1882,13 @@ notify_connect_result (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param cls our "struct GNUNET_TESTING_ConnectContext" * @param peer identity of the peer that has connected * @param atsi performance information + * @param atsi_count number of records in 'atsi' * */ static void connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_TESTING_ConnectContext *ctx = cls; @@ -2080,11 +2082,13 @@ reattempt_daemons_connect (void *cls, * @param peer identity of the peer that has connected, * NULL when iteration has finished * @param atsi performance information + * @param atsi_count number of records in 'atsi' * */ static void core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct GNUNET_TESTING_ConnectContext *ctx = cls; diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index a2c68c93c..04c2cfd00 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -4877,7 +4877,8 @@ perform_dfs (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num) */ static void internal_topology_callback (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct CoreContext *core_ctx = cls; struct TopologyIterateContext *iter_ctx = core_ctx->iter_context; @@ -4941,7 +4942,7 @@ schedule_get_topology (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) &internal_topology_callback, core_context)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Topology iteration failed.\n"); - internal_topology_callback (core_context, NULL, NULL); + internal_topology_callback (core_context, NULL, NULL, 0); } } } diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 453c9d924..625923cdf 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c @@ -632,10 +632,12 @@ reschedule_hellos (void *cls, const GNUNET_HashCode * pid, void *value) * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' */ static void connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct Peer *pos; @@ -1100,13 +1102,15 @@ read_friends_file (const struct GNUNET_CONFIGURATION_Handle *cfg) * for loopback messages where we are both sender and receiver) * @param message the actual HELLO message * @param atsi performance data + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ static int handle_encrypted_hello (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { struct Peer *peer; struct GNUNET_PeerIdentity pid; diff --git a/src/vpn/gnunet-daemon-exit.c b/src/vpn/gnunet-daemon-exit.c index b88dd0f08..8b7a8cff3 100644 --- a/src/vpn/gnunet-daemon-exit.c +++ b/src/vpn/gnunet-daemon-exit.c @@ -1025,7 +1025,9 @@ receive_tcp_service (void *cls __attribute__ ((unused)), const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received TCP-Packet\n"); GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); @@ -1133,7 +1135,9 @@ receive_tcp_remote (void *cls __attribute__ ((unused)), const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct tcp_pkt *pkt = (struct tcp_pkt *) (desc + 1); @@ -1209,7 +1213,9 @@ receive_udp_remote (void *cls __attribute__ ((unused)), const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1); @@ -1289,7 +1295,9 @@ receive_udp_service (void *cls __attribute__ ((unused)), const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1); diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c index d91b00416..4d2bbf819 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.c +++ b/src/vpn/gnunet-daemon-vpn-helper.c @@ -333,7 +333,7 @@ message_token (void *cls __attribute__ ((unused)), void *client else if (NULL != cls) { *cls = me->tunnel; - send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL); + send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL, 0); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Queued to send IPv6 to peer %x, type %d\n", *((unsigned int *) &me->desc.peer), ntohs (hdr->type)); @@ -384,7 +384,7 @@ message_token (void *cls __attribute__ ((unused)), void *client else if (NULL != cls) { *cls = me->tunnel; - send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL); + send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL, 0); } } } @@ -535,7 +535,7 @@ message_token (void *cls __attribute__ ((unused)), void *client else if (NULL != cls) { *cls = me->tunnel; - send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL); + send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL, 0); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Queued to send IPv4 to peer %x, type %d\n", *((unsigned int *) &me->desc.peer), @@ -577,7 +577,7 @@ message_token (void *cls __attribute__ ((unused)), void *client else if (NULL != cls) { *cls = me->tunnel; - send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL); + send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL, 0); } } } diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 0f7bdff70..a6d051e9c 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c @@ -341,7 +341,9 @@ port_in_ports (uint64_t ports, uint16_t port) void send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { /* peer == NULL means that all peers in this request are connected */ if (peer == NULL) @@ -872,7 +874,9 @@ receive_udp_back (void *cls __attribute__ ((unused)), const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct remote_addr *s = (struct remote_addr *) desc; @@ -1051,7 +1055,9 @@ receive_tcp_back (void *cls __attribute__ ((unused)), const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct remote_addr *s = (struct remote_addr *) desc; diff --git a/src/vpn/gnunet-daemon-vpn.h b/src/vpn/gnunet-daemon-vpn.h index c0dba360e..7d3b0e68a 100644 --- a/src/vpn/gnunet-daemon-vpn.h +++ b/src/vpn/gnunet-daemon-vpn.h @@ -56,7 +56,8 @@ port_in_ports (uint64_t ports, uint16_t port); void send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi); + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count); /** * The configuration to use diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c index 49e774dc2..4aa04ddfa 100644 --- a/src/vpn/gnunet-service-dns.c +++ b/src/vpn/gnunet-service-dns.c @@ -325,7 +325,9 @@ mesh_send (void *cls, size_t size, void *buf) void mesh_connect (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { if (NULL == peer) return; @@ -395,7 +397,9 @@ receive_mesh_query (void *cls __attribute__ ((unused)), const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { struct dns_pkt *dns = (struct dns_pkt *) (message + 1); @@ -429,7 +433,9 @@ receive_mesh_answer (void *cls const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *message, const struct GNUNET_ATS_Information *atsi - __attribute__ ((unused))) + __attribute__ ((unused)), + unsigned int atsi_count + __attribute__ ((unused))) { /* TODo: size check */ struct dns_pkt *dns = (struct dns_pkt *) (message + 1);