diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-16 16:03:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-16 16:03:20 +0000 |
commit | 16a6919a9f98ee9fa1fee9dd262906c321004a19 (patch) | |
tree | e09d4fe5191dc329b3e1b667f2914f8313bcba59 /src/vpn | |
parent | 4d7904c62bb867c44e90b8e9f7cdbb4b283abc44 (diff) | |
download | gnunet-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.h | 11 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn-helper.c | 6 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn-helper.h | 28 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.c | 8 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.h | 38 | ||||
-rw-r--r-- | src/vpn/gnunet-dns-parser.h | 6 | ||||
-rw-r--r-- | src/vpn/gnunet-helper-vpn-api.h | 18 | ||||
-rw-r--r-- | src/vpn/gnunet-service-dns.c | 4 | ||||
-rw-r--r-- | src/vpn/gnunet-vpn-checksum.h | 9 |
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 | */ |
43 | size_t send_query (void *cls, size_t size, void *buf); | 43 | size_t |
44 | send_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 | */ |
48 | void connect_to_service_dns (void *cls, | 49 | void |
49 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 50 | connect_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 | */ |
55 | void dns_answer_handler (void *cls, const struct GNUNET_MessageHeader *msg); | 57 | void |
58 | dns_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 | */ |
41 | void start_helper_and_schedule (void *cls, | 41 | void |
42 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 42 | start_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 | */ |
47 | void restart_helper (void *cls, | 48 | void |
48 | const struct GNUNET_SCHEDULER_TaskContext *tskctx); | 49 | restart_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 | */ |
53 | void helper_read (void *cls, | 54 | void |
54 | const struct GNUNET_SCHEDULER_TaskContext *tsdkctx); | 55 | helper_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 | */ |
59 | void helper_write (void *cls, | 60 | void |
60 | const struct GNUNET_SCHEDULER_TaskContext *tsdkctx); | 61 | helper_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 | */ |
65 | void message_token (void *cls, void *client, | 66 | void |
66 | const struct GNUNET_MessageHeader *message); | 67 | message_token (void *cls, void *client, |
68 | const struct GNUNET_MessageHeader *message); | ||
67 | 69 | ||
68 | void write_to_helper (void *buf, size_t len); | 70 | void |
71 | write_to_helper (void *buf, size_t len); | ||
69 | 72 | ||
70 | void schedule_helper_write (struct GNUNET_TIME_Relative, void *cls); | 73 | void |
74 | schedule_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 | */ |
38 | void process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 38 | void |
39 | process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
39 | 40 | ||
40 | void send_icmp6_response (void *cls, | 41 | void |
41 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 42 | send_icmp6_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); |
42 | void send_icmp4_response (void *cls, | 43 | void |
43 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 44 | send_icmp4_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); |
44 | 45 | ||
45 | size_t send_udp_service (void *cls, size_t size, | 46 | size_t |
46 | void *buf); | 47 | send_udp_service (void *cls, size_t size, void *buf); |
47 | 48 | ||
48 | GNUNET_HashCode *address6_mapping_exists (unsigned char addr[]); | 49 | GNUNET_HashCode * |
49 | GNUNET_HashCode *address4_mapping_exists (uint32_t addr); | 50 | address6_mapping_exists (unsigned char addr[]); |
51 | GNUNET_HashCode * | ||
52 | address4_mapping_exists (uint32_t addr); | ||
50 | 53 | ||
51 | unsigned int port_in_ports (uint64_t ports, uint16_t port); | 54 | unsigned int |
55 | port_in_ports (uint64_t ports, uint16_t port); | ||
52 | 56 | ||
53 | void send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer, | 57 | void |
54 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 58 | send_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 | */ |
97 | void setBit (char *bitArray, unsigned int bitIdx); | 102 | void |
103 | setBit (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 | */ |
105 | void clearBit (char *bitArray, unsigned int bitIdx); | 111 | void |
112 | clearBit (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 | */ |
114 | int testBit (char *bitArray, unsigned int bitIdx); | 121 | int |
122 | testBit (char *bitArray, unsigned int bitIdx); | ||
115 | 123 | ||
116 | struct remote_addr | 124 | struct 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 | ||
7 | struct dns_pkt_parsed *parse_dns_packet (struct dns_pkt *pkt); | 7 | struct dns_pkt_parsed * |
8 | parse_dns_packet (struct dns_pkt *pkt); | ||
8 | 9 | ||
9 | void free_parsed_dns_packet (struct dns_pkt_parsed *ppkt); | 10 | void |
11 | free_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 | */ |
98 | struct GNUNET_VPN_HELPER_Handle *start_helper (const char *ifname, | 98 | struct GNUNET_VPN_HELPER_Handle * |
99 | const char *ipv6addr, | 99 | start_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 | */ |
112 | void cleanup_helper (struct GNUNET_VPN_HELPER_Handle *); | 107 | void |
108 | cleanup_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 | ||
930 | static void read_response (void *cls, | 930 | static void |
931 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 931 | read_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); |
932 | 932 | ||
933 | static int | 933 | static int |
934 | open_port () | 934 | open_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 | ||
7 | uint32_t calculate_checksum_update (uint32_t sum, uint16_t * hdr, short len); | 7 | uint32_t |
8 | calculate_checksum_update (uint32_t sum, uint16_t * hdr, short len); | ||
8 | 9 | ||
9 | uint16_t calculate_checksum_end (uint32_t sum); | 10 | uint16_t |
11 | calculate_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 | */ |
14 | uint16_t calculate_ip_checksum (uint16_t * hdr, short len); | 16 | uint16_t |
17 | calculate_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 */ |