ats related changes in core
authorMatthias Wachs <wachs@net.in.tum.de>
Thu, 21 Mar 2013 13:31:13 +0000 (13:31 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Thu, 21 Mar 2013 13:31:13 +0000 (13:31 +0000)
src/core/core.h
src/core/core_api.c
src/core/core_api_is_connected.c
src/core/core_api_iterate_peers.c
src/core/gnunet-service-core_clients.c
src/core/gnunet-service-core_clients.h
src/core/gnunet-service-core_kx.c
src/core/gnunet-service-core_kx.h
src/core/gnunet-service-core_neighbours.c
src/core/gnunet-service-core_sessions.c

index 9b1802fbc4284f8bb1301060c1e9df5558076d32..d518a93086ff7346292719ede291caff0c74fdaf 100644 (file)
@@ -110,11 +110,6 @@ struct ConnectNotifyMessage
    */
   struct GNUNET_MessageHeader header;
 
-  /**
-   * Number of ATS key-value pairs that follow this struct
-   */
-  uint32_t ats_count GNUNET_PACKED;
-
   /**
    * Identity of the connecting peer.
    */
@@ -210,21 +205,11 @@ struct NotifyTrafficMessage
    */
   struct GNUNET_MessageHeader header;
 
-  /**
-   * Number of ATS key-value pairs that follow this struct
-   * (excluding the 0-terminator).
-   */
-  uint32_t ats_count GNUNET_PACKED;
-
   /**
    * Identity of the receiver or sender.
    */
   struct GNUNET_PeerIdentity peer;
 
-  /* Followed by ATS information blocks:
-   * struct GNUNET_ATS_Information ats[ats_count]
-   */
-
   /* Followed by payload (message or just header), variable size */
 };
 
index 2b1291d0819735c0efef433cc59c6960e45cfea4..511c7ee99365fee32b670737185011f48f2ae164 100644 (file)
@@ -739,7 +739,6 @@ 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;
@@ -747,8 +746,6 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
   int trigger;
   uint16_t msize;
   uint16_t et;
-  uint32_t ats_count;
-
   if (NULL == msg)
   {
     LOG (GNUNET_ERROR_TYPE_INFO,
@@ -813,10 +810,8 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
       return;
     }
     cnm = (const struct ConnectNotifyMessage *) msg;
-    ats_count = ntohl (cnm->ats_count);
     if (msize !=
-        sizeof (struct ConnectNotifyMessage) +
-        ats_count * sizeof (struct GNUNET_ATS_Information))
+        sizeof (struct ConnectNotifyMessage))
     {
       GNUNET_break (0);
       reconnect_later (h);
@@ -845,9 +840,8 @@ 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, ats, ats_count);
+      h->connects (h->cls, &cnm->peer, NULL, 0);
     break;
   case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT:
     if (msize != sizeof (struct DisconnectNotifyMessage))
@@ -888,25 +882,21 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
       return;
     }
     ntm = (const struct NotifyTrafficMessage *) msg;
-    ats_count = ntohl (ntm->ats_count);
     if ((msize <
          sizeof (struct NotifyTrafficMessage) +
-         ats_count * sizeof (struct GNUNET_ATS_Information) +
          sizeof (struct GNUNET_MessageHeader)) )
     {
       GNUNET_break (0);
       reconnect_later (h);
       return;
     }
