gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28841 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r28841 - gnunet/src/gns
Date: Sat, 24 Aug 2013 11:26:15 +0200

Author: grothoff
Date: 2013-08-24 11:26:15 +0200 (Sat, 24 Aug 2013)
New Revision: 28841

Modified:
   gnunet/src/gns/gnunet-service-gns_resolver.c
Log:
-convert additional record types

Modified: gnunet/src/gns/gnunet-service-gns_resolver.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.c        2013-08-24 09:25:26 UTC 
(rev 28840)
+++ gnunet/src/gns/gnunet-service-gns_resolver.c        2013-08-24 09:26:15 UTC 
(rev 28841)
@@ -527,131 +527,6 @@
 }
 
 
-/**
- * finish lookup
- */
-static void
-finish_lookup (struct ResolverHandle *rh,
-               struct RecordLookupHandle* rlh,
-               unsigned int rd_count,
-               const struct GNUNET_NAMESTORE_RecordData *rd)
-{
-  unsigned int i;
-  char new_rr_data[GNUNET_DNSPARSER_MAX_NAME_LENGTH];
-  char new_mx_data[MAX_MX_LENGTH];
-  char new_soa_data[MAX_SOA_LENGTH];
-  char new_srv_data[MAX_SRV_LENGTH];
-  struct GNUNET_TUN_DnsSrvRecord *old_srv;
-  struct GNUNET_TUN_DnsSrvRecord *new_srv;
-  struct GNUNET_TUN_DnsSoaRecord *old_soa;
-  struct GNUNET_TUN_DnsSoaRecord *new_soa;
-  struct GNUNET_NAMESTORE_RecordData p_rd[rd_count];
-  char* repl_string;
-  char* pos;
-  unsigned int offset;
-
-  if (GNUNET_SCHEDULER_NO_TASK != rh->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel(rh->timeout_task);
-    rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
-  }
-
-  GNUNET_CONTAINER_DLL_remove (rlh_head, rlh_tail, rh);
-
-  if (0 < rd_count)
-    memcpy(p_rd, rd, rd_count*sizeof(struct GNUNET_NAMESTORE_RecordData));
-
-  for (i = 0; i < rd_count; i++)
-  {
-    
-    if ((GNUNET_DNSPARSER_TYPE_NS != rd[i].record_type) &&
-        (GNUNET_DNSPARSER_TYPE_PTR != rd[i].record_type) &&
-        (GNUNET_DNSPARSER_TYPE_CNAME != rd[i].record_type) &&
-        (GNUNET_DNSPARSER_TYPE_MX != rd[i].record_type) &&
-        (GNUNET_DNSPARSER_TYPE_SOA != rd[i].record_type) &&
-        (GNUNET_DNSPARSER_TYPE_SRV != rd[i].record_type))
-    {
-      p_rd[i].data = rd[i].data;
-      continue;
-    }
-
-    /**
-     * for all those records we 'should'
-     * also try to resolve the A/AAAA records (RFC1035)
-     * This is a feature and not important
-     */
-    
-    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-               "GNS_POSTPROCESS: Postprocessing\n");
-    if (0 == strcmp(rh->name, GNUNET_GNS_MASTERZONE_STR))
-      repl_string = rlh->name;
-    else
-      repl_string = rlh->name+strlen(rh->name)+1;
-
-    offset = 0;
-    if (GNUNET_DNSPARSER_TYPE_MX == rd[i].record_type)
-    {
-      memcpy (new_mx_data, (char*)rd[i].data, sizeof(uint16_t));
-      offset = sizeof (uint16_t);
-      pos = new_mx_data + offset;
-      // FIXME: how do we know that 'pos' has enough space for the new name?
-      expand_plus (pos, (char*)rd[i].data+sizeof(uint16_t),
-                  repl_string);
-      offset += strlen(new_mx_data+sizeof(uint16_t)) + 1;
-      p_rd[i].data = new_mx_data;
-      p_rd[i].data_size = offset;
-    }
-    else if (GNUNET_DNSPARSER_TYPE_SRV == rd[i].record_type)
-    {
-      /*
-       * Prio, weight and port
-       */
-      new_srv = (struct GNUNET_TUN_DnsSrvRecord*)new_srv_data;
-      old_srv = (struct GNUNET_TUN_DnsSrvRecord*)rd[i].data;
-      new_srv->prio = old_srv->prio;
-      new_srv->weight = old_srv->weight;
-      new_srv->port = old_srv->port;
-      // FIXME: how do we know that '&new_srv[1]' has enough space for the new 
name?
-      expand_plus((char*)&new_srv[1], (char*)&old_srv[1],
-                  repl_string);
-      p_rd[i].data = new_srv_data;
-      p_rd[i].data_size = sizeof (struct GNUNET_TUN_DnsSrvRecord) + strlen 
((char*)&new_srv[1]) + 1;
-    }
-    else if (GNUNET_DNSPARSER_TYPE_SOA == rd[i].record_type)
-    {
-      /* expand mname and rname */
-      old_soa = (struct GNUNET_TUN_DnsSoaRecord*)rd[i].data;
-      new_soa = (struct GNUNET_TUN_DnsSoaRecord*)new_soa_data;
-      memcpy (new_soa, old_soa, sizeof (struct GNUNET_TUN_DnsSoaRecord));
-      // FIXME: how do we know that 'new_soa[1]' has enough space for the new 
name?
-      expand_plus((char*)&new_soa[1], (char*)&old_soa[1], repl_string);
-      offset = strlen ((char*)&new_soa[1]) + 1;
-      // FIXME: how do we know that 'new_soa[1]' has enough space for the new 
name?
-      expand_plus((char*)&new_soa[1] + offset,
-                  (char*)&old_soa[1] + strlen ((char*)&old_soa[1]) + 1,
-                  repl_string);
-      p_rd[i].data_size = sizeof (struct GNUNET_TUN_DnsSoaRecord)
-                          + offset
-                          + strlen ((char*)&new_soa[1] + offset);
-      p_rd[i].data = new_soa_data;
-    }
-    else
-    {
-      pos = new_rr_data;
-      // FIXME: how do we know that 'rd[i].data' has enough space for the new 
name?
-      expand_plus(pos, (char*)rd[i].data, repl_string);
-      p_rd[i].data_size = strlen(new_rr_data)+1;
-      p_rd[i].data = new_rr_data;
-    }
-    
-  }
-
-  rlh->proc(rlh->proc_cls, rd_count, p_rd);
-  GNUNET_free(rlh);
-  free_resolver_handle (rh);
-}
-
-
 #endif
 
 
///////////////////////////////////////////////////////////////////////////////////////////////////




reply via email to

[Prev in Thread] Current Thread [Next in Thread]