-improve UDP logging
[oweals/gnunet.git] / src / ats / gnunet-service-ats_addresses.h
index f26eb779d7ab2261c3471707568a4f04dd8d994f..2be8277e15bea84f2025e2ac89f6bec3bbd174b9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  This file is part of GNUnet.
- (C) 2011-2014 Christian Grothoff (and other contributing authors)
Copyright (C) 2011-2014 Christian Grothoff (and other contributing authors)
 
  GNUnet is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published
@@ -30,8 +30,6 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_ats_service.h"
 #include "gnunet-service-ats.h"
-#include "gnunet_statistics_service.h"
-#include "ats.h"
 
 /**
  * NOTE: Do not change this documentation. This documentation is based on
@@ -257,57 +255,58 @@ struct GAS_NormalizationInfo
 struct ATS_Address
 {
   /**
-   * Next element in DLL
+   * Peer ID this address is for.
    */
-  struct ATS_Address *next;
+  struct GNUNET_PeerIdentity peer;
 
   /**
-   * Previous element in DLL
+   * Address (in plugin-specific binary format).
    */
-  struct ATS_Address *prev;
+  const void *addr;
 
   /**
-   * Peer ID
+   * Plugin name
    */
-  struct GNUNET_PeerIdentity peer;
+  char *plugin;
 
   /**
-   * Address
+   * Solver-specific information for this address
    */
-  const void *addr;
+  void *solver_information;
 
   /**
-   * Address length
+   * ATS performance information for this address
    */
-  size_t addr_len;
+  struct GNUNET_ATS_Information *atsi;
 
   /**
-   * Session ID, can never be 0.
+   * Time when address had last activity (update, in uses)
    */
-  uint32_t session_id;
+  struct GNUNET_TIME_Absolute t_last_activity;
 
   /**
-   * Field to store local flags
+   * Time when address was added
    */
-  uint32_t local_address_info;
+  struct GNUNET_TIME_Absolute t_added;
 
   /**
-   * Plugin name
+   * Address length, number of bytes in @e addr.
    */
-  char *plugin;
+  size_t addr_len;
 
   /**
-   * Solver specific information for this address
+   * Session ID, can never be 0.
    */
-  void *solver_information;
+  uint32_t session_id;
 
   /**
-   * ATS performance information for this address
+   * Field to store local flags.
+   * FIXME: `enum GNUNET_HELLO_AddressInfo`?
    */
-  struct GNUNET_ATS_Information *atsi;
+  uint32_t local_address_info;
 
   /**
-   * ATS performance information for this address
+   * ATS performance information for this address, size of the @e atsi array.
    */
   uint32_t atsi_count;
 
@@ -331,26 +330,11 @@ struct ATS_Address
    */
   uint32_t last_notified_bw_out;
 
-  /**
-   * Time when address had last activity (update, in uses)
-   */
-  struct GNUNET_TIME_Absolute t_last_activity;
-
-  /**
-   * Time when address was added
-   */
-  struct GNUNET_TIME_Absolute t_added;
-
   /**
    * Is this the active address for this peer?
    */
   int active;
 
-  /**
-   * Is this the address for this peer in use?
-   */
-  int used;
-
   /**
    * Normalized ATS performance information for this address
    * Each entry can be accessed using the GNUNET_ATS_QualityProperties avg_queue_index
@@ -360,18 +344,19 @@ struct ATS_Address
 
 
 /**
- * A multihashmap to store all addresses
+ * A multipeermap mapping peer identities to `struct ATS_Address`.
  */
 extern struct GNUNET_CONTAINER_MultiPeerMap *GSA_addresses;
 
 
-
 /**
  * Initialize address subsystem. The addresses subsystem manages the addresses
- * known and current performance information. 
+ * known and current performance information.
+ *
+ * @param server handle to our server
  */
 void
-GAS_addresses_init (void);
+GAS_addresses_init (struct GNUNET_SERVER_Handle *server);
 
 
 /**
@@ -387,7 +372,7 @@ GAS_addresses_done (void);
  * @param peer peer
  * @param plugin_name transport plugin name
  * @param plugin_addr plugin address
- * @param plugin_addr_len length of the plugin address
+ * @param plugin_addr_len length of the @a plugin_addr
  * @param local_address_info the local address for the address
  * @param session_id session id, can never be 0.
  * @param atsi performance information for this address
@@ -420,7 +405,7 @@ GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
 
 
 /**
- * Remove an address or just a session for a peer.
+ * Remove an address for a peer.
  *
  * @param peer peer
  * @param session_id session id, can never be 0
@@ -431,18 +416,16 @@ GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
 
 
 /**
- * Remove all addresses
+ * Remove all addresses.
  */
 void
 GAS_addresses_destroy_all (void);
 
 
-
-
 /**
  * Iterator for #GAS_addresses_get_peer_info()
  *
- * @param p_it_cls closure closure
+ * @param cls closure
  * @param id the peer id
  * @param plugin_name plugin name
  * @param plugin_addr address
@@ -454,7 +437,7 @@ GAS_addresses_destroy_all (void);
  * @param bandwidth_in current inbound bandwidth assigned to address
  */
 typedef void
-(*GNUNET_ATS_PeerInfo_Iterator) (void *p_it_cls,
+(*GNUNET_ATS_PeerInfo_Iterator) (void *cls,
                                  const struct GNUNET_PeerIdentity *id,
                                  const char *plugin_name,
                                  const void *plugin_addr,
@@ -478,6 +461,20 @@ GAS_addresses_get_peer_info (const struct GNUNET_PeerIdentity *peer,
                              GNUNET_ATS_PeerInfo_Iterator pi_it,
                              void *pi_it_cls);
 
+
+/**
+ * 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);
+
+
 #endif
 
 /* end of gnunet-service-ats_addresses.h */