address.address = plugin_address;
address.address_length = plugin_address_length;
address.transport_name = plugin_name;
+ address.local_info = ntohl(m->address_local_info);
if ((s == NULL) && (0 == address.address_length))
{
return;
}
- sh->suggest_cb (sh->suggest_cb_cls, &address, s, m->bandwidth_out,
+ sh->suggest_cb (sh->suggest_cb_cls,
+ (const struct GNUNET_PeerIdentity *) &m->peer,
+ &address, s, m->bandwidth_out,
m->bandwidth_in, atsi, ats_count);
GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh,
}
/**
- * We would like to establish a new connection with a peer. ATS
- * should suggest a good address to begin with.
+ * We would like to receive address suggestions for a peer. ATS will
+ * respond with a call to the continuation immediately containing an address or
+ * no address if none is available. ATS can suggest more addresses until we call
+ * #GNUNET_ATS_suggest_address_cancel.
+ *
*
* @param sh handle
* @param peer identity of the peer we need an address for
+ * @param cont the continuation to call with the address
+ * @param cont_cls the cls for the continuation
* @return suggest handle
*/
struct GNUNET_ATS_SuggestHandle *
GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh,
- const struct GNUNET_PeerIdentity *peer)
+ const struct GNUNET_PeerIdentity *peer,
+ GNUNET_ATS_AddressSuggestionCallback cont,
+ void *cont_cls)
{
struct PendingMessage *p;
struct RequestAddressMessage *m;
return GNUNET_SYSERR;
}
- namelen =
- (address->transport_name ==
- NULL) ? 0 : strlen (address->transport_name) + 1;
- msize =
- sizeof (struct AddressUpdateMessage) + address->address_length +
+ namelen = (address->transport_name == NULL) ? 0 : strlen (address->transport_name) + 1;
+
+ msize = sizeof (struct AddressUpdateMessage) + address->address_length +
ats_count * sizeof (struct GNUNET_ATS_Information) + namelen;
if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
(address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
m->ats_count = htonl (ats_count);
m->peer = address->peer;
m->address_length = htons (address->address_length);
+ m->address_local_info = htonl ((uint32_t) address->local_info);
m->plugin_name_length = htons (namelen);
m->session_id = htonl (s);
m->ats_count = htonl (ats_count);
m->peer = address->peer;
m->address_length = htons (address->address_length);
+ m->address_local_info = htonl ((uint32_t) address->local_info);
m->plugin_name_length = htons (namelen);
m->session_id = htonl (s);
m->peer = address->peer;
m->in_use = htons (in_use);
m->address_length = htons (address->address_length);
+ m->address_local_info = htonl ((uint32_t) address->local_info);
m->plugin_name_length = htons (namelen);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
/**
- * A session got destroyed, stop including it as a valid address.
+ * An address got destroyed, stop including it as a valid address.
+ *
+ * If a session is given, only the session will be removed, if no session is
+ * given the full address will be deleted.
*
* @param sh handle
* @param address the address
m->reserved = htonl (0);
m->peer = address->peer;
m->address_length = htons (address->address_length);
+ m->address_local_info = htonl ((uint32_t) address->local_info);
m->plugin_name_length = htons (namelen);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,