gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22186 - gnunet/src/dns


From: gnunet
Subject: [GNUnet-SVN] r22186 - gnunet/src/dns
Date: Thu, 21 Jun 2012 15:38:31 +0200

Author: grothoff
Date: 2012-06-21 15:38:31 +0200 (Thu, 21 Jun 2012)
New Revision: 22186

Modified:
   gnunet/src/dns/dnsparser.c
   gnunet/src/dns/gnunet-dns-monitor.c
Log:
-finishing SRV implementation (#2268)

Modified: gnunet/src/dns/dnsparser.c
===================================================================
--- gnunet/src/dns/dnsparser.c  2012-06-21 13:35:26 UTC (rev 22185)
+++ gnunet/src/dns/dnsparser.c  2012-06-21 13:38:31 UTC (rev 22186)
@@ -397,9 +397,9 @@
       return GNUNET_SYSERR;
     return GNUNET_OK;
   case GNUNET_DNSPARSER_TYPE_SRV:
-    if ('_' != *r->data.hostname)
+    if ('_' != *r->name)
       return GNUNET_SYSERR; /* all valid srv names must start with "_" */
-    if (NULL == strstr (r->data.hostname, "._"))
+    if (NULL == strstr (r->name, "._"))
       return GNUNET_SYSERR; /* necessary string from "._$PROTO" not present */
     old_off = *off;
     if (*off + sizeof (struct srv_data) > udp_payload_length)
@@ -412,7 +412,7 @@
     r->data.srv->port = ntohs (srv.port);
     /* parse 'data.hostname' into components, which are
        "_$SERVICE._$PROTO.$DOMAIN_NAME" */
-    ndup = GNUNET_strdup (r->data.hostname);
+    ndup = GNUNET_strdup (r->name);
     tok = strtok (ndup, ".");
     GNUNET_assert ('_' == *tok);
     r->data.srv->service = GNUNET_strdup (&tok[1]);

Modified: gnunet/src/dns/gnunet-dns-monitor.c
===================================================================
--- gnunet/src/dns/gnunet-dns-monitor.c 2012-06-21 13:35:26 UTC (rev 22185)
+++ gnunet/src/dns/gnunet-dns-monitor.c 2012-06-21 13:38:31 UTC (rev 22186)
@@ -75,6 +75,7 @@
   case GNUNET_DNSPARSER_TYPE_MX: return "MX";
   case GNUNET_DNSPARSER_TYPE_TXT: return "TXT";
   case GNUNET_DNSPARSER_TYPE_AAAA: return "AAAA";
+  case GNUNET_DNSPARSER_TYPE_SRV: return "SRV";
   }
   GNUNET_snprintf (buf, sizeof (buf), "%u", (unsigned int) type);
   return buf;
@@ -151,7 +152,7 @@
     format = record->data.hostname;
     break;
   case GNUNET_DNSPARSER_TYPE_SOA:
-    if (record->data.soa == NULL)
+    if (NULL == record->data.soa)
       format = "<invalid>";
     else
     {
@@ -179,6 +180,23 @@
       format = tmp;
     }
     break;
+  case GNUNET_DNSPARSER_TYPE_SRV:
+    if (NULL == record->data.srv)
+      format = "<invalid>";
+    else
+    {
+      GNUNET_asprintf (&tmp,
+                      "service: %s, protocol: %s, domain_name = %s, priority 
%u, weight = %s, port = %u, target = %s",
+                      record->data.srv->service,
+                      record->data.srv->proto,
+                      record->data.srv->domain_name,
+                      (unsigned int) record->data.srv->priority,
+                      (unsigned int) record->data.srv->weight,
+                      (unsigned int) record->data.srv->port,
+                      record->data.srv->target);
+      format = tmp;
+    }
+    break;
   case GNUNET_DNSPARSER_TYPE_TXT:
     GNUNET_asprintf (&tmp,
                     "%.*s",




reply via email to

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