gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r26538 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r26538 - gnunet/src/core
Date: Thu, 21 Mar 2013 14:31:13 +0100

Author: wachs
Date: 2013-03-21 14:31:13 +0100 (Thu, 21 Mar 2013)
New Revision: 26538

Modified:
   gnunet/src/core/core.h
   gnunet/src/core/core_api.c
   gnunet/src/core/core_api_is_connected.c
   gnunet/src/core/core_api_iterate_peers.c
   gnunet/src/core/gnunet-service-core_clients.c
   gnunet/src/core/gnunet-service-core_clients.h
   gnunet/src/core/gnunet-service-core_kx.c
   gnunet/src/core/gnunet-service-core_kx.h
   gnunet/src/core/gnunet-service-core_neighbours.c
   gnunet/src/core/gnunet-service-core_sessions.c
Log:
ats related changes in core


Modified: gnunet/src/core/core.h
===================================================================
--- gnunet/src/core/core.h      2013-03-21 13:30:51 UTC (rev 26537)
+++ gnunet/src/core/core.h      2013-03-21 13:31:13 UTC (rev 26538)
@@ -111,11 +111,6 @@
   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.
    */
   struct GNUNET_PeerIdentity peer;
@@ -211,20 +206,10 @@
   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 */
 };
 

Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c  2013-03-21 13:30:51 UTC (rev 26537)
+++ gnunet/src/core/core_api.c  2013-03-21 13:31:13 UTC (rev 26538)
@@ -739,7 +739,6 @@
   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 @@
   int trigger;
   uint16_t msize;
   uint16_t et;
-  uint32_t ats_count;
-
   if (NULL == msg)
   {
     LOG (GNUNET_ERROR_TYPE_INFO,
@@ -813,10 +810,8 @@
       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 @@
                    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 @@
       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 @@
        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 @@
       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 @@
       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))

Modified: gnunet/src/core/core_api_is_connected.c
===================================================================
--- gnunet/src/core/core_api_is_connected.c     2013-03-21 13:30:51 UTC (rev 
26537)
+++ gnunet/src/core/core_api_is_connected.c     2013-03-21 13:31:13 UTC (rev 
26538)
@@ -78,7 +78,6 @@
 {
   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 @@
     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 @@
     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);
 }

Modified: gnunet/src/core/core_api_iterate_peers.c
===================================================================
--- gnunet/src/core/core_api_iterate_peers.c    2013-03-21 13:30:51 UTC (rev 
26537)
+++ gnunet/src/core/core_api_iterate_peers.c    2013-03-21 13:31:13 UTC (rev 
26538)
@@ -70,7 +70,6 @@
 {
   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 @@
     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 @@
   /* 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);
 }

Modified: gnunet/src/core/gnunet-service-core_clients.c
===================================================================
--- gnunet/src/core/gnunet-service-core_clients.c       2013-03-21 13:30:51 UTC 
(rev 26537)
+++ gnunet/src/core/gnunet-service-core_clients.c       2013-03-21 13:31:13 UTC 
(rev 26538)
@@ -525,16 +525,16 @@
     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 @@
     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 @@
   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 @@
                                                       &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 @@
     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 @@
  */
 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 @@
     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));
 }

Modified: gnunet/src/core/gnunet-service-core_clients.h
===================================================================
--- gnunet/src/core/gnunet-service-core_clients.h       2013-03-21 13:30:51 UTC 
(rev 26537)
+++ gnunet/src/core/gnunet-service-core_clients.h       2013-03-21 13:31:13 UTC 
(rev 26538)
@@ -102,8 +102,6 @@
  */
 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);

Modified: gnunet/src/core/gnunet-service-core_kx.c
===================================================================
--- gnunet/src/core/gnunet-service-core_kx.c    2013-03-21 13:30:51 UTC (rev 
26537)
+++ gnunet/src/core/gnunet-service-core_kx.c    2013-03-21 13:31:13 UTC (rev 
26538)
@@ -1251,11 +1251,6 @@
 {
 
   /**
-   * Performance information for the connection.
-   */
-  const struct GNUNET_ATS_Information *atsi;
-
-  /**
    * Key exchange context.
    */
   struct GSC_KeyExchangeInfo *kx;
@@ -1264,11 +1259,6 @@
    * Sender of the message.
    */
   const struct GNUNET_PeerIdentity *peer;
-
-  /**
-   * Number of entries in 'atsi' array.
-   */
-  uint32_t atsi_count;
 };
 
 
@@ -1283,9 +1273,7 @@
  */
 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 @@
   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 @@
     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);
   }

Modified: gnunet/src/core/gnunet-service-core_kx.h
===================================================================
--- gnunet/src/core/gnunet-service-core_kx.h    2013-03-21 13:30:51 UTC (rev 
26537)
+++ gnunet/src/core/gnunet-service-core_kx.h    2013-03-21 13:31:13 UTC (rev 
26538)
@@ -94,9 +94,7 @@
  */
 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);
 
 
 /**

Modified: gnunet/src/core/gnunet-service-core_neighbours.c
===================================================================
--- gnunet/src/core/gnunet-service-core_neighbours.c    2013-03-21 13:30:51 UTC 
(rev 26537)
+++ gnunet/src/core/gnunet-service-core_neighbours.c    2013-03-21 13:31:13 UTC 
(rev 26538)
@@ -373,9 +373,7 @@
  */
 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 @@
     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 */

Modified: gnunet/src/core/gnunet-service-core_sessions.c
===================================================================
--- gnunet/src/core/gnunet-service-core_sessions.c      2013-03-21 13:30:51 UTC 
(rev 26537)
+++ gnunet/src/core/gnunet-service-core_sessions.c      2013-03-21 13:31:13 UTC 
(rev 26538)
@@ -662,8 +662,6 @@
   /* 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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]