gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r25058 - in gnunet/src: ats ats-tool include


From: gnunet
Subject: [GNUnet-SVN] r25058 - in gnunet/src: ats ats-tool include
Date: Mon, 19 Nov 2012 17:30:11 +0100

Author: wachs
Date: 2012-11-19 17:30:11 +0100 (Mon, 19 Nov 2012)
New Revision: 25058

Modified:
   gnunet/src/ats-tool/gnunet-ats.c
   gnunet/src/ats/ats.h
   gnunet/src/ats/ats_api_performance.c
   gnunet/src/ats/gnunet-service-ats.c
   gnunet/src/ats/gnunet-service-ats_performance.c
   gnunet/src/ats/gnunet-service-ats_performance.h
   gnunet/src/include/gnunet_protocols.h
Log:
 changes ... more TBD

Modified: gnunet/src/ats/ats.h
===================================================================
--- gnunet/src/ats/ats.h        2012-11-19 15:54:08 UTC (rev 25057)
+++ gnunet/src/ats/ats.h        2012-11-19 16:30:11 UTC (rev 25058)
@@ -188,7 +188,16 @@
 
 };
 
+struct AddressListRequestMessage
+{
+  struct GNUNET_MessageHeader header;
 
+  int32_t all GNUNET_PACKED;
+
+  struct GNUNET_PeerIdentity peer;
+};
+
+
 struct ReservationRequestMessage
 {
   struct GNUNET_MessageHeader header;

Modified: gnunet/src/ats/ats_api_performance.c
===================================================================
--- gnunet/src/ats/ats_api_performance.c        2012-11-19 15:54:08 UTC (rev 
25057)
+++ gnunet/src/ats/ats_api_performance.c        2012-11-19 16:30:11 UTC (rev 
25058)
@@ -648,6 +648,8 @@
                                        void *infocb_cls)
 {
   struct GNUNET_ATS_AddressListHandle *alh;
+  struct PendingMessage *p;
+  struct AddressListRequestMessage *m;
 
   GNUNET_assert (NULL != handle);
 
@@ -666,8 +668,21 @@
 
   GNUNET_CONTAINER_DLL_insert (handle->addresslist_head, 
handle->addresslist_tail, alh);
 
-  /* TODO */
-  FPRINTF (stderr, "TBD");
+  p = GNUNET_malloc (sizeof (struct PendingMessage) +
+                     sizeof (struct AddressListRequestMessage));
+  p->size = sizeof (struct AddressListRequestMessage);
+  m = (struct AddressListRequestMessage *) &p[1];
+  m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST);
+  m->header.size = htons (sizeof (struct AddressListRequestMessage));
+  m->all = htonl (all);
+  if (NULL != peer)
+    m->peer = *peer;
+  else
+  {
+      memset (&m->peer, '\0', sizeof (struct GNUNET_PeerIdentity));
+  }
+  GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, 
handle->pending_tail, p);
+  do_transmit (handle);
 
   return alh;
 }

Modified: gnunet/src/ats/gnunet-service-ats.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats.c 2012-11-19 15:54:08 UTC (rev 25057)
+++ gnunet/src/ats/gnunet-service-ats.c 2012-11-19 16:30:11 UTC (rev 25058)
@@ -142,6 +142,9 @@
     {&GAS_handle_request_address_cancel, NULL,
      GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL,
      sizeof (struct RequestAddressMessage)},
+    {&GAS_handle_request_address_list, NULL,
+     GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST,
+     sizeof (struct AddressListRequestMessage)},
     {&GAS_handle_address_add, NULL,
      GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD, 0},
     {&GAS_handle_address_update, NULL,

Modified: gnunet/src/ats/gnunet-service-ats_performance.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.c     2012-11-19 15:54:08 UTC 
(rev 25057)
+++ gnunet/src/ats/gnunet-service-ats_performance.c     2012-11-19 16:30:11 UTC 
(rev 25058)
@@ -284,8 +284,28 @@
   GAS_addresses_iterate_peers (&peer_it, pc);
 }
 
+/**
+ * Handle 'address list request' messages from clients.
+ *
+ * @param cls unused, NULL
+ * @param client client that sent the request
+ * @param message the request message
+ */
+void
+GAS_handle_request_address_list (void *cls, struct GNUNET_SERVER_Client 
*client,
+                                 const struct GNUNET_MessageHeader *message)
+{
+  struct AddressListRequestMessage * alrm = cls;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
+              "ADDRESSLIST_REQUEST");
 
