gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17447 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r17447 - gnunet/src/ats
Date: Thu, 13 Oct 2011 16:09:02 +0200

Author: grothoff
Date: 2011-10-13 16:09:02 +0200 (Thu, 13 Oct 2011)
New Revision: 17447

Modified:
   gnunet/src/ats/ats_api_scheduling.c
Log:
parse updated message type

Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2011-10-13 14:08:51 UTC (rev 17446)
+++ gnunet/src/ats/ats_api_scheduling.c 2011-10-13 14:09:02 UTC (rev 17447)
@@ -277,9 +277,11 @@
 {
   struct GNUNET_ATS_SchedulingHandle *sh = cls;
   const struct AddressSuggestionMessage *m;
+  const struct GNUNET_TRANSPORT_ATS_Information *atsi;
   const char *address;
   const char *plugin_name;
   uint16_t address_length;
+  uint32_t ats_count;
 
   if (NULL == msg) 
   {
@@ -298,13 +300,16 @@
     return;
   }
   m = (const struct AddressSuggestionMessage*) msg;
-  address = (const char*) &m[1];
+  ats_count = ntohl (m->ats_count);
   address_length = ntohs (m->address_length);
+  atsi = (const struct GNUNET_TRANSPORT_ATS_Information*) &m[1];
+  address = (const char*) &atsi[ats_count];
   plugin_name = &address[address_length];
-  GNUNET_break (0 == ntohl (m->reserved));
   if ( (ntohs (m->address_length) +
        ntohs (m->plugin_name_length) +
+       ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) +
        sizeof (struct AddressSuggestionMessage) != ntohs (msg->size))  ||
+       (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct 
GNUNET_TRANSPORT_ATS_Information)) ||
        (plugin_name[ntohs (m->plugin_name_length) - 1] != '\0') )
   {
     GNUNET_break (0);
@@ -319,7 +324,9 @@
                  address, address_length,
                  find_session (sh, ntohl (m->session_id)),
                  m->bandwidth_out,
-                 m->bandwidth_in);
+                 m->bandwidth_in,
+                 atsi,
+                 ats_count);
   GNUNET_CLIENT_receive (sh->client,
                         &process_ats_message, sh,
                         GNUNET_TIME_UNIT_FOREVER_REL);




reply via email to

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