2 This file is part of GNUnet
3 Copyright (C) 2010-2014 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @author Philipp Toelke
23 * @author Christian Grothoff
26 * API for helper library to parse DNS packets.
28 * @defgroup dns-parser DNS parser library
29 * Helper library to parse DNS packets.
32 #ifndef GNUNET_DNSPARSER_LIB_H
33 #define GNUNET_DNSPARSER_LIB_H
35 #include "gnunet_util_lib.h"
38 * Maximum length of a label in DNS.
40 #define GNUNET_DNSPARSER_MAX_LABEL_LENGTH 63
43 * Maximum length of a name in DNS.
45 #define GNUNET_DNSPARSER_MAX_NAME_LENGTH 253
49 * A few common DNS types.
51 #define GNUNET_DNSPARSER_TYPE_ANY 0
52 #define GNUNET_DNSPARSER_TYPE_A 1
53 #define GNUNET_DNSPARSER_TYPE_NS 2
54 #define GNUNET_DNSPARSER_TYPE_CNAME 5
55 #define GNUNET_DNSPARSER_TYPE_SOA 6
56 #define GNUNET_DNSPARSER_TYPE_PTR 12
57 #define GNUNET_DNSPARSER_TYPE_MX 15
58 #define GNUNET_DNSPARSER_TYPE_TXT 16
59 #define GNUNET_DNSPARSER_TYPE_RP 17
60 #define GNUNET_DNSPARSER_TYPE_AFSDB 18
61 #define GNUNET_DNSPARSER_TYPE_SIG 24
62 #define GNUNET_DNSPARSER_TYPE_KEY 25
63 #define GNUNET_DNSPARSER_TYPE_AAAA 28
64 #define GNUNET_DNSPARSER_TYPE_LOC 29
65 #define GNUNET_DNSPARSER_TYPE_SRV 33
66 #define GNUNET_DNSPARSER_TYPE_NAPTR 35
67 #define GNUNET_DNSPARSER_TYPE_KX 36
68 #define GNUNET_DNSPARSER_TYPE_CERT 37
69 #define GNUNET_DNSPARSER_TYPE_DNAME 39
70 #define GNUNET_DNSPARSER_TYPE_APL 42
71 #define GNUNET_DNSPARSER_TYPE_DS 43
72 #define GNUNET_DNSPARSER_TYPE_SSHFP 44
73 #define GNUNET_DNSPARSER_TYPE_IPSECKEY 45
74 #define GNUNET_DNSPARSER_TYPE_RRSIG 46
75 #define GNUNET_DNSPARSER_TYPE_NSEC 47
76 #define GNUNET_DNSPARSER_TYPE_DNSKEY 48
77 #define GNUNET_DNSPARSER_TYPE_DHCID 49
78 #define GNUNET_DNSPARSER_TYPE_NSEC3 50
79 #define GNUNET_DNSPARSER_TYPE_NSEC3PARAM 51
80 #define GNUNET_DNSPARSER_TYPE_TLSA 52
81 #define GNUNET_DNSPARSER_TYPE_HIP 55
82 #define GNUNET_DNSPARSER_TYPE_CDS 59
83 #define GNUNET_DNSPARSER_TYPE_CDNSKEY 60
84 #define GNUNET_DNSPARSER_TYPE_OPENPGPKEY 61
85 #define GNUNET_DNSPARSER_TYPE_TKEY 249
86 #define GNUNET_DNSPARSER_TYPE_TSIG 250
87 #define GNUNET_DNSPARSER_TYPE_ALL 255
88 #define GNUNET_DNSPARSER_TYPE_URI 256
89 #define GNUNET_DNSPARSER_TYPE_CAA 257
90 #define GNUNET_DNSPARSER_TYPE_TA 32768
95 struct GNUNET_DNSPARSER_Query
98 * Name of the record that the query is for (0-terminated).
99 * In UTF-8 format. The library will convert from and to DNS-IDNA
100 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
101 * individual label is well-formed. If a given name is not well-formed,
102 * creating the DNS packet will fail.
107 * See GNUNET_DNSPARSER_TYPE_*.
112 * See GNUNET_TUN_DNS_CLASS_*.
114 uint16_t dns_traffic_class;
119 * Information from MX records (RFC 1035).
121 struct GNUNET_DNSPARSER_MxRecord
124 * Preference for this entry (lower value is higher preference).
129 * Name of the mail server.
130 * In UTF-8 format. The library will convert from and to DNS-IDNA
131 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
132 * individual label is well-formed. If a given name is not well-formed,
133 * creating the DNS packet will fail.
140 * Information from SRV records (RFC 2782).
142 struct GNUNET_DNSPARSER_SrvRecord
145 * Hostname offering the service.
146 * In UTF-8 format. The library will convert from and to DNS-IDNA
147 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
148 * individual label is well-formed. If a given name is not well-formed,
149 * creating the DNS packet will fail.
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.
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.
168 * TCP or UDP port of the service.
175 * DNS CERT types as defined in RFC 4398.
177 enum GNUNET_DNSPARSER_CertType
182 GNUNET_DNSPARSER_CERTTYPE_RESERVED = 0,
185 * An x509 PKIX certificate
187 GNUNET_DNSPARSER_CERTTYPE_PKIX = 1,
192 GNUNET_DNSPARSER_CERTTYPE_SKPI = 2,
197 GNUNET_DNSPARSER_CERTTYPE_PGP = 3,
200 * An x509 PKIX cert URL
202 GNUNET_DNSPARSER_CERTTYPE_IPKIX = 4,
207 GNUNET_DNSPARSER_CERTTYPE_ISKPI = 5,
210 * A PGP cert fingerprint and URL
212 GNUNET_DNSPARSER_CERTTYPE_IPGP = 6,
215 * An attribute Certificate
217 GNUNET_DNSPARSER_CERTTYPE_ACPKIX = 7,
220 * An attribute cert URL
222 GNUNET_DNSPARSER_CERTTYPE_IACKPIX = 8
227 * DNSCERT algorithms as defined in http://www.iana.org/assignments/
228 * dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml, under dns-sec-alg-numbers-1
230 enum GNUNET_DNSPARSER_CertAlgorithm
235 GNUNET_DNSPARSER_CERTALGO_UNDEFINED = 0,
240 GNUNET_DNSPARSER_CERTALGO_RSAMD5 = 1,
245 GNUNET_DNSPARSER_CERTALGO_DH = 2,
250 GNUNET_DNSPARSER_CERTALGO_DSASHA = 3,
255 GNUNET_DNSPARSER_CERTALGO_RSRVD4 = 4,
260 GNUNET_DNSPARSER_CERTALGO_RSASHA = 5,
265 GNUNET_DNSPARSER_CERTALGO_DSANSEC3 = 6,
270 GNUNET_DNSPARSER_CERTALGO_RSANSEC3 = 7,
275 GNUNET_DNSPARSER_CERTALGO_RSASHA256 = 8,
280 GNUNET_DNSPARSER_CERTALGO_RSRVD9 = 9,
285 GNUNET_DNSPARSER_CERTALGO_RSASHA512 = 10,
290 GNUNET_DNSPARSER_CERTALGO_GOST_R34 = 12,
293 * ECDSA Curve P-256/SHA256
295 GNUNET_DNSPARSER_CERTALGO_ECDSA_P256SHA256 = 13,
298 * ECDSA Curve P-384/SHA384
300 GNUNET_DNSPARSER_CERTALGO_ECDSA_P384SHA384 = 14
305 * Information from CERT records (RFC 4034).
307 struct GNUNET_DNSPARSER_CertRecord
312 enum GNUNET_DNSPARSER_CertType cert_type;
322 enum GNUNET_DNSPARSER_CertAlgorithm algorithm;
325 * Number of bytes in @e certificate_data
327 size_t certificate_size;
330 * Data of the certificate.
332 char *certificate_data;
337 * Information from SOA records (RFC 1035).
339 struct GNUNET_DNSPARSER_SoaRecord
342 * The domainname of the name server that was the
343 * original or primary source of data for this zone.
344 * In UTF-8 format. The library will convert from and to DNS-IDNA
345 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
346 * individual label is well-formed. If a given name is not well-formed,
347 * creating the DNS packet will fail.
352 * A domainname which specifies the mailbox of the
353 * person responsible for this zone.
354 * In UTF-8 format. The library will convert from and to DNS-IDNA
355 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
356 * individual label is well-formed. If a given name is not well-formed,
357 * creating the DNS packet will fail.
362 * The version number of the original copy of the zone.
367 * Time interval before the zone should be refreshed.
372 * Time interval that should elapse before a failed refresh should
378 * Time value that specifies the upper limit on the time interval
379 * that can elapse before the zone is no longer authoritative.
384 * The bit minimum TTL field that should be exported with any RR
387 uint32_t minimum_ttl;
392 * Information from CAA records (RFC 6844).
393 * The tag is followed by the tag_len.
394 * The value is followed by the tag for (d - tag_len - 2) bytes
396 struct GNUNET_DNSPARSER_CaaRecord
399 * The flags of the CAA record.
404 * The length of the tag.
411 * Binary record information (unparsed).
413 struct GNUNET_DNSPARSER_RawRecord
416 * Binary record data.
421 * Number of bytes in data.
428 * A DNS response record.
430 struct GNUNET_DNSPARSER_Record
433 * Name of the record that the query is for (0-terminated).
434 * In UTF-8 format. The library will convert from and to DNS-IDNA
435 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
436 * individual label is well-formed. If a given name is not well-formed,
437 * creating the DNS packet will fail.
442 * Payload of the record (which one of these is valid depends on the 'type').
447 * For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname.
448 * In UTF-8 format. The library will convert from and to DNS-IDNA
449 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
450 * individual label is well-formed. If a given name is not well-formed,
451 * creating the DNS packet will fail.
456 * SOA data for SOA records.
458 struct GNUNET_DNSPARSER_SoaRecord *soa;
461 * CERT data for CERT records.
463 struct GNUNET_DNSPARSER_CertRecord *cert;
466 * MX data for MX records.
468 struct GNUNET_DNSPARSER_MxRecord *mx;
471 * SRV data for SRV records.
473 struct GNUNET_DNSPARSER_SrvRecord *srv;
476 * Raw data for all other types.
478 struct GNUNET_DNSPARSER_RawRecord raw;
483 * When does the record expire?
485 struct GNUNET_TIME_Absolute expiration_time;
488 * See GNUNET_DNSPARSER_TYPE_*.
493 * See GNUNET_TUN_DNS_CLASS_*.
495 uint16_t dns_traffic_class;
500 * Easy-to-process, parsed version of a DNS packet.
502 struct GNUNET_DNSPARSER_Packet
505 * Array of all queries in the packet, must contain "num_queries" entries.
507 struct GNUNET_DNSPARSER_Query *queries;
510 * Array of all answers in the packet, must contain "num_answers" entries.
512 struct GNUNET_DNSPARSER_Record *answers;
515 * Array of all authority records in the packet, must contain "num_authority_records" entries.
517 struct GNUNET_DNSPARSER_Record *authority_records;
520 * Array of all additional answers in the packet, must contain "num_additional_records" entries.
522 struct GNUNET_DNSPARSER_Record *additional_records;
525 * Number of queries in the packet.
527 unsigned int num_queries;
530 * Number of answers in the packet, should be 0 for queries.
532 unsigned int num_answers;
535 * Number of authoritative answers in the packet, should be 0 for queries.
537 unsigned int num_authority_records;
540 * Number of additional records in the packet, should be 0 for queries.
542 unsigned int num_additional_records;
545 * Bitfield of DNS flags.
547 struct GNUNET_TUN_DnsFlags flags;
550 * DNS ID (to match replies to requests).
557 * Check if a label in UTF-8 format can be coded into valid IDNA.
558 * This can fail if the ASCII-conversion becomes longer than 63 characters.
560 * @param label label to check (UTF-8 string)
561 * @return #GNUNET_OK if the label can be converted to IDNA,
562 * #GNUNET_SYSERR if the label is not valid for DNS names
565 GNUNET_DNSPARSER_check_label (const char *label);
569 * Check if a hostname in UTF-8 format can be coded into valid IDNA.
570 * This can fail if a label becomes longer than 63 characters or if
571 * the entire name exceeds 253 characters.
573 * @param name name to check (UTF-8 string)
574 * @return #GNUNET_OK if the label can be converted to IDNA,
575 * #GNUNET_SYSERR if the label is not valid for DNS names
578 GNUNET_DNSPARSER_check_name (const char *name);
582 * Parse a UDP payload of a DNS packet in to a nice struct for further
583 * processing and manipulation.
585 * @param udp_payload wire-format of the DNS packet
586 * @param udp_payload_length number of bytes in @a udp_payload
587 * @return NULL on error, otherwise the parsed packet
589 struct GNUNET_DNSPARSER_Packet *
590 GNUNET_DNSPARSER_parse (const char *udp_payload,
591 size_t udp_payload_length);
595 * Free memory taken by a packet.
597 * @param p packet to free
600 GNUNET_DNSPARSER_free_packet (struct GNUNET_DNSPARSER_Packet *p);
604 * Given a DNS packet @a p, generate the corresponding UDP payload.
605 * Note that we do not attempt to pack the strings with pointers
606 * as this would complicate the code and this is about being
607 * simple and secure, not fast, fancy and broken like bind.
609 * @param p packet to pack
610 * @param max maximum allowed size for the resulting UDP payload
611 * @param buf set to a buffer with the packed message
612 * @param buf_length set to the length of @a buf
613 * @return #GNUNET_SYSERR if @a p is invalid
614 * #GNUNET_NO if @a p was truncated (but there is still a result in @a buf)
615 * #GNUNET_OK if @a p was packed completely into @a buf
618 GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
623 /* ***************** low-level packing API ******************** */
626 * Add a DNS name to the UDP packet at the given location, converting
627 * the name to IDNA notation as necessary.
629 * @param dst where to write the name (UDP packet)
630 * @param dst_len number of bytes in @a dst
631 * @param off pointer to offset where to write the name (increment by bytes used)
632 * must not be changed if there is an error
633 * @param name name to write
634 * @return #GNUNET_SYSERR if @a name is invalid
635 * #GNUNET_NO if @a name did not fit
636 * #GNUNET_OK if @a name was added to @a dst
639 GNUNET_DNSPARSER_builder_add_name (char *dst,
646 * Add a DNS query to the UDP packet at the given location.
648 * @param dst where to write the query
649 * @param dst_len number of bytes in @a dst
650 * @param off pointer to offset where to write the query (increment by bytes used)
651 * must not be changed if there is an error
652 * @param query query to write
653 * @return #GNUNET_SYSERR if @a query is invalid
654 * #GNUNET_NO if @a query did not fit
655 * #GNUNET_OK if @a query was added to @a dst
658 GNUNET_DNSPARSER_builder_add_query (char *dst,
661 const struct GNUNET_DNSPARSER_Query *query);
665 * Add an MX record to the UDP packet at the given location.
667 * @param dst where to write the mx record
668 * @param dst_len number of bytes in @a dst
669 * @param off pointer to offset where to write the mx information (increment by bytes used);
670 * can also change if there was an error
671 * @param mx mx information to write
672 * @return #GNUNET_SYSERR if @a mx is invalid
673 * #GNUNET_NO if @a mx did not fit
674 * #GNUNET_OK if @a mx was added to @a dst
677 GNUNET_DNSPARSER_builder_add_mx (char *dst,
680 const struct GNUNET_DNSPARSER_MxRecord *mx);
684 * Add an SOA record to the UDP packet at the given location.
686 * @param dst where to write the SOA record
687 * @param dst_len number of bytes in @a dst
688 * @param off pointer to offset where to write the SOA information (increment by bytes used)
689 * can also change if there was an error
690 * @param soa SOA information to write
691 * @return #GNUNET_SYSERR if @a soa is invalid
692 * #GNUNET_NO if @a soa did not fit
693 * #GNUNET_OK if @a soa was added to @a dst
696 GNUNET_DNSPARSER_builder_add_soa (char *dst,
699 const struct GNUNET_DNSPARSER_SoaRecord *soa);
703 * Add CERT record to the UDP packet at the given location.
705 * @param dst where to write the CERT record
706 * @param dst_len number of bytes in @a dst
707 * @param off pointer to offset where to write the CERT information (increment by bytes used)
708 * can also change if there was an error
709 * @param cert CERT information to write
710 * @return #GNUNET_SYSERR if @a soa is invalid
711 * #GNUNET_NO if @a soa did not fit
712 * #GNUNET_OK if @a soa was added to @a dst
715 GNUNET_DNSPARSER_builder_add_cert (char *dst,
719 GNUNET_DNSPARSER_CertRecord *cert);
723 * Add an SRV record to the UDP packet at the given location.
725 * @param dst where to write the SRV record
726 * @param dst_len number of bytes in @a dst
727 * @param off pointer to offset where to write the SRV information (increment by bytes used)
728 * can also change if there was an error
729 * @param srv SRV information to write
730 * @return #GNUNET_SYSERR if @a srv is invalid
731 * #GNUNET_NO if @a srv did not fit
732 * #GNUNET_OK if @a srv was added to @a dst
735 GNUNET_DNSPARSER_builder_add_srv (char *dst,
738 const struct GNUNET_DNSPARSER_SrvRecord *srv);
740 /* ***************** low-level parsing API ******************** */
743 * Parse a DNS record entry.
745 * @param udp_payload entire UDP payload
746 * @param udp_payload_length length of @a udp_payload
747 * @param off pointer to the offset of the record to parse in the udp_payload (to be
748 * incremented by the size of the record)
749 * @param r where to write the record information
750 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the record is malformed
753 GNUNET_DNSPARSER_parse_record (const char *udp_payload,
754 size_t udp_payload_length,
756 struct GNUNET_DNSPARSER_Record *r);
760 * Parse name inside of a DNS query or record.
762 * @param udp_payload entire UDP payload
763 * @param udp_payload_length length of @a udp_payload
764 * @param off pointer to the offset of the name to parse in the udp_payload (to be
765 * incremented by the size of the name)
766 * @return name as 0-terminated C string on success, NULL if the payload is malformed
769 GNUNET_DNSPARSER_parse_name (const char *udp_payload,
770 size_t udp_payload_length,
775 * Parse a DNS query entry.
777 * @param udp_payload entire UDP payload
778 * @param udp_payload_length length of @a udp_payload
779 * @param off pointer to the offset of the query to parse in the udp_payload (to be
780 * incremented by the size of the query)
781 * @param q where to write the query information
782 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the query is malformed
785 GNUNET_DNSPARSER_parse_query (const char *udp_payload,
786 size_t udp_payload_length,
788 struct GNUNET_DNSPARSER_Query *q);
792 * Parse a DNS SOA record.
794 * @param udp_payload reference to UDP packet
795 * @param udp_payload_length length of @a udp_payload
796 * @param off pointer to the offset of the query to parse in the SOA record (to be
797 * incremented by the size of the record), unchanged on error
798 * @return the parsed SOA record, NULL on error
800 struct GNUNET_DNSPARSER_SoaRecord *
801 GNUNET_DNSPARSER_parse_soa (const char *udp_payload,
802 size_t udp_payload_length,
807 * Parse a DNS CERT record.
809 * @param udp_payload reference to UDP packet
810 * @param udp_payload_length length of @a udp_payload
811 * @param off pointer to the offset of the query to parse in the CERT record (to be
812 * incremented by the size of the record), unchanged on error
813 * @return the parsed CERT record, NULL on error
815 struct GNUNET_DNSPARSER_CertRecord *
816 GNUNET_DNSPARSER_parse_cert (const char *udp_payload,
817 size_t udp_payload_length,
822 * Parse a DNS MX record.
824 * @param udp_payload reference to UDP packet
825 * @param udp_payload_length length of @a udp_payload
826 * @param off pointer to the offset of the query to parse in the MX record (to be
827 * incremented by the size of the record), unchanged on error
828 * @return the parsed MX record, NULL on error
830 struct GNUNET_DNSPARSER_MxRecord *
831 GNUNET_DNSPARSER_parse_mx (const char *udp_payload,
832 size_t udp_payload_length,
837 * Parse a DNS SRV record.
839 * @param udp_payload reference to UDP packet
840 * @param udp_payload_length length of @a udp_payload
841 * @param off pointer to the offset of the query to parse in the SRV record (to be
842 * incremented by the size of the record), unchanged on error
843 * @return the parsed SRV record, NULL on error
845 struct GNUNET_DNSPARSER_SrvRecord *
846 GNUNET_DNSPARSER_parse_srv (const char *udp_payload,
847 size_t udp_payload_length,
850 /* ***************** low-level duplication API ******************** */
853 * Duplicate (deep-copy) the given DNS record
855 * @param r the record
856 * @return the newly allocated record
858 struct GNUNET_DNSPARSER_Record *
859 GNUNET_DNSPARSER_duplicate_record (const struct GNUNET_DNSPARSER_Record *r);
863 * Duplicate (deep-copy) the given DNS record
865 * @param r the record
866 * @return the newly allocated record
868 struct GNUNET_DNSPARSER_SoaRecord *
869 GNUNET_DNSPARSER_duplicate_soa_record (const struct
870 GNUNET_DNSPARSER_SoaRecord *r);
874 * Duplicate (deep-copy) the given DNS record
876 * @param r the record
877 * @return the newly allocated record
879 struct GNUNET_DNSPARSER_CertRecord *
880 GNUNET_DNSPARSER_duplicate_cert_record (const struct
881 GNUNET_DNSPARSER_CertRecord *r);
885 * Duplicate (deep-copy) the given DNS record
887 * @param r the record
888 * @return the newly allocated record
890 struct GNUNET_DNSPARSER_MxRecord *
891 GNUNET_DNSPARSER_duplicate_mx_record (const struct
892 GNUNET_DNSPARSER_MxRecord *r);
896 * Duplicate (deep-copy) the given DNS record
898 * @param r the record
899 * @return the newly allocated record
901 struct GNUNET_DNSPARSER_SrvRecord *
902 GNUNET_DNSPARSER_duplicate_srv_record (const struct
903 GNUNET_DNSPARSER_SrvRecord *r);
906 /* ***************** low-level deallocation API ******************** */
909 * Free the given DNS record.
911 * @param r record to free
914 GNUNET_DNSPARSER_free_record (struct GNUNET_DNSPARSER_Record *r);
918 * Free MX information record.
920 * @param mx record to free
923 GNUNET_DNSPARSER_free_mx (struct GNUNET_DNSPARSER_MxRecord *mx);
927 * Free SRV information record.
929 * @param srv record to free
932 GNUNET_DNSPARSER_free_srv (struct GNUNET_DNSPARSER_SrvRecord *srv);
936 * Free SOA information record.
938 * @param soa record to free
941 GNUNET_DNSPARSER_free_soa (struct GNUNET_DNSPARSER_SoaRecord *soa);
945 * Free CERT information record.
947 * @param cert record to free
950 GNUNET_DNSPARSER_free_cert (struct GNUNET_DNSPARSER_CertRecord *cert);
954 * Convert a block of binary data to HEX.
956 * @param data binary data to convert
957 * @param data_size number of bytes in @a data
958 * @return HEX string (lower case)
961 GNUNET_DNSPARSER_bin_to_hex (const void *data,
966 * Convert a HEX string to block of binary data.
968 * @param hex HEX string to convert (may contain mixed case)
969 * @param data where to write result, must be
970 * at least `strlen(hex)/2` bytes long
971 * @return number of bytes written to data
974 GNUNET_DNSPARSER_hex_to_bin (const char *hex,
980 /** @} */ /* end of group */