+
+ return GNUNET_OK;
+}
+
+/**
+ * Return all peers currently known to ATS
+ *
+ * @param p_it the iterator to call for every peer, callbach with id == NULL
+ * when done
+ * @param p_it_cls the closure for the iterator
+ */
+void
+GAS_addresses_iterate_peers (GNUNET_ATS_Peer_Iterator p_it, void *p_it_cls)
+{
+ struct PeerIteratorContext ip_ctx;
+ unsigned int size;
+
+ if (NULL == p_it)
+ return;
+ GNUNET_assert (NULL != handle->addresses);
+
+ size = GNUNET_CONTAINER_multihashmap_size(handle->addresses);
+ if (0 != size)
+ {
+ ip_ctx.it = p_it;
+ ip_ctx.it_cls = p_it_cls;
+ ip_ctx.peers_returned = GNUNET_CONTAINER_multihashmap_create (size, GNUNET_NO);
+ GNUNET_CONTAINER_multihashmap_iterate (handle->addresses, &peer_it, &ip_ctx);
+ GNUNET_CONTAINER_multihashmap_destroy (ip_ctx.peers_returned);
+ }
+ p_it (p_it_cls, NULL);
+}
+
+struct PeerInfoIteratorContext
+{
+ GNUNET_ATS_PeerInfo_Iterator it;
+ void *it_cls;
+};
+
+
+static int
+peerinfo_it (void *cls,
+ const struct GNUNET_HashCode * key,
+ void *value)
+{
+ struct PeerInfoIteratorContext *pi_ctx = cls;
+ struct ATS_Address *addr = (struct ATS_Address *) value;
+ struct GNUNET_ATS_Information *ats;
+ uint32_t ats_count;
+
+ if (NULL != pi_ctx->it)
+ {
+ ats_count = assemble_ats_information (addr, &ats);
+
+ pi_ctx->it (pi_ctx->it_cls,
+ &addr->peer,
+ addr->plugin,
+ addr->addr, addr->addr_len,
+ addr->active,
+ ats, ats_count,
+ addr->assigned_bw_out,
+ addr->assigned_bw_in);
+ GNUNET_free (ats);
+ }
+ return GNUNET_YES;
+}
+
+
+/**
+ * Return all peers currently known to ATS
+ *
+ * @param peer the respective peer
+ * @param pi_it the iterator to call for every peer
+ * @param pi_it_cls the closure for the iterator
+ */
+void
+GAS_addresses_get_peer_info (const struct GNUNET_PeerIdentity *peer, GNUNET_ATS_PeerInfo_Iterator pi_it, void *pi_it_cls)
+{
+ struct PeerInfoIteratorContext pi_ctx;
+ struct GNUNET_BANDWIDTH_Value32NBO zero_bw;
+ GNUNET_assert (NULL != peer);
+ GNUNET_assert (NULL != handle->addresses);
+ if (NULL == pi_it)
+ return; /* does not make sense without callback */
+
+ zero_bw = GNUNET_BANDWIDTH_value_init (0);
+ pi_ctx.it = pi_it;
+ pi_ctx.it_cls = pi_it_cls;
+
+ GNUNET_CONTAINER_multihashmap_get_multiple (handle->addresses, &peer->hashPubKey, &peerinfo_it, &pi_ctx);
+
+ if (NULL != pi_it)
+ pi_it (pi_it_cls, NULL, NULL, NULL, 0, GNUNET_NO, NULL, 0, zero_bw, zero_bw);