-    ats = (const struct GNUNET_ATS_Information*) &ntm[1];
-    em = (const struct GNUNET_MessageHeader *) &ats[ats_count];
+    em = (const struct GNUNET_MessageHeader *) &ntm[1];
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Received message of type %u and size %u from peer `%4s'\n",
          ntohs (em->type), ntohs (em->size), GNUNET_i2s (&ntm->peer));
     if ((GNUNET_NO == h->inbound_hdr_only) &&
         (msize !=
-         ntohs (em->size) + sizeof (struct NotifyTrafficMessage) +
-         +ats_count * sizeof (struct GNUNET_ATS_Information)))
+         ntohs (em->size) + sizeof (struct NotifyTrafficMessage)))
     {
       GNUNET_break (0);
       reconnect_later (h);
@@ -934,15 +924,14 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
        return;
       }
       if (GNUNET_OK !=
-          h->handlers[hpos].callback (h->cls, &ntm->peer, em, ats,
-                                      ats_count))
+          h->handlers[hpos].callback (h->cls, &ntm->peer, em, NULL,0))
       {
         /* error in processing, do not process other messages! */
         break;
       }
     }
     if (NULL != h->inbound_notify)
-      h->inbound_notify (h->cls, &ntm->peer, em, ats, ats_count);
+      h->inbound_notify (h->cls, &ntm->peer, em, NULL, 0);
     break;
   case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND:
     if (msize < sizeof (struct NotifyTrafficMessage))
@@ -952,25 +941,21 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
       return;
     }
     ntm = (const struct NotifyTrafficMessage *) msg;
-    ats_count = ntohl (ntm->ats_count);
     if ((msize <
          sizeof (struct NotifyTrafficMessage) +
-         ats_count * sizeof (struct GNUNET_ATS_Information) +
          sizeof (struct GNUNET_MessageHeader)) )
     {
       GNUNET_break (0);
       reconnect_later (h);
       return;
     }
-    ats = (const struct GNUNET_ATS_Information*) &ntm[1];    
-    em = (const struct GNUNET_MessageHeader *) &ats[ats_count];
+    em = (const struct GNUNET_MessageHeader *) &ntm[1];
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Received notification about transmission to `%s'.\n",
          GNUNET_i2s (&ntm->peer));
     if ((GNUNET_NO == h->outbound_hdr_only) &&
         (msize !=
-         ntohs (em->size) + sizeof (struct NotifyTrafficMessage) +
-         ats_count * sizeof (struct GNUNET_ATS_Information)))
+         ntohs (em->size) + sizeof (struct NotifyTrafficMessage)))
     {
       GNUNET_break (0);
       reconnect_later (h);
@@ -981,7 +966,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
       GNUNET_break (0);
       break;
     }
-    h->outbound_notify (h->cls, &ntm->peer, em, ats, ats_count);
+    h->outbound_notify (h->cls, &ntm->peer, em, NULL, 0);
     break;
   case GNUNET_MESSAGE_TYPE_CORE_SEND_READY:
     if (msize != sizeof (struct SendMessageReady))
index 2e01b3691560daaaf659d8235b6acf5c1d7af651..10af88f5c3af89c13d3a6ebc2e7b32e95a67da6f 100644 (file)
@@ -78,7 +78,6 @@ receive_connect_info (void *cls, const struct GNUNET_MessageHeader *msg)
 {
   struct GNUNET_CORE_ConnectTestHandle *cth = cls;
   const struct ConnectNotifyMessage *connect_message;
-  uint32_t ats_count;
   uint16_t msize;
 
   if (NULL == msg)
@@ -107,10 +106,7 @@ receive_connect_info (void *cls, const struct GNUNET_MessageHeader *msg)
     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))
+  if (msize != sizeof (struct ConnectNotifyMessage))
   {
     GNUNET_break (0);
     cth->peer_cb (cth->cb_cls, NULL, NULL, 0);
@@ -118,9 +114,7 @@ receive_connect_info (void *cls, const struct GNUNET_MessageHeader *msg)
     return;
   }
   /* Normal case */
-  cth->peer_cb (cth->cb_cls, &connect_message->peer,
-               (const struct GNUNET_ATS_Information *)
-               &connect_message[1], ats_count);
+  cth->peer_cb (cth->cb_cls, &connect_message->peer, NULL, 0);
   GNUNET_CLIENT_receive (cth->client, &receive_connect_info,
                          cth, GNUNET_TIME_UNIT_FOREVER_REL);
 }
index 7db94861843f8651ba9a4de27fe0705af05891f0..4cb73dc2127c6823dbeb56af1d2169cb2b63738c 100644 (file)
@@ -70,7 +70,6 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg)
 {
   struct GNUNET_CORE_RequestContext *request_context = cls;
   const struct ConnectNotifyMessage *connect_message;
-  uint32_t ats_count;
   uint16_t msize;
 
   /* Handle last message or error case, disconnect and clean up */
@@ -98,10 +97,7 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg)
     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))
+  if (msize != sizeof (struct ConnectNotifyMessage))
   {
     GNUNET_break (0);
     if (request_context->peer_cb != NULL)
@@ -113,8 +109,7 @@ 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,
-                              (const struct GNUNET_ATS_Information *)
-                              &connect_message[1], ats_count);
+                              NULL , 0);
   GNUNET_CLIENT_receive (request_context->client, &receive_info,
                          request_context, GNUNET_TIME_UNIT_FOREVER_REL);
 }
index 1d299dae83b66c46574f73942bd11633c23f1514..9ad23ed0bf0544c48277ab744e15069c56e857d3 100644 (file)
@@ -525,16 +525,16 @@ client_tokenizer_callback (void *cls, void *client,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Delivering message of type %u to myself\n",
                 ntohs (message->type));
