*/
/**
* @file gns/gnunet-service-gns.c
- * @brief GNUnet GNS service
+ * @brief GNU Name System (main service)
* @author Martin Schanzenbach
* @author Christian Grothoff
- *
- * TODO:
- * - perform conversion of relative expiration times to absolute time
- * when going to DHT!
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_transport_service.h"
#include "gnunet_dns_service.h"
#include "gnunet_dnsparser_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_gns_service.h"
#include "gnunet_statistics_service.h"
#include "gns.h"
-#include "gns_common.h"
#include "gnunet-service-gns_resolver.h"
+#include "gnunet-service-gns_shorten.h"
#include "gnunet-service-gns_interceptor.h"
#include "gnunet_protocols.h"
GNS_interceptor_done ();
GNS_resolver_done ();
+ GNS_shorten_done ();
if (NULL != statistics)
{
GNUNET_STATISTICS_destroy (statistics, GNUNET_NO);
{
struct GNUNET_TIME_Relative next_put_interval;
+ active_put = NULL;
num_public_records++;
if ( (num_public_records > last_num_public_records) &&
(GNUNET_NO == first_zone_iteration) )
struct GNUNET_NAMESTORE_Block *block;
struct GNUNET_HashCode query;
struct GNUNET_TIME_Absolute expire;
+ struct GNUNET_TIME_Absolute now;
size_t block_size;
struct GNUNET_NAMESTORE_RecordData rd_public[rd_count];
unsigned int rd_public_count;
return;
}
- /* filter out records that are not public! */
+ /* filter out records that are not public, and convert to
+ absolute expiration time. */
rd_public_count = 0;
+ now = GNUNET_TIME_absolute_get ();
for (i=0;i<rd_count;i++)
if (0 == (rd[i].flags & (GNUNET_NAMESTORE_RF_PRIVATE |
GNUNET_NAMESTORE_RF_PENDING)))
- rd_public[rd_public_count++] = rd[i];
-
+ {
+ rd_public[rd_public_count] = rd[i];
+ if (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
+ {
+ rd_public[rd_public_count].flags &= ~GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION;
+ rd_public[rd_public_count].expiration_time += now.abs_value_us;
+ }
+ rd_public_count++;
+ }
/* We got a set of records to publish */
if (0 == rd_public_count)
rd_public_count);
block_size = ntohl (block->purpose.size)
+ sizeof (struct GNUNET_CRYPTO_EccSignature)
- + sizeof (struct GNUNET_CRYPTO_EccPublicKey);
+ + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
GNUNET_NAMESTORE_query_from_private_key (key,
name,
&query);
* 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_count the number of records in @a rd
* @param rd the record data
*/
static void
GNUNET_SERVER_receive_done (clh->client,
GNUNET_OK);
GNUNET_CONTAINER_DLL_remove (clh_head, clh_tail, clh);
+ GNUNET_SERVER_client_set_user_context (clh->client, NULL);
GNUNET_free (clh);
GNUNET_STATISTICS_update (statistics,
"Completed lookups", 1,
{ &handle_lookup, NULL, GNUNET_MESSAGE_TYPE_GNS_LOOKUP, 0},
{NULL, NULL, 0, 0}
};
- struct GNUNET_CRYPTO_EccPublicKey dns_root;
+ struct GNUNET_CRYPTO_EccPublicSignKey dns_root;
unsigned long long max_parallel_bg_queries = 0;
char *dns_root_name;
&dns_root_name))
{
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (dns_root_name,
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (dns_root_name,
strlen (dns_root_name),
&dns_root))
{
return;
}
}
- /* FIXME: install client disconnect handle to clean up pending
- lookups on client disconnect! */
GNS_resolver_init (namestore_handle, dht_handle,
c,
max_parallel_bg_queries);
+ GNS_shorten_init (namestore_handle, dht_handle);
GNUNET_SERVER_disconnect_notify (server,
¬ify_client_disconnect,
NULL);