aboutsummaryrefslogtreecommitdiff
path: root/src/pt/gnunet-daemon-pt.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-05-07 12:06:50 +0000
committerBart Polot <bart@net.in.tum.de>2014-05-07 12:06:50 +0000
commitbe4c79e4cd4a8f118c5577874f0c95e253359595 (patch)
tree7fd74fb0cf6921c4e35a43f2593396bb4805f154 /src/pt/gnunet-daemon-pt.c
parent15ccd7a167bcce0dde4331092975a6401393610f (diff)
downloadgnunet-be4c79e4cd4a8f118c5577874f0c95e253359595.tar.gz
gnunet-be4c79e4cd4a8f118c5577874f0c95e253359595.zip
Rename mesh->cadet
Diffstat (limited to 'src/pt/gnunet-daemon-pt.c')
-rw-r--r--src/pt/gnunet-daemon-pt.c202
1 files changed, 101 insertions, 101 deletions
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c
index 166f9df1d..832d51d63 100644
--- a/src/pt/gnunet-daemon-pt.c
+++ b/src/pt/gnunet-daemon-pt.c
@@ -27,7 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_dns_service.h" 28#include "gnunet_dns_service.h"
29#include "gnunet_dnsparser_lib.h" 29#include "gnunet_dnsparser_lib.h"
30#include "gnunet_mesh_service.h" 30#include "gnunet_cadet_service.h"
31#include "gnunet_tun_lib.h" 31#include "gnunet_tun_lib.h"
32#include "gnunet_dht_service.h" 32#include "gnunet_dht_service.h"
33#include "gnunet_vpn_service.h" 33#include "gnunet_vpn_service.h"
@@ -37,7 +37,7 @@
37 37
38 38
39/** 39/**
40 * After how long do we time out if we could not get an IP from VPN or MESH? 40 * After how long do we time out if we could not get an IP from VPN or CADET?
41 */ 41 */
42#define TIMEOUT GNUNET_TIME_UNIT_MINUTES 42#define TIMEOUT GNUNET_TIME_UNIT_MINUTES
43 43
@@ -126,24 +126,24 @@ struct ReplyContext
126 * as a DNS exit. We try to keep a few channels open and a few 126 * as a DNS exit. We try to keep a few channels open and a few
127 * peers in reserve. 127 * peers in reserve.
128 */ 128 */
129struct MeshExit 129struct CadetExit
130{ 130{
131 131
132 /** 132 /**
133 * Kept in a DLL. 133 * Kept in a DLL.
134 */ 134 */
135 struct MeshExit *next; 135 struct CadetExit *next;
136 136
137 /** 137 /**
138 * Kept in a DLL. 138 * Kept in a DLL.
139 */ 139 */
140 struct MeshExit *prev; 140 struct CadetExit *prev;
141 141
142 /** 142 /**
143 * Channel we use for DNS requests over MESH, NULL if we did 143 * Channel we use for DNS requests over CADET, NULL if we did
144 * not initialze a channel to this peer yet. 144 * not initialze a channel to this peer yet.
145 */ 145 */
146 struct GNUNET_MESH_Channel *mesh_channel; 146 struct GNUNET_CADET_Channel *cadet_channel;
147 147
148 /** 148 /**
149 * At what time did the peer's advertisement expire? 149 * At what time did the peer's advertisement expire?
@@ -161,19 +161,19 @@ struct MeshExit
161 struct RequestContext *receive_queue_tail; 161 struct RequestContext *receive_queue_tail;
162 162
163 /** 163 /**
164 * Head of DLL of requests to be transmitted to a mesh_channel. 164 * Head of DLL of requests to be transmitted to a cadet_channel.
165 */ 165 */
166 struct RequestContext *transmit_queue_head; 166 struct RequestContext *transmit_queue_head;
167 167
168 /** 168 /**
169 * Tail of DLL of requests to be transmitted to a mesh_channel. 169 * Tail of DLL of requests to be transmitted to a cadet_channel.
170 */ 170 */
171 struct RequestContext *transmit_queue_tail; 171 struct RequestContext *transmit_queue_tail;
172 172
173 /** 173 /**
174 * Active transmission request for this channel (or NULL). 174 * Active transmission request for this channel (or NULL).
175 */ 175 */
176 struct GNUNET_MESH_TransmitHandle *mesh_th; 176 struct GNUNET_CADET_TransmitHandle *cadet_th;
177 177
178 /** 178 /**
179 * Identity of the peer that is providing the exit for us. 179 * Identity of the peer that is providing the exit for us.
@@ -195,7 +195,7 @@ struct MeshExit
195 195
196 196
197/** 197/**
198 * State we keep for a request that is going out via MESH. 198 * State we keep for a request that is going out via CADET.
199 */ 199 */
200struct RequestContext 200struct RequestContext
201{ 201{
@@ -212,7 +212,7 @@ struct RequestContext
212 /** 212 /**
213 * Exit that was chosen for this request. 213 * Exit that was chosen for this request.
214 */ 214 */
215 struct MeshExit *exit; 215 struct CadetExit *exit;
216 216
217 /** 217 /**
218 * Handle for interaction with DNS service. 218 * Handle for interaction with DNS service.
@@ -220,10 +220,10 @@ struct RequestContext
220 struct GNUNET_DNS_RequestHandle *rh; 220 struct GNUNET_DNS_RequestHandle *rh;
221 221
222 /** 222 /**
223 * Message we're sending out via MESH, allocated at the 223 * Message we're sending out via CADET, allocated at the
224 * end of this struct. 224 * end of this struct.
225 */ 225 */
226 const struct GNUNET_MessageHeader *mesh_message; 226 const struct GNUNET_MessageHeader *cadet_message;
227 227
228 /** 228 /**
229 * Task used to abort this operation with timeout. 229 * Task used to abort this operation with timeout.
@@ -250,16 +250,16 @@ struct RequestContext
250 250
251 251
252/** 252/**
253 * Head of DLL of mesh exits. Mesh exits with an open channel are 253 * Head of DLL of cadet exits. Cadet exits with an open channel are
254 * always at the beginning (so we do not have to traverse the entire 254 * always at the beginning (so we do not have to traverse the entire
255 * list to find them). 255 * list to find them).
256 */ 256 */
257static struct MeshExit *exit_head; 257static struct CadetExit *exit_head;
258 258
259/** 259/**
260 * Tail of DLL of mesh exits. 260 * Tail of DLL of cadet exits.
261 */ 261 */
262static struct MeshExit *exit_tail; 262static struct CadetExit *exit_tail;
263 263
264/** 264/**
265 * The handle to the configuration used throughout the process 265 * The handle to the configuration used throughout the process
@@ -272,9 +272,9 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
272static struct GNUNET_VPN_Handle *vpn_handle; 272static struct GNUNET_VPN_Handle *vpn_handle;
273 273
274/** 274/**
275 * The handle to the MESH service 275 * The handle to the CADET service
276 */ 276 */
277static struct GNUNET_MESH_Handle *mesh_handle; 277static struct GNUNET_CADET_Handle *cadet_handle;
278 278
279/** 279/**
280 * Statistics. 280 * Statistics.
@@ -317,43 +317,43 @@ static int ipv6_pt;
317static int dns_channel; 317static int dns_channel;
318 318
319/** 319/**
320 * Number of DNS exit peers we currently have in the mesh channel. 320 * Number of DNS exit peers we currently have in the cadet channel.
321 * Used to see if using the mesh channel makes any sense right now, 321 * Used to see if using the cadet channel makes any sense right now,
322 * as well as to decide if we should open new channels. 322 * as well as to decide if we should open new channels.
323 */ 323 */
324static unsigned int dns_exit_available; 324static unsigned int dns_exit_available;
325 325
326 326
327/** 327/**
328 * We are short on mesh exits, try to open another one. 328 * We are short on cadet exits, try to open another one.
329 */ 329 */
330static void 330static void
331try_open_exit () 331try_open_exit ()
332{ 332{
333 struct MeshExit *pos; 333 struct CadetExit *pos;
334 uint32_t candidate_count; 334 uint32_t candidate_count;
335 uint32_t candidate_selected; 335 uint32_t candidate_selected;
336 336
337 candidate_count = 0; 337 candidate_count = 0;
338 for (pos = exit_head; NULL != pos; pos = pos->next) 338 for (pos = exit_head; NULL != pos; pos = pos->next)
339 if (NULL == pos->mesh_channel) 339 if (NULL == pos->cadet_channel)
340 candidate_count++; 340 candidate_count++;
341 candidate_selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 341 candidate_selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
342 candidate_count); 342 candidate_count);
343 candidate_count = 0; 343 candidate_count = 0;
344 for (pos = exit_head; NULL != pos; pos = pos->next) 344 for (pos = exit_head; NULL != pos; pos = pos->next)
345 if (NULL == pos->mesh_channel) 345 if (NULL == pos->cadet_channel)
346 { 346 {
347 candidate_count++; 347 candidate_count++;
348 if (candidate_selected < candidate_count) 348 if (candidate_selected < candidate_count)
349 { 349 {
350 /* move to the head of the DLL */ 350 /* move to the head of the DLL */
351 pos->mesh_channel = GNUNET_MESH_channel_create (mesh_handle, 351 pos->cadet_channel = GNUNET_CADET_channel_create (cadet_handle,
352 pos, 352 pos,
353 &pos->peer, 353 &pos->peer,
354 GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER, 354 GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER,
355 GNUNET_MESH_OPTION_DEFAULT); 355 GNUNET_CADET_OPTION_DEFAULT);
356 if (NULL == pos->mesh_channel) 356 if (NULL == pos->cadet_channel)
357 { 357 {
358 GNUNET_break (0); 358 GNUNET_break (0);
359 continue; 359 continue;
@@ -382,7 +382,7 @@ try_open_exit ()
382 * @return weight of the channel 382 * @return weight of the channel
383 */ 383 */
384static uint32_t 384static uint32_t
385get_channel_weight (struct MeshExit *exit) 385get_channel_weight (struct CadetExit *exit)
386{ 386{
387 uint32_t dropped; 387 uint32_t dropped;
388 uint32_t drop_percent; 388 uint32_t drop_percent;
@@ -406,7 +406,7 @@ get_channel_weight (struct MeshExit *exit)
406 406
407 407
408/** 408/**
409 * Choose a mesh exit for a DNS request. We try to use a channel 409 * Choose a cadet exit for a DNS request. We try to use a channel
410 * that is reliable and currently available. All existing 410 * that is reliable and currently available. All existing
411 * channels are given a base weight of 1, plus a score relating 411 * channels are given a base weight of 1, plus a score relating
412 * to the total number of queries answered in relation to the 412 * to the total number of queries answered in relation to the
@@ -416,10 +416,10 @@ get_channel_weight (struct MeshExit *exit)
416 * @return NULL if no exit is known, otherwise the 416 * @return NULL if no exit is known, otherwise the
417 * exit that we should use to queue a message with 417 * exit that we should use to queue a message with
418 */ 418 */
419static struct MeshExit * 419static struct CadetExit *
420choose_exit () 420choose_exit ()
421{ 421{
422 struct MeshExit *pos; 422 struct CadetExit *pos;
423 uint64_t total_transmitted; 423 uint64_t total_transmitted;
424 uint64_t selected_offset; 424 uint64_t selected_offset;
425 uint32_t channel_weight; 425 uint32_t channel_weight;
@@ -427,12 +427,12 @@ choose_exit ()
427 total_transmitted = 0; 427 total_transmitted = 0;
428 for (pos = exit_head; NULL != pos; pos = pos->next) 428 for (pos = exit_head; NULL != pos; pos = pos->next)
429 { 429 {
430 if (NULL == pos->mesh_channel) 430 if (NULL == pos->cadet_channel)
431 break; 431 break;
432 channel_weight = get_channel_weight (pos); 432 channel_weight = get_channel_weight (pos);
433 total_transmitted += channel_weight; 433 total_transmitted += channel_weight;
434 /* double weight for idle channels */ 434 /* double weight for idle channels */
435 if (NULL == pos->mesh_th) 435 if (NULL == pos->cadet_th)
436 total_transmitted += channel_weight; 436 total_transmitted += channel_weight;
437 } 437 }
438 if (0 == total_transmitted) 438 if (0 == total_transmitted)
@@ -445,12 +445,12 @@ choose_exit ()
445 total_transmitted = 0; 445 total_transmitted = 0;
446 for (pos = exit_head; NULL != pos; pos = pos->next) 446 for (pos = exit_head; NULL != pos; pos = pos->next)
447 { 447 {
448 if (NULL == pos->mesh_channel) 448 if (NULL == pos->cadet_channel)
449 break; 449 break;
450 channel_weight = get_channel_weight (pos); 450 channel_weight = get_channel_weight (pos);
451 total_transmitted += channel_weight; 451 total_transmitted += channel_weight;
452 /* double weight for idle channels */ 452 /* double weight for idle channels */
453 if (NULL == pos->mesh_th) 453 if (NULL == pos->cadet_th)
454 total_transmitted += channel_weight; 454 total_transmitted += channel_weight;
455 if (total_transmitted > selected_offset) 455 if (total_transmitted > selected_offset)
456 return pos; 456 return pos;
@@ -696,7 +696,7 @@ work_test (const struct GNUNET_DNSPARSER_Record *ra,
696 * This function is called AFTER we got an IP address for a 696 * This function is called AFTER we got an IP address for a
697 * DNS request. Now, the PT daemon has the chance to substitute 697 * DNS request. Now, the PT daemon has the chance to substitute
698 * the IP address with one from the VPN range to channel requests 698 * the IP address with one from the VPN range to channel requests
699 * destined for this IP address via VPN and MESH. 699 * destined for this IP address via VPN and CADET.
700 * 700 *
701 * @param cls closure 701 * @param cls closure
702 * @param rh request handle to user for reply 702 * @param rh request handle to user for reply
@@ -744,39 +744,39 @@ dns_post_request_handler (void *cls,
744 744
745 745
746/** 746/**
747 * Transmit a DNS request via MESH and move the request 747 * Transmit a DNS request via CADET and move the request
748 * handle to the receive queue. 748 * handle to the receive queue.
749 * 749 *
750 * @param cls the `struct MeshExit` 750 * @param cls the `struct CadetExit`
751 * @param size number of bytes available in buf 751 * @param size number of bytes available in buf
752 * @param buf where to copy the message 752 * @param buf where to copy the message
753 * @return number of bytes written to buf 753 * @return number of bytes written to buf
754 */ 754 */
755static size_t 755static size_t
756transmit_dns_request_to_mesh (void *cls, 756transmit_dns_request_to_cadet (void *cls,
757 size_t size, 757 size_t size,
758 void *buf) 758 void *buf)
759{ 759{
760 struct MeshExit *exit = cls; 760 struct CadetExit *exit = cls;
761 struct RequestContext *rc; 761 struct RequestContext *rc;
762 size_t mlen; 762 size_t mlen;
763 763
764 exit->mesh_th = NULL; 764 exit->cadet_th = NULL;
765 if (NULL == (rc = exit->transmit_queue_head)) 765 if (NULL == (rc = exit->transmit_queue_head))
766 return 0; 766 return 0;
767 mlen = rc->mlen; 767 mlen = rc->mlen;
768 if (mlen > size) 768 if (mlen > size)
769 { 769 {
770 exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel, 770 exit->cadet_th = GNUNET_CADET_notify_transmit_ready (exit->cadet_channel,
771 GNUNET_NO, 771 GNUNET_NO,
772 TIMEOUT, 772 TIMEOUT,
773 mlen, 773 mlen,
774 &transmit_dns_request_to_mesh, 774 &transmit_dns_request_to_cadet,
775 exit); 775 exit);
776 return 0; 776 return 0;
777 } 777 }
778 GNUNET_assert (GNUNET_NO == rc->was_transmitted); 778 GNUNET_assert (GNUNET_NO == rc->was_transmitted);
779 memcpy (buf, rc->mesh_message, mlen); 779 memcpy (buf, rc->cadet_message, mlen);
780 GNUNET_CONTAINER_DLL_remove (exit->transmit_queue_head, 780 GNUNET_CONTAINER_DLL_remove (exit->transmit_queue_head,
781 exit->transmit_queue_tail, 781 exit->transmit_queue_tail,
782 rc); 782 rc);
@@ -786,18 +786,18 @@ transmit_dns_request_to_mesh (void *cls,
786 rc); 786 rc);
787 rc = exit->transmit_queue_head; 787 rc = exit->transmit_queue_head;
788 if (NULL != rc) 788 if (NULL != rc)
789 exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel, 789 exit->cadet_th = GNUNET_CADET_notify_transmit_ready (exit->cadet_channel,
790 GNUNET_NO, 790 GNUNET_NO,
791 TIMEOUT, 791 TIMEOUT,
792 rc->mlen, 792 rc->mlen,
793 &transmit_dns_request_to_mesh, 793 &transmit_dns_request_to_cadet,
794 exit); 794 exit);
795 return mlen; 795 return mlen;
796} 796}
797 797
798 798
799/** 799/**
800 * Task run if the time to answer a DNS request via MESH is over. 800 * Task run if the time to answer a DNS request via CADET is over.
801 * 801 *
802 * @param cls the `struct RequestContext` to abort 802 * @param cls the `struct RequestContext` to abort
803 * @param tc scheduler context 803 * @param tc scheduler context
@@ -807,7 +807,7 @@ timeout_request (void *cls,
807 const struct GNUNET_SCHEDULER_TaskContext *tc) 807 const struct GNUNET_SCHEDULER_TaskContext *tc)
808{ 808{
809 struct RequestContext *rc = cls; 809 struct RequestContext *rc = cls;
810 struct MeshExit *exit = rc->exit; 810 struct CadetExit *exit = rc->exit;
811 811
812 if (rc->was_transmitted) 812 if (rc->was_transmitted)
813 { 813 {
@@ -833,9 +833,9 @@ timeout_request (void *cls,
833 { 833 {
834 /* this straw broke the camel's back: this channel now has 834 /* this straw broke the camel's back: this channel now has
835 such a low score that it will not be used; close it! */ 835 such a low score that it will not be used; close it! */
836 GNUNET_assert (NULL == exit->mesh_th); 836 GNUNET_assert (NULL == exit->cadet_th);
837 GNUNET_MESH_channel_destroy (exit->mesh_channel); 837 GNUNET_CADET_channel_destroy (exit->cadet_channel);
838 exit->mesh_channel = NULL; 838 exit->cadet_channel = NULL;
839 GNUNET_CONTAINER_DLL_remove (exit_head, 839 GNUNET_CONTAINER_DLL_remove (exit_head,
840 exit_tail, 840 exit_tail,
841 exit); 841 exit);
@@ -859,7 +859,7 @@ timeout_request (void *cls,
859/** 859/**
860 * This function is called *before* the DNS request has been 860 * This function is called *before* the DNS request has been
861 * given to a "local" DNS resolver. Channeling for DNS requests 861 * given to a "local" DNS resolver. Channeling for DNS requests
862 * was enabled, so we now need to send the request via some MESH 862 * was enabled, so we now need to send the request via some CADET
863 * channel to a DNS EXIT for resolution. 863 * channel to a DNS EXIT for resolution.
864 * 864 *
865 * @param cls closure 865 * @param cls closure
@@ -877,7 +877,7 @@ dns_pre_request_handler (void *cls,
877 size_t mlen; 877 size_t mlen;
878 struct GNUNET_MessageHeader hdr; 878 struct GNUNET_MessageHeader hdr;
879 struct GNUNET_TUN_DnsHeader dns; 879 struct GNUNET_TUN_DnsHeader dns;
880 struct MeshExit *exit; 880 struct CadetExit *exit;
881 881
882 GNUNET_STATISTICS_update (stats, 882 GNUNET_STATISTICS_update (stats,
883 gettext_noop ("# DNS requests intercepted"), 883 gettext_noop ("# DNS requests intercepted"),
@@ -885,7 +885,7 @@ dns_pre_request_handler (void *cls,
885 if (0 == dns_exit_available) 885 if (0 == dns_exit_available)
886 { 886 {
887 GNUNET_STATISTICS_update (stats, 887 GNUNET_STATISTICS_update (stats,
888 gettext_noop ("# DNS requests dropped (DNS mesh channel down)"), 888 gettext_noop ("# DNS requests dropped (DNS cadet channel down)"),
889 1, GNUNET_NO); 889 1, GNUNET_NO);
890 GNUNET_DNS_request_drop (rh); 890 GNUNET_DNS_request_drop (rh);
891 return; 891 return;
@@ -902,11 +902,11 @@ dns_pre_request_handler (void *cls,
902 mlen = sizeof (struct GNUNET_MessageHeader) + request_length; 902 mlen = sizeof (struct GNUNET_MessageHeader) + request_length;
903 exit = choose_exit (); 903 exit = choose_exit ();
904 GNUNET_assert (NULL != exit); 904 GNUNET_assert (NULL != exit);
905 GNUNET_assert (NULL != exit->mesh_channel); 905 GNUNET_assert (NULL != exit->cadet_channel);
906 rc = GNUNET_malloc (sizeof (struct RequestContext) + mlen); 906 rc = GNUNET_malloc (sizeof (struct RequestContext) + mlen);
907 rc->exit = exit; 907 rc->exit = exit;
908 rc->rh = rh; 908 rc->rh = rh;
909 rc->mesh_message = (const struct GNUNET_MessageHeader*) &rc[1]; 909 rc->cadet_message = (const struct GNUNET_MessageHeader*) &rc[1];
910 rc->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 910 rc->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
911 &timeout_request, 911 &timeout_request,
912 rc); 912 rc);
@@ -921,33 +921,33 @@ dns_pre_request_handler (void *cls,
921 GNUNET_CONTAINER_DLL_insert_tail (exit->transmit_queue_head, 921 GNUNET_CONTAINER_DLL_insert_tail (exit->transmit_queue_head,
922 exit->transmit_queue_tail, 922 exit->transmit_queue_tail,
923 rc); 923 rc);
924 if (NULL == exit->mesh_th) 924 if (NULL == exit->cadet_th)
925 exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel, 925 exit->cadet_th = GNUNET_CADET_notify_transmit_ready (exit->cadet_channel,
926 GNUNET_NO, 926 GNUNET_NO,
927 TIMEOUT, 927 TIMEOUT,
928 mlen, 928 mlen,
929 &transmit_dns_request_to_mesh, 929 &transmit_dns_request_to_cadet,
930 exit); 930 exit);
931} 931}
932 932
933 933
934/** 934/**
935 * Process a request via mesh to perform a DNS query. 935 * Process a request via cadet to perform a DNS query.
936 * 936 *
937 * @param cls NULL 937 * @param cls NULL
938 * @param channel connection to the other end 938 * @param channel connection to the other end
939 * @param channel_ctx pointer to our `struct MeshExit` 939 * @param channel_ctx pointer to our `struct CadetExit`
940 * @param message the actual message 940 * @param message the actual message
941 * @return #GNUNET_OK to keep the connection open, 941 * @return #GNUNET_OK to keep the connection open,
942 * #GNUNET_SYSERR to close it (signal serious error) 942 * #GNUNET_SYSERR to close it (signal serious error)
943 */ 943 */
944static int 944static int
945receive_dns_response (void *cls, 945receive_dns_response (void *cls,
946 struct GNUNET_MESH_Channel *channel, 946 struct GNUNET_CADET_Channel *channel,
947 void **channel_ctx, 947 void **channel_ctx,
948 const struct GNUNET_MessageHeader *message) 948 const struct GNUNET_MessageHeader *message)
949{ 949{
950 struct MeshExit *exit = *channel_ctx; 950 struct CadetExit *exit = *channel_ctx;
951 struct GNUNET_TUN_DnsHeader dns; 951 struct GNUNET_TUN_DnsHeader dns;
952 size_t mlen; 952 size_t mlen;
953 struct RequestContext *rc; 953 struct RequestContext *rc;
@@ -989,12 +989,12 @@ receive_dns_response (void *cls,
989 989
990 990
991/** 991/**
992 * Abort all pending DNS requests with the given mesh exit. 992 * Abort all pending DNS requests with the given cadet exit.
993 * 993 *
994 * @param exit mesh exit to abort requests for 994 * @param exit cadet exit to abort requests for
995 */ 995 */
996static void 996static void
997abort_all_requests (struct MeshExit *exit) 997abort_all_requests (struct CadetExit *exit)
998{ 998{
999 struct RequestContext *rc; 999 struct RequestContext *rc;
1000 1000
@@ -1029,7 +1029,7 @@ static void
1029cleanup (void *cls, 1029cleanup (void *cls,
1030 const struct GNUNET_SCHEDULER_TaskContext *tskctx) 1030 const struct GNUNET_SCHEDULER_TaskContext *tskctx)
1031{ 1031{
1032 struct MeshExit *exit; 1032 struct CadetExit *exit;
1033 1033
1034 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1034 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1035 "Protocol translation daemon is shutting down now\n"); 1035 "Protocol translation daemon is shutting down now\n");
@@ -1043,23 +1043,23 @@ cleanup (void *cls,
1043 GNUNET_CONTAINER_DLL_remove (exit_head, 1043 GNUNET_CONTAINER_DLL_remove (exit_head,
1044 exit_tail, 1044 exit_tail,
1045 exit); 1045 exit);
1046 if (NULL != exit->mesh_th) 1046 if (NULL != exit->cadet_th)
1047 { 1047 {
1048 GNUNET_MESH_notify_transmit_ready_cancel (exit->mesh_th); 1048 GNUNET_CADET_notify_transmit_ready_cancel (exit->cadet_th);
1049 exit->mesh_th = NULL; 1049 exit->cadet_th = NULL;
1050 } 1050 }
1051 if (NULL != exit->mesh_channel) 1051 if (NULL != exit->cadet_channel)
1052 { 1052 {
1053 GNUNET_MESH_channel_destroy (exit->mesh_channel); 1053 GNUNET_CADET_channel_destroy (exit->cadet_channel);
1054 exit->mesh_channel = NULL; 1054 exit->cadet_channel = NULL;
1055 } 1055 }
1056 abort_all_requests (exit); 1056 abort_all_requests (exit);
1057 GNUNET_free (exit); 1057 GNUNET_free (exit);
1058 } 1058 }
1059 if (NULL != mesh_handle) 1059 if (NULL != cadet_handle)
1060 { 1060 {
1061 GNUNET_MESH_disconnect (mesh_handle); 1061 GNUNET_CADET_disconnect (cadet_handle);
1062 mesh_handle = NULL; 1062 cadet_handle = NULL;
1063 } 1063 }
1064 if (NULL != dns_post_handle) 1064 if (NULL != dns_post_handle)
1065 { 1065 {
@@ -1093,32 +1093,32 @@ cleanup (void *cls,
1093 * Function called whenever a channel is destroyed. Should clean up 1093 * Function called whenever a channel is destroyed. Should clean up
1094 * the associated state and attempt to build a new one. 1094 * the associated state and attempt to build a new one.
1095 * 1095 *
1096 * It must NOT call #GNUNET_MESH_channel_destroy on the channel. 1096 * It must NOT call #GNUNET_CADET_channel_destroy on the channel.
1097 * 1097 *
1098 * @param cls closure (the `struct MeshExit` set from #GNUNET_MESH_connect) 1098 * @param cls closure (the `struct CadetExit` set from #GNUNET_CADET_connect)
1099 * @param channel connection to the other end (henceforth invalid) 1099 * @param channel connection to the other end (henceforth invalid)
1100 * @param channel_ctx place where local state associated 1100 * @param channel_ctx place where local state associated
1101 * with the channel is stored 1101 * with the channel is stored
1102 */ 1102 */
1103static void 1103static void
1104mesh_channel_end_cb (void *cls, 1104cadet_channel_end_cb (void *cls,
1105 const struct GNUNET_MESH_Channel *channel, 1105 const struct GNUNET_CADET_Channel *channel,
1106 void *channel_ctx) 1106 void *channel_ctx)
1107{ 1107{
1108 struct MeshExit *exit = channel_ctx; 1108 struct CadetExit *exit = channel_ctx;
1109 struct MeshExit *alt; 1109 struct CadetExit *alt;
1110 struct RequestContext *rc; 1110 struct RequestContext *rc;
1111 1111
1112 if (NULL != exit->mesh_th) 1112 if (NULL != exit->cadet_th)
1113 { 1113 {
1114 GNUNET_MESH_notify_transmit_ready_cancel (exit->mesh_th); 1114 GNUNET_CADET_notify_transmit_ready_cancel (exit->cadet_th);
1115 exit->mesh_th = NULL; 1115 exit->cadet_th = NULL;
1116 } 1116 }
1117 exit->mesh_channel = NULL; 1117 exit->cadet_channel = NULL;
1118 dns_exit_available--; 1118 dns_exit_available--;
1119 /* open alternative channels */ 1119 /* open alternative channels */
1120 try_open_exit (); 1120 try_open_exit ();
1121 if (NULL == exit->mesh_channel) 1121 if (NULL == exit->cadet_channel)
1122 { 1122 {
1123 /* our channel is now closed, move our requests to an alternative 1123 /* our channel is now closed, move our requests to an alternative
1124 channel */ 1124 channel */
@@ -1150,20 +1150,20 @@ mesh_channel_end_cb (void *cls,
1150 /* the same peer was chosen, just make sure the queue processing is restarted */ 1150 /* the same peer was chosen, just make sure the queue processing is restarted */
1151 alt = exit; 1151 alt = exit;
1152 } 1152 }
1153 if ( (NULL == alt->mesh_th) && 1153 if ( (NULL == alt->cadet_th) &&
1154 (NULL != (rc = alt->transmit_queue_head)) ) 1154 (NULL != (rc = alt->transmit_queue_head)) )
1155 alt->mesh_th = GNUNET_MESH_notify_transmit_ready (alt->mesh_channel, 1155 alt->cadet_th = GNUNET_CADET_notify_transmit_ready (alt->cadet_channel,
1156 GNUNET_NO, 1156 GNUNET_NO,
1157 TIMEOUT, 1157 TIMEOUT,
1158 rc->mlen, 1158 rc->mlen,
1159 &transmit_dns_request_to_mesh, 1159 &transmit_dns_request_to_cadet,
1160 alt); 1160 alt);
1161} 1161}
1162 1162
1163 1163
1164/** 1164/**
1165 * Function called whenever we find an advertisement for a 1165 * Function called whenever we find an advertisement for a
1166 * DNS exit in the DHT. If we don't have a mesh channel, 1166 * DNS exit in the DHT. If we don't have a cadet channel,
1167 * we should build one; otherwise, we should save the 1167 * we should build one; otherwise, we should save the
1168 * advertisement for later use. 1168 * advertisement for later use.
1169 * 1169 *
@@ -1192,7 +1192,7 @@ handle_dht_result (void *cls,
1192 size_t size, const void *data) 1192 size_t size, const void *data)
1193{ 1193{
1194 const struct GNUNET_DNS_Advertisement *ad; 1194 const struct GNUNET_DNS_Advertisement *ad;
1195 struct MeshExit *exit; 1195 struct CadetExit *exit;
1196 1196
1197 if (sizeof (struct GNUNET_DNS_Advertisement) != size) 1197 if (sizeof (struct GNUNET_DNS_Advertisement) != size)
1198 { 1198 {
@@ -1207,7 +1207,7 @@ handle_dht_result (void *cls,
1207 break; 1207 break;
1208 if (NULL == exit) 1208 if (NULL == exit)
1209 { 1209 {
1210 exit = GNUNET_new (struct MeshExit); 1210 exit = GNUNET_new (struct CadetExit);
1211 exit->peer = ad->peer; 1211 exit->peer = ad->peer;
1212 /* channel is closed, so insert at the end */ 1212 /* channel is closed, so insert at the end */
1213 GNUNET_CONTAINER_DLL_insert_tail (exit_head, 1213 GNUNET_CONTAINER_DLL_insert_tail (exit_head,
@@ -1275,7 +1275,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
1275 } 1275 }
1276 if (dns_channel) 1276 if (dns_channel)
1277 { 1277 {
1278 static struct GNUNET_MESH_MessageHandler mesh_handlers[] = { 1278 static struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
1279 {&receive_dns_response, GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET, 0}, 1279 {&receive_dns_response, GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET, 0},
1280 {NULL, 0, 0} 1280 {NULL, 0, 0}
1281 }; 1281 };
@@ -1292,14 +1292,14 @@ run (void *cls, char *const *args GNUNET_UNUSED,
1292 GNUNET_SCHEDULER_shutdown (); 1292 GNUNET_SCHEDULER_shutdown ();
1293 return; 1293 return;
1294 } 1294 }
1295 mesh_handle = GNUNET_MESH_connect (cfg, NULL, NULL, 1295 cadet_handle = GNUNET_CADET_connect (cfg, NULL, NULL,
1296 &mesh_channel_end_cb, 1296 &cadet_channel_end_cb,
1297 mesh_handlers, NULL); 1297 cadet_handlers, NULL);
1298 if (NULL == mesh_handle) 1298 if (NULL == cadet_handle)
1299 { 1299 {
1300 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1300 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1301 _("Failed to connect to %s service. Exiting.\n"), 1301 _("Failed to connect to %s service. Exiting.\n"),
1302 "MESH"); 1302 "CADET");
1303 GNUNET_SCHEDULER_shutdown (); 1303 GNUNET_SCHEDULER_shutdown ();
1304 return; 1304 return;
1305 } 1305 }