-
- cah->name = GNUNET_malloc (strlen (name)
- - strlen (GNUNET_GNS_TLD) + 1);
- memcpy (cah->name, name,
- strlen (name) - strlen (GNUNET_GNS_TLD));
-
- /* Start delegation resolution in our namestore */
- gns_resolver_get_authority (zone_hash, zone_hash, name,
- &send_get_auth_response, cah);
- GNUNET_STATISTICS_update (statistics,
- "Authority lookup attempts", 1, GNUNET_NO);
-}
-
-
-/**
- * Reply to client with the result from our lookup.
- *
- * @param cls the closure (our client lookup handle)
- * @param rd_count the number of records
- * @param rd the record data
- */
-static void
-send_lookup_response (void* cls,
- uint32_t rd_count,
- const struct GNUNET_NAMESTORE_RecordData *rd)
-{
- struct ClientLookupHandle* clh = cls;
- struct GNUNET_GNS_ClientLookupResultMessage *rmsg;
- size_t len;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message with %d results\n",
- "LOOKUP_RESULT", rd_count);
-
- len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
- rmsg = GNUNET_malloc (len + sizeof (struct GNUNET_GNS_ClientLookupResultMessage));
-
- rmsg->id = clh->request_id;
- rmsg->rd_count = htonl(rd_count);
- rmsg->header.type = htons(GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT);
- rmsg->header.size =
- htons(len+sizeof(struct GNUNET_GNS_ClientLookupResultMessage));
-
- GNUNET_NAMESTORE_records_serialize (rd_count, rd, len, (char*)&rmsg[1]);
-
- GNUNET_SERVER_notification_context_unicast (nc, clh->client,
- (const struct GNUNET_MessageHeader *) rmsg,
- GNUNET_NO);
- GNUNET_SERVER_receive_done (clh->client, GNUNET_OK);
-
- GNUNET_free(rmsg);
- GNUNET_free(clh->name);
-
- if (NULL != clh->shorten_key)
- GNUNET_CRYPTO_ecc_key_free (clh->shorten_key);
- GNUNET_free (clh);