#include "gnunet_dns_service.h"
#include "gnunet_dnsparser_lib.h"
#include "gnunet_dht_service.h"
+#include "gnunet_namecache_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_gns_service.h"
#include "gnunet_statistics_service.h"
*/
static struct GNUNET_NAMESTORE_Handle *namestore_handle;
+/**
+ * Our handle to the namecache service
+ */
+static struct GNUNET_NAMECACHE_Handle *namecache_handle;
+
/**
* Handle to iterate over our authoritative zone in namestore
*/
GNUNET_NAMESTORE_disconnect (namestore_handle);
namestore_handle = NULL;
}
+ if (NULL != namecache_handle)
+ {
+ GNUNET_NAMECACHE_disconnect (namecache_handle);
+ namecache_handle = NULL;
+ }
if (NULL != active_put)
{
GNUNET_DHT_put_cancel (active_put);
*/
static void
put_gns_record (void *cls,
- const struct GNUNET_CRYPTO_EccPrivateKey *key,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
const char *name,
unsigned int rd_count,
- const struct GNUNET_NAMESTORE_RecordData *rd)
+ const struct GNUNET_GNSRECORD_Data *rd)
{
- struct GNUNET_NAMESTORE_Block *block;
+ struct GNUNET_GNSRECORD_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];
+ struct GNUNET_GNSRECORD_Data rd_public[rd_count];
unsigned int rd_public_count;
unsigned int i;
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)))
+ if (0 == (rd[i].flags & (GNUNET_GNSRECORD_RF_PRIVATE |
+ GNUNET_GNSRECORD_RF_PENDING)))
{
rd_public[rd_public_count] = rd[i];
- if (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
+ if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
{
- rd_public[rd_public_count].flags &= ~GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION;
+ rd_public[rd_public_count].flags &= ~GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
rd_public[rd_public_count].expiration_time += now.abs_value_us;
}
rd_public_count++;
NULL);
return;
}
- expire = GNUNET_NAMESTORE_record_get_expiration_time (rd_public_count,
+ expire = GNUNET_GNSRECORD_record_get_expiration_time (rd_public_count,
rd_public);
- block = GNUNET_NAMESTORE_block_create (key,
+ block = GNUNET_GNSRECORD_block_create (key,
expire,
name,
rd_public,
rd_public_count);
block_size = ntohl (block->purpose.size)
- + sizeof (struct GNUNET_CRYPTO_EccSignature)
- + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
- GNUNET_NAMESTORE_query_from_private_key (key,
+ + sizeof (struct GNUNET_CRYPTO_EcdsaSignature)
+ + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
+ GNUNET_GNSRECORD_query_from_private_key (key,
name,
&query);
static void
send_lookup_response (void* cls,
uint32_t rd_count,
- const struct GNUNET_NAMESTORE_RecordData *rd)
+ const struct GNUNET_GNSRECORD_Data *rd)
{
struct ClientLookupHandle *clh = cls;
struct GNUNET_GNS_ClientLookupResultMessage *rmsg;
"LOOKUP_RESULT",
rd_count);
- len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
+ len = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
rmsg = GNUNET_malloc (len + sizeof (struct GNUNET_GNS_ClientLookupResultMessage));
rmsg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT);
rmsg->header.size = htons (len + sizeof(struct GNUNET_GNS_ClientLookupResultMessage));
rmsg->id = clh->request_id;
rmsg->rd_count = htonl (rd_count);
- GNUNET_NAMESTORE_records_serialize (rd_count, rd, len,
+ GNUNET_GNSRECORD_records_serialize (rd_count, rd, len,
(char*) &rmsg[1]);
GNUNET_SERVER_notification_context_unicast (nc,
clh->client,
struct ClientLookupHandle *clh;
char *nameptr = name;
const char *utf_in;
- const struct GNUNET_CRYPTO_EccPrivateKey *key;
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *key;
uint16_t msg_size;
const struct GNUNET_GNS_ClientLookupMessage *sh_msg;
{ &handle_lookup, NULL, GNUNET_MESSAGE_TYPE_GNS_LOOKUP, 0},
{NULL, NULL, 0, 0}
};
- struct GNUNET_CRYPTO_EccPublicSignKey dns_root;
+ struct GNUNET_CRYPTO_EcdsaPublicKey dns_root;
unsigned long long max_parallel_bg_queries = 0;
char *dns_root_name;
GNUNET_SCHEDULER_shutdown ();
return;
}
+ namecache_handle = GNUNET_NAMECACHE_connect (c);
+ if (NULL == namecache_handle)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to connect to the namecache!\n"));
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
put_interval = INITIAL_PUT_INTERVAL;
zone_publish_time_window = DEFAULT_ZONE_PUBLISH_TIME_WINDOW;
&dns_root_name))
{
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_sign_key_from_string (dns_root_name,
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (dns_root_name,
strlen (dns_root_name),
&dns_root))
{
return;
}
}
- GNS_resolver_init (namestore_handle, dht_handle,
+ GNS_resolver_init (namestore_handle,
+ namecache_handle,
+ dht_handle,
c,
max_parallel_bg_queries);
- GNS_shorten_init (namestore_handle, dht_handle);
+ GNS_shorten_init (namestore_handle,
+ namecache_handle,
+ dht_handle);
GNUNET_SERVER_disconnect_notify (server,
¬ify_client_disconnect,
NULL);