WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
#define GNUNET_DNSPARSER_TYPE_TSIG 250
#define GNUNET_DNSPARSER_TYPE_ALL 255
#define GNUNET_DNSPARSER_TYPE_URI 256
+#define GNUNET_DNSPARSER_TYPE_CAA 257
#define GNUNET_DNSPARSER_TYPE_TA 32768
/**
*/
struct GNUNET_DNSPARSER_Query
{
-
/**
* Name of the record that the query is for (0-terminated).
* In UTF-8 format. The library will convert from and to DNS-IDNA
* See GNUNET_TUN_DNS_CLASS_*.
*/
uint16_t dns_traffic_class;
-
};
*/
struct GNUNET_DNSPARSER_MxRecord
{
-
/**
* Preference for this entry (lower value is higher preference).
*/
* creating the DNS packet will fail.
*/
char *mxhost;
-
};
*/
struct GNUNET_DNSPARSER_SrvRecord
{
-
/**
* Hostname offering the service.
* In UTF-8 format. The library will convert from and to DNS-IDNA
* TCP or UDP port of the service.
*/
uint16_t port;
-
};
* ECDSA Curve P-384/SHA384
*/
GNUNET_DNSPARSER_CERTALGO_ECDSA_P384SHA384 = 14
-
};
*/
struct GNUNET_DNSPARSER_CertRecord
{
-
/**
* Certificate type
*/
* Data of the certificate.
*/
char *certificate_data;
-
};
*/
struct GNUNET_DNSPARSER_SoaRecord
{
-
/**
* The domainname of the name server that was the
* original or primary source of data for this zone.
* from this zone.
*/
uint32_t minimum_ttl;
+};
+
+
+/**
+ * Information from CAA records (RFC 6844).
+ * The tag is followed by the tag_len.
+ * The value is followed by the tag for (d - tag_len - 2) bytes
+ */
+struct GNUNET_DNSPARSER_CaaRecord
+{
+ /**
+ * The flags of the CAA record.
+ */
+ uint8_t flags;
+ /**
+ * The length of the tag.
+ */
+ uint8_t tag_len;
};
*/
struct GNUNET_DNSPARSER_RawRecord
{
-
/**
* Binary record data.
*/
*/
struct GNUNET_DNSPARSER_Record
{
-
/**
* Name of the record that the query is for (0-terminated).
* In UTF-8 format. The library will convert from and to DNS-IDNA
*/
union
{
-
/**
* For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname.
* In UTF-8 format. The library will convert from and to DNS-IDNA
* Raw data for all other types.
*/
struct GNUNET_DNSPARSER_RawRecord raw;
-
} data;
* See GNUNET_TUN_DNS_CLASS_*.
*/
uint16_t dns_traffic_class;
-
};
* DNS ID (to match replies to requests).
*/
uint16_t id;
-
};
*/
struct GNUNET_DNSPARSER_Packet *
GNUNET_DNSPARSER_parse (const char *udp_payload,
- size_t udp_payload_length);
+ size_t udp_payload_length);
/**
*/
int
GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
- uint16_t max,
- char **buf,
- size_t *buf_length);
+ uint16_t max,
+ char **buf,
+ size_t *buf_length);
/* ***************** low-level packing API ******************** */
*/
int
GNUNET_DNSPARSER_builder_add_name (char *dst,
- size_t dst_len,
- size_t *off,
- const char *name);
+ size_t dst_len,
+ size_t *off,
+ const char *name);
/**
*/
int
GNUNET_DNSPARSER_builder_add_query (char *dst,
- size_t dst_len,
- size_t *off,
- const struct GNUNET_DNSPARSER_Query *query);
+ size_t dst_len,
+ size_t *off,
+ const struct GNUNET_DNSPARSER_Query *query);
/**
*/
int
GNUNET_DNSPARSER_builder_add_mx (char *dst,
- size_t dst_len,
- size_t *off,
- const struct GNUNET_DNSPARSER_MxRecord *mx);
+ size_t dst_len,
+ size_t *off,
+ const struct GNUNET_DNSPARSER_MxRecord *mx);
/**
*/
int
GNUNET_DNSPARSER_builder_add_soa (char *dst,
- size_t dst_len,
- size_t *off,
- const struct GNUNET_DNSPARSER_SoaRecord *soa);
+ size_t dst_len,
+ size_t *off,
+ const struct GNUNET_DNSPARSER_SoaRecord *soa);
/**
GNUNET_DNSPARSER_builder_add_cert (char *dst,
size_t dst_len,
size_t *off,
- const struct GNUNET_DNSPARSER_CertRecord *cert);
+ const struct
+ GNUNET_DNSPARSER_CertRecord *cert);
/**
*/
int
GNUNET_DNSPARSER_builder_add_srv (char *dst,
- size_t dst_len,
- size_t *off,
- const struct GNUNET_DNSPARSER_SrvRecord *srv);
+ size_t dst_len,
+ size_t *off,
+ const struct GNUNET_DNSPARSER_SrvRecord *srv);
/* ***************** low-level parsing API ******************** */
*/
int
GNUNET_DNSPARSER_parse_record (const char *udp_payload,
- size_t udp_payload_length,
- size_t *off,
- struct GNUNET_DNSPARSER_Record *r);
+ size_t udp_payload_length,
+ size_t *off,
+ struct GNUNET_DNSPARSER_Record *r);
/**
*/
char *
GNUNET_DNSPARSER_parse_name (const char *udp_payload,
- size_t udp_payload_length,
- size_t *off);
+ size_t udp_payload_length,
+ size_t *off);
/**
*/
int
GNUNET_DNSPARSER_parse_query (const char *udp_payload,
- size_t udp_payload_length,
- size_t *off,
- struct GNUNET_DNSPARSER_Query *q);
+ size_t udp_payload_length,
+ size_t *off,
+ struct GNUNET_DNSPARSER_Query *q);
/**
*/
struct GNUNET_DNSPARSER_SoaRecord *
GNUNET_DNSPARSER_parse_soa (const char *udp_payload,
- size_t udp_payload_length,
- size_t *off);
+ size_t udp_payload_length,
+ size_t *off);
/**
*/
struct GNUNET_DNSPARSER_MxRecord *
GNUNET_DNSPARSER_parse_mx (const char *udp_payload,
- size_t udp_payload_length,
- size_t *off);
+ size_t udp_payload_length,
+ size_t *off);
/**
*/
struct GNUNET_DNSPARSER_SrvRecord *
GNUNET_DNSPARSER_parse_srv (const char *udp_payload,
- size_t udp_payload_length,
- size_t *off);
+ size_t udp_payload_length,
+ size_t *off);
/* ***************** low-level duplication API ******************** */
* @return the newly allocated record
*/
struct GNUNET_DNSPARSER_SoaRecord *
-GNUNET_DNSPARSER_duplicate_soa_record (const struct GNUNET_DNSPARSER_SoaRecord *r);
+GNUNET_DNSPARSER_duplicate_soa_record (const struct
+ GNUNET_DNSPARSER_SoaRecord *r);
/**
* @return the newly allocated record
*/
struct GNUNET_DNSPARSER_CertRecord *
-GNUNET_DNSPARSER_duplicate_cert_record (const struct GNUNET_DNSPARSER_CertRecord *r);
+GNUNET_DNSPARSER_duplicate_cert_record (const struct
+ GNUNET_DNSPARSER_CertRecord *r);
/**
* @return the newly allocated record
*/
struct GNUNET_DNSPARSER_MxRecord *
-GNUNET_DNSPARSER_duplicate_mx_record (const struct GNUNET_DNSPARSER_MxRecord *r);
+GNUNET_DNSPARSER_duplicate_mx_record (const struct
+ GNUNET_DNSPARSER_MxRecord *r);
/**
* @return the newly allocated record
*/
struct GNUNET_DNSPARSER_SrvRecord *
-GNUNET_DNSPARSER_duplicate_srv_record (const struct GNUNET_DNSPARSER_SrvRecord *r);
+GNUNET_DNSPARSER_duplicate_srv_record (const struct
+ GNUNET_DNSPARSER_SrvRecord *r);
/* ***************** low-level deallocation API ******************** */