- if (client == NULL)
- return NULL;
- msg = GNUNET_malloc (len);
- msg->header.size = htons (len);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP);
- msg->numeric_only = htonl (numeric);
- msg->timeout = GNUNET_TIME_relative_hton (timeout);
- msg->addrlen = htonl (addressLen);
- addrbuf = (char *) &msg[1];
- memcpy (addrbuf, address, addressLen);
- memcpy (&addrbuf[addressLen], nameTrans, slen);
- alc = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_AddressLookupContext));
- alc->cb = aluc;
- alc->cb_cls = aluc_cls;
- alc->timeout = GNUNET_TIME_relative_to_absolute (timeout);
- alc->client = client;
+ if (client == NULL)
+ return NULL;
+ abs_timeout = GNUNET_TIME_relative_to_absolute (timeout);
+ msg.header.size = htons (sizeof (struct AddressIterateMessage));
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE);
+ msg.one_shot = htonl (one_shot);
+ msg.timeout = GNUNET_TIME_absolute_hton (abs_timeout);
+ if (peer == NULL)
+ memset (&msg.peer, 0, sizeof (struct GNUNET_PeerIdentity));
+ else
+ msg.peer = *peer;
+ pal_ctx = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PeerIterateContext));
+ pal_ctx->cb = peer_address_callback;
+ pal_ctx->cb_cls = peer_address_callback_cls;
+ pal_ctx->timeout = abs_timeout;
+ pal_ctx->client = client;