replacing 0-terminated atsi-array with array+length in core API (and the core-connect...
authorChristian Grothoff <christian@grothoff.org>
Sat, 22 Oct 2011 21:59:27 +0000 (21:59 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 22 Oct 2011 21:59:27 +0000 (21:59 +0000)
33 files changed:
src/core/core.h
src/core/core_api.c
src/core/core_api_iterate_peers.c
src/core/gnunet-core-list-connections.c
src/core/gnunet-service-core_clients.c
src/core/gnunet-service-core_sessions.c
src/core/test_core_api.c
src/core/test_core_api_reliability.c
src/core/test_core_api_send_to_self.c
src/core/test_core_api_start_only.c
src/core/test_core_quota_compliance.c
src/dht/gnunet-service-dht_neighbours.c
src/fs/gnunet-service-fs.c
src/fs/gnunet-service-fs_cp.c
src/fs/gnunet-service-fs_cp.h
src/hostlist/gnunet-daemon-hostlist.c
src/hostlist/hostlist-client.c
src/hostlist/hostlist-server.c
src/hostlist/test_gnunet_daemon_hostlist_learning.c
src/include/gnunet_core_service.h
src/include/gnunet_mesh_service.h
src/mesh/gnunet-service-mesh.c
src/mesh/mesh_api.c
src/nse/gnunet-service-nse.c
src/testing/test_testing_topology.c
src/testing/testing.c
src/testing/testing_group.c
src/topology/gnunet-daemon-topology.c
src/vpn/gnunet-daemon-exit.c
src/vpn/gnunet-daemon-vpn-helper.c
src/vpn/gnunet-daemon-vpn.c
src/vpn/gnunet-daemon-vpn.h
src/vpn/gnunet-service-dns.c

index 71969c3e045b394c53a20625abff4d64bead1e64..b76528a8ec275f33d960a4cc6babfedfbcec1647 100644 (file)
@@ -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;
-
 };
 
 
index b903d73bb921cd0e1c0134385ed491794f2644df..3349f79abbd055a255ebab96a96230f607efaba0 100644 (file)
@@ -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))
index ed9ea175ee3b4d7f6fb07c01a4fb6fdbed95ded1..7bf40a678c645c72d79528e432108935307ea85d 100644 (file)
@@ -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);
 }
index ae7feb915e4dd2748b28e3aafa5777c73fcccadb..9665110a38ef02cdee7b565944cbe4bef12d676e 100644 (file)
@@ -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;
 
index 146b251be40379a90e1171eee3a0e00599b1ae6d..47bbd98db18432828a47742269fb92f7c0cf76a0 100644 (file)
@@ -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",
index fc9576a938bc78a027b99077d1af12a6effafad4..61532ac9cf31c0e48256a5468ba9f2ab0ca78a4d 100644 (file)
@@ -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;
 }
index 56b7412c30f98d3f51abc5dbc18ab0353e65e2b9..be3edf9741d2e8d75da89f2821014e4466b8ee7f 100644 (file)
@@ -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));
index f40b616601b9c601972787953f6fc39c7968088e..6a764c126f485196e8be89b325546cce8bd0ac50 100644 (file)
@@ -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;
index a1c3613761152ae3d4def4c97fe14129cbde85db..cf9608edef83f914eb4dbf7f00925760f875a1c0 100644 (file)
@@ -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));
index 9825131be99f6f74a0f25d401cb92648993f683a..f27866c19be01986a7a8338da11fba88d41812cc 100644 (file)
@@ -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;
 }
index c8dcfad86876edfa1c1608fb672afaf23238be4a..be875c235213bb15c9e1e049cf02a3056e0c46eb 100644 (file)
@@ -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;
index 9d0bd996dfdb9922d7e18f9170db05f3dc94f18d..45df22b89236d3f86a3aaa7513d12e6981a4ed00 100644 (file)
@@ -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;
index 6ea47c2e291bbd33ef729e72d0f9549f10c04e27..c5933d989667b79e953e7816d55050789ce09758 100644 (file)
@@ -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);
index b9302e6456ea6319732a0bca12a1cc4d368cb1b6..fc9c44785a06e4a650832cbcef187f386bf3123b 100644 (file)
@@ -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;i<atsi_count;i++)
+    if (ntohl (atsi->type) == 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;
 }
 
