- sh = NULL;
-}
-
-/**
- * We would like to reset the address suggestion block time for this
- * peer
- *
- * @param sh handle
- * @param peer identity of the peer we want to reset
- */
-void
-GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh,
- const struct GNUNET_PeerIdentity *peer)
-{
- struct PendingMessage *p;
- struct ResetBackoffMessage *m;
-
- p = GNUNET_malloc (sizeof (struct PendingMessage) +
- sizeof (struct ResetBackoffMessage));
- p->size = sizeof (struct ResetBackoffMessage);
- p->is_init = GNUNET_NO;
- m = (struct ResetBackoffMessage *) &p[1];
- m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF);
- m->header.size = htons (sizeof (struct ResetBackoffMessage));
- m->reserved = htonl (0);
- m->peer = *peer;
- GNUNET_CONTAINER_DLL_insert_tail (sh->pending_head, sh->pending_tail, p);
- do_transmit (sh);
-}
-
-/**
- * We would like to establish a new connection with a peer. ATS
- * should suggest a good address to begin with.
- *
- * @param sh handle
- * @param peer identity of the peer we need an address for
- * @return suggest handle
- */
-struct GNUNET_ATS_SuggestHandle *
-GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh,
- const struct GNUNET_PeerIdentity *peer)
-{
- struct PendingMessage *p;
- struct RequestAddressMessage *m;
- struct GNUNET_ATS_SuggestHandle *s;
-
- // FIXME: ATS needs to remember this in case of
- // a disconnect!
- p = GNUNET_malloc (sizeof (struct PendingMessage) +
- sizeof (struct RequestAddressMessage));
- p->size = sizeof (struct RequestAddressMessage);
- p->is_init = GNUNET_NO;
- m = (struct RequestAddressMessage *) &p[1];
- m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS);
- m->header.size = htons (sizeof (struct RequestAddressMessage));
- m->reserved = htonl (0);
- m->peer = *peer;
- GNUNET_CONTAINER_DLL_insert_tail (sh->pending_head, sh->pending_tail, p);
- do_transmit (sh);
- s = GNUNET_malloc (sizeof (struct GNUNET_ATS_SuggestHandle));
- s->id = (*peer);
- GNUNET_CONTAINER_DLL_insert_tail (sh->sug_head, sh->sug_tail, s);
- return s;
-}
-
-
-/**
- * We would like to stop receiving address updates for this peer
- *
- * @param sh handle
- * @param peer identity of the peer
- */
-void
-GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh,
- const struct GNUNET_PeerIdentity *peer)
-{
- struct PendingMessage *p;
- struct RequestAddressMessage *m;
- struct GNUNET_ATS_SuggestHandle *s;
-
- for (s = sh->sug_head; NULL != s; s = s->next)
- if (0 == memcmp(peer, &s->id, sizeof (s->id)))
- break;
- if (NULL == s)
- {
- GNUNET_break (0);
- return;
- }
- else
- {
- GNUNET_CONTAINER_DLL_remove (sh->sug_head, sh->sug_tail, s);
- GNUNET_free (s);
- }
-
- p = GNUNET_malloc (sizeof (struct PendingMessage) +
- sizeof (struct RequestAddressMessage));
- p->size = sizeof (struct RequestAddressMessage);
- p->is_init = GNUNET_NO;
- m = (struct RequestAddressMessage *) &p[1];
- m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL);
- m->header.size = htons (sizeof (struct RequestAddressMessage));
- m->reserved = htonl (0);
- m->peer = *peer;
- GNUNET_CONTAINER_DLL_insert_tail (sh->pending_head, sh->pending_tail, p);
- do_transmit (sh);