diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-07-31 07:03:54 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-07-31 07:03:54 +0000 |
commit | 6429ccfb2ffb8c44a1d10a28a545b72f64c0b6da (patch) | |
tree | 69c8d6d13126375b4a547b4c83e5ebe5e098758a | |
parent | 42e7166e7800d97dbbee4b218604d94340bea763 (diff) | |
download | gnunet-6429ccfb2ffb8c44a1d10a28a545b72f64c0b6da.tar.gz gnunet-6429ccfb2ffb8c44a1d10a28a545b72f64c0b6da.zip |
-move record defs out of dnsparser, add tlsa rr
-rw-r--r-- | src/gns/gns_records.h | 161 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 4 | ||||
-rw-r--r-- | src/gns/test_gns_simple_srv_lookup.c | 2 |
3 files changed, 164 insertions, 3 deletions
diff --git a/src/gns/gns_records.h b/src/gns/gns_records.h new file mode 100644 index 000000000..b5e6f33e1 --- /dev/null +++ b/src/gns/gns_records.h | |||
@@ -0,0 +1,161 @@ | |||
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_records.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 protocol to use | ||
148 | */ | ||
149 | uint16_t proto; | ||
150 | |||
151 | /** | ||
152 | * The peer to contact | ||
153 | */ | ||
154 | struct GNUNET_HashCode peer; | ||
155 | |||
156 | /* followed by the servicename */ | ||
157 | }; | ||
158 | |||
159 | GNUNET_NETWORK_STRUCT_END | ||
160 | |||
161 | #endif | ||
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index ab4989bc3..89aa4a06e 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "gnunet_dns_service.h" | 33 | #include "gnunet_dns_service.h" |
34 | #include "gnunet_resolver_service.h" | 34 | #include "gnunet_resolver_service.h" |
35 | #include "gnunet_dnsparser_lib.h" | 35 | #include "gnunet_dnsparser_lib.h" |
36 | #include "../dns/dnsparser.h" | 36 | #include "gns_records.h" |
37 | #include "gnunet_gns_service.h" | 37 | #include "gnunet_gns_service.h" |
38 | #include "block_gns.h" | 38 | #include "block_gns.h" |
39 | #include "gns.h" | 39 | #include "gns.h" |
@@ -590,7 +590,7 @@ start_shorten (struct AuthorityChain *auth, | |||
590 | struct GetPseuAuthorityHandle *gph; | 590 | struct GetPseuAuthorityHandle *gph; |
591 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; | 591 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; |
592 | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *pb_key; | 592 | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *pb_key; |
593 | 593 | ||
594 | GNUNET_CRYPTO_rsa_key_get_public (key, &pkey); | 594 | GNUNET_CRYPTO_rsa_key_get_public (key, &pkey); |
595 | pb_key = GNUNET_CRYPTO_rsa_encode_key (key); | 595 | pb_key = GNUNET_CRYPTO_rsa_encode_key (key); |
596 | 596 | ||
diff --git a/src/gns/test_gns_simple_srv_lookup.c b/src/gns/test_gns_simple_srv_lookup.c index 12f40d62e..259d32e53 100644 --- a/src/gns/test_gns_simple_srv_lookup.c +++ b/src/gns/test_gns_simple_srv_lookup.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "gnunet_namestore_service.h" | 30 | #include "gnunet_namestore_service.h" |
31 | #include "../namestore/namestore.h" | 31 | #include "../namestore/namestore.h" |
32 | #include "gnunet_dnsparser_lib.h" | 32 | #include "gnunet_dnsparser_lib.h" |
33 | #include "../dns/dnsparser.h" | 33 | #include "gns_records.h" |
34 | #include "gnunet_gns_service.h" | 34 | #include "gnunet_gns_service.h" |
35 | 35 | ||
36 | /* DEFINES */ | 36 | /* DEFINES */ |