static GNUNET_SCHEDULER_TaskIdentifier t6;
/**
- * DNS suffix
+ * DNS suffix, suffix of this gateway in DNS; defaults to '.zkey.eu'
*/
static char *dns_suffix;
/**
- * FCFS suffix
+ * FCFS suffix, suffix of FCFS-authority in DNS; defaults to 'fcfs.zkey.eu'.
*/
static char *fcfs_suffix;
GNUNET_DNSPARSER_free_packet (request->packet);
if (NULL != request->lookup)
GNUNET_GNS_cancel_lookup_request (request->lookup);
+ if (NULL != request->dns_lookup)
+ GNUNET_DNSSTUB_resolve_cancel (request->dns_lookup);
GNUNET_free (request);
}
+
/**
* Iterator called on obtained result for a DNS
* lookup
size_t r)
{
struct Request *request = cls;
+
request->packet = GNUNET_DNSPARSER_parse ((char*)dns, r);
send_response (request);
}
+
/**
* Iterator called on obtained result for a GNS
* lookup
//packet->flags.opcode = GNUNET_DNSPARSER_OPCODE_STATUS; // ???
for (i=0;i<rd_count;i++)
{
+ rec.expiration_time.abs_value = rd[i].expiration_time;
switch (rd[i].record_type)
{
case GNUNET_DNSPARSER_TYPE_A:
struct Request *request;
struct GNUNET_DNSPARSER_Packet *packet;
char *name;
+ char *dot;
+ char *nname;
size_t name_len;
enum GNUNET_GNS_RecordType type;
int use_gns;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
packet = GNUNET_DNSPARSER_parse (udp_msg, udp_msg_size);
if (NULL == packet)
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received request with flags %u, #answers %d, #auth %d, #additional %d\n",
+ "Received request for `%s' with flags %u, #answers %d, #auth %d, #additional %d\n",
+ packet->queries[0].name,
(unsigned int) packet->flags.query_or_response,
(int) packet->num_answers,
(int) packet->num_authority_records,
(0 == strcasecmp (dns_suffix,
&name[name_len - strlen (dns_suffix)])) )
{
- if ( (name_len > strlen (fcfs_suffix)) &&
- (0 == strcasecmp (fcfs_suffix,
- &name[name_len - strlen (fcfs_suffix)])) )
+ /* Test if '.zkey' was requested */
+ name[name_len - strlen (dns_suffix)] = '\0';
+ dot = strrchr (name, (int) '.');
+ if ( (NULL != dot) &&
+ (GNUNET_OK ==
+ GNUNET_CRYPTO_short_hash_from_string (dot + 1, &zone)) )
{
- name[name_len - strlen (fcfs_suffix) + 1] = '\0';
- strcat (name, GNUNET_GNS_TLD);
+ /* valid '.zkey' name */
+ GNUNET_asprintf (&nname,
+ "%s.%s",
+ name,
+ GNUNET_GNS_TLD_ZKEY);
+ GNUNET_free (name);
+ name = nname;
}
else
- {
- name[name_len - strlen (dns_suffix) + 1] = '\0';
- strcat (name, GNUNET_GNS_TLD_ZKEY);
+ {
+ /* try '.gads' name */
+ GNUNET_asprintf (&nname,
+ "%s.%s",
+ name,
+ GNUNET_GNS_TLD);
+ GNUNET_free (name);
+ name = nname;
}
name_len = strlen (name);
}
- if ( (name_len > strlen ((GNUNET_GNS_TLD) + 1)) &&
+ if ( (name_len >= strlen ((GNUNET_GNS_TLD))) &&
(0 == strcasecmp (GNUNET_GNS_TLD,
&name[name_len - strlen (GNUNET_GNS_TLD)])) )
use_gns = GNUNET_YES;
}
else
{
- /* FIXME: do traditional *DNS* lookup; note that
- gnunet-service-dns already has code to do this;
- factor into library to share! Why not use GNUNET_RESOLVER here?*/
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Calling DNS at %s\n", dns_ip);
GNUNET_DNSPARSER_free_packet (request->packet);
+ request->packet = NULL;
request->dns_lookup = GNUNET_DNSSTUB_resolve2 (dns_stub,
udp_msg,
udp_msg_size,
&dns_result_processor,
request);
-
-
-
}
GNUNET_free (name);
}