gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r13710 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r13710 - gnunet/src/vpn
Date: Wed, 17 Nov 2010 09:55:34 +0100

Author: toelke
Date: 2010-11-17 09:55:34 +0100 (Wed, 17 Nov 2010)
New Revision: 13710

Modified:
   gnunet/src/vpn/gnunet-daemon-vpn.c
Log:
Refactored the creation of fake-addresses

Modified: gnunet/src/vpn/gnunet-daemon-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-vpn.c  2010-11-17 08:55:34 UTC (rev 13709)
+++ gnunet/src/vpn/gnunet-daemon-vpn.c  2010-11-17 08:55:34 UTC (rev 13710)
@@ -495,6 +495,18 @@
 }
 
 /**
+ * Create a new Address from an answer-packet
+ * {{{
+ */
+void
+new_ip6addr(char* buf, struct answer_packet* pkt) {
+       memcpy(buf, (int[]){htons(0x1234)}, 2);
+       memcpy(buf+2, &pkt->service_descriptor, 6);
+       memcpy(buf+8, &pkt->peer, 8);
+}
+/*}}}*/
+
+/**
  * This gets scheduled with cls pointing to an answer_packet and does 
everything
  * needed in order to send it to the helper.
  *
@@ -514,14 +526,9 @@
     //FIXME htons?
     if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_SERVICE)
       {
-       unsigned char ip6addr[16];
-
        pkt->subtype = GNUNET_DNS_ANSWER_TYPE_IP;
-       memcpy(ip6addr, (int[]){htons(0x1234)}, 2);
-       memcpy(ip6addr+2, &pkt->peer, 7);
-       memcpy(ip6addr+9, &pkt->service_descriptor, 7);
 
-       memcpy(((char*)pkt)+ntohs(pkt->addroffset), ip6addr, 16);
+       new_ip6addr(((char*)pkt)+ntohs(pkt->addroffset), pkt);
 
          /*FIXME:
           * -save DNS_Record into hashmap, pointed to by ip




reply via email to

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