2 This file is part of GNUnet
3 (C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file dns/dnsparser.h
23 * @brief helper library to parse DNS packets.
24 * @author Philipp Toelke
25 * @author Christian Grothoff
26 * @author Martin Schanzenbach
28 GNUNET_NETWORK_STRUCT_BEGIN
30 /* FIXME: replace this one with the one from tcpip_tun.h!? */
32 * Head of a any DNS message.
34 struct GNUNET_TUN_DnsHeader
37 * Request/response ID. (NBO)
39 uint16_t id GNUNET_PACKED;
42 * Flags for the operation.
44 struct GNUNET_DNSPARSER_Flags flags;
47 * number of questions (NBO)
49 uint16_t query_count GNUNET_PACKED;
52 * number of answers (NBO)
54 uint16_t answer_rcount GNUNET_PACKED;
57 * number of authority-records (NBO)
59 uint16_t authority_rcount GNUNET_PACKED;
62 * number of additional records (NBO)
64 uint16_t additional_rcount GNUNET_PACKED;
74 * Desired type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
76 uint16_t type GNUNET_PACKED;
79 * Desired class (usually GNUNET_DNSPARSER_CLASS_INTERNET). (NBO)
81 uint16_t class GNUNET_PACKED;
86 * General DNS record prefix.
91 * Record type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
93 uint16_t type GNUNET_PACKED;
96 * Record class (usually GNUNET_DNSPARSER_CLASS_INTERNET). (NBO)
98 uint16_t class GNUNET_PACKED;
101 * Expiration for the record (in seconds). (NBO)
103 uint32_t ttl GNUNET_PACKED;
106 * Number of bytes of data that follow. (NBO)
108 uint16_t data_len GNUNET_PACKED;
113 * Payload of DNS SOA record (header).
118 * The version number of the original copy of the zone. (NBO)
120 uint32_t serial GNUNET_PACKED;
123 * Time interval before the zone should be refreshed. (NBO)
125 uint32_t refresh GNUNET_PACKED;
128 * Time interval that should elapse before a failed refresh should
131 uint32_t retry GNUNET_PACKED;
134 * Time value that specifies the upper limit on the time interval
135 * that can elapse before the zone is no longer authoritative. (NBO)
137 uint32_t expire GNUNET_PACKED;
140 * The bit minimum TTL field that should be exported with any RR
141 * from this zone. (NBO)
143 uint32_t minimum GNUNET_PACKED;
148 * Payload of DNS SRV record (header).
154 * Preference for this entry (lower value is higher preference). Clients
155 * will contact hosts from the lowest-priority group first and fall back
156 * to higher priorities if the low-priority entries are unavailable. (NBO)
158 uint16_t prio GNUNET_PACKED;
161 * Relative weight for records with the same priority. Clients will use
162 * the hosts of the same (lowest) priority with a probability proportional
163 * to the weight given. (NBO)
165 uint16_t weight GNUNET_PACKED;
168 * TCP or UDP port of the service. (NBO)
170 uint16_t port GNUNET_PACKED;
172 /* followed by 'target' name */
176 * Payload of GNS VPN record
181 * The protocol to use
186 * The peer to contact
188 struct GNUNET_HashCode peer;
190 /* followed by the servicename */
193 GNUNET_NETWORK_STRUCT_END