+
+
+}
+
+
+
 /**
  * Handle 'reservation request' messages from clients.
  *

Modified: gnunet/src/ats/gnunet-service-ats_performance.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.h     2012-11-19 15:54:08 UTC 
(rev 25057)
+++ gnunet/src/ats/gnunet-service-ats_performance.h     2012-11-19 16:30:11 UTC 
(rev 25058)
@@ -78,6 +78,17 @@
 
 
 /**
+ * Handle 'address list request' messages from clients.
+ *
+ * @param cls unused, NULL
+ * @param client client that sent the request
+ * @param message the request message
+ */
+void
+GAS_handle_request_address_list (void *cls, struct GNUNET_SERVER_Client 
*client,
+                                 const struct GNUNET_MessageHeader *message);
+
+/**
  * Handle 'reservation request' messages from clients.
  *
  * @param cls unused, NULL

Modified: gnunet/src/ats-tool/gnunet-ats.c
===================================================================
--- gnunet/src/ats-tool/gnunet-ats.c    2012-11-19 15:54:08 UTC (rev 25057)
+++ gnunet/src/ats-tool/gnunet-ats.c    2012-11-19 16:30:11 UTC (rev 25058)
@@ -178,31 +178,27 @@
 {
   struct PendingResolutions * pr;
 
-  pr = GNUNET_malloc (sizeof (struct PendingResolutions) +
-                      ats_count * sizeof (struct GNUNET_ATS_Information));
 
-  pr->ats_count = ats_count;
-  pr->ats = (struct GNUNET_ATS_Information *) &pr[1];
-  if (ats_count > 0)
-    memcpy (pr->ats, ats, ats_count * sizeof (struct GNUNET_ATS_Information));
-  pr->address = GNUNET_HELLO_address_copy (address);
-  pr->bandwidth_in = bandwidth_in;
-  pr->bandwidth_out = bandwidth_out;
-  pr->tats_ctx = GNUNET_TRANSPORT_address_to_string(cfg, address,
-                    resolve_addresses_numeric, GNUNET_TIME_UNIT_FOREVER_REL, 
transport_addr_to_str_cb, pr);
-  GNUNET_CONTAINER_DLL_insert (head, tail, pr);
-  results++;
+  if (NULL != address)
+  {
+    pr = GNUNET_malloc (sizeof (struct PendingResolutions) +
+                        ats_count * sizeof (struct GNUNET_ATS_Information));
+
+    pr->ats_count = ats_count;
+    pr->ats = (struct GNUNET_ATS_Information *) &pr[1];
+    if (ats_count > 0)
+      memcpy (pr->ats, ats, ats_count * sizeof (struct 
GNUNET_ATS_Information));
+    pr->address = GNUNET_HELLO_address_copy (address);
+    pr->bandwidth_in = bandwidth_in;
+    pr->bandwidth_out = bandwidth_out;
+    pr->tats_ctx = GNUNET_TRANSPORT_address_to_string(cfg, address,
+                      resolve_addresses_numeric, GNUNET_TIME_UNIT_FOREVER_REL, 
transport_addr_to_str_cb, pr);
+    GNUNET_CONTAINER_DLL_insert (head, tail, pr);
+    results++;
+  }
 }
 
-void la_cb (void *cls,
-            const struct GNUNET_HELLO_Address * address,
-            struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-            struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-            const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
-{
 
-}
-
 void end (void *cls,
           const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
@@ -289,7 +285,7 @@
 
         alh = GNUNET_ATS_performance_list_addresses (ph,
                                                (NULL == pid_str) ? NULL : &pid,
-                                               GNUNET_YES, la_cb, NULL);
+                                               GNUNET_YES, ats_perf_cb, NULL);
         if (NULL == alh)
         {
           fprintf (stderr, _("Cannot issue request to ATS service, 
exiting...\n"));
@@ -308,7 +304,7 @@
 
         alh = GNUNET_ATS_performance_list_addresses (ph,
                                                (NULL == pid_str) ? NULL : &pid,
-                                               GNUNET_NO, la_cb, NULL);
+                                               GNUNET_NO, ats_perf_cb, NULL);
         if (NULL == alh)
         {
           fprintf (stderr, _("Cannot issue request to ATS service, 
exiting...\n"));

Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h       2012-11-19 15:54:08 UTC (rev 
25057)
+++ gnunet/src/include/gnunet_protocols.h       2012-11-19 16:30:11 UTC (rev 
25058)
@@ -1100,6 +1100,18 @@
  */
 #define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD 353
 
+/**
+ * Type of the 'struct AddressListRequestMessage' sent by client to ATS
+ * to request information about addresses
+ */
+#define GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST 354
+
+/**
+ * Type of the 'struct AddressListResponseMessage' sent by ATS to client
+ * with information about addresses
+ */
+#define GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE 355
+
 
/*******************************************************************************
  * TRANSPORT message types
  
******************************************************************************/




reply via email to

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