- 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)])) )
- {
- /*
- * FIXME: Here we want to query fcfs. But what is fcfs in our
- * context?? -> we need a PKEY or name
- */
- if ( (name_len >= strlen (fcfs_suffix)) &&
- (0 == strcasecmp (fcfs_suffix,
- &name[name_len - strlen (fcfs_suffix)])) )
- {
- name[name_len - strlen (fcfs_suffix)] = '\0';
- if (0 == strcmp (name, ""))
- strcpy (name, GNUNET_GNS_TLD);
- else
- {
- if (sizeof (name) < (strlen (GNUNET_GNS_TLD)+strlen (name)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Name %s.%s is too long!\n",
- name,
- GNUNET_GNS_TLD);
- GNUNET_DNSPARSER_free_packet (request->packet);
- return;
- }
- sprintf (name, "%s.%s", name, GNUNET_GNS_TLD);
- }
- }
- else
- {
- name[name_len - strlen (dns_suffix)] = '\0';
- if (0 == strcmp (name, ""))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "No zkey given!\n");
- GNUNET_DNSPARSER_free_packet (request->packet);
- return;
- }
- if (sizeof (name) < (strlen (GNUNET_GNS_TLD_ZKEY)+strlen (name)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Name %s.%s is too long!\n",
- name,
- GNUNET_GNS_TLD);
- GNUNET_DNSPARSER_free_packet (request->packet);
- return;
- }
- sprintf (name, "%s.%s", name, GNUNET_GNS_TLD_ZKEY);
- }
- 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,
- type,
- GNUNET_NO,
- NULL,
- &result_processor,
- request);
- }
- 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->dns_lookup = GNUNET_DNSSTUB_resolve2 (dns_stub,
- udp_msg,
- udp_msg_size,
- &dns_result_processor,
- request);
-
-
-
- }
- GNUNET_free (name);