diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-17 18:59:02 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-17 18:59:02 +0000 |
commit | 4d899684274d4d5d0ce68c897acafc3d6d5ea3ab (patch) | |
tree | 832befd0132651af352e30cbb15f71783077aa28 | |
parent | 6a665489add525880f1f609271dace270c868786 (diff) | |
download | gnunet-4d899684274d4d5d0ce68c897acafc3d6d5ea3ab.tar.gz gnunet-4d899684274d4d5d0ce68c897acafc3d6d5ea3ab.zip |
-rename header
-rw-r--r-- | src/dns/gnunet-service-dns.c | 2 | ||||
-rw-r--r-- | src/exit/gnunet-daemon-exit.c | 2 | ||||
-rw-r--r-- | src/include/Makefile.am | 4 | ||||
-rw-r--r-- | src/include/gnunet_tun_lib.h (renamed from src/include/tcpip_tun.h) | 4 | ||||
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 153 |
5 files changed, 83 insertions, 82 deletions
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c index 764ede782..76beaaf5c 100644 --- a/src/dns/gnunet-service-dns.c +++ b/src/dns/gnunet-service-dns.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "dns.h" | 30 | #include "dns.h" |
31 | #include "gnunet_dns_service.h" | 31 | #include "gnunet_dns_service.h" |
32 | #include "gnunet_statistics_service.h" | 32 | #include "gnunet_statistics_service.h" |
33 | #include "tcpip_tun.h" | 33 | #include "gnunet_tun_lib.h" |
34 | 34 | ||
35 | #ifndef IPVERSION | 35 | #ifndef IPVERSION |
36 | #define IPVERSION 4 | 36 | #define IPVERSION 4 |
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 3909d4a70..3dce69a3e 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "gnunet_mesh_service.h" | 44 | #include "gnunet_mesh_service.h" |
45 | #include "gnunet_statistics_service.h" | 45 | #include "gnunet_statistics_service.h" |
46 | #include "gnunet_constants.h" | 46 | #include "gnunet_constants.h" |
47 | #include "tcpip_tun.h" | 47 | #include "gnunet_tun_lib.h" |
48 | #include "exit.h" | 48 | #include "exit.h" |
49 | 49 | ||
50 | /** | 50 | /** |
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index d0cd70d01..85c9f7d4f 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -72,6 +72,6 @@ gnunetinclude_HEADERS = \ | |||
72 | gnunet_time_lib.h \ | 72 | gnunet_time_lib.h \ |
73 | gnunet_transport_service.h \ | 73 | gnunet_transport_service.h \ |
74 | gnunet_transport_plugin.h \ | 74 | gnunet_transport_plugin.h \ |
75 | gnunet_tun_lib.h \ | ||
75 | gnunet_util_lib.h \ | 76 | gnunet_util_lib.h \ |
76 | gnunet_vpn_service.h \ | 77 | gnunet_vpn_service.h |
77 | tcpip_tun.h \ No newline at end of file | ||
diff --git a/src/include/tcpip_tun.h b/src/include/gnunet_tun_lib.h index 80419aae5..ca521db3b 100644 --- a/src/include/tcpip_tun.h +++ b/src/include/gnunet_tun_lib.h | |||
@@ -19,8 +19,8 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file include/tcpip_tun.h | 22 | * @file include/gnunet_tun_lib.h |
23 | * @brief standard TCP/IP network structs for TUN interaction | 23 | * @brief standard TCP/IP network structs and IP checksum calculations for TUN interaction |
24 | * @author Philipp Toelke | 24 | * @author Philipp Toelke |
25 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
26 | * | 26 | * |
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index 381cdb7c8..9c0fb1667 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #include "gnunet_mesh_service.h" | 45 | #include "gnunet_mesh_service.h" |
46 | #include "gnunet_statistics_service.h" | 46 | #include "gnunet_statistics_service.h" |
47 | #include "gnunet_constants.h" | 47 | #include "gnunet_constants.h" |
48 | #include "tcpip_tun.h" | 48 | #include "gnunet_tun_lib.h" |
49 | #include "vpn.h" | 49 | #include "vpn.h" |
50 | #include "exit.h" | 50 | #include "exit.h" |
51 | 51 | ||
@@ -500,6 +500,79 @@ send_client_reply (struct GNUNET_SERVER_Client *client, | |||
500 | 500 | ||
501 | 501 | ||
502 | /** | 502 | /** |
503 | * Free resources associated with a tunnel state. | ||
504 | * | ||
505 | * @param ts state to free | ||
506 | */ | ||
507 | static void | ||
508 | free_tunnel_state (struct TunnelState *ts) | ||
509 | { | ||
510 | GNUNET_HashCode key; | ||
511 | struct TunnelMessageQueueEntry *tnq; | ||
512 | struct GNUNET_MESH_Tunnel *tunnel; | ||
513 | |||
514 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
515 | "Cleaning up tunnel state\n"); | ||
516 | GNUNET_STATISTICS_update (stats, | ||
517 | gettext_noop ("# Active tunnels"), | ||
518 | -1, GNUNET_NO); | ||
519 | if (GNUNET_SCHEDULER_NO_TASK != ts->destroy_task) | ||
520 | { | ||
521 | GNUNET_SCHEDULER_cancel (ts->destroy_task); | ||
522 | ts->destroy_task = GNUNET_SCHEDULER_NO_TASK; | ||
523 | } | ||
524 | while (NULL != (tnq = ts->tmq_head)) | ||
525 | { | ||
526 | GNUNET_CONTAINER_DLL_remove (ts->tmq_head, | ||
527 | ts->tmq_tail, | ||
528 | tnq); | ||
529 | ts->tmq_length--; | ||
530 | GNUNET_free (tnq); | ||
531 | } | ||
532 | GNUNET_assert (0 == ts->tmq_length); | ||
533 | if (NULL != ts->client) | ||
534 | { | ||
535 | GNUNET_SERVER_client_drop (ts->client); | ||
536 | ts->client = NULL; | ||
537 | } | ||
538 | if (NULL != ts->th) | ||
539 | { | ||
540 | GNUNET_MESH_notify_transmit_ready_cancel (ts->th); | ||
541 | ts->th = NULL; | ||
542 | } | ||
543 | GNUNET_assert (NULL == ts->destination.heap_node); | ||
544 | if (NULL != (tunnel = ts->tunnel)) | ||
545 | { | ||
546 | ts->tunnel = NULL; | ||
547 | GNUNET_MESH_tunnel_destroy (tunnel); | ||
548 | } | ||
549 | if (NULL != ts->heap_node) | ||
550 | { | ||
551 | GNUNET_CONTAINER_heap_remove_node (ts->heap_node); | ||
552 | ts->heap_node = NULL; | ||
553 | get_tunnel_key_from_ips (ts->af, | ||
554 | ts->protocol, | ||
555 | &ts->source_ip, | ||
556 | ts->source_port, | ||
557 | &ts->destination_ip, | ||
558 | ts->destination_port, | ||
559 | &key); | ||
560 | GNUNET_assert (GNUNET_YES == | ||
561 | GNUNET_CONTAINER_multihashmap_remove (tunnel_map, | ||
562 | &key, | ||
563 | ts)); | ||
564 | } | ||
565 | if (NULL != ts->destination_container) | ||
566 | { | ||
567 | GNUNET_assert (ts == ts->destination_container->ts); | ||
568 | ts->destination_container->ts = NULL; | ||
569 | ts->destination_container = NULL; | ||
570 | } | ||
571 | GNUNET_free (ts); | ||
572 | } | ||
573 | |||
574 | |||
575 | /** | ||
503 | * Destroy the mesh tunnel. | 576 | * Destroy the mesh tunnel. |
504 | * | 577 | * |
505 | * @param cls the 'struct TunnelState' with the tunnel to destroy | 578 | * @param cls the 'struct TunnelState' with the tunnel to destroy |
@@ -513,10 +586,11 @@ destroy_tunnel_task (void *cls, | |||
513 | struct GNUNET_MESH_Tunnel *tunnel; | 586 | struct GNUNET_MESH_Tunnel *tunnel; |
514 | 587 | ||
515 | ts->destroy_task = GNUNET_SCHEDULER_NO_TASK; | 588 | ts->destroy_task = GNUNET_SCHEDULER_NO_TASK; |
516 | if (NULL == (tunnel = ts->tunnel)) | 589 | GNUNET_assert (NULL != ts->tunnel); |
517 | return; | 590 | tunnel = ts->tunnel; |
518 | ts->tunnel = NULL; | 591 | ts->tunnel = NULL; |
519 | GNUNET_MESH_tunnel_destroy (tunnel); | 592 | GNUNET_MESH_tunnel_destroy (tunnel); |
593 | free_tunnel_state (ts); | ||
520 | } | 594 | } |
521 | 595 | ||
522 | 596 | ||
@@ -764,79 +838,6 @@ create_tunnel_to_destination (struct DestinationEntry *de, | |||
764 | 838 | ||
765 | 839 | ||
766 | /** | 840 | /** |
767 | * Free resources associated with a tunnel state. | ||
768 | * | ||
769 | * @param ts state to free | ||
770 | */ | ||
771 | static void | ||
772 | free_tunnel_state (struct TunnelState *ts) | ||
773 | { | ||
774 | GNUNET_HashCode key; | ||
775 | struct TunnelMessageQueueEntry *tnq; | ||
776 | struct GNUNET_MESH_Tunnel *tunnel; | ||
777 | |||
778 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
779 | "Cleaning up tunnel state\n"); | ||
780 | GNUNET_STATISTICS_update (stats, | ||
781 | gettext_noop ("# Active tunnels"), | ||
782 | -1, GNUNET_NO); | ||
783 | if (GNUNET_SCHEDULER_NO_TASK != ts->destroy_task) | ||
784 | { | ||
785 | GNUNET_SCHEDULER_cancel (ts->destroy_task); | ||
786 | ts->destroy_task = GNUNET_SCHEDULER_NO_TASK; | ||
787 | } | ||
788 | while (NULL != (tnq = ts->tmq_head)) | ||
789 | { | ||
790 | GNUNET_CONTAINER_DLL_remove (ts->tmq_head, | ||
791 | ts->tmq_tail, | ||
792 | tnq); | ||
793 | ts->tmq_length--; | ||
794 | GNUNET_free (tnq); | ||
795 | } | ||
796 | GNUNET_assert (0 == ts->tmq_length); | ||
797 | if (NULL != ts->client) | ||
798 | { | ||
799 | GNUNET_SERVER_client_drop (ts->client); | ||
800 | ts->client = NULL; | ||
801 | } | ||
802 | if (NULL != ts->th) | ||
803 | { | ||
804 | GNUNET_MESH_notify_transmit_ready_cancel (ts->th); | ||
805 | ts->th = NULL; | ||
806 | } | ||
807 | GNUNET_assert (NULL == ts->destination.heap_node); | ||
808 | if (NULL != (tunnel = ts->tunnel)) | ||
809 | { | ||
810 | ts->tunnel = NULL; | ||
811 | GNUNET_MESH_tunnel_destroy (tunnel); | ||
812 | } | ||
813 | if (NULL != ts->heap_node) | ||
814 | { | ||
815 | GNUNET_CONTAINER_heap_remove_node (ts->heap_node); | ||
816 | ts->heap_node = NULL; | ||
817 | get_tunnel_key_from_ips (ts->af, | ||
818 | ts->protocol, | ||
819 | &ts->source_ip, | ||
820 | ts->source_port, | ||
821 | &ts->destination_ip, | ||
822 | ts->destination_port, | ||
823 | &key); | ||
824 | GNUNET_assert (GNUNET_YES == | ||
825 | GNUNET_CONTAINER_multihashmap_remove (tunnel_map, | ||
826 | &key, | ||
827 | ts)); | ||
828 | } | ||
829 | if (NULL != ts->destination_container) | ||
830 | { | ||
831 | GNUNET_assert (ts == ts->destination_container->ts); | ||
832 | ts->destination_container->ts = NULL; | ||
833 | ts->destination_container = NULL; | ||
834 | } | ||
835 | GNUNET_free (ts); | ||
836 | } | ||
837 | |||
838 | |||
839 | /** | ||
840 | * We have too many active tunnels. Clean up the oldest tunnel. | 841 | * We have too many active tunnels. Clean up the oldest tunnel. |
841 | * | 842 | * |
842 | * @param except tunnel that must NOT be cleaned up, even if it is the oldest | 843 | * @param except tunnel that must NOT be cleaned up, even if it is the oldest |