aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-02 05:03:07 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-02 05:03:07 +0000
commitb75373955d92c8ac1e9554182025843c01cbb96c (patch)
tree701cd50e4282eabc8bbd4ab622ee6e5b1d00447b /src
parenta0ba564746ecdff082ac3982d4d911f91deb8ab7 (diff)
downloadgnunet-b75373955d92c8ac1e9554182025843c01cbb96c.tar.gz
gnunet-b75373955d92c8ac1e9554182025843c01cbb96c.zip
-again moving towards DNS API sanity
Diffstat (limited to 'src')
-rw-r--r--src/dns/dns_api.c13
-rw-r--r--src/dns/gnunet-service-dns.c6
-rw-r--r--src/include/gnunet_dns_service.h89
-rw-r--r--src/vpn/gnunet-daemon-vpn.c157
-rw-r--r--src/vpn/gnunet-daemon-vpn.h28
5 files changed, 142 insertions, 151 deletions
diff --git a/src/dns/dns_api.c b/src/dns/dns_api.c
index 68b703eba..7a1577365 100644
--- a/src/dns/dns_api.c
+++ b/src/dns/dns_api.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file vpn/gnunet-daemon-vpn-dns.c 22 * @file dns/dns_api.c
23 * @brief 23 * @brief
24 * @author Philipp Toelke 24 * @author Philipp Toelke
25 */ 25 */
@@ -56,7 +56,7 @@ struct GNUNET_DNS_Handle
56 56
57 const struct GNUNET_CONFIGURATION_Handle *cfg; 57 const struct GNUNET_CONFIGURATION_Handle *cfg;
58 58
59 GNUNET_SCHEDULER_Task process_answer_cb; 59 GNUNET_DNS_ResponseCallback process_answer_cb;
60 60
61 void *process_answer_cb_cls; 61 void *process_answer_cb_cls;
62}; 62};
@@ -177,11 +177,8 @@ dns_answer_handler (void *cls,
177#endif 177#endif
178 return; 178 return;
179 } 179 }
180 void *pkt = GNUNET_malloc (ntohs (msg->size)); 180 h->process_answer_cb (h->process_answer_cb_cls,
181 181 (const struct answer_packet*) msg);
182 memcpy (pkt, msg, ntohs (msg->size));
183
184 GNUNET_SCHEDULER_add_now (h->process_answer_cb, pkt);
185 GNUNET_CLIENT_receive (h->dns_connection, &dns_answer_handler, h, 182 GNUNET_CLIENT_receive (h->dns_connection, &dns_answer_handler, h,
186 GNUNET_TIME_UNIT_FOREVER_REL); 183 GNUNET_TIME_UNIT_FOREVER_REL);
187} 184}
@@ -192,7 +189,7 @@ dns_answer_handler (void *cls,
192 */ 189 */
193struct GNUNET_DNS_Handle * 190struct GNUNET_DNS_Handle *
194GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 191GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
195 GNUNET_SCHEDULER_Task cb, 192 GNUNET_DNS_ResponseCallback cb,
196 void *cb_cls) 193 void *cb_cls)
197{ 194{
198 struct GNUNET_DNS_Handle *h; 195 struct GNUNET_DNS_Handle *h;
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c
index 55c87b9c6..7d24e630f 100644
--- a/src/dns/gnunet-service-dns.c
+++ b/src/dns/gnunet-service-dns.c
@@ -386,7 +386,7 @@ mesh_send (void *cls, size_t size, void *buf)
386} 386}
387 387
388 388
389void 389static void
390mesh_connect (void *cls, const struct GNUNET_PeerIdentity *peer, 390mesh_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
391 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED) 391 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
392{ 392{
@@ -1212,7 +1212,7 @@ open_port ()
1212 return GNUNET_YES; 1212 return GNUNET_YES;
1213} 1213}
1214 1214
1215void 1215static void
1216handle_response (struct dns_pkt *dns, struct sockaddr *addr, socklen_t addrlen, 1216handle_response (struct dns_pkt *dns, struct sockaddr *addr, socklen_t addrlen,
1217 int r); 1217 int r);
1218 1218
@@ -1320,7 +1320,7 @@ read_response (void *cls GNUNET_UNUSED,
1320 &read_response, NULL); 1320 &read_response, NULL);
1321} 1321}
1322 1322
1323void 1323static void
1324handle_response (struct dns_pkt *dns, struct sockaddr *addr, socklen_t addrlen, 1324handle_response (struct dns_pkt *dns, struct sockaddr *addr, socklen_t addrlen,
1325 int r) 1325 int r)
1326{ 1326{
diff --git a/src/include/gnunet_dns_service.h b/src/include/gnunet_dns_service.h
index c42f7787f..d697b9c16 100644
--- a/src/include/gnunet_dns_service.h
+++ b/src/include/gnunet_dns_service.h
@@ -37,38 +37,44 @@
37#include "gnunet_util_lib.h" 37#include "gnunet_util_lib.h"
38 38
39 39
40/**
41 * Subtypes of DNS answers.
42 */
40enum GNUNET_DNS_ANSWER_Subtype 43enum GNUNET_DNS_ANSWER_Subtype
41{ 44{
42 /** 45 /**
43 * Answers of this type contain a dns-packet that just has to be transmitted 46 * Answers of this type contain a dns-packet that just has to be transmitted
44 */ 47 */
45 GNUNET_DNS_ANSWER_TYPE_IP, 48 GNUNET_DNS_ANSWER_TYPE_IP,
46 49
47 /** 50 /**
48 * Answers of this type contain an incomplete dns-packet. The IP-Address 51 * Answers of this type contain an incomplete dns-packet. The IP-Address
49 * is all 0s. The addroffset points to it. 52 * is all 0s. The addroffset points to it.
50 */ 53 */
51 GNUNET_DNS_ANSWER_TYPE_SERVICE, 54 GNUNET_DNS_ANSWER_TYPE_SERVICE,
52 55
53 /** 56 /**
54 * Answers of this type contain an incomplete dns-packet as answer to a 57 * Answers of this type contain an incomplete dns-packet as answer to a
55 * PTR-Query. The resolved name is not allocated. The addroffset points to it. 58 * PTR-Query. The resolved name is not allocated. The addroffset points to it.
56 */ 59 */
57 GNUNET_DNS_ANSWER_TYPE_REV, 60 GNUNET_DNS_ANSWER_TYPE_REV,
58 61
59 /** 62 /**
60 * Answers of this type contains an IP6-Address but traffic to this IP should 63 * Answers of this type contains an IP6-Address but traffic to this IP should
61 * be routed through the GNUNet. 64 * be routed through the GNUNet.
62 */ 65 */
63 GNUNET_DNS_ANSWER_TYPE_REMOTE_AAAA, 66 GNUNET_DNS_ANSWER_TYPE_REMOTE_AAAA,
64 67
65 /** 68 /**
66 * Answers of this type contains an IP4-Address but traffic to this IP should 69 * Answers of this type contains an IP4-Address but traffic to this IP should
67 * be routed through the GNUNet. 70 * be routed through the GNUNet.
68 */ 71 */
69 GNUNET_DNS_ANSWER_TYPE_REMOTE_A 72 GNUNET_DNS_ANSWER_TYPE_REMOTE_A
73
70}; 74};
71 75
76
77GNUNET_NETWORK_STRUCT_BEGIN
72struct GNUNET_vpn_service_descriptor 78struct GNUNET_vpn_service_descriptor
73{ 79{
74 GNUNET_HashCode peer GNUNET_PACKED; 80 GNUNET_HashCode peer GNUNET_PACKED;
@@ -77,7 +83,7 @@ struct GNUNET_vpn_service_descriptor
77 uint32_t service_type GNUNET_PACKED; 83 uint32_t service_type GNUNET_PACKED;
78}; 84};
79 85
80GNUNET_NETWORK_STRUCT_BEGIN 86
81struct answer_packet 87struct answer_packet
82{ 88{
83 /* General data */ 89 /* General data */
@@ -108,6 +114,8 @@ struct answer_packet
108 114
109 unsigned char data[1]; 115 unsigned char data[1];
110}; 116};
117GNUNET_NETWORK_STRUCT_END
118
111 119
112struct answer_packet_list 120struct answer_packet_list
113{ 121{
@@ -116,18 +124,45 @@ struct answer_packet_list
116 struct GNUNET_SERVER_Client *client; 124 struct GNUNET_SERVER_Client *client;
117 struct answer_packet pkt; 125 struct answer_packet pkt;
118}; 126};
119GNUNET_NETWORK_STRUCT_END
120 127
128
129/**
130 * Type of a function to be called by the DNS API whenever
131 * a DNS reply is obtained.
132 *
133 * @param cls closure
134 * @param pkt reply that we got
135 */
136typedef void (*GNUNET_DNS_ResponseCallback)(void *cls,
137 const struct answer_packet *pkt);
138
139
140/**
141 * Opaque DNS handle
142 */
121struct GNUNET_DNS_Handle; 143struct GNUNET_DNS_Handle;
122 144
145
123/** 146/**
124 * Connect to the service-dns 147 * Connect to the service-dns
148 *
149 * @param cfg configuration to use
150 * @param cb function to call with DNS replies
151 * @param cb_cls closure to pass to cb
152 * @return DNS handle
125 */ 153 */
126struct GNUNET_DNS_Handle * 154struct GNUNET_DNS_Handle *
127GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 155GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
128 GNUNET_SCHEDULER_Task cb, 156 GNUNET_DNS_ResponseCallback cb,
129 void *cb_cls); 157 void *cb_cls);
130 158
159
160/**
161 * Signal the DNS service that it needs to re-initialize the DNS
162 * hijacking (the network setup has changed significantly).
163 *
164 * @param h DNS handle
165 */
131void 166void
132GNUNET_DNS_restart_hijack (struct GNUNET_DNS_Handle *h); 167GNUNET_DNS_restart_hijack (struct GNUNET_DNS_Handle *h);
133 168
@@ -170,7 +205,11 @@ GNUNET_DNS_queue_request_v6 (struct GNUNET_DNS_Handle *h,
170 size_t udp_packet_len, 205 size_t udp_packet_len,
171 const char *udp_packet); 206 const char *udp_packet);
172 207
173 208/**
209 * Disconnect from the DNS service.
210 *
211 * @param h DNS handle
212 */
174void 213void
175GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h); 214GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h);
176 215
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c
index cd587d7b1..7d303ecd5 100644
--- a/src/vpn/gnunet-daemon-vpn.c
+++ b/src/vpn/gnunet-daemon-vpn.c
@@ -80,6 +80,47 @@ GNUNET_SCHEDULER_TaskIdentifier conn_task;
80 80
81GNUNET_SCHEDULER_TaskIdentifier shs_task; 81GNUNET_SCHEDULER_TaskIdentifier shs_task;
82 82
83
84/**
85 * Sets a bit active in a bitArray.
86 *
87 * @param bitArray memory area to set the bit in
88 * @param bitIdx which bit to set
89 */
90static void
91setBit (char *bitArray, unsigned int bitIdx)
92{
93 size_t arraySlot;
94 unsigned int targetBit;
95
96 arraySlot = bitIdx / 8;
97 targetBit = (1L << (bitIdx % 8));
98 bitArray[arraySlot] |= targetBit;
99}
100
101
102/**
103 * Checks if a bit is active in the bitArray
104 *
105 * @param bitArray memory area to set the bit in
106 * @param bitIdx which bit to test
107 * @return GNUNET_YES if the bit is set, GNUNET_NO if not.
108 */
109int
110testBit (char *bitArray, unsigned int bitIdx)
111{
112 size_t slot;
113 unsigned int targetBit;
114
115 slot = bitIdx / 8;
116 targetBit = (1L << (bitIdx % 8));
117 if (bitArray[slot] & targetBit)
118 return GNUNET_YES;
119 else
120 return GNUNET_NO;
121}
122
123
83/** 124/**
84 * Function scheduled as very last function, cleans up after us 125 * Function scheduled as very last function, cleans up after us
85 *{{{ 126 *{{{
@@ -510,12 +551,9 @@ new_ip4addr_remote (unsigned char *buf, unsigned char *addr, char addrlen)
510 * doing nothing for "real" services. 551 * doing nothing for "real" services.
511 */ 552 */
512void 553void
513process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 554process_answer (void *cls,
555 const struct answer_packet *pkt)
514{ 556{
515 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
516 return;
517
518 struct answer_packet *pkt = cls;
519 struct answer_packet_list *list; 557 struct answer_packet_list *list;
520 558
521 /* This answer is about a .gnunet-service 559 /* This answer is about a .gnunet-service
@@ -525,13 +563,18 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
525 */ 563 */
526 if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_SERVICE) 564 if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_SERVICE)
527 { 565 {
528 pkt->subtype = GNUNET_DNS_ANSWER_TYPE_IP;
529 566
530 GNUNET_HashCode key; 567 GNUNET_HashCode key;
531 568
532 memset (&key, 0, sizeof (GNUNET_HashCode)); 569 memset (&key, 0, sizeof (GNUNET_HashCode));
533 570
534 unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset); 571 list =
572 GNUNET_malloc (htons (pkt->hdr.size) +
573 sizeof (struct answer_packet_list) -
574 sizeof (struct answer_packet));
575 memcpy (&list->pkt, pkt, htons (pkt->hdr.size));
576
577 unsigned char *c = ((unsigned char *) &list->pkt) + ntohs (pkt->addroffset);
535 unsigned char *k = (unsigned char *) &key; 578 unsigned char *k = (unsigned char *) &key;
536 579
537 new_ip6addr ((struct in6_addr*) c, 580 new_ip6addr ((struct in6_addr*) c,
@@ -576,12 +619,8 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
576 GNUNET_free (value); 619 GNUNET_free (value);
577 620
578 621
579 list = 622 list->pkt.subtype = GNUNET_DNS_ANSWER_TYPE_IP;
580 GNUNET_malloc (htons (pkt->hdr.size) +
581 sizeof (struct answer_packet_list) -
582 sizeof (struct answer_packet));
583 623
584 memcpy (&list->pkt, pkt, htons (pkt->hdr.size));
585 624
586 } 625 }
587 else if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_REV) 626 else if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_REV)
@@ -590,7 +629,7 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
590 629
591 memset (&key, 0, sizeof key); 630 memset (&key, 0, sizeof key);
592 unsigned char *k = (unsigned char *) &key; 631 unsigned char *k = (unsigned char *) &key;
593 unsigned char *s = pkt->data + 12; 632 const unsigned char *s = pkt->data + 12;
594 int i = 0; 633 int i = 0;
595 634
596 /* Whoever designed the reverse IPv6-lookup is batshit insane */ 635 /* Whoever designed the reverse IPv6-lookup is batshit insane */
@@ -614,10 +653,7 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
614 uint16_t offset = ntohs (pkt->addroffset); 653 uint16_t offset = ntohs (pkt->addroffset);
615 654
616 if (map_entry == NULL) 655 if (map_entry == NULL)
617 {
618 GNUNET_free (pkt);
619 return; 656 return;
620 }
621 657
622 GNUNET_CONTAINER_heap_update_cost (heap, map_entry->heap_node, 658 GNUNET_CONTAINER_heap_update_cost (heap, map_entry->heap_node,
623 GNUNET_TIME_absolute_get ().abs_value); 659 GNUNET_TIME_absolute_get ().abs_value);
@@ -653,16 +689,23 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
653 } 689 }
654 else if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_REMOTE_AAAA) 690 else if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_REMOTE_AAAA)
655 { 691 {
656 pkt->subtype = GNUNET_DNS_ANSWER_TYPE_IP;
657 692
658 GNUNET_HashCode key; 693 GNUNET_HashCode key;
659 694
660 memset (&key, 0, sizeof (GNUNET_HashCode)); 695 memset (&key, 0, sizeof (GNUNET_HashCode));
661 696
662 unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset); 697 list =
698 GNUNET_malloc (htons (pkt->hdr.size) +
699 sizeof (struct answer_packet_list) -
700 sizeof (struct answer_packet));
701
702 memcpy (&list->pkt, pkt, htons (pkt->hdr.size));
703 list->pkt.subtype = GNUNET_DNS_ANSWER_TYPE_IP;
704
705 unsigned char *c = ((unsigned char *) &list->pkt) + ntohs (list->pkt.addroffset);
663 706
664 new_ip6addr_remote ((struct in6_addr*) c, 707 new_ip6addr_remote ((struct in6_addr*) c,
665 pkt->addr, pkt->addrsize); 708 list->pkt.addr, list->pkt.addrsize);
666 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 709 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
667 "New mapping to %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n", 710 "New mapping to %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
668 c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], 711 c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9],
@@ -707,24 +750,25 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
707 else 750 else
708 GNUNET_free (value); 751 GNUNET_free (value);
709 752
753
754 }
755 else if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_REMOTE_A)
756 {
710 list = 757 list =
711 GNUNET_malloc (htons (pkt->hdr.size) + 758 GNUNET_malloc (htons (pkt->hdr.size) +
712 sizeof (struct answer_packet_list) - 759 sizeof (struct answer_packet_list) -
713 sizeof (struct answer_packet)); 760 sizeof (struct answer_packet));
714 761
715 memcpy (&list->pkt, pkt, htons (pkt->hdr.size)); 762 memcpy (&list->pkt, pkt, htons (pkt->hdr.size));
716 } 763 list->pkt.subtype = GNUNET_DNS_ANSWER_TYPE_IP;
717 else if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_REMOTE_A)
718 {
719 pkt->subtype = GNUNET_DNS_ANSWER_TYPE_IP;
720 764
721 GNUNET_HashCode key; 765 GNUNET_HashCode key;
722 766
723 memset (&key, 0, sizeof (GNUNET_HashCode)); 767 memset (&key, 0, sizeof (GNUNET_HashCode));
724 768
725 unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset); 769 unsigned char *c = ((unsigned char *) &list->pkt) + ntohs (pkt->addroffset);
726 770
727 new_ip4addr_remote (c, pkt->addr, pkt->addrsize); 771 new_ip4addr_remote (c, list->pkt.addr, pkt->addrsize);
728 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New mapping to %d.%d.%d.%d\n", c[0], 772 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New mapping to %d.%d.%d.%d\n", c[0],
729 c[1], c[2], c[3]); 773 c[1], c[2], c[3]);
730 unsigned char *k = (unsigned char *) &key; 774 unsigned char *k = (unsigned char *) &key;
@@ -770,22 +814,13 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
770 else 814 else
771 GNUNET_free (value); 815 GNUNET_free (value);
772 816
773 list =
774 GNUNET_malloc (htons (pkt->hdr.size) +
775 sizeof (struct answer_packet_list) -
776 sizeof (struct answer_packet));
777
778 memcpy (&list->pkt, pkt, htons (pkt->hdr.size));
779 } 817 }
780 else 818 else
781 { 819 {
782 GNUNET_break (0); 820 GNUNET_break (0);
783 GNUNET_free (pkt);
784 return; 821 return;
785 } 822 }
786 823
787 GNUNET_free (pkt);
788
789 GNUNET_CONTAINER_DLL_insert_after (answer_proc_head, answer_proc_tail, 824 GNUNET_CONTAINER_DLL_insert_after (answer_proc_head, answer_proc_tail,
790 answer_proc_tail, list); 825 answer_proc_tail, list);
791 826
@@ -794,60 +829,6 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
794 return; 829 return;
795} 830}
796 831
797/**
798 * Sets a bit active in a bitArray.
799 *
800 * @param bitArray memory area to set the bit in
801 * @param bitIdx which bit to set
802 */
803void
804setBit (char *bitArray, unsigned int bitIdx)
805{
806 size_t arraySlot;
807 unsigned int targetBit;
808
809 arraySlot = bitIdx / 8;
810 targetBit = (1L << (bitIdx % 8));
811 bitArray[arraySlot] |= targetBit;
812}
813
814/**
815 * Clears a bit from bitArray.
816 *
817 * @param bitArray memory area to set the bit in
818 * @param bitIdx which bit to unset
819 */
820void
821clearBit (char *bitArray, unsigned int bitIdx)
822{
823 size_t slot;
824 unsigned int targetBit;
825
826 slot = bitIdx / 8;
827 targetBit = (1L << (bitIdx % 8));
828 bitArray[slot] = bitArray[slot] & (~targetBit);
829}
830
831/**
832 * Checks if a bit is active in the bitArray
833 *
834 * @param bitArray memory area to set the bit in
835 * @param bitIdx which bit to test
836 * @return GNUNET_YES if the bit is set, GNUNET_NO if not.
837 */
838int
839testBit (char *bitArray, unsigned int bitIdx)
840{
841 size_t slot;
842 unsigned int targetBit;
843
844 slot = bitIdx / 8;
845 targetBit = (1L << (bitIdx % 8));
846 if (bitArray[slot] & targetBit)
847 return GNUNET_YES;
848 else
849 return GNUNET_NO;
850}
851 832
852/** 833/**
853 * @brief Add the port to the list of additional ports in the map_entry 834 * @brief Add the port to the list of additional ports in the map_entry
diff --git a/src/vpn/gnunet-daemon-vpn.h b/src/vpn/gnunet-daemon-vpn.h
index 91280368a..c2970402c 100644
--- a/src/vpn/gnunet-daemon-vpn.h
+++ b/src/vpn/gnunet-daemon-vpn.h
@@ -34,15 +34,6 @@ extern struct answer_packet_list *answer_proc_tail;
34 34
35extern struct GNUNET_DNS_Handle *dns_handle; 35extern struct GNUNET_DNS_Handle *dns_handle;
36 36
37/**
38 * This gets scheduled with cls pointing to an answer_packet and does everything
39 * needed in order to send it to the helper.
40 *
41 * At the moment this means "inventing" and IPv6-Address for .gnunet-services and
42 * doing nothing for "real" services.
43 */
44void
45process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
46 37
47void 38void
48send_icmp6_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 39send_icmp6_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
@@ -100,24 +91,6 @@ struct map_entry
100}; 91};
101 92
102/** 93/**
103 * Sets a bit active in a bitArray.
104 *
105 * @param bitArray memory area to set the bit in
106 * @param bitIdx which bit to set
107 */
108void
109setBit (char *bitArray, unsigned int bitIdx);
110
111/**
112 * Clears a bit from bitArray.
113 *
114 * @param bitArray memory area to set the bit in
115 * @param bitIdx which bit to unset
116 */
117void
118clearBit (char *bitArray, unsigned int bitIdx);
119
120/**
121 * Checks if a bit is active in the bitArray 94 * Checks if a bit is active in the bitArray
122 * 95 *
123 * @param bitArray memory area to set the bit in 96 * @param bitArray memory area to set the bit in
@@ -127,6 +100,7 @@ clearBit (char *bitArray, unsigned int bitIdx);
127int 100int
128testBit (char *bitArray, unsigned int bitIdx); 101testBit (char *bitArray, unsigned int bitIdx);
129 102
103
130struct remote_addr 104struct remote_addr
131{ 105{
132 char addrlen; 106 char addrlen;