aboutsummaryrefslogtreecommitdiff
path: root/src/dns
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-21 07:32:50 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-21 07:32:50 +0000
commite2931e9e5cffd9f3dc37b71b2a01ed151c0dd4e5 (patch)
tree8f8b3ee426c5e88bafa66e53d937fa64018e5d5f /src/dns
parente615a940e0a60823c040f1df2ba4977018692d28 (diff)
downloadgnunet-e2931e9e5cffd9f3dc37b71b2a01ed151c0dd4e5.tar.gz
gnunet-e2931e9e5cffd9f3dc37b71b2a01ed151c0dd4e5.zip
-improving comments, towards implementing #2268
Diffstat (limited to 'src/dns')
-rw-r--r--src/dns/dnsparser.c123
1 files changed, 117 insertions, 6 deletions
diff --git a/src/dns/dnsparser.c b/src/dns/dnsparser.c
index 0e658bdda..c11ec25d6 100644
--- a/src/dns/dnsparser.c
+++ b/src/dns/dnsparser.c
@@ -29,42 +29,153 @@
29#include "gnunet_dnsparser_lib.h" 29#include "gnunet_dnsparser_lib.h"
30 30
31 31
32// DNS-Stuff
33GNUNET_NETWORK_STRUCT_BEGIN 32GNUNET_NETWORK_STRUCT_BEGIN
34/* FIXME: replace this one with the one from tcpip_tun.h! */ 33
34/* FIXME: replace this one with the one from tcpip_tun.h!? */
35/**
36 * Head of a any DNS message.
37 */
35struct GNUNET_TUN_DnsHeader 38struct GNUNET_TUN_DnsHeader
36{ 39{
40 /**
41 * Request/response ID. (NBO)
42 */
37 uint16_t id GNUNET_PACKED; 43 uint16_t id GNUNET_PACKED;
44
45 /**
46 * Flags for the operation.
47 */
38 struct GNUNET_DNSPARSER_Flags flags; 48 struct GNUNET_DNSPARSER_Flags flags;
39 uint16_t query_count GNUNET_PACKED; // number of questions 49
40 uint16_t answer_rcount GNUNET_PACKED; // number of answers 50 /**
41 uint16_t authority_rcount GNUNET_PACKED; // number of authority-records 51 * number of questions (NBO)
42 uint16_t additional_rcount GNUNET_PACKED; // number of additional records 52 */
53 uint16_t query_count GNUNET_PACKED;
54
55 /**
56 * number of answers (NBO)
57 */
58 uint16_t answer_rcount GNUNET_PACKED;
59
60 /**
61 * number of authority-records (NBO)
62 */
63 uint16_t authority_rcount GNUNET_PACKED;
64
65 /**
66 * number of additional records (NBO)
67 */
68 uint16_t additional_rcount GNUNET_PACKED;
43}; 69};
44 70
71
72/**
73 * DNS query prefix.
74 */
45struct query_line 75struct query_line
46{ 76{
77 /**
78 * Desired type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
79 */
47 uint16_t type GNUNET_PACKED; 80 uint16_t type GNUNET_PACKED;
81
82 /**
83 * Desired class (usually GNUNET_DNSPARSER_CLASS_INTERNET). (NBO)
84 */
48 uint16_t class GNUNET_PACKED; 85 uint16_t class GNUNET_PACKED;
49}; 86};
50 87
88
89/**
90 * General DNS record prefix.
91 */
51struct record_line 92struct record_line
52{ 93{
94 /**
95 * Record type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
96 */
53 uint16_t type GNUNET_PACKED; 97 uint16_t type GNUNET_PACKED;
98
99 /**
100 * Record class (usually GNUNET_DNSPARSER_CLASS_INTERNET). (NBO)
101 */
54 uint16_t class GNUNET_PACKED; 102 uint16_t class GNUNET_PACKED;
103
104 /**
105 * Expiration for the record (in seconds). (NBO)
106 */
55 uint32_t ttl GNUNET_PACKED; 107 uint32_t ttl GNUNET_PACKED;
108
109 /**
110 * Number of bytes of data that follow. (NBO)
111 */
56 uint16_t data_len GNUNET_PACKED; 112 uint16_t data_len GNUNET_PACKED;
57}; 113};
58 114
115
116/**
117 * Payload of DNS SOA record (header).
118 */
59struct soa_data 119struct soa_data
60{ 120{
121 /**
122 * The version number of the original copy of the zone. (NBO)
123 */
61 uint32_t serial GNUNET_PACKED; 124 uint32_t serial GNUNET_PACKED;
125
126 /**
127 * Time interval before the zone should be refreshed. (NBO)
128 */
62 uint32_t refresh GNUNET_PACKED; 129 uint32_t refresh GNUNET_PACKED;
130
131 /**
132 * Time interval that should elapse before a failed refresh should
133 * be retried. (NBO)
134 */
63 uint32_t retry GNUNET_PACKED; 135 uint32_t retry GNUNET_PACKED;
136
137 /**
138 * Time value that specifies the upper limit on the time interval
139 * that can elapse before the zone is no longer authoritative. (NBO)
140 */
64 uint32_t expire GNUNET_PACKED; 141 uint32_t expire GNUNET_PACKED;
142
143 /**
144 * The bit minimum TTL field that should be exported with any RR
145 * from this zone. (NBO)
146 */
65 uint32_t minimum GNUNET_PACKED; 147 uint32_t minimum GNUNET_PACKED;
66}; 148};
67 149
150
151/**
152 * Payload of DNS SRV record (header).
153 */
154struct srv_data
155{
156
157 /**
158 * Preference for this entry (lower value is higher preference). Clients
159 * will contact hosts from the lowest-priority group first and fall back
160 * to higher priorities if the low-priority entries are unavailable. (NBO)
161 */
162 uint16_t prio GNUNET_PACKED;
163
164 /**
165 * Relative weight for records with the same priority. Clients will use
166 * the hosts of the same (lowest) priority with a probability proportional
167 * to the weight given. (NBO)
168 */
169 uint16_t weight GNUNET_PACKED;
170
171 /**
172 * TCP or UDP port of the service. (NBO)
173 */
174 uint16_t port GNUNET_PACKED;
175
176 /* followed by 'target' name */
177};
178
68GNUNET_NETWORK_STRUCT_END 179GNUNET_NETWORK_STRUCT_END
69 180
70 181