+ * Notify ATS about the new address including the network this address is
+ * located in. The address must NOT be inbound and must be new to ATS.
+ *
+ * @param address the address
+ * @param prop performance information
+ */
+void
+GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
+ const struct GNUNET_ATS_Properties *prop)
+{
+ struct GNUNET_ATS_AddressRecord *ar;
+ struct AddressInfo *ai;
+
+ if (0 ==
+ memcmp (&GST_my_identity,
+ &address->peer,
+ sizeof (struct GNUNET_PeerIdentity)))
+ return; /* our own, ignore! */
+ /* validadte address */
+ if (NULL == address->transport_name)
+ {
+ GNUNET_break(0);
+ return;
+ }
+ GNUNET_assert (GNUNET_YES !=
+ GNUNET_HELLO_address_check_option (address,
+ GNUNET_HELLO_ADDRESS_INFO_INBOUND));
+ ai = find_ai_no_session (address);
+ GNUNET_assert (NULL == ai);
+ GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != prop->scope);
+
+ /* address seems sane, let's tell ATS */
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ "Notifying ATS about peer %s's new address `%s'\n",
+ GNUNET_i2s (&address->peer),
+ GST_plugins_a2s (address));
+ ar = GNUNET_ATS_address_add (GST_ats,
+ address,
+ NULL,
+ prop);
+ GNUNET_assert (NULL != ar);
+ ai = GNUNET_new (struct AddressInfo);
+ ai->address = GNUNET_HELLO_address_copy (address);
+ ai->ar = ar;
+ ai->properties = *prop;
+ (void) GNUNET_CONTAINER_multipeermap_put (p2a,
+ &ai->address->peer,
+ ai,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+ publish_p2a_stat_update ();
+}
+
+
+/**
+ * Notify ATS about a new @a session now existing for the given
+ * @a address. Essentially, an outbound @a address was used
+ * to establish a @a session. It is safe to call this function
+ * repeatedly for the same @a address and @a session pair.