aboutsummaryrefslogtreecommitdiff
path: root/src/exit
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-07 01:04:06 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-07 01:04:06 +0000
commit0a671e8ffbff1cb993a1df595b7d0d87a295b4d3 (patch)
treed7eefb9eff6668a6950b4a9ae03e94bf5d499381 /src/exit
parentf07938e02ddc22a8c61e26f0a81d7dc4d5c814b4 (diff)
downloadgnunet-0a671e8ffbff1cb993a1df595b7d0d87a295b4d3.tar.gz
gnunet-0a671e8ffbff1cb993a1df595b7d0d87a295b4d3.zip
-moving tcpip structs to joint header, some more work on vpn service
Diffstat (limited to 'src/exit')
-rw-r--r--src/exit/gnunet-daemon-exit.c119
1 files changed, 7 insertions, 112 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 363060966..9090ca32c 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -33,118 +33,13 @@
33 * the service's existence; maybe the daemon should turn into a 33 * the service's existence; maybe the daemon should turn into a
34 * service with an API to add local-exit services dynamically? 34 * service with an API to add local-exit services dynamically?
35 */ 35 */
36#include <platform.h> 36#include "platform.h"
37#include <gnunet_common.h> 37#include "gnunet_util_lib.h"
38#include <gnunet_program_lib.h> 38#include "gnunet_protocols.h"
39#include <gnunet_protocols.h> 39#include "gnunet_applications.h"
40#include <gnunet_applications.h> 40#include "gnunet_mesh_service.h"
41#include <gnunet_mesh_service.h> 41#include "gnunet_constants.h"
42#include <gnunet_constants.h> 42#include "tcpip_tun.h"
43#include <string.h>
44
45
46/* see http://www.iana.org/assignments/ethernet-numbers */
47#ifndef ETH_P_IPV4
48#define ETH_P_IPV4 0x0800
49#endif
50
51#ifndef ETH_P_IPV6
52#define ETH_P_IPV6 0x86DD
53#endif
54
55
56GNUNET_NETWORK_STRUCT_BEGIN
57/**
58 * Header from Linux TUN interface.
59 */
60struct tun_header
61{
62 /**
63 * Some flags (unused).
64 */
65 uint16_t flags;
66
67 /**
68 * Here we get an ETH_P_-number.
69 */
70 uint16_t proto;
71};
72
73/**
74 * Standard IPv4 header.
75 */
76struct ip4_header
77{
78 unsigned header_length:4 GNUNET_PACKED;
79 unsigned version:4 GNUNET_PACKED;
80 uint8_t diff_serv;
81 uint16_t total_length GNUNET_PACKED;
82 uint16_t identification GNUNET_PACKED;
83 unsigned flags:3 GNUNET_PACKED;
84 unsigned fragmentation_offset:13 GNUNET_PACKED;
85 uint8_t ttl;
86 uint8_t protocol;
87 uint16_t checksum GNUNET_PACKED;
88 struct in_addr source_address GNUNET_PACKED;
89 struct in_addr destination_address GNUNET_PACKED;
90};
91
92/**
93 * Standard IPv6 header.
94 */
95struct ip6_header
96{
97 unsigned traffic_class_h:4 GNUNET_PACKED;
98 unsigned version:4 GNUNET_PACKED;
99 unsigned traffic_class_l:4 GNUNET_PACKED;
100 unsigned flow_label:20 GNUNET_PACKED;
101 uint16_t payload_length GNUNET_PACKED;
102 uint8_t next_header;
103 uint8_t hop_limit;
104 struct in6_addr source_address GNUNET_PACKED;
105 struct in6_addr destination_address GNUNET_PACKED;
106};
107
108#define TCP_FLAG_SYN 2
109
110struct tcp_packet
111{
112 unsigned spt:16 GNUNET_PACKED;
113 unsigned dpt:16 GNUNET_PACKED;
114 unsigned seq:32 GNUNET_PACKED;
115 unsigned ack:32 GNUNET_PACKED;
116 unsigned off:4 GNUNET_PACKED;
117 unsigned rsv:4 GNUNET_PACKED;
118 unsigned flg:8 GNUNET_PACKED;
119 unsigned wsz:16 GNUNET_PACKED;
120 unsigned crc:16 GNUNET_PACKED;
121 unsigned urg:16 GNUNET_PACKED;
122};
123
124/**
125 * UDP packet header.
126 */
127struct udp_packet
128{
129 uint16_t spt GNUNET_PACKED;
130 uint16_t dpt GNUNET_PACKED;
131 uint16_t len GNUNET_PACKED;
132 uint16_t crc GNUNET_PACKED;
133};
134
135/**
136 * DNS header.
137 */
138struct dns_header
139{
140 uint16_t id GNUNET_PACKED;
141 uint16_t flags GNUNET_PACKED;
142 uint16_t qdcount GNUNET_PACKED;
143 uint16_t ancount GNUNET_PACKED;
144 uint16_t nscount GNUNET_PACKED;
145 uint16_t arcount GNUNET_PACKED;
146};
147GNUNET_NETWORK_STRUCT_END
148 43
149/** 44/**
150 * Information about an address. 45 * Information about an address.