-    GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message,
+    GSC_CLIENTS_deliver_message (&GSC_my_identity, message,
                                 ntohs (message->size),
                                 GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND);
-    GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message,
+    GSC_CLIENTS_deliver_message (&GSC_my_identity, message,
                                 sizeof (struct GNUNET_MessageHeader),
                                 GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND);
-    GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message,
+    GSC_CLIENTS_deliver_message (&GSC_my_identity, message,
                                 ntohs (message->size),
                                 GNUNET_CORE_OPTION_SEND_FULL_INBOUND);
-    GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message,
+    GSC_CLIENTS_deliver_message (&GSC_my_identity, message,
                                 sizeof (struct GNUNET_MessageHeader),
                                 GNUNET_CORE_OPTION_SEND_HDR_INBOUND);    
   }
@@ -543,10 +543,10 @@ client_tokenizer_callback (void *cls, void *client,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Delivering message of type %u to %s\n", ntohs (message->type),
                 GNUNET_i2s (&car->target));
-    GSC_CLIENTS_deliver_message (&car->target, NULL, 0, message,
+    GSC_CLIENTS_deliver_message (&car->target, message,
                                 ntohs (message->size),
                                 GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND);
-    GSC_CLIENTS_deliver_message (&car->target, NULL, 0, message,
+    GSC_CLIENTS_deliver_message (&car->target, message,
                                 sizeof (struct GNUNET_MessageHeader),
                                 GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND);  
     GSC_SESSIONS_transmit (car, message, tc->cork);
@@ -697,7 +697,6 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client,
   struct ConnectNotifyMessage *cnm;
   size_t size;
   char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN;
-  struct GNUNET_ATS_Information *a;
   struct DisconnectNotifyMessage dcm;
   int old_match;
   int new_match;
@@ -722,9 +721,7 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client,
                                                       &neighbour->hashPubKey,
                                                       NULL,
                                                       GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-    size =
-        sizeof (struct ConnectNotifyMessage) +
-        (atsi_count) * sizeof (struct GNUNET_ATS_Information);
+    size = sizeof (struct ConnectNotifyMessage);
     if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
     {
       GNUNET_break (0);
@@ -735,9 +732,6 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client,
     cnm = (struct ConnectNotifyMessage *) buf;
     cnm->header.size = htons (size);
     cnm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
-    cnm->ats_count = htonl (atsi_count);
-    a = (struct GNUNET_ATS_Information *) &cnm[1];
-    memcpy (a, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n",
                 "NOTIFY_CONNECT");
     cnm->peer = *neighbour;
@@ -804,24 +798,18 @@ GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity
  */
 void
 GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
-                             const struct GNUNET_ATS_Information *atsi,
-                             unsigned int atsi_count,
                              const struct GNUNET_MessageHeader *msg,
                              uint16_t msize, 
-                            uint32_t options)
+                             uint32_t options)
 {
-  size_t size =
-      msize + sizeof (struct NotifyTrafficMessage) +
-      atsi_count * sizeof (struct GNUNET_ATS_Information);
+  size_t size = msize + sizeof (struct NotifyTrafficMessage);
   char buf[size] GNUNET_ALIGN;
   struct NotifyTrafficMessage *ntm;
-  struct GNUNET_ATS_Information *a;
 
   if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
   {
     GNUNET_break (0);
     /* recovery strategy: throw performance data away... */
-    atsi_count = 0;
     size = msize + sizeof (struct NotifyTrafficMessage);
   }
   if (! ( (0 != (all_client_options & options)) ||
@@ -837,11 +825,8 @@ GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
     ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND);
   else
     ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND);
-  ntm->ats_count = htonl (atsi_count);
   ntm->peer = *sender;
-  a = (struct GNUNET_ATS_Information*) &ntm[1];
-  memcpy (a, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count);
-  memcpy (&a[atsi_count], msg, msize);
+  memcpy (&ntm[1], msg, msize);
   send_to_all_clients (sender, &ntm->header, GNUNET_YES, options,
                        ntohs (msg->type));
 }
index 8ece1ce1d7e60087ddb38f9c072f0b762600d0af..d3f9e6e8e1af77039320c0f8b36e93e2a664c39d 100644 (file)
@@ -102,8 +102,6 @@ GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity
  */
 void
 GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
-                             const struct GNUNET_ATS_Information *atsi,
-                             unsigned int atsi_count,
                              const struct GNUNET_MessageHeader *msg,
                              uint16_t msize,
                             uint32_t options);
