- compiler warning
[oweals/gnunet.git] / src / ats / gnunet-service-ats_addresses.c
index e961978137aecdec421c0e25c2d4422bdf4f6596..d587d832b3e9bbc22e0f9255e3e976f7a042f732 100644 (file)
@@ -14,8 +14,8 @@
 
  You should have received a copy of the GNU General Public License
  along with GNUnet; see the file COPYING.  If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
  */
 
 /**
@@ -58,9 +58,10 @@ update_addresses_stat ()
 static void
 free_address (struct ATS_Address *addr)
 {
-  GNUNET_CONTAINER_multipeermap_remove (GSA_addresses,
-                                        &addr->peer,
-                                        addr);
+  GNUNET_assert (GNUNET_YES ==
+                 GNUNET_CONTAINER_multipeermap_remove (GSA_addresses,
+                                                       &addr->peer,
+                                                       addr));
   update_addresses_stat ();
   GAS_plugin_delete_address (addr);
   GAS_performance_notify_all_clients (&addr->peer,
@@ -69,6 +70,7 @@ free_address (struct ATS_Address *addr)
                                       addr->addr_len,
                                       GNUNET_NO,
                                       NULL,
+                                      addr->local_address_info,
                                       GNUNET_BANDWIDTH_ZERO,
                                       GNUNET_BANDWIDTH_ZERO);
   GNUNET_free (addr->plugin);
@@ -255,6 +257,7 @@ GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
                                      new_address->addr_len,
                                      new_address->active,
                                      &new_address->properties,
+                                      new_address->local_address_info,
                                      GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_out),
                                      GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_in));
 }
@@ -302,6 +305,7 @@ GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
                                       aa->addr_len,
                                       aa->active,
                                       prop,
+                                      aa->local_address_info,
                                       GNUNET_BANDWIDTH_value_init (aa->assigned_bw_out),
                                       GNUNET_BANDWIDTH_value_init (aa->assigned_bw_in));
 
@@ -446,6 +450,7 @@ peerinfo_it (void *cls,
               addr->addr_len,
               addr->active,
               &addr->properties,
+              addr->local_address_info,
               GNUNET_BANDWIDTH_value_init (addr->assigned_bw_out),
               GNUNET_BANDWIDTH_value_init (addr->assigned_bw_in));
   return GNUNET_OK;
@@ -492,6 +497,7 @@ GAS_addresses_get_peer_info (const struct GNUNET_PeerIdentity *peer,
          NULL, NULL, NULL, 0,
          GNUNET_NO,
          NULL,
+         GNUNET_HELLO_ADDRESS_INFO_NONE,
          GNUNET_BANDWIDTH_ZERO,
          GNUNET_BANDWIDTH_ZERO);
 }
@@ -532,6 +538,7 @@ struct AddressIteration
  * @param plugin_addr_len length of @a plugin_addr
  * @param active #GNUNET_YES if this address is actively used
  * @param prop performance information
+ * @param local_address_info flags for the address
  * @param bandwidth_out current outbound bandwidth assigned to address
  * @param bandwidth_in current inbound bandwidth assigned to address
  */
@@ -543,6 +550,7 @@ transmit_req_addr (struct AddressIteration *ai,
                    size_t plugin_addr_len,
                    int active,
                    const struct GNUNET_ATS_Properties *prop,
+                   enum GNUNET_HELLO_AddressInfo local_address_info,
                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 
@@ -551,6 +559,7 @@ transmit_req_addr (struct AddressIteration *ai,
   char *addrp;
   size_t plugin_name_length;
   size_t msize;
+  struct GNUNET_SERVER_NotificationContext **uc;
   struct GNUNET_SERVER_NotificationContext *nc;
 
   if (NULL != plugin_name)
@@ -582,18 +591,20 @@ transmit_req_addr (struct AddressIteration *ai,
     memset (&msg->properties,
             0,
             sizeof (struct GNUNET_ATS_Properties));
+  msg->address_local_info = htonl ((uint32_t) local_address_info);
   addrp = (char *) &msg[1];
   if (NULL != plugin_addr)
     memcpy (addrp, plugin_addr, plugin_addr_len);
   if (NULL != plugin_name)
     strcpy (&addrp[plugin_addr_len], plugin_name);
-  nc = *GNUNET_SERVER_client_get_user_context (ai->client,
-                                               struct GNUNET_SERVER_NotificationContext *);
-  if (NULL == nc)
+  uc = GNUNET_SERVER_client_get_user_context (ai->client,
+                                              struct GNUNET_SERVER_NotificationContext *);
+  if (NULL == uc)
   {
     GNUNET_break (0);
     return;
   }
+  nc = *uc;
   GNUNET_SERVER_notification_context_unicast (nc,
                                               ai->client,
                                               &msg->header,
@@ -612,6 +623,7 @@ transmit_req_addr (struct AddressIteration *ai,
  * @param plugin_addr_len length of @a plugin_addr
  * @param active is address actively used
  * @param prop performance information
+ * @param local_address_info additional local info for the address
  * @param bandwidth_out current outbound bandwidth assigned to address
  * @param bandwidth_in current inbound bandwidth assigned to address
  */
@@ -623,6 +635,7 @@ req_addr_peerinfo_it (void *cls,
                       size_t plugin_addr_len,
                       int active,
                       const struct GNUNET_ATS_Properties *prop,
+                      enum GNUNET_HELLO_AddressInfo local_address_info,
                       struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
                       struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 {
@@ -654,6 +667,7 @@ req_addr_peerinfo_it (void *cls,
                      plugin_addr, plugin_addr_len,
                      active,
                      prop,
+                     local_address_info,
                      bandwidth_out,
                      bandwidth_in);
 }
@@ -708,6 +722,7 @@ GAS_handle_request_address_list (void *cls,
                      NULL, NULL, NULL,
                      0, GNUNET_NO,
                      NULL,
+                     GNUNET_HELLO_ADDRESS_INFO_NONE,
                      GNUNET_BANDWIDTH_ZERO,
                      GNUNET_BANDWIDTH_ZERO);
   GNUNET_SERVER_receive_done (client,