/*
This file is part of GNUnet.
(C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/**
* @file gns/gnunet-service-gns.c
* @brief GNUnet GNS service
* @author Martin Schanzenbach
*/
#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_namestore_service.h"
#include "gnunet_gns_service.h"
#include "gnunet_statistics_service.h"
#include "block_gns.h"
#include "gns.h"
#include "gns_common.h"
#include "gnunet-service-gns_resolver.h"
#include "gnunet-service-gns_interceptor.h"
#include "gnunet_protocols.h"
/**
* The initial interval in milliseconds btween puts in
* a zone iteration
*/
#define INITIAL_PUT_INTERVAL GNUNET_TIME_UNIT_MILLISECONDS
/**
* The upper bound for the zone iteration interval in milliseconds
*/
#define MINIMUM_ZONE_ITERATION_INTERVAL GNUNET_TIME_UNIT_SECONDS
/**
* The default put interval for the zone iteration. In case
* No option is found
*/
#define DEFAULT_ZONE_PUBLISH_TIME_WINDOW GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
/**
* The factor the current zone iteration interval is divided by for each
* additional new record
*/
#define LATE_ITERATION_SPEEDUP_FACTOR 2
/**
* Handle to a shorten operation from api
*/
struct ClientShortenHandle
{
/**
* List for all shorten requests
*/
struct ClientShortenHandle *next;
/**
* List for all shorten requests
*/
struct ClientShortenHandle *prev;
/**
* Handle to the requesting client
*/
struct GNUNET_SERVER_Client *client;
/**
* Namestore lookup task
*/
struct GNUNET_NAMESTORE_QueueEntry *namestore_task;
/**
* master zone
*/
struct GNUNET_CRYPTO_ShortHashCode root_zone;
/**
* private zone
*/
struct GNUNET_CRYPTO_ShortHashCode private_zone;
/**
* shorten zone
*/
struct GNUNET_CRYPTO_ShortHashCode shorten_zone;
/**
* The request id
*/
uint32_t request_id;
/**
* request type
*/
enum GNUNET_GNS_RecordType type;
/**
* name to shorten
*/
char name[GNUNET_DNSPARSER_MAX_NAME_LENGTH];
/**
* name of private zone (relative to root)
*/
char private_zone_id[GNUNET_DNSPARSER_MAX_NAME_LENGTH];
/**
* name of shorten zone (relative to root)
*/
char shorten_zone_id[GNUNET_DNSPARSER_MAX_NAME_LENGTH];
};
/**
* Handle to a get authority operation from api
*/
struct ClientGetAuthHandle
{
/**
* Handle to the requesting client
*/
struct GNUNET_SERVER_Client *client;
/**
* name to lookup authority
*/
char *name;
/**
* request id
*/
uint32_t request_id;
};
/**
* Handle to a lookup operation from api
*/
struct ClientLookupHandle
{
/**
* Handle to the requesting client
*/
struct GNUNET_SERVER_Client *client;
/**
* optional zone private key used for shorten
*/
struct GNUNET_CRYPTO_RsaPrivateKey *shorten_key;
/**
* the name to look up
*/
char *name;