diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-01 22:49:53 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-01 22:49:53 +0000 |
commit | 131c43b2b18b12e52ff045e51025706802cbd2e2 (patch) | |
tree | ba23619713013ee715430f91ae3846e77dffdf26 /src | |
parent | 64c442461b84953230d3dc4e78cb649db6c54abc (diff) | |
download | gnunet-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.h | 81 | ||||
-rw-r--r-- | src/vpn/gnunet-vpn-packet.h | 75 |
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 | ||
8 | GNUNET_NETWORK_STRUCT_BEGIN | ||
9 | |||
10 | struct 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 | }; | ||
34 | GNUNET_NETWORK_STRUCT_END | ||
35 | |||
36 | struct dns_pkt | ||
37 | { | ||
38 | struct dns_static s; | ||
39 | unsigned char data[1]; | ||
40 | }; | ||
41 | |||
42 | struct 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 | |||
51 | struct dns_query_line | ||
52 | { | ||
53 | unsigned short type; | ||
54 | unsigned short class; | ||
55 | }; | ||
56 | |||
57 | struct dns_query | ||
58 | { | ||
59 | char *name; | ||
60 | unsigned char namelen; | ||
61 | unsigned short qtype; | ||
62 | unsigned short qclass; | ||
63 | }; | ||
64 | |||
65 | struct 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 | |||
74 | struct 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 | ||
7 | struct dns_pkt_parsed * | 86 | struct dns_pkt_parsed * |
8 | parse_dns_packet (struct dns_pkt *pkt); | 87 | parse_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 | ||
7 | GNUNET_NETWORK_STRUCT_BEGIN | 8 | GNUNET_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 | ||
81 | struct 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 | }; | ||
105 | GNUNET_NETWORK_STRUCT_END | 80 | GNUNET_NETWORK_STRUCT_END |
106 | 81 | ||
107 | struct dns_pkt | ||
108 | { | ||
109 | struct dns_static s; | ||
110 | unsigned char data[1]; | ||
111 | }; | ||
112 | |||
113 | struct 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 | |||
122 | struct dns_query_line | ||
123 | { | ||
124 | unsigned short type; | ||
125 | unsigned short class; | ||
126 | }; | ||
127 | |||
128 | struct dns_query | ||
129 | { | ||
130 | char *name; | ||
131 | unsigned char namelen; | ||
132 | unsigned short qtype; | ||
133 | unsigned short qclass; | ||
134 | }; | ||
135 | |||
136 | struct 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 | |||
145 | struct 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 | ||
156 | struct udp_dns | 83 | struct udp_dns |
157 | { | 84 | { |