aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-02 10:26:22 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-02 10:26:22 +0000
commitcf88dbef239cb00d1e89c3329a969ee27d6ec7e8 (patch)
treee2243eb9085f8133d34133d0f1c3d100526c4840 /src
parent8dcab0a21d59adb07eb5151c8be883a44520e4b6 (diff)
downloadgnunet-cf88dbef239cb00d1e89c3329a969ee27d6ec7e8.tar.gz
gnunet-cf88dbef239cb00d1e89c3329a969ee27d6ec7e8.zip
-merging gnunet-daemon-vpn.h into gnunet-daemon-vpn.c
Diffstat (limited to 'src')
-rw-r--r--src/vpn/Makefile.am2
-rw-r--r--src/vpn/gnunet-daemon-vpn.c66
-rw-r--r--src/vpn/gnunet-daemon-vpn.h129
3 files changed, 66 insertions, 131 deletions
diff --git a/src/vpn/Makefile.am b/src/vpn/Makefile.am
index 38b37dd65..1fb1dd3f6 100644
--- a/src/vpn/Makefile.am
+++ b/src/vpn/Makefile.am
@@ -33,7 +33,7 @@ gnunet_helper_vpn_SOURCES = \
33 gnunet-helper-vpn.c 33 gnunet-helper-vpn.c
34 34
35gnunet_daemon_vpn_SOURCES = \ 35gnunet_daemon_vpn_SOURCES = \
36 gnunet-daemon-vpn.c gnunet-daemon-vpn.h 36 gnunet-daemon-vpn.c
37gnunet_daemon_vpn_LDADD = \ 37gnunet_daemon_vpn_LDADD = \
38 $(top_builddir)/src/core/libgnunetcore.la \ 38 $(top_builddir)/src/core/libgnunetcore.la \
39 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 39 $(top_builddir)/src/statistics/libgnunetstatistics.la \
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c
index 919614ae7..c9463184c 100644
--- a/src/vpn/gnunet-daemon-vpn.c
+++ b/src/vpn/gnunet-daemon-vpn.c
@@ -36,7 +36,6 @@
36#include "gnunet_constants.h" 36#include "gnunet_constants.h"
37#include <block_dns.h> 37#include <block_dns.h>
38#include "gnunet_dns_service.h" 38#include "gnunet_dns_service.h"
39#include "gnunet-daemon-vpn.h"
40 39
41 40
42const struct GNUNET_CONFIGURATION_Handle *cfg; 41const struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -60,6 +59,71 @@ struct answer_packet_list *answer_proc_head;
60 59
61struct answer_packet_list *answer_proc_tail; 60struct answer_packet_list *answer_proc_tail;
62 61
62struct answer_packet_list
63{
64 struct answer_packet_list *next GNUNET_PACKED;
65 struct answer_packet_list *prev GNUNET_PACKED;
66 struct GNUNET_SERVER_Client *client;
67 struct answer_packet pkt;
68};
69
70
71void
72send_icmp6_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
73void
74send_icmp4_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
75
76size_t
77send_udp_service (void *cls, size_t size, void *buf);
78
79GNUNET_HashCode *
80address6_mapping_exists (struct in6_addr *v6addr);
81GNUNET_HashCode *
82address4_mapping_exists (uint32_t addr);
83
84unsigned int
85port_in_ports (uint64_t ports, uint16_t port);
86
87void
88send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer,
89 const struct GNUNET_ATS_Information *atsi);
90
91struct map_entry
92{
93 /** The description of the service (used for service) */
94 struct GNUNET_vpn_service_descriptor desc;
95
96 /** The real address of the service (used for remote) */
97 char addrlen;
98 char addr[16];
99
100 struct GNUNET_MESH_Tunnel *tunnel;
101 uint16_t namelen;
102 char additional_ports[8192];
103
104 struct GNUNET_CONTAINER_HeapNode *heap_node;
105 GNUNET_HashCode hash;
106 /**
107 * After this struct the name is located in DNS-Format!
108 */
109};
110
111
112struct remote_addr
113{
114 char addrlen;
115 unsigned char addr[16];
116 char proto;
117};
118
119struct tunnel_state
120{
121 struct GNUNET_MESH_TransmitHandle *th;
122 struct tunnel_notify_queue *head, *tail;
123
124 int addrlen;
125};
126
63 127
64struct tunnel_notify_queue 128struct tunnel_notify_queue
65{ 129{
diff --git a/src/vpn/gnunet-daemon-vpn.h b/src/vpn/gnunet-daemon-vpn.h
deleted file mode 100644
index e4c259ec4..000000000
--- a/src/vpn/gnunet-daemon-vpn.h
+++ /dev/null
@@ -1,129 +0,0 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file vpn/gnunet-daemon-vpn.h
23 * @brief
24 * @author Philipp Toelke
25 */
26#ifndef GNUNET_DAEMON_VPN_H
27#define GNUNET_DAEMON_VPN_H
28
29#include "gnunet_dns_service.h"
30
31struct answer_packet_list
32{
33 struct answer_packet_list *next GNUNET_PACKED;
34 struct answer_packet_list *prev GNUNET_PACKED;
35 struct GNUNET_SERVER_Client *client;
36 struct answer_packet pkt;
37};
38
39
40
41extern struct answer_packet_list *answer_proc_head;
42
43extern struct answer_packet_list *answer_proc_tail;
44
45extern struct GNUNET_DNS_Handle *dns_handle;
46
47
48void
49send_icmp6_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
50void
51send_icmp4_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
52
53size_t
54send_udp_service (void *cls, size_t size, void *buf);
55
56GNUNET_HashCode *
57address6_mapping_exists (struct in6_addr *v6addr);
58GNUNET_HashCode *
59address4_mapping_exists (uint32_t addr);
60
61unsigned int
62port_in_ports (uint64_t ports, uint16_t port);
63
64void
65send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer,
66 const struct GNUNET_ATS_Information *atsi);
67
68/**
69 * The configuration to use
70 */
71extern const struct GNUNET_CONFIGURATION_Handle *cfg;
72
73/**
74 * The handle to mesh
75 */
76extern struct GNUNET_MESH_Handle *mesh_handle;
77
78/**
79 * The hashmap containing the mappings from ipv6-addresses to gnunet-descriptors
80 */
81extern struct GNUNET_CONTAINER_MultiHashMap *hashmap;
82
83struct map_entry
84{
85 /** The description of the service (used for service) */
86 struct GNUNET_vpn_service_descriptor desc;
87
88 /** The real address of the service (used for remote) */
89 char addrlen;
90 char addr[16];
91
92 struct GNUNET_MESH_Tunnel *tunnel;
93 uint16_t namelen;
94 char additional_ports[8192];
95
96 struct GNUNET_CONTAINER_HeapNode *heap_node;
97 GNUNET_HashCode hash;
98 /**
99 * After this struct the name is located in DNS-Format!
100 */
101};
102
103/**
104 * Checks if a bit is active in the bitArray
105 *
106 * @param bitArray memory area to set the bit in
107 * @param bitIdx which bit to test
108 * @return GNUNET_YES if the bit is set, GNUNET_NO if not.
109 */
110int
111testBit (char *bitArray, unsigned int bitIdx);
112
113
114struct remote_addr
115{
116 char addrlen;
117 unsigned char addr[16];
118 char proto;
119};
120
121struct tunnel_state
122{
123 struct GNUNET_MESH_TransmitHandle *th;
124 struct tunnel_notify_queue *head, *tail;
125
126 int addrlen;
127};
128
129#endif /* end of include guard: GNUNET-DAEMON-VPN_H */