aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-01 22:49:53 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-01 22:49:53 +0000
commit131c43b2b18b12e52ff045e51025706802cbd2e2 (patch)
treeba23619713013ee715430f91ae3846e77dffdf26 /src
parent64c442461b84953230d3dc4e78cb649db6c54abc (diff)
downloadgnunet-131c43b2b18b12e52ff045e51025706802cbd2e2.tar.gz
gnunet-131c43b2b18b12e52ff045e51025706802cbd2e2.zip
-moving DNS structs to gnunet-dns-parser.h
Diffstat (limited to 'src')
-rw-r--r--src/vpn/gnunet-dns-parser.h81
-rw-r--r--src/vpn/gnunet-vpn-packet.h75
2 files changed, 81 insertions, 75 deletions
diff --git a/src/vpn/gnunet-dns-parser.h b/src/vpn/gnunet-dns-parser.h
index b5cc7e1e8..a9ed5b3b2 100644
--- a/src/vpn/gnunet-dns-parser.h
+++ b/src/vpn/gnunet-dns-parser.h
@@ -2,7 +2,86 @@
2#define _GNVPN_DNSP_H_ 2#define _GNVPN_DNSP_H_
3 3
4#include "platform.h" 4#include "platform.h"
5#include "gnunet-vpn-packet.h" 5#include "gnunet_common.h"
6
7// DNS-Stuff
8GNUNET_NETWORK_STRUCT_BEGIN
9
10struct dns_static
11{
12 uint16_t id GNUNET_PACKED;
13
14 unsigned rd:1 GNUNET_PACKED; // recursion desired (client -> server)
15 unsigned tc:1 GNUNET_PACKED; // message is truncated
16 unsigned aa:1 GNUNET_PACKED; // authoritative answer
17 unsigned op:4 GNUNET_PACKED; // query:0, inverse q.:1, status: 2
18 unsigned qr:1 GNUNET_PACKED; // query:0, response:1
19
20 unsigned rcode:4 GNUNET_PACKED; // 0 No error
21 // 1 Format error
22 // 2 Server failure
23 // 3 Name Error
24 // 4 Not Implemented
25 // 5 Refused
26 unsigned z:3 GNUNET_PACKED; // reserved
27 unsigned ra:1 GNUNET_PACKED; // recursion available (server -> client)
28
29 uint16_t qdcount GNUNET_PACKED; // number of questions
30 uint16_t ancount GNUNET_PACKED; // number of answers
31 uint16_t nscount GNUNET_PACKED; // number of authority-records
32 uint16_t arcount GNUNET_PACKED; // number of additional records
33};
34GNUNET_NETWORK_STRUCT_END
35
36struct dns_pkt
37{
38 struct dns_static s;
39 unsigned char data[1];
40};
41
42struct dns_pkt_parsed
43{
44 struct dns_static s;
45 struct dns_query **queries;
46 struct dns_record **answers;
47 struct dns_record **nameservers;
48 struct dns_record **additional;
49};
50
51struct dns_query_line
52{
53 unsigned short type;
54 unsigned short class;
55};
56
57struct dns_query
58{
59 char *name;
60 unsigned char namelen;
61 unsigned short qtype;
62 unsigned short qclass;
63};
64
65struct dns_record_line
66{
67 unsigned short type;
68 unsigned short class;
69 unsigned int ttl;
70 unsigned short data_len;
71 unsigned char data;
72};
73
74struct dns_record
75{
76 char *name;
77 unsigned char namelen;
78 unsigned short type;
79 unsigned short class;
80 unsigned int ttl;
81 unsigned short data_len;
82 unsigned char *data;
83};
84
6 85
7struct dns_pkt_parsed * 86struct dns_pkt_parsed *
8parse_dns_packet (struct dns_pkt *pkt); 87parse_dns_packet (struct dns_pkt *pkt);
diff --git a/src/vpn/gnunet-vpn-packet.h b/src/vpn/gnunet-vpn-packet.h
index 9cbbf1bb2..19b2c8d7b 100644
--- a/src/vpn/gnunet-vpn-packet.h
+++ b/src/vpn/gnunet-vpn-packet.h
@@ -3,6 +3,7 @@
3 3
4#include "platform.h" 4#include "platform.h"
5#include "gnunet_common.h" 5#include "gnunet_common.h"
6#include "gnunet-dns-parser.h"
6 7
7GNUNET_NETWORK_STRUCT_BEGIN 8GNUNET_NETWORK_STRUCT_BEGIN
8 9
@@ -76,82 +77,8 @@ struct icmp_hdr
76 unsigned code:8 GNUNET_PACKED; 77 unsigned code:8 GNUNET_PACKED;
77 unsigned chks:16 GNUNET_PACKED; 78 unsigned chks:16 GNUNET_PACKED;
78}; 79};
79
80// DNS-Stuff
81struct dns_static
82{
83 uint16_t id GNUNET_PACKED;
84
85 unsigned rd:1 GNUNET_PACKED; // recursion desired (client -> server)
86 unsigned tc:1 GNUNET_PACKED; // message is truncated
87 unsigned aa:1 GNUNET_PACKED; // authoritative answer
88 unsigned op:4 GNUNET_PACKED; // query:0, inverse q.:1, status: 2
89 unsigned qr:1 GNUNET_PACKED; // query:0, response:1
90
91 unsigned rcode:4 GNUNET_PACKED; // 0 No error
92 // 1 Format error
93 // 2 Server failure
94 // 3 Name Error
95 // 4 Not Implemented
96 // 5 Refused
97 unsigned z:3 GNUNET_PACKED; // reserved
98 unsigned ra:1 GNUNET_PACKED; // recursion available (server -> client)
99
100 uint16_t qdcount GNUNET_PACKED; // number of questions
101 uint16_t ancount GNUNET_PACKED; // number of answers
102 uint16_t nscount GNUNET_PACKED; // number of authority-records
103 uint16_t arcount GNUNET_PACKED; // number of additional records
104};
105GNUNET_NETWORK_STRUCT_END 80GNUNET_NETWORK_STRUCT_END
106 81
107struct dns_pkt
108{
109 struct dns_static s;
110 unsigned char data[1];
111};
112
113struct dns_pkt_parsed
114{
115 struct dns_static s;
116 struct dns_query **queries;
117 struct dns_record **answers;
118 struct dns_record **nameservers;
119 struct dns_record **additional;
120};
121
122struct dns_query_line
123{
124 unsigned short type;
125 unsigned short class;
126};
127
128struct dns_query
129{
130 char *name;
131 unsigned char namelen;
132 unsigned short qtype;
133 unsigned short qclass;
134};
135
136struct dns_record_line
137{
138 unsigned short type;
139 unsigned short class;
140 unsigned int ttl;
141 unsigned short data_len;
142 unsigned char data;
143};
144
145struct dns_record
146{
147 char *name;
148 unsigned char namelen;
149 unsigned short type;
150 unsigned short class;
151 unsigned int ttl;
152 unsigned short data_len;
153 unsigned char *data;
154};
155 82
156struct udp_dns 83struct udp_dns
157{ 84{