aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorPhilipp Tölke <toelke@in.tum.de>2011-04-10 21:36:22 +0000
committerPhilipp Tölke <toelke@in.tum.de>2011-04-10 21:36:22 +0000
commit9898b0cbe6b15c3b1ae1264011f7d5375ab5247c (patch)
treea09710c0788767a09e17d3cd3fde37a003db28a3 /src/vpn
parent5ed2894503fb9fcd11ada7fc5f1bef77639d1b3e (diff)
downloadgnunet-9898b0cbe6b15c3b1ae1264011f7d5375ab5247c.tar.gz
gnunet-9898b0cbe6b15c3b1ae1264011f7d5375ab5247c.zip
indent
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/gnunet-daemon-exit.c62
1 files changed, 29 insertions, 33 deletions
diff --git a/src/vpn/gnunet-daemon-exit.c b/src/vpn/gnunet-daemon-exit.c
index 038904f11..e154f4c6a 100644
--- a/src/vpn/gnunet-daemon-exit.c
+++ b/src/vpn/gnunet-daemon-exit.c
@@ -247,9 +247,9 @@ udp_from_helper (struct udp_pkt *udp, unsigned char *dadr, size_t addrlen,
247 42, 247 42,
248 GNUNET_TIME_relative_divide 248 GNUNET_TIME_relative_divide
249 (GNUNET_CONSTANTS_MAX_CORK_DELAY, 2), 249 (GNUNET_CONSTANTS_MAX_CORK_DELAY, 2),
250 (const struct GNUNET_PeerIdentity *)NULL, 250 (const struct GNUNET_PeerIdentity *)
251 len, send_udp_to_peer_notify_callback, 251 NULL, len,
252 msg); 252 send_udp_to_peer_notify_callback, msg);
253} 253}
254 254
255/** 255/**
@@ -757,17 +757,17 @@ static int
757receive_tcp_service (void *cls, 757receive_tcp_service (void *cls,
758 struct GNUNET_MESH_Tunnel *tunnel, 758 struct GNUNET_MESH_Tunnel *tunnel,
759 void **tunnel_ctx, 759 void **tunnel_ctx,
760 const struct GNUNET_PeerIdentity *sender, 760 const struct GNUNET_PeerIdentity *sender,
761 const struct GNUNET_MessageHeader *message, 761 const struct GNUNET_MessageHeader *message,
762 const struct GNUNET_TRANSPORT_ATS_Information *atsi) 762 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
763{ 763{
764 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received TCP-Packet\n"); 764 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received TCP-Packet\n");
765 GNUNET_HashCode hash; 765 GNUNET_HashCode hash;
766 GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); 766 GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
767 struct tcp_pkt *pkt = (struct tcp_pkt *) (desc + 1); 767 struct tcp_pkt *pkt = (struct tcp_pkt *) (desc + 1);
768 unsigned int pkt_len = ntohs(message->size) - sizeof (struct 768 unsigned int pkt_len = ntohs (message->size) - sizeof (struct
769 GNUNET_MessageHeader) - 769 GNUNET_MessageHeader)
770 sizeof(GNUNET_HashCode); 770 - sizeof (GNUNET_HashCode);
771 771
772 /** Get the configuration from the services-hashmap. 772 /** Get the configuration from the services-hashmap.
773 * 773 *
@@ -783,8 +783,8 @@ receive_tcp_service (void *cls,
783 GNUNET_CONTAINER_multihashmap_get (tcp_services, &hash); 783 GNUNET_CONTAINER_multihashmap_get (tcp_services, &hash);
784 if (NULL == serv) 784 if (NULL == serv)
785 { 785 {
786 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "No service found for TCP dpt %d!\n", 786 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
787 *tcp_desc); 787 "No service found for TCP dpt %d!\n", *tcp_desc);
788 return GNUNET_YES; 788 return GNUNET_YES;
789 } 789 }
790 790
@@ -801,7 +801,8 @@ receive_tcp_service (void *cls,
801 * This will be saved in the hashmap, so that the receiving procedure knows 801 * This will be saved in the hashmap, so that the receiving procedure knows
802 * through which tunnel this connection has to be routed. 802 * through which tunnel this connection has to be routed.
803 */ 803 */
804 struct redirect_state *state = GNUNET_malloc (sizeof (struct redirect_state)); 804 struct redirect_state *state =
805 GNUNET_malloc (sizeof (struct redirect_state));
805 memset (state, 0, sizeof (struct redirect_state)); 806 memset (state, 0, sizeof (struct redirect_state));
806 state->tunnel = tunnel; 807 state->tunnel = tunnel;
807 state->serv = serv; 808 state->serv = serv;
@@ -816,12 +817,12 @@ receive_tcp_service (void *cls,
816 switch (serv->version) 817 switch (serv->version)
817 { 818 {
818 case 4: 819 case 4:
819 prepare_ipv4_packet (len, pkt_len, pkt, 0x06, /* TCP */ 820 prepare_ipv4_packet (len, pkt_len, pkt, 0x06, /* TCP */
820 &serv->v4.ip4address, 821 &serv->v4.ip4address,
821 tunnel, state, (struct ip_pkt *) buf); 822 tunnel, state, (struct ip_pkt *) buf);
822 break; 823 break;
823 case 6: 824 case 6:
824 prepare_ipv6_packet (len, pkt_len, pkt, 0x06, /* TCP */ 825 prepare_ipv6_packet (len, pkt_len, pkt, 0x06, /* TCP */
825 &serv->v6.ip6address, 826 &serv->v6.ip6address,
826 tunnel, state, (struct ip6_pkt *) buf); 827 tunnel, state, (struct ip6_pkt *) buf);
827 828
@@ -853,7 +854,7 @@ static int
853receive_udp_service (void *cls, 854receive_udp_service (void *cls,
854 struct GNUNET_MESH_Tunnel *tunnel, 855 struct GNUNET_MESH_Tunnel *tunnel,
855 void **tunnel_ctx, 856 void **tunnel_ctx,
856 const struct GNUNET_PeerIdentity *sender, 857 const struct GNUNET_PeerIdentity *sender,
857 const struct GNUNET_MessageHeader *message, 858 const struct GNUNET_MessageHeader *message,
858 const struct GNUNET_TRANSPORT_ATS_Information *atsi) 859 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
859{ 860{
@@ -875,8 +876,8 @@ receive_udp_service (void *cls,
875 GNUNET_CONTAINER_multihashmap_get (udp_services, &hash); 876 GNUNET_CONTAINER_multihashmap_get (udp_services, &hash);
876 if (NULL == serv) 877 if (NULL == serv)
877 { 878 {
878 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "No service found for UDP dpt %d!\n", 879 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
879 *udp_desc); 880 "No service found for UDP dpt %d!\n", *udp_desc);
880 return GNUNET_YES; 881 return GNUNET_YES;
881 } 882 }
882 883
@@ -949,19 +950,14 @@ receive_udp_service (void *cls,
949static void 950static void
950run (void *cls, 951run (void *cls,
951 char *const *args, 952 char *const *args,
952 const char *cfgfile, 953 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg_)
953 const struct GNUNET_CONFIGURATION_Handle *cfg_)
954{ 954{
955 const static struct GNUNET_MESH_MessageHandler handlers[] = { 955 const static struct GNUNET_MESH_MessageHandler handlers[] = {
956 {receive_udp_service, GNUNET_MESSAGE_TYPE_SERVICE_UDP, 0}, 956 {receive_udp_service, GNUNET_MESSAGE_TYPE_SERVICE_UDP, 0},
957 {receive_tcp_service, GNUNET_MESSAGE_TYPE_SERVICE_TCP, 0}, 957 {receive_tcp_service, GNUNET_MESSAGE_TYPE_SERVICE_TCP, 0},
958 {NULL, 0, 0} 958 {NULL, 0, 0}
959 }; 959 };
960 mesh_handle = GNUNET_MESH_connect(cfg_, 960 mesh_handle = GNUNET_MESH_connect (cfg_, NULL, NULL, handlers, NULL);
961 NULL,
962 NULL,
963 handlers,
964 NULL);
965 961
966 cfg = cfg_; 962 cfg = cfg_;
967 udp_connections = GNUNET_CONTAINER_multihashmap_create(65536); 963 udp_connections = GNUNET_CONTAINER_multihashmap_create(65536);
@@ -970,18 +966,18 @@ run (void *cls,
970 tcp_services = GNUNET_CONTAINER_multihashmap_create(65536); 966 tcp_services = GNUNET_CONTAINER_multihashmap_create(65536);
971 967
972 char *services; 968 char *services;
973 GNUNET_CONFIGURATION_get_value_filename(cfg, "dns", "SERVICES", &services); 969 GNUNET_CONFIGURATION_get_value_filename (cfg, "dns", "SERVICES", &services);
974 servicecfg = GNUNET_CONFIGURATION_create(); 970 servicecfg = GNUNET_CONFIGURATION_create ();
975 if (GNUNET_OK == GNUNET_CONFIGURATION_parse(servicecfg, services)) 971 if (GNUNET_OK == GNUNET_CONFIGURATION_parse (servicecfg, services))
976 { 972 {
977 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Parsing services %s\n", services); 973 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Parsing services %s\n", services);
978 GNUNET_CONFIGURATION_iterate(servicecfg, read_service_conf, NULL); 974 GNUNET_CONFIGURATION_iterate (servicecfg, read_service_conf, NULL);
979 } 975 }
980 if (NULL != services) 976 if (NULL != services)
981 GNUNET_free(services); 977 GNUNET_free (services);
982 978
983 GNUNET_SCHEDULER_add_now (start_helper_and_schedule, NULL); 979 GNUNET_SCHEDULER_add_now (start_helper_and_schedule, NULL);
984 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); 980 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls);
985} 981}
986 982
987/** 983/**