removing remenants of abstract unix domain socket handling, this finishes addressing...
[oweals/gnunet.git] / src / gns / gnunet-gns-helper-service-w32.c
index a15b3547c170923536b7a6adb0aaca924eafd27e..26a3f688ab18dea75c3c7cb8ba415f51da89351e 100644 (file)
@@ -61,8 +61,8 @@ struct request
  */
 static struct GNUNET_GNS_Handle *gns;
 
-static struct GNUNET_CRYPTO_ShortHashCode *zone = NULL;
-static struct GNUNET_CRYPTO_ShortHashCode user_zone;
+static struct GNUNET_CRYPTO_EccPublicSignKey *zone = NULL;
+static struct GNUNET_HashCode user_zone;
 struct GNUNET_CRYPTO_EccPrivateKey *shorten_key = NULL;
 
 
@@ -172,7 +172,7 @@ transmit_callback (void *cls, size_t size, void *buf)
  * @param msg message to transmit, will be freed!
  */
 static void
-transmit (struct GNUNET_SERVER_Client *client, 
+transmit (struct GNUNET_SERVER_Client *client,
          struct GNUNET_MessageHeader *msg)
 {
   struct TransmitCallbackContext *tcc;
@@ -188,7 +188,7 @@ transmit (struct GNUNET_SERVER_Client *client,
   tcc->msg = msg;
   if (NULL ==
       (tcc->th =
-       GNUNET_SERVER_notify_transmit_ready (client, 
+       GNUNET_SERVER_notify_transmit_ready (client,
                                            ntohs (msg->size),
                                             GNUNET_TIME_UNIT_FOREVER_REL,
                                             &transmit_callback, tcc)))
@@ -242,7 +242,7 @@ MarshallWSAQUERYSETW (WSAQUERYSETW *qs, GUID *sc)
 
 
 static void
-process_ip_lookup_result (void* cls, 
+process_ip_lookup_result (void* cls,
                          uint32_t rd_count,
                          const struct GNUNET_NAMESTORE_RecordData *rd)
 {
@@ -282,13 +282,13 @@ process_ip_lookup_result (void* cls,
   {
     switch (rd[i].record_type)
     {
-    case GNUNET_GNS_RECORD_A:
+    case GNUNET_DNSPARSER_TYPE_A:
       if (rd[i].data_size != sizeof (struct in_addr))
         continue;
       size += sizeof (CSADDR_INFO) + sizeof (struct sockaddr_in) * 2;
       csanum++;
       break;
-    case GNUNET_GNS_RECORD_AAAA:
+    case GNUNET_DNSPARSER_TYPE_AAAA:
       if (rd[i].data_size != sizeof (struct in6_addr))
         continue;
       size += sizeof (CSADDR_INFO) + sizeof (struct sockaddr_in6) * 2;
@@ -305,13 +305,13 @@ process_ip_lookup_result (void* cls,
     blobsize += sizeof (void *); /* For addresses */
     for (i = 0; i < rd_count; i++)
     {
-      if ((rq->af == AF_INET || rq->af == AF_UNSPEC) && rd[i].record_type == GNUNET_GNS_RECORD_A)
+      if ((rq->af == AF_INET || rq->af == AF_UNSPEC) && rd[i].record_type == GNUNET_DNSPARSER_TYPE_A)
       {
         blobsize += sizeof (void *);
         blobsize += sizeof (struct in_addr);
         blobaddrcount++;
       }
-      else if (rq->af == AF_INET6 && rd[i].record_type == GNUNET_GNS_RECORD_AAAA)
+      else if (rq->af == AF_INET6 && rd[i].record_type == GNUNET_DNSPARSER_TYPE_AAAA)
       {
         blobsize += sizeof (void *);
         blobsize += sizeof (struct in6_addr);
@@ -367,7 +367,7 @@ process_ip_lookup_result (void* cls,
   {
     switch (rd[i].record_type)
     {
-    case GNUNET_GNS_RECORD_A:
+    case GNUNET_DNSPARSER_TYPE_A:
       if (rd[i].data_size != sizeof (struct in_addr))
         continue;
       qs->lpcsaBuffer[j].iSocketType = SOCK_STREAM;
@@ -389,7 +389,7 @@ process_ip_lookup_result (void* cls,
       size_recalc += sizeof (CSADDR_INFO) + sizeof (struct sockaddr_in) * 2;
       j++;
       break;
-    case GNUNET_GNS_RECORD_AAAA:
+    case GNUNET_DNSPARSER_TYPE_AAAA:
       if (rd[i].data_size != sizeof (struct in6_addr))
         continue;
       qs->lpcsaBuffer[j].iSocketType = SOCK_STREAM;
@@ -460,7 +460,7 @@ process_ip_lookup_result (void* cls,
     for (i = 0; i < rd_count; i++)
     {
       if ((rq->af == AF_INET || rq->af == AF_UNSPEC) &&
-          rd[i].record_type == GNUNET_GNS_RECORD_A)
+          rd[i].record_type == GNUNET_DNSPARSER_TYPE_A)
       {
         he->h_addr_list[j] = (char *) ptr;
         ptr += sizeof (struct in_addr);
@@ -471,7 +471,7 @@ process_ip_lookup_result (void* cls,
         memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in_addr));
         j++;
       }
-      else if (rq->af == AF_INET6 && rd[i].record_type == GNUNET_GNS_RECORD_AAAA)
+      else if (rq->af == AF_INET6 && rd[i].record_type == GNUNET_DNSPARSER_TYPE_AAAA)
       {
         he->h_addr_list[j] = (char *) ptr;
         ptr += sizeof (struct in6_addr);
@@ -512,25 +512,25 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client,
   uint32_t rtype;
 
   if (IsEqualGUID (&SVCID_DNS_TYPE_A, &sc))
-    rtype = GNUNET_GNS_RECORD_A;
+    rtype = GNUNET_DNSPARSER_TYPE_A;
   else if (IsEqualGUID (&SVCID_DNS_TYPE_NS, &sc))
-    rtype = GNUNET_GNS_RECORD_NS;
+    rtype = GNUNET_DNSPARSER_TYPE_NS;
   else if (IsEqualGUID (&SVCID_DNS_TYPE_CNAME, &sc))
-    rtype = GNUNET_GNS_RECORD_CNAME;
+    rtype = GNUNET_DNSPARSER_TYPE_CNAME;
   else if (IsEqualGUID (&SVCID_DNS_TYPE_SOA, &sc))
-    rtype = GNUNET_GNS_RECORD_SOA;
+    rtype = GNUNET_DNSPARSER_TYPE_SOA;
   else if (IsEqualGUID (&SVCID_DNS_TYPE_PTR, &sc))
-    rtype = GNUNET_GNS_RECORD_PTR;
+    rtype = GNUNET_DNSPARSER_TYPE_PTR;
   else if (IsEqualGUID (&SVCID_DNS_TYPE_MX, &sc))
-    rtype = GNUNET_GNS_RECORD_MX;
+    rtype = GNUNET_DNSPARSER_TYPE_MX;
   else if (IsEqualGUID (&SVCID_DNS_TYPE_TEXT, &sc))
-    rtype = GNUNET_GNS_RECORD_TXT;
+    rtype = GNUNET_DNSPARSER_TYPE_TXT;
   else if (IsEqualGUID (&SVCID_DNS_TYPE_AAAA, &sc))
-    rtype = GNUNET_GNS_RECORD_AAAA;
+    rtype = GNUNET_DNSPARSER_TYPE_AAAA;
   else if (IsEqualGUID (&SVCID_DNS_TYPE_SRV, &sc))
-    rtype = GNUNET_GNS_RECORD_SRV;
+    rtype = GNUNET_DNSPARSER_TYPE_SRV;
   else if (IsEqualGUID (&SVCID_INET_HOSTADDRBYNAME, &sc))
-    rtype = GNUNET_GNS_RECORD_A;
+    rtype = GNUNET_DNSPARSER_TYPE_A;
   else
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -547,7 +547,7 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client,
     namelen = 0;
   if (namelen > 0)
     hostname = (char *) u16_to_u8 (name, namelen + 1, NULL, &strl);
-  
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "W32 DNS resolver asked to look up %s for `%s'.\n",
               af == AF_INET ? "IPv4" : af == AF_INET6 ? "IPv6" : "anything",
@@ -569,7 +569,7 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client,
               "Launching a lookup for client %p with rq %p\n",
               client, rq);
 
-  if (NULL != GNUNET_GNS_lookup_zone (gns, hostname, zone, rtype,
+  if (NULL != GNUNET_GNS_lookup (gns, hostname, zone, rtype,
       GNUNET_YES, shorten_key, &process_ip_lookup_result, rq))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -631,7 +631,7 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client,
       sc.Data1, sc.Data2, sc.Data3, data4);
   for (i = 0; i < 8; i++)
     sc.Data4[i] = 0xFF & (data4 >> ((7 - i) * 8));
-  
+
   hostname = (const wchar_t *) &msg[1];
   if (hostname[size - 1] != L'\0')
   {
@@ -663,8 +663,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
 
   char* keyfile;
   struct GNUNET_CRYPTO_EccPrivateKey *key = NULL;
-  struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pkey;
-  struct GNUNET_CRYPTO_ShortHashAsciiEncoded zonename;
+  struct GNUNET_CRYPTO_EccPublicSignKey pkey;
+  struct GNUNET_CRYPTO_HashAsciiEncoded zonename;
 
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
                                                            "ZONEKEY", &keyfile))
@@ -678,15 +678,13 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
     if (GNUNET_YES == GNUNET_DISK_file_test (keyfile))
     {
       key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
-      GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
-      GNUNET_CRYPTO_short_hash(&pkey,
-                         sizeof(struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
-                         &user_zone);
-      zone = &user_zone;
-      GNUNET_CRYPTO_short_hash_to_enc (zone, &zonename);
+      GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
+      GNUNET_CRYPTO_hash (&pkey, sizeof(struct GNUNET_CRYPTO_EccPublicSignKey),
+                          &user_zone);
+      GNUNET_CRYPTO_hash_to_enc (&user_zone, &zonename);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Using zone: %s!\n", &zonename);
-      GNUNET_CRYPTO_ecc_key_free(key);
+      GNUNET_free(key);
     }
     GNUNET_free(keyfile);
   }