aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-16 16:03:20 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-16 16:03:20 +0000
commit16a6919a9f98ee9fa1fee9dd262906c321004a19 (patch)
treee09d4fe5191dc329b3e1b667f2914f8313bcba59 /src/vpn
parent4d7904c62bb867c44e90b8e9f7cdbb4b283abc44 (diff)
downloadgnunet-16a6919a9f98ee9fa1fee9dd262906c321004a19.tar.gz
gnunet-16a6919a9f98ee9fa1fee9dd262906c321004a19.zip
even nicer indentation, thanks to LRN's indent patch
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/gnunet-daemon-vpn-dns.h11
-rw-r--r--src/vpn/gnunet-daemon-vpn-helper.c6
-rw-r--r--src/vpn/gnunet-daemon-vpn-helper.h28
-rw-r--r--src/vpn/gnunet-daemon-vpn.c8
-rw-r--r--src/vpn/gnunet-daemon-vpn.h38
-rw-r--r--src/vpn/gnunet-dns-parser.h6
-rw-r--r--src/vpn/gnunet-helper-vpn-api.h18
-rw-r--r--src/vpn/gnunet-service-dns.c4
-rw-r--r--src/vpn/gnunet-vpn-checksum.h9
9 files changed, 72 insertions, 56 deletions
diff --git a/src/vpn/gnunet-daemon-vpn-dns.h b/src/vpn/gnunet-daemon-vpn-dns.h
index 2882969e5..0cd0d8b26 100644
--- a/src/vpn/gnunet-daemon-vpn-dns.h
+++ b/src/vpn/gnunet-daemon-vpn-dns.h
@@ -40,19 +40,22 @@ extern struct query_packet_list *tail;
40 * Callback called by notify_transmit_ready; sends dns-queries or rehijack-messages 40 * Callback called by notify_transmit_ready; sends dns-queries or rehijack-messages
41 * to the service-dns 41 * to the service-dns
42 */ 42 */
43size_t send_query (void *cls, size_t size, void *buf); 43size_t
44send_query (void *cls, size_t size, void *buf);
44 45
45/** 46/**
46 * Connect to the service-dns 47 * Connect to the service-dns
47 */ 48 */
48void connect_to_service_dns (void *cls, 49void
49 const struct GNUNET_SCHEDULER_TaskContext *tc); 50connect_to_service_dns (void *cls,
51 const struct GNUNET_SCHEDULER_TaskContext *tc);
50 52
51/** 53/**
52 * This receives packets from the service-dns and schedules process_answer to 54 * This receives packets from the service-dns and schedules process_answer to
53 * handle it 55 * handle it
54 */ 56 */
55void dns_answer_handler (void *cls, const struct GNUNET_MessageHeader *msg); 57void
58dns_answer_handler (void *cls, const struct GNUNET_MessageHeader *msg);
56 59
57/** 60/**
58 * The connection to the service-dns 61 * The connection to the service-dns
diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c
index 71fdefc0a..ef2833f87 100644
--- a/src/vpn/gnunet-daemon-vpn-helper.c
+++ b/src/vpn/gnunet-daemon-vpn-helper.c
@@ -497,9 +497,9 @@ message_token (void *cls __attribute__ ((unused)), void *client
497 497
498 } 498 }
499 else if (0x06 == pkt->ip_hdr.proto && 499 else if (0x06 == pkt->ip_hdr.proto &&
500 (me->desc. 500 (me->
501 service_type & htonl (GNUNET_DNS_SERVICE_TYPE_TCP)) && 501 desc.service_type & htonl (GNUNET_DNS_SERVICE_TYPE_TCP))
502 (port_in_ports (me->desc.ports, pkt_tcp->tcp_hdr.dpt))) 502 && (port_in_ports (me->desc.ports, pkt_tcp->tcp_hdr.dpt)))
503 { 503 {
504 hdr->type = ntohs (GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP); 504 hdr->type = ntohs (GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP);
505 505
diff --git a/src/vpn/gnunet-daemon-vpn-helper.h b/src/vpn/gnunet-daemon-vpn-helper.h
index 8e0ee5a0f..7329e45ff 100644
--- a/src/vpn/gnunet-daemon-vpn-helper.h
+++ b/src/vpn/gnunet-daemon-vpn-helper.h
@@ -38,35 +38,39 @@ extern GNUNET_SCHEDULER_TaskIdentifier shs_task;
38/** 38/**
39 * Start the helper-process 39 * Start the helper-process
40 */ 40 */
41void start_helper_and_schedule (void *cls, 41void
42 const struct GNUNET_SCHEDULER_TaskContext *tc); 42start_helper_and_schedule (void *cls,
43 const struct GNUNET_SCHEDULER_TaskContext *tc);
43 44
44/** 45/**
45 * Restart the helper-process 46 * Restart the helper-process
46 */ 47 */
47void restart_helper (void *cls, 48void
48 const struct GNUNET_SCHEDULER_TaskContext *tskctx); 49restart_helper (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tskctx);
49 50
50/** 51/**
51 * Read from the helper-process 52 * Read from the helper-process
52 */ 53 */
53void helper_read (void *cls, 54void
54 const struct GNUNET_SCHEDULER_TaskContext *tsdkctx); 55helper_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tsdkctx);
55 56
56/** 57/**
57 * Send an dns-answer-packet to the helper 58 * Send an dns-answer-packet to the helper
58 */ 59 */
59void helper_write (void *cls, 60void
60 const struct GNUNET_SCHEDULER_TaskContext *tsdkctx); 61helper_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tsdkctx);
61 62
62/** 63/**
63 * Receive packets from the helper-process 64 * Receive packets from the helper-process
64 */ 65 */
65void message_token (void *cls, void *client, 66void
66 const struct GNUNET_MessageHeader *message); 67message_token (void *cls, void *client,
68 const struct GNUNET_MessageHeader *message);
67 69
68void write_to_helper (void *buf, size_t len); 70void
71write_to_helper (void *buf, size_t len);
69 72
70void schedule_helper_write (struct GNUNET_TIME_Relative, void *cls); 73void
74schedule_helper_write (struct GNUNET_TIME_Relative, void *cls);
71 75
72#endif /* end of include guard: GNUNET-DAEMON-VPN-HELPER_H */ 76#endif /* end of include guard: GNUNET-DAEMON-VPN-HELPER_H */
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c
index 301ba90be..06cade482 100644
--- a/src/vpn/gnunet-daemon-vpn.c
+++ b/src/vpn/gnunet-daemon-vpn.c
@@ -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-> 934 GNUNET_assert (me->desc.
935 desc.service_type & htonl (GNUNET_DNS_SERVICE_TYPE_UDP)); 935 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-> 1112 GNUNET_assert (me->desc.
1113 desc.service_type & htonl (GNUNET_DNS_SERVICE_TYPE_TCP)); 1113 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;
diff --git a/src/vpn/gnunet-daemon-vpn.h b/src/vpn/gnunet-daemon-vpn.h
index 4f4cf5a0f..701a88d63 100644
--- a/src/vpn/gnunet-daemon-vpn.h
+++ b/src/vpn/gnunet-daemon-vpn.h
@@ -35,23 +35,28 @@
35 * At the moment this means "inventing" and IPv6-Address for .gnunet-services and 35 * At the moment this means "inventing" and IPv6-Address for .gnunet-services and
36 * doing nothing for "real" services. 36 * doing nothing for "real" services.
37 */ 37 */
38void process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 38void
39process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
39 40
40void send_icmp6_response (void *cls, 41void
41 const struct GNUNET_SCHEDULER_TaskContext *tc); 42send_icmp6_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
42void send_icmp4_response (void *cls, 43void
43 const struct GNUNET_SCHEDULER_TaskContext *tc); 44send_icmp4_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
44 45
45size_t send_udp_service (void *cls, size_t size, 46size_t
46 void *buf); 47send_udp_service (void *cls, size_t size, void *buf);
47 48
48GNUNET_HashCode *address6_mapping_exists (unsigned char addr[]); 49GNUNET_HashCode *
49GNUNET_HashCode *address4_mapping_exists (uint32_t addr); 50address6_mapping_exists (unsigned char addr[]);
51GNUNET_HashCode *
52address4_mapping_exists (uint32_t addr);
50 53
51unsigned int port_in_ports (uint64_t ports, uint16_t port); 54unsigned int
55port_in_ports (uint64_t ports, uint16_t port);
52 56
53void send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer, 57void
54 const struct GNUNET_TRANSPORT_ATS_Information *atsi); 58send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer,
59 const struct GNUNET_TRANSPORT_ATS_Information *atsi);
55 60
56/** 61/**
57 * The configuration to use 62 * The configuration to use
@@ -94,7 +99,8 @@ struct map_entry
94 * @param bitArray memory area to set the bit in 99 * @param bitArray memory area to set the bit in
95 * @param bitIdx which bit to set 100 * @param bitIdx which bit to set
96 */ 101 */
97void setBit (char *bitArray, unsigned int bitIdx); 102void
103setBit (char *bitArray, unsigned int bitIdx);
98 104
99/** 105/**
100 * Clears a bit from bitArray. 106 * Clears a bit from bitArray.
@@ -102,7 +108,8 @@ void setBit (char *bitArray, unsigned int bitIdx);
102 * @param bitArray memory area to set the bit in 108 * @param bitArray memory area to set the bit in
103 * @param bitIdx which bit to unset 109 * @param bitIdx which bit to unset
104 */ 110 */
105void clearBit (char *bitArray, unsigned int bitIdx); 111void
112clearBit (char *bitArray, unsigned int bitIdx);
106 113
107/** 114/**
108 * Checks if a bit is active in the bitArray 115 * Checks if a bit is active in the bitArray
@@ -111,7 +118,8 @@ void clearBit (char *bitArray, unsigned int bitIdx);
111 * @param bitIdx which bit to test 118 * @param bitIdx which bit to test
112 * @return GNUNET_YES if the bit is set, GNUNET_NO if not. 119 * @return GNUNET_YES if the bit is set, GNUNET_NO if not.
113 */ 120 */
114int testBit (char *bitArray, unsigned int bitIdx); 121int
122testBit (char *bitArray, unsigned int bitIdx);
115 123
116struct remote_addr 124struct remote_addr
117{ 125{
diff --git a/src/vpn/gnunet-dns-parser.h b/src/vpn/gnunet-dns-parser.h
index cf9d55e8a..70a1e4b9e 100644
--- a/src/vpn/gnunet-dns-parser.h
+++ b/src/vpn/gnunet-dns-parser.h
@@ -4,8 +4,10 @@
4#include "platform.h" 4#include "platform.h"
5#include "gnunet-vpn-packet.h" 5#include "gnunet-vpn-packet.h"
6 6
7struct dns_pkt_parsed *parse_dns_packet (struct dns_pkt *pkt); 7struct dns_pkt_parsed *
8parse_dns_packet (struct dns_pkt *pkt);
8 9
9void free_parsed_dns_packet (struct dns_pkt_parsed *ppkt); 10void
11free_parsed_dns_packet (struct dns_pkt_parsed *ppkt);
10 12
11#endif 13#endif
diff --git a/src/vpn/gnunet-helper-vpn-api.h b/src/vpn/gnunet-helper-vpn-api.h
index 4e8f76611..964beb23c 100644
--- a/src/vpn/gnunet-helper-vpn-api.h
+++ b/src/vpn/gnunet-helper-vpn-api.h
@@ -95,20 +95,16 @@ struct GNUNET_VPN_HELPER_Handle
95 * 95 *
96 * @return A pointer to the new Handle, NULL on error 96 * @return A pointer to the new Handle, NULL on error
97 */ 97 */
98struct GNUNET_VPN_HELPER_Handle *start_helper (const char *ifname, 98struct GNUNET_VPN_HELPER_Handle *
99 const char *ipv6addr, 99start_helper (const char *ifname, const char *ipv6addr, const char *ipv6prefix,
100 const char *ipv6prefix, 100 const char *ipv4addr, const char *ipv4mask,
101 const char *ipv4addr, 101 const char *process_name, GNUNET_SCHEDULER_Task restart_task,
102 const char *ipv4mask, 102 GNUNET_SERVER_MessageTokenizerCallback cb, void *cb_cls);
103 const char *process_name,
104 GNUNET_SCHEDULER_Task
105 restart_task,
106 GNUNET_SERVER_MessageTokenizerCallback
107 cb, void *cb_cls);
108 103
109/** 104/**
110 * @brief Kills the helper, closes the pipe and free()s the handle 105 * @brief Kills the helper, closes the pipe and free()s the handle
111 */ 106 */
112void cleanup_helper (struct GNUNET_VPN_HELPER_Handle *); 107void
108cleanup_helper (struct GNUNET_VPN_HELPER_Handle *);
113 109
114#endif /* end of include guard: GNUNET_HELPER_VPN_API_H */ 110#endif /* end of include guard: GNUNET_HELPER_VPN_API_H */
diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c
index a267cab0d..ba7fa65d7 100644
--- a/src/vpn/gnunet-service-dns.c
+++ b/src/vpn/gnunet-service-dns.c
@@ -927,8 +927,8 @@ out:
927 GNUNET_SERVER_receive_done (client, GNUNET_OK); 927 GNUNET_SERVER_receive_done (client, GNUNET_OK);
928} 928}
929 929
930static void read_response (void *cls, 930static void
931 const struct GNUNET_SCHEDULER_TaskContext *tc); 931read_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
932 932
933static int 933static int
934open_port () 934open_port ()
diff --git a/src/vpn/gnunet-vpn-checksum.h b/src/vpn/gnunet-vpn-checksum.h
index 82f4954ca..b6af8c56e 100644
--- a/src/vpn/gnunet-vpn-checksum.h
+++ b/src/vpn/gnunet-vpn-checksum.h
@@ -4,13 +4,16 @@
4 4
5#include <platform.h> 5#include <platform.h>
6 6
7uint32_t calculate_checksum_update (uint32_t sum, uint16_t * hdr, short len); 7uint32_t
8calculate_checksum_update (uint32_t sum, uint16_t * hdr, short len);
8 9
9uint16_t calculate_checksum_end (uint32_t sum); 10uint16_t
11calculate_checksum_end (uint32_t sum);
10 12
11/** 13/**
12 * Calculate the checksum of an IPv4-Header 14 * Calculate the checksum of an IPv4-Header
13 */ 15 */
14uint16_t calculate_ip_checksum (uint16_t * hdr, short len); 16uint16_t
17calculate_ip_checksum (uint16_t * hdr, short len);
15 18
16#endif /* end of include guard: GNUNET-VPN-CHECKSUM_H */ 19#endif /* end of include guard: GNUNET-VPN-CHECKSUM_H */