diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-06-28 14:34:55 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-06-28 14:34:55 +0000 |
commit | cf19b5082fe8de33e38957f54d28647635b46b60 (patch) | |
tree | e6e41da7d5cb14d9a342ef6533633ecb2f34b18d /src/pt | |
parent | 166d8f9122bf7ebbaa2a662d09a3fa4d34f6d092 (diff) | |
download | gnunet-cf19b5082fe8de33e38957f54d28647635b46b60.tar.gz gnunet-cf19b5082fe8de33e38957f54d28647635b46b60.zip |
Replace mesh with new version
Diffstat (limited to 'src/pt')
-rw-r--r-- | src/pt/gnunet-daemon-pt.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c index 8044f930c..466584f0f 100644 --- a/src/pt/gnunet-daemon-pt.c +++ b/src/pt/gnunet-daemon-pt.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include "gnunet_statistics_service.h" | 33 | #include "gnunet_statistics_service.h" |
34 | #include "gnunet_applications.h" | 34 | #include "gnunet_applications.h" |
35 | 35 | ||
36 | #define PORT_PT 4242 // FIXME | ||
37 | |||
36 | 38 | ||
37 | /** | 39 | /** |
38 | * 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 MESH? |
@@ -548,11 +550,11 @@ transmit_dns_request_to_mesh (void *cls, | |||
548 | return 0; | 550 | return 0; |
549 | mlen = ntohs (rc->mesh_message->size); | 551 | mlen = ntohs (rc->mesh_message->size); |
550 | if (mlen > size) | 552 | if (mlen > size) |
551 | { | 553 | { |
552 | mesh_th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel, | 554 | mesh_th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel, |
553 | GNUNET_NO, | 555 | GNUNET_NO, |
554 | TIMEOUT, | 556 | TIMEOUT, |
555 | NULL, mlen, | 557 | mlen, |
556 | &transmit_dns_request_to_mesh, | 558 | &transmit_dns_request_to_mesh, |
557 | NULL); | 559 | NULL); |
558 | return 0; | 560 | return 0; |
@@ -571,7 +573,7 @@ transmit_dns_request_to_mesh (void *cls, | |||
571 | mesh_th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel, | 573 | mesh_th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel, |
572 | GNUNET_NO, | 574 | GNUNET_NO, |
573 | TIMEOUT, | 575 | TIMEOUT, |
574 | NULL, ntohs (rc->mesh_message->size), | 576 | ntohs (rc->mesh_message->size), |
575 | &transmit_dns_request_to_mesh, | 577 | &transmit_dns_request_to_mesh, |
576 | NULL); | 578 | NULL); |
577 | return mlen; | 579 | return mlen; |
@@ -670,7 +672,7 @@ dns_pre_request_handler (void *cls, | |||
670 | mesh_th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel, | 672 | mesh_th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel, |
671 | GNUNET_NO, | 673 | GNUNET_NO, |
672 | TIMEOUT, | 674 | TIMEOUT, |
673 | NULL, mlen, | 675 | mlen, |
674 | &transmit_dns_request_to_mesh, | 676 | &transmit_dns_request_to_mesh, |
675 | NULL); | 677 | NULL); |
676 | } | 678 | } |
@@ -682,18 +684,15 @@ dns_pre_request_handler (void *cls, | |||
682 | * @param cls closure, NULL | 684 | * @param cls closure, NULL |
683 | * @param tunnel connection to the other end | 685 | * @param tunnel connection to the other end |
684 | * @param tunnel_ctx pointer to our 'struct TunnelState *' | 686 | * @param tunnel_ctx pointer to our 'struct TunnelState *' |
685 | * @param sender who sent the message | ||
686 | * @param message the actual message | 687 | * @param message the actual message |
687 | * @param atsi performance data for the connection | 688 | * |
688 | * @return GNUNET_OK to keep the connection open, | 689 | * @return GNUNET_OK to keep the connection open, |
689 | * GNUNET_SYSERR to close it (signal serious error) | 690 | * GNUNET_SYSERR to close it (signal serious error) |
690 | */ | 691 | */ |
691 | static int | 692 | static int |
692 | receive_dns_response (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | 693 | receive_dns_response (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, |
693 | void **tunnel_ctx, | 694 | void **tunnel_ctx, |
694 | const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED, | 695 | const struct GNUNET_MessageHeader *message) |
695 | const struct GNUNET_MessageHeader *message, | ||
696 | const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED) | ||
697 | { | 696 | { |
698 | struct GNUNET_TUN_DnsHeader dns; | 697 | struct GNUNET_TUN_DnsHeader dns; |
699 | size_t mlen; | 698 | size_t mlen; |
@@ -772,10 +771,12 @@ abort_all_requests () | |||
772 | /** | 771 | /** |
773 | * Method called whenever a peer has disconnected from the tunnel. | 772 | * Method called whenever a peer has disconnected from the tunnel. |
774 | * | 773 | * |
774 | * FIXME merge with inbound cleaner | ||
775 | * | ||
775 | * @param cls closure | 776 | * @param cls closure |
776 | * @param peer peer identity the tunnel stopped working with | 777 | * @param peer peer identity the tunnel stopped working with |
777 | */ | 778 | */ |
778 | static void | 779 | void |
779 | mesh_disconnect_handler (void *cls, | 780 | mesh_disconnect_handler (void *cls, |
780 | const struct | 781 | const struct |
781 | GNUNET_PeerIdentity * peer) | 782 | GNUNET_PeerIdentity * peer) |
@@ -797,11 +798,13 @@ mesh_disconnect_handler (void *cls, | |||
797 | /** | 798 | /** |
798 | * Method called whenever a peer has connected to the tunnel. | 799 | * Method called whenever a peer has connected to the tunnel. |
799 | * | 800 | * |
801 | * FIXME find anouther way (in tmt_ready_callback ?) | ||
802 | * | ||
800 | * @param cls closure | 803 | * @param cls closure |
801 | * @param peer peer identity the tunnel was created to, NULL on timeout | 804 | * @param peer peer identity the tunnel was created to, NULL on timeout |
802 | * @param atsi performance data for the connection | 805 | * @param atsi performance data for the connection |
803 | */ | 806 | */ |
804 | static void | 807 | void |
805 | mesh_connect_handler (void *cls, | 808 | mesh_connect_handler (void *cls, |
806 | const struct GNUNET_PeerIdentity | 809 | const struct GNUNET_PeerIdentity |
807 | * peer, | 810 | * peer, |
@@ -916,9 +919,6 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
916 | {&receive_dns_response, GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET, 0}, | 919 | {&receive_dns_response, GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET, 0}, |
917 | {NULL, 0, 0} | 920 | {NULL, 0, 0} |
918 | }; | 921 | }; |
919 | static GNUNET_MESH_ApplicationType mesh_types[] = { | ||
920 | GNUNET_APPLICATION_TYPE_END | ||
921 | }; | ||
922 | 922 | ||
923 | dns_pre_handle | 923 | dns_pre_handle |
924 | = GNUNET_DNS_connect (cfg, | 924 | = GNUNET_DNS_connect (cfg, |
@@ -932,8 +932,8 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
932 | GNUNET_SCHEDULER_shutdown (); | 932 | GNUNET_SCHEDULER_shutdown (); |
933 | return; | 933 | return; |
934 | } | 934 | } |
935 | mesh_handle = GNUNET_MESH_connect (cfg, NULL, NULL, NULL, | 935 | mesh_handle = GNUNET_MESH_connect (cfg, NULL, NULL, NULL, // FIXME use end handler |
936 | mesh_handlers, mesh_types); | 936 | mesh_handlers, NULL); |
937 | if (NULL == mesh_handle) | 937 | if (NULL == mesh_handle) |
938 | { | 938 | { |
939 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 939 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -944,11 +944,10 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
944 | } | 944 | } |
945 | mesh_tunnel = GNUNET_MESH_tunnel_create (mesh_handle, | 945 | mesh_tunnel = GNUNET_MESH_tunnel_create (mesh_handle, |
946 | NULL, | 946 | NULL, |
947 | &mesh_connect_handler, | 947 | NULL, /* FIXME peer ID*/ |
948 | &mesh_disconnect_handler, | 948 | PORT_PT); |
949 | NULL); | 949 | // GNUNET_MESH_peer_request_connect_by_type (mesh_tunnel, FIXME use regex |
950 | GNUNET_MESH_peer_request_connect_by_type (mesh_tunnel, | 950 | // GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER); |
951 | GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER); | ||
952 | } | 951 | } |
953 | } | 952 | } |
954 | 953 | ||