input checks
[oweals/gnunet.git] / src / include / gns_protocol.h
1 /*
2       This file is part of GNUnet
3       (C) 2012 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19  */
20
21 /**
22  * @file gns/gns_protocol.h
23  * @brief Resource Record definitions
24  * @author Martin Schanzenbach
25  */
26 #ifndef GNS_RECORDS_H
27 #define GNS_RECORDS_H
28
29 GNUNET_NETWORK_STRUCT_BEGIN
30
31 /**
32  * Payload of DNS SOA record (header).
33  */
34 struct soa_data
35 {
36   /**
37    * The version number of the original copy of the zone.   (NBO)
38    */
39   uint32_t serial GNUNET_PACKED;
40   
41   /**
42    * Time interval before the zone should be refreshed. (NBO)
43    */
44   uint32_t refresh GNUNET_PACKED;
45   
46   /**
47    * Time interval that should elapse before a failed refresh should
48    * be retried. (NBO)
49    */
50   uint32_t retry GNUNET_PACKED;
51  
52   /**
53    * Time value that specifies the upper limit on the time interval
54    * that can elapse before the zone is no longer authoritative. (NBO)
55    */
56   uint32_t expire GNUNET_PACKED;
57
58   /**
59    * The bit minimum TTL field that should be exported with any RR
60    * from this zone. (NBO)
61    */
62   uint32_t minimum GNUNET_PACKED;
63 };
64
65
66 /**
67  * Payload of DNS SRV record (header).
68  */
69 struct srv_data
70 {
71
72   /**
73    * Preference for this entry (lower value is higher preference).  Clients
74    * will contact hosts from the lowest-priority group first and fall back
75    * to higher priorities if the low-priority entries are unavailable. (NBO)
76    */
77   uint16_t prio GNUNET_PACKED;
78
79   /**
80    * Relative weight for records with the same priority.  Clients will use
81    * the hosts of the same (lowest) priority with a probability proportional
82    * to the weight given. (NBO)
83    */
84   uint16_t weight GNUNET_PACKED;
85
86   /**
87    * TCP or UDP port of the service. (NBO)
88    */
89   uint16_t port GNUNET_PACKED;
90
91   /* followed by 'target' name */
92 };
93
94
95 /**
96  * Payload of DNSSEC TLSA record.
97  * http://datatracker.ietf.org/doc/draft-ietf-dane-protocol/
98  */
99 struct tlsa_data
100 {
101
102   /**
103    * Certificate usage
104    * 0: CA cert
105    * 1: Entity cert
106    * 2: Trust anchor
107    * 3: domain-issued cert
108    */
109   uint8_t usage;
110
111   /**
112    * Selector
113    * What part will be matched against the cert
114    * presented by server
115    * 0: Full cert (in binary)
116    * 1: Full cert (in DER)
117    */
118   uint8_t selector;
119
120   /**
121    * Matching type (of selected content)
122    * 0: exact match
123    * 1: SHA-256 hash
124    * 2: SHA-512 hash
125    */
126   uint8_t matching_type;
127
128   /**
129    * followed by certificate association data
130    * The "certificate association data" to be matched.
131    * These bytes are either raw data (that is, the full certificate or
132    * its SubjectPublicKeyInfo, depending on the selector) for matching
133    * type 0, or the hash of the raw data for matching types 1 and 2.
134    * The data refers to the certificate in the association, not to the
135    * TLS ASN.1 Certificate object.
136    *
137    * The data is represented as a string of hex chars
138    */
139 };
140
141 /**
142  * Payload of GNS VPN record
143  */
144 struct vpn_data
145 {
146   /**
147    * The peer to contact
148    */
149   struct GNUNET_HashCode peer;
150
151   /**
152    * The protocol to use
153    */
154   uint16_t proto;
155
156   /* followed by the servicename */
157 };
158
159 GNUNET_NETWORK_STRUCT_END
160
161 #endif