index 2d0d01015f43377ab784402dd7369b43db767787..545cccaa66cb6e7a2942b91ce08b02ec915f9418 100644 (file)
@@ -1250,11 +1250,6 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
 struct DeliverMessageContext
 {
 
-  /**
-   * Performance information for the connection.
-   */
-  const struct GNUNET_ATS_Information *atsi;
-
   /**
    * Key exchange context.
    */
@@ -1264,11 +1259,6 @@ struct DeliverMessageContext
    * Sender of the message.
    */
   const struct GNUNET_PeerIdentity *peer;
-
-  /**
-   * Number of entries in 'atsi' array.
-   */
-  uint32_t atsi_count;
 };
 
 
@@ -1283,9 +1273,7 @@ struct DeliverMessageContext
  */
 void
 GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
-                                 const struct GNUNET_MessageHeader *msg,
-                                 const struct GNUNET_ATS_Information *atsi,
-                                 uint32_t atsi_count)
+                                 const struct GNUNET_MessageHeader *msg)
 {
   const struct EncryptedMessage *m;
   struct EncryptedMessage *pt;  /* plaintext */
@@ -1425,9 +1413,7 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
   GNUNET_STATISTICS_update (GSC_stats,
                             gettext_noop ("# bytes of payload decrypted"),
                             size - sizeof (struct EncryptedMessage), GNUNET_NO);
-  dmc.atsi = atsi;
   dmc.kx = kx;
-  dmc.atsi_count = atsi_count;
   dmc.peer = &kx->peer;
   if (GNUNET_OK !=
       GNUNET_SERVER_mst_receive (mst, &dmc,
@@ -1467,10 +1453,10 @@ deliver_message (void *cls, void *client, const struct GNUNET_MessageHeader *m)
     GSC_SESSIONS_set_typemap (dmc->peer, m);
     return GNUNET_OK;
   default:
-    GSC_CLIENTS_deliver_message (dmc->peer, dmc->atsi, dmc->atsi_count, m,
+    GSC_CLIENTS_deliver_message (dmc->peer, m,
                                  ntohs (m->size),
                                  GNUNET_CORE_OPTION_SEND_FULL_INBOUND);
-    GSC_CLIENTS_deliver_message (dmc->peer, dmc->atsi, dmc->atsi_count, m,
+    GSC_CLIENTS_deliver_message (dmc->peer, m,
                                  sizeof (struct GNUNET_MessageHeader),
                                  GNUNET_CORE_OPTION_SEND_HDR_INBOUND);
   }
index 6e6d30d8d1fc30ea03ae07b5c2b6177115d0b816..5d4d638b5475813d46d2ca7d93be7f03a8e3c8e7 100644 (file)
@@ -94,9 +94,7 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
  */
 void
 GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
-                                 const struct GNUNET_MessageHeader *msg,
-                                 const struct GNUNET_ATS_Information *atsi,
-                                 uint32_t atsi_count);
+                                 const struct GNUNET_MessageHeader *msg);
 
 
 /**
index 38edf8e1a034134bd7508004aa2bb44a47267697..b4c1370dafadd0fe8a081cf4ec43a99b95d74af3 100644 (file)
@@ -373,9 +373,7 @@ handle_transport_notify_disconnect (void *cls,
  */
 static void
 handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
-                          const struct GNUNET_MessageHeader *message,
-                          const struct GNUNET_ATS_Information *atsi,
-                          uint32_t atsi_count)
+                          const struct GNUNET_MessageHeader *message)
 {
   struct Neighbour *n;
   uint16_t type;
@@ -408,7 +406,7 @@ handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
     GSC_KX_handle_pong (n->kxinfo, message);
     break;
   case GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE:
-    GSC_KX_handle_encrypted_message (n->kxinfo, message, atsi, atsi_count);
+    GSC_KX_handle_encrypted_message (n->kxinfo, message);
     break;
   case GNUNET_MESSAGE_TYPE_DUMMY:
     /*  Dummy messages for testing / benchmarking, just discard */
index 7316f4b25879f072fad390d427de79feb019b699..bf27d56007bbdd4643fa31b019516c8acf210428 100644 (file)
@@ -662,8 +662,6 @@ queue_connect_message (void *cls, const struct GNUNET_HashCode * key, void *valu
   /* 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;
   GNUNET_SERVER_transmit_context_append_message (tc, &cnm.header);
   return GNUNET_OK;