- name = GNUNET_strdup (packet->queries[0].name);
- name_len = strlen (name);
- use_gns = GNUNET_NO;
- if ( (name_len > strlen (dns_suffix)) &&
- (0 == strcasecmp (dns_suffix,
- &name[name_len - strlen (dns_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)) )
- {
- /* valid '.zkey' name */
- GNUNET_asprintf (&nname,
- "%s.%s",
- name,
- GNUNET_GNS_TLD_ZKEY);
- GNUNET_free (name);
- name = nname;
- }
- else
- {
- /* 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))) &&
- (0 == strcasecmp (GNUNET_GNS_TLD,
- &name[name_len - strlen (GNUNET_GNS_TLD)])) )
- use_gns = GNUNET_YES;
-
- if ( (name_len > strlen (GNUNET_GNS_TLD_ZKEY)) &&
- (0 == strcasecmp (GNUNET_GNS_TLD_ZKEY,
- &name[name_len - strlen (GNUNET_GNS_TLD_ZKEY)])) )
- use_gns = GNUNET_YES;
-
- if (GNUNET_YES == use_gns)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Calling GNS\n");
- type = packet->queries[0].type;
- request->lookup = GNUNET_GNS_lookup (gns,
- name,
- &my_zone,
- type,
- GNUNET_NO,
- NULL /* no shorten */,
- &result_processor,
- request);
- }
- else
- {
- 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);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Calling GNS on `%s'\n",
+ packet->queries[0].name);
+ request->lookup = GNUNET_GNS_lookup_with_tld (gns,
+ packet->queries[0].name,
+ packet->queries[0].type,
+ GNUNET_NO,
+ &result_processor,
+ request);