diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/vpn/gnunet-daemon-vpn.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/vpn/gnunet-daemon-vpn.c')
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.c | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 3673b72c6..301ba90be 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c | |||
@@ -332,8 +332,7 @@ port_in_ports (uint64_t ports, uint16_t port) | |||
332 | } | 332 | } |
333 | 333 | ||
334 | void | 334 | void |
335 | send_pkt_to_peer (void *cls, | 335 | send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer, |
336 | const struct GNUNET_PeerIdentity *peer, | ||
337 | const struct GNUNET_TRANSPORT_ATS_Information *atsi | 336 | const struct GNUNET_TRANSPORT_ATS_Information *atsi |
338 | __attribute__ ((unused))) | 337 | __attribute__ ((unused))) |
339 | { | 338 | { |
@@ -429,8 +428,8 @@ new_ip6addr_remote (unsigned char *buf, unsigned char *addr, char addrlen) | |||
429 | unsigned long long ipv6prefix; | 428 | unsigned long long ipv6prefix; |
430 | 429 | ||
431 | GNUNET_assert (GNUNET_OK == | 430 | GNUNET_assert (GNUNET_OK == |
432 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", | 431 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", "IPV6ADDR", |
433 | "IPV6ADDR", &ipv6addr)); | 432 | &ipv6addr)); |
434 | GNUNET_assert (GNUNET_OK == | 433 | GNUNET_assert (GNUNET_OK == |
435 | GNUNET_CONFIGURATION_get_value_number (cfg, "vpn", | 434 | GNUNET_CONFIGURATION_get_value_number (cfg, "vpn", |
436 | "IPV6PREFIX", | 435 | "IPV6PREFIX", |
@@ -458,11 +457,11 @@ new_ip4addr_remote (unsigned char *buf, unsigned char *addr, char addrlen) | |||
458 | char *ipv4mask; | 457 | char *ipv4mask; |
459 | 458 | ||
460 | GNUNET_assert (GNUNET_OK == | 459 | GNUNET_assert (GNUNET_OK == |
461 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", | 460 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", "IPV4ADDR", |
462 | "IPV4ADDR", &ipv4addr)); | 461 | &ipv4addr)); |
463 | GNUNET_assert (GNUNET_OK == | 462 | GNUNET_assert (GNUNET_OK == |
464 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", | 463 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", "IPV4MASK", |
465 | "IPV4MASK", &ipv4mask)); | 464 | &ipv4mask)); |
466 | uint32_t mask; | 465 | uint32_t mask; |
467 | 466 | ||
468 | inet_pton (AF_INET, ipv4addr, buf); | 467 | inet_pton (AF_INET, ipv4addr, buf); |
@@ -568,9 +567,9 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
568 | GNUNET_CONTAINER_multihashmap_put (hashmap, &key, value, | 567 | GNUNET_CONTAINER_multihashmap_put (hashmap, &key, value, |
569 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 568 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
570 | 569 | ||
571 | value->heap_node = GNUNET_CONTAINER_heap_insert (heap, value, | 570 | value->heap_node = |
572 | GNUNET_TIME_absolute_get | 571 | GNUNET_CONTAINER_heap_insert (heap, value, |
573 | ().abs_value); | 572 | GNUNET_TIME_absolute_get ().abs_value); |
574 | if (GNUNET_CONTAINER_heap_get_size (heap) > max_mappings) | 573 | if (GNUNET_CONTAINER_heap_get_size (heap) > max_mappings) |
575 | GNUNET_SCHEDULER_add_now (collect_mappings, NULL); | 574 | GNUNET_SCHEDULER_add_now (collect_mappings, NULL); |
576 | } | 575 | } |
@@ -696,9 +695,9 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
696 | { | 695 | { |
697 | GNUNET_CONTAINER_multihashmap_put (hashmap, &key, value, | 696 | GNUNET_CONTAINER_multihashmap_put (hashmap, &key, value, |
698 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 697 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
699 | value->heap_node = GNUNET_CONTAINER_heap_insert (heap, value, | 698 | value->heap_node = |
700 | GNUNET_TIME_absolute_get | 699 | GNUNET_CONTAINER_heap_insert (heap, value, |
701 | ().abs_value); | 700 | GNUNET_TIME_absolute_get ().abs_value); |
702 | if (GNUNET_CONTAINER_heap_get_size (heap) > max_mappings) | 701 | if (GNUNET_CONTAINER_heap_get_size (heap) > max_mappings) |
703 | GNUNET_SCHEDULER_add_now (collect_mappings, NULL); | 702 | GNUNET_SCHEDULER_add_now (collect_mappings, NULL); |
704 | } | 703 | } |
@@ -722,8 +721,8 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
722 | unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset); | 721 | unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset); |
723 | 722 | ||
724 | new_ip4addr_remote (c, pkt->addr, pkt->addrsize); | 723 | new_ip4addr_remote (c, pkt->addr, pkt->addrsize); |
725 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New mapping to %d.%d.%d.%d\n", | 724 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New mapping to %d.%d.%d.%d\n", c[0], |
726 | c[0], c[1], c[2], c[3]); | 725 | c[1], c[2], c[3]); |
727 | unsigned char *k = (unsigned char *) &key; | 726 | unsigned char *k = (unsigned char *) &key; |
728 | 727 | ||
729 | /* | 728 | /* |
@@ -755,9 +754,9 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
755 | { | 754 | { |
756 | GNUNET_CONTAINER_multihashmap_put (hashmap, &key, value, | 755 | GNUNET_CONTAINER_multihashmap_put (hashmap, &key, value, |
757 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 756 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
758 | value->heap_node = GNUNET_CONTAINER_heap_insert (heap, value, | 757 | value->heap_node = |
759 | GNUNET_TIME_absolute_get | 758 | GNUNET_CONTAINER_heap_insert (heap, value, |
760 | ().abs_value); | 759 | GNUNET_TIME_absolute_get ().abs_value); |
761 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 760 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
762 | "Mapping is saved in the hashmap with key %08x.\n", | 761 | "Mapping is saved in the hashmap with key %08x.\n", |
763 | *((uint32_t *) (&key))); | 762 | *((uint32_t *) (&key))); |
@@ -860,7 +859,8 @@ add_additional_port (struct map_entry *me, uint16_t port) | |||
860 | static int | 859 | static int |
861 | receive_udp_back (void *cls | 860 | receive_udp_back (void *cls |
862 | __attribute__ ((unused)), struct GNUNET_MESH_Tunnel *tunnel, | 861 | __attribute__ ((unused)), struct GNUNET_MESH_Tunnel *tunnel, |
863 | void **tunnel_ctx __attribute__ ((unused)), | 862 | void **tunnel_ctx |
863 | __attribute__ ((unused)), | ||
864 | const struct GNUNET_PeerIdentity *sender | 864 | const struct GNUNET_PeerIdentity *sender |
865 | __attribute__ ((unused)), | 865 | __attribute__ ((unused)), |
866 | const struct GNUNET_MessageHeader *message, | 866 | const struct GNUNET_MessageHeader *message, |
@@ -931,8 +931,8 @@ receive_udp_back (void *cls | |||
931 | GNUNET_assert (me != NULL); | 931 | GNUNET_assert (me != NULL); |
932 | if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK) | 932 | if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK) |
933 | { | 933 | { |
934 | GNUNET_assert (me->desc. | 934 | GNUNET_assert (me-> |
935 | service_type & htonl (GNUNET_DNS_SERVICE_TYPE_UDP)); | 935 | desc.service_type & htonl (GNUNET_DNS_SERVICE_TYPE_UDP)); |
936 | if (!port_in_ports (me->desc.ports, pkt6->udp_hdr.spt) && | 936 | if (!port_in_ports (me->desc.ports, pkt6->udp_hdr.spt) && |
937 | !testBit (me->additional_ports, ntohs (pkt6->udp_hdr.spt))) | 937 | !testBit (me->additional_ports, ntohs (pkt6->udp_hdr.spt))) |
938 | { | 938 | { |
@@ -1109,8 +1109,8 @@ receive_tcp_back (void *cls | |||
1109 | 1109 | ||
1110 | GNUNET_assert (me != NULL); | 1110 | GNUNET_assert (me != NULL); |
1111 | if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK) | 1111 | if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK) |
1112 | GNUNET_assert (me->desc. | 1112 | GNUNET_assert (me-> |
1113 | service_type & htonl (GNUNET_DNS_SERVICE_TYPE_TCP)); | 1113 | desc.service_type & htonl (GNUNET_DNS_SERVICE_TYPE_TCP)); |
1114 | 1114 | ||
1115 | pkt6->tcp_hdr.crc = 0; | 1115 | pkt6->tcp_hdr.crc = 0; |
1116 | uint32_t sum = 0; | 1116 | uint32_t sum = 0; |
@@ -1228,10 +1228,8 @@ receive_tcp_back (void *cls | |||
1228 | * @param cfg_ configuration | 1228 | * @param cfg_ configuration |
1229 | */ | 1229 | */ |
1230 | static void | 1230 | static void |
1231 | run (void *cls, | 1231 | run (void *cls, char *const *args __attribute__ ((unused)), const char *cfgfilep |
1232 | char *const *args __attribute__ ((unused)), | 1232 | __attribute__ ((unused)), const struct GNUNET_CONFIGURATION_Handle *cfg_) |
1233 | const char *cfgfilep __attribute__ ((unused)), | ||
1234 | const struct GNUNET_CONFIGURATION_Handle *cfg_) | ||
1235 | { | 1233 | { |
1236 | static const struct GNUNET_MESH_MessageHandler handlers[] = { | 1234 | static const struct GNUNET_MESH_MessageHandler handlers[] = { |
1237 | {receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK, 0}, | 1235 | {receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK, 0}, |
@@ -1274,10 +1272,7 @@ main (int argc, char *const *argv) | |||
1274 | }; | 1272 | }; |
1275 | 1273 | ||
1276 | return (GNUNET_OK == | 1274 | return (GNUNET_OK == |
1277 | GNUNET_PROGRAM_run (argc, | 1275 | GNUNET_PROGRAM_run (argc, argv, "vpn", gettext_noop ("help text"), |
1278 | argv, | ||
1279 | "vpn", | ||
1280 | gettext_noop ("help text"), | ||
1281 | options, &run, NULL)) ? ret : 1; | 1276 | options, &run, NULL)) ? ret : 1; |
1282 | } | 1277 | } |
1283 | 1278 | ||