aboutsummaryrefslogtreecommitdiff
path: root/src/dns
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/dns
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/dns')
-rw-r--r--src/dns/dnsparser.c1
-rw-r--r--src/dns/gnunet-service-dns_new.c87
2 files changed, 2 insertions, 86 deletions
diff --git a/src/dns/dnsparser.c b/src/dns/dnsparser.c
index 8346051d7..2e9e73f1c 100644
--- a/src/dns/dnsparser.c
+++ b/src/dns/dnsparser.c
@@ -31,6 +31,7 @@
31 31
32// DNS-Stuff 32// DNS-Stuff
33GNUNET_NETWORK_STRUCT_BEGIN 33GNUNET_NETWORK_STRUCT_BEGIN
34/* FIXME: replace this one with the one from tcpip_tun.h! */
34struct dns_header 35struct dns_header
35{ 36{
36 uint16_t id GNUNET_PACKED; 37 uint16_t id GNUNET_PACKED;
diff --git a/src/dns/gnunet-service-dns_new.c b/src/dns/gnunet-service-dns_new.c
index 046630aac..968f850fb 100644
--- a/src/dns/gnunet-service-dns_new.c
+++ b/src/dns/gnunet-service-dns_new.c
@@ -30,92 +30,7 @@
30#include "dns_new.h" 30#include "dns_new.h"
31#include "gnunet_dns_service-new.h" 31#include "gnunet_dns_service-new.h"
32#include "gnunet_statistics_service.h" 32#include "gnunet_statistics_service.h"
33 33#include "tcpip_tun.h"
34/* see http://www.iana.org/assignments/ethernet-numbers */
35#ifndef ETH_P_IPV4
36#define ETH_P_IPV4 0x0800
37#endif
38
39#ifndef ETH_P_IPV6
40#define ETH_P_IPV6 0x86DD
41#endif
42
43GNUNET_NETWORK_STRUCT_BEGIN
44/**
45 * Header from Linux TUN interface.
46 */
47struct tun_header
48{
49 /**
50 * Some flags (unused).
51 */
52 uint16_t flags;
53
54 /**
55 * Here we get an ETH_P_-number.
56 */
57 uint16_t proto;
58};
59
60/**
61 * Standard IPv4 header.
62 */
63struct ip4_header
64{
65 unsigned header_length:4 GNUNET_PACKED;
66 unsigned version:4 GNUNET_PACKED;
67 uint8_t diff_serv;
68 uint16_t total_length GNUNET_PACKED;
69 uint16_t identification GNUNET_PACKED;
70 unsigned flags:3 GNUNET_PACKED;
71 unsigned fragmentation_offset:13 GNUNET_PACKED;
72 uint8_t ttl;
73 uint8_t protocol;
74 uint16_t checksum GNUNET_PACKED;
75 struct in_addr source_address GNUNET_PACKED;
76 struct in_addr destination_address GNUNET_PACKED;
77};
78
79/**
80 * Standard IPv6 header.
81 */
82struct ip6_header
83{
84 unsigned traffic_class_h:4 GNUNET_PACKED;
85 unsigned version:4 GNUNET_PACKED;
86 unsigned traffic_class_l:4 GNUNET_PACKED;
87 unsigned flow_label:20 GNUNET_PACKED;
88 uint16_t payload_length GNUNET_PACKED;
89 uint8_t next_header;
90 uint8_t hop_limit;
91 struct in6_addr source_address GNUNET_PACKED;
92 struct in6_addr destination_address GNUNET_PACKED;
93};
94
95/**
96 * UDP packet header.
97 */
98struct udp_packet
99{
100 uint16_t spt GNUNET_PACKED;
101 uint16_t dpt GNUNET_PACKED;
102 uint16_t len GNUNET_PACKED;
103 uint16_t crc GNUNET_PACKED;
104};
105
106/**
107 * DNS header.
108 */
109struct dns_header
110{
111 uint16_t id GNUNET_PACKED;
112 uint16_t flags GNUNET_PACKED;
113 uint16_t qdcount GNUNET_PACKED;
114 uint16_t ancount GNUNET_PACKED;
115 uint16_t nscount GNUNET_PACKED;
116 uint16_t arcount GNUNET_PACKED;
117};
118GNUNET_NETWORK_STRUCT_END
119 34
120 35
121/** 36/**