index c725dee75e1e48089e7abd5a7b90459134ba1710..8923513c7c6a108e9f6d4399d4fe9aca380fbf30 100644 (file)
@@ -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);
 
 
 /**
index fb23d2345bca4b3f1681e06ee2159553876e6f6c..2ef80744407181a71c0ed1b293131700caf5ff3a 100644 (file)
@@ -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
 }
 
index 1f3ad2a7c7212f9dcfc95f55a6d4fecb166bdfd8..ba5093779a1d1e73bfecbae52d114eedf74fab99 100644 (file)
@@ -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;
index fb4c1b1b9243a8c9d25b918aaeeccbd30cc33025..a6d9c126cb61a3df45ab640910ccfd1111533824 100644 (file)
@@ -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;
 
index 9d72433cee0e532e33f20fc45e1b4019ceca21f4..dfeca8d5785ee81e2aafdd8fbc2283905b890809 100644 (file)
@@ -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;
index d0adf127ba7394c81dc301f1a9721853571c155e..24c9aa59872c96496f994923bc11b94359787a1b 100644 (file)
@@ -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);
 
 
 /**
index ab573557c8bcfa6c618f937b69be52b6946bf76f..914bc2dc652da573a3dffb6302ee060075090c63 100644 (file)
@@ -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);
 
 
 
index 94196be8436ac72f1b98c69d83b7e7571b30f631..19650dcb653a80e062be7472f88a934333504b0e 100644 (file)
@@ -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, &copy->header, NULL);
+    handle_mesh_data_unicast (NULL, &my_full_id, &copy->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, &copy->header, NULL);
+    handle_mesh_data_to_orig (NULL, &my_full_id, &copy->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, &copy->header, NULL);
+    handle_mesh_data_multicast(client, &my_full_id, &copy->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;
index 2067b7b6c3f26dfab2ed24e0a876fa3b2cc63667..0f7592056d965b1d3d7bb34cc6a04a3c91bf6ab4 100644 (file)
@@ -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 *
index ce48ecfc4a557dafcee1eca0e2deb262870e328e..d9687acd29af1a26c0971885659c17a12d53588c 100644 (file)
@@ -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;
 
index b83a8cf3cde53a9c89343cd62bae401e1acc0885..e563f4d64a6f8d24994d31275e363339e2319a31 100644 (file)
@@ -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;
 
index 1798a1af675ffff44de9e592d35f96a93b9b1b20..e81a92fb52998135b298184d1afa8aad87f0ac73 100644 (file)
@@ -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;
 
index a2c68c93c3fed1c53874dad118f09b759373940f..04c2cfd0068c73dadeef18735b2a8bd9ac38068f 100644 (file)
@@ -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);
     }
   }
 }
index 453c9d924ddc0702c44d5c6fd8f9f5badd039276..625923cdf8cf312e26d193d464d4b6ccd6adbf97 100644 (file)
@@ -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;
index b88dd0f08ef4d5da694284caebeacf61c51286a0..8b7a8cff3210cb1fe274de66b9a5735e6adae27d 100644 (file)
@@ -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);
index d91b00416915dbf735ba66e39b160892cb57fa31..4d2bbf819e625bf19ed21ee0570ae1d7284e26d1 100644 (file)
@@ -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);
             }
           }
         }
index 0f7bdff702b0faf61bb5fd7fff632870961a745b..a6d051e9ce234a9628b62efbc467933a2a4cafb4 100644 (file)
@@ -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;
index c0dba360ef6489c5630140ab59db1efc0d52d107..7d3b0e68a28e0808d6df07f8c965340547fa59cf 100644 (file)
@@ -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
index 49e774dc2fdf32358a8bf6bb1e88be56782683cf..4aa04ddfa0b181144495fb3be8cee6bc41692fd2 100644 (file)
@@ -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);