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
99 * Name of the record that the query is for (0-terminated).
100 * In UTF-8 format. The library will convert from and to DNS-IDNA
101 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
102 * individual label is well-formed. If a given name is not well-formed,
103 * creating the DNS packet will fail.
108 * See GNUNET_DNSPARSER_TYPE_*.
113 * See GNUNET_TUN_DNS_CLASS_*.
115 uint16_t dns_traffic_class;
121 * Information from MX records (RFC 1035).
123 struct GNUNET_DNSPARSER_MxRecord
127 * Preference for this entry (lower value is higher preference).
132 * Name of the mail server.
133 * In UTF-8 format. The library will convert from and to DNS-IDNA
134 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
135 * individual label is well-formed. If a given name is not well-formed,
136 * creating the DNS packet will fail.
144 * Information from SRV records (RFC 2782).
146 struct GNUNET_DNSPARSER_SrvRecord
150 * Hostname offering the service.
151 * In UTF-8 format. The library will convert from and to DNS-IDNA
152 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
153 * individual label is well-formed. If a given name is not well-formed,
154 * creating the DNS packet will fail.
159 * Preference for this entry (lower value is higher preference). Clients
160 * will contact hosts from the lowest-priority group first and fall back
161 * to higher priorities if the low-priority entries are unavailable.
166 * Relative weight for records with the same priority. Clients will use
167 * the hosts of the same (lowest) priority with a probability proportional
168 * to the weight given.
173 * TCP or UDP port of the service.
181 * DNS CERT types as defined in RFC 4398.
183 enum GNUNET_DNSPARSER_CertType
188 GNUNET_DNSPARSER_CERTTYPE_RESERVED = 0,
191 * An x509 PKIX certificate
193 GNUNET_DNSPARSER_CERTTYPE_PKIX = 1,
198 GNUNET_DNSPARSER_CERTTYPE_SKPI = 2,
203 GNUNET_DNSPARSER_CERTTYPE_PGP = 3,
206 * An x509 PKIX cert URL
208 GNUNET_DNSPARSER_CERTTYPE_IPKIX = 4,
213 GNUNET_DNSPARSER_CERTTYPE_ISKPI = 5,
216 * A PGP cert fingerprint and URL
218 GNUNET_DNSPARSER_CERTTYPE_IPGP = 6,
221 * An attribute Certificate
223 GNUNET_DNSPARSER_CERTTYPE_ACPKIX = 7,
226 * An attribute cert URL
228 GNUNET_DNSPARSER_CERTTYPE_IACKPIX = 8
233 * DNSCERT algorithms as defined in http://www.iana.org/assignments/
234 * dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml, under dns-sec-alg-numbers-1
236 enum GNUNET_DNSPARSER_CertAlgorithm
241 GNUNET_DNSPARSER_CERTALGO_UNDEFINED = 0,
246 GNUNET_DNSPARSER_CERTALGO_RSAMD5 = 1,
251 GNUNET_DNSPARSER_CERTALGO_DH = 2,
256 GNUNET_DNSPARSER_CERTALGO_DSASHA = 3,
261 GNUNET_DNSPARSER_CERTALGO_RSRVD4 = 4,
266 GNUNET_DNSPARSER_CERTALGO_RSASHA = 5,
271 GNUNET_DNSPARSER_CERTALGO_DSANSEC3 = 6,
276 GNUNET_DNSPARSER_CERTALGO_RSANSEC3 = 7,
281 GNUNET_DNSPARSER_CERTALGO_RSASHA256 = 8,
286 GNUNET_DNSPARSER_CERTALGO_RSRVD9 = 9,
291 GNUNET_DNSPARSER_CERTALGO_RSASHA512 = 10,
296 GNUNET_DNSPARSER_CERTALGO_GOST_R34 = 12,
299 * ECDSA Curve P-256/SHA256
301 GNUNET_DNSPARSER_CERTALGO_ECDSA_P256SHA256 = 13,
304 * ECDSA Curve P-384/SHA384
306 GNUNET_DNSPARSER_CERTALGO_ECDSA_P384SHA384 = 14
312 * Information from CERT records (RFC 4034).
314 struct GNUNET_DNSPARSER_CertRecord
320 enum GNUNET_DNSPARSER_CertType cert_type;
330 enum GNUNET_DNSPARSER_CertAlgorithm algorithm;
333 * Number of bytes in @e certificate_data
335 size_t certificate_size;
338 * Data of the certificate.
340 char *certificate_data;
346 * Information from SOA records (RFC 1035).
348 struct GNUNET_DNSPARSER_SoaRecord
352 * The domainname of the name server that was the
353 * original or primary source of data 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 * A domainname which specifies the mailbox of the
363 * person responsible for this zone.
364 * In UTF-8 format. The library will convert from and to DNS-IDNA
365 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
366 * individual label is well-formed. If a given name is not well-formed,
367 * creating the DNS packet will fail.
372 * The version number of the original copy of the zone.
377 * Time interval before the zone should be refreshed.
382 * Time interval that should elapse before a failed refresh should
388 * Time value that specifies the upper limit on the time interval
389 * that can elapse before the zone is no longer authoritative.
394 * The bit minimum TTL field that should be exported with any RR
397 uint32_t minimum_ttl;
403 * Information from CAA records (RFC 6844).
404 * The tag is followed by the tag_len.
405 * The value is followed by the tag for (d - tag_len - 2) bytes
407 struct GNUNET_DNSPARSER_CaaRecord
410 * The flags of the CAA record.
415 * The length of the tag.
423 * Binary record information (unparsed).
425 struct GNUNET_DNSPARSER_RawRecord
429 * Binary record data.
434 * Number of bytes in data.
441 * A DNS response record.
443 struct GNUNET_DNSPARSER_Record
447 * Name of the record that the query is for (0-terminated).
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 * Payload of the record (which one of these is valid depends on the 'type').
462 * For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname.
463 * In UTF-8 format. The library will convert from and to DNS-IDNA
464 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
465 * individual label is well-formed. If a given name is not well-formed,
466 * creating the DNS packet will fail.
471 * SOA data for SOA records.
473 struct GNUNET_DNSPARSER_SoaRecord *soa;
476 * CERT data for CERT records.
478 struct GNUNET_DNSPARSER_CertRecord *cert;
481 * MX data for MX records.
483 struct GNUNET_DNSPARSER_MxRecord *mx;
486 * SRV data for SRV records.
488 struct GNUNET_DNSPARSER_SrvRecord *srv;
491 * Raw data for all other types.
493 struct GNUNET_DNSPARSER_RawRecord raw;
499 * When does the record expire?
501 struct GNUNET_TIME_Absolute expiration_time;
504 * See GNUNET_DNSPARSER_TYPE_*.
509 * See GNUNET_TUN_DNS_CLASS_*.
511 uint16_t dns_traffic_class;
517 * Easy-to-process, parsed version of a DNS packet.
519 struct GNUNET_DNSPARSER_Packet
522 * Array of all queries in the packet, must contain "num_queries" entries.
524 struct GNUNET_DNSPARSER_Query *queries;
527 * Array of all answers in the packet, must contain "num_answers" entries.
529 struct GNUNET_DNSPARSER_Record *answers;
532 * Array of all authority records in the packet, must contain "num_authority_records" entries.
534 struct GNUNET_DNSPARSER_Record *authority_records;
537 * Array of all additional answers in the packet, must contain "num_additional_records" entries.
539 struct GNUNET_DNSPARSER_Record *additional_records;
542 * Number of queries in the packet.
544 unsigned int num_queries;
547 * Number of answers in the packet, should be 0 for queries.
549 unsigned int num_answers;
552 * Number of authoritative answers in the packet, should be 0 for queries.
554 unsigned int num_authority_records;
557 * Number of additional records in the packet, should be 0 for queries.
559 unsigned int num_additional_records;
562 * Bitfield of DNS flags.
564 struct GNUNET_TUN_DnsFlags flags;
567 * DNS ID (to match replies to requests).
575 * Check if a label in UTF-8 format can be coded into valid IDNA.
576 * This can fail if the ASCII-conversion becomes longer than 63 characters.
578 * @param label label to check (UTF-8 string)
579 * @return #GNUNET_OK if the label can be converted to IDNA,
580 * #GNUNET_SYSERR if the label is not valid for DNS names
583 GNUNET_DNSPARSER_check_label (const char *label);
587 * Check if a hostname in UTF-8 format can be coded into valid IDNA.
588 * This can fail if a label becomes longer than 63 characters or if
589 * the entire name exceeds 253 characters.
591 * @param name name to check (UTF-8 string)
592 * @return #GNUNET_OK if the label can be converted to IDNA,
593 * #GNUNET_SYSERR if the label is not valid for DNS names
596 GNUNET_DNSPARSER_check_name (const char *name);
600 * Parse a UDP payload of a DNS packet in to a nice struct for further
601 * processing and manipulation.
603 * @param udp_payload wire-format of the DNS packet
604 * @param udp_payload_length number of bytes in @a udp_payload
605 * @return NULL on error, otherwise the parsed packet
607 struct GNUNET_DNSPARSER_Packet *
608 GNUNET_DNSPARSER_parse (const char *udp_payload,
609 size_t udp_payload_length);
613 * Free memory taken by a packet.
615 * @param p packet to free
618 GNUNET_DNSPARSER_free_packet (struct GNUNET_DNSPARSER_Packet *p);
622 * Given a DNS packet @a p, generate the corresponding UDP payload.
623 * Note that we do not attempt to pack the strings with pointers
624 * as this would complicate the code and this is about being
625 * simple and secure, not fast, fancy and broken like bind.
627 * @param p packet to pack
628 * @param max maximum allowed size for the resulting UDP payload
629 * @param buf set to a buffer with the packed message
630 * @param buf_length set to the length of @a buf
631 * @return #GNUNET_SYSERR if @a p is invalid
632 * #GNUNET_NO if @a p was truncated (but there is still a result in @a buf)
633 * #GNUNET_OK if @a p was packed completely into @a buf
636 GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
641 /* ***************** low-level packing API ******************** */
644 * Add a DNS name to the UDP packet at the given location, converting
645 * the name to IDNA notation as necessary.
647 * @param dst where to write the name (UDP packet)
648 * @param dst_len number of bytes in @a dst
649 * @param off pointer to offset where to write the name (increment by bytes used)
650 * must not be changed if there is an error
651 * @param name name to write
652 * @return #GNUNET_SYSERR if @a name is invalid
653 * #GNUNET_NO if @a name did not fit
654 * #GNUNET_OK if @a name was added to @a dst
657 GNUNET_DNSPARSER_builder_add_name (char *dst,
664 * Add a DNS query to the UDP packet at the given location.
666 * @param dst where to write the query
667 * @param dst_len number of bytes in @a dst
668 * @param off pointer to offset where to write the query (increment by bytes used)
669 * must not be changed if there is an error
670 * @param query query to write
671 * @return #GNUNET_SYSERR if @a query is invalid
672 * #GNUNET_NO if @a query did not fit
673 * #GNUNET_OK if @a query was added to @a dst
676 GNUNET_DNSPARSER_builder_add_query (char *dst,
679 const struct GNUNET_DNSPARSER_Query *query);
683 * Add an MX record to the UDP packet at the given location.
685 * @param dst where to write the mx record
686 * @param dst_len number of bytes in @a dst
687 * @param off pointer to offset where to write the mx information (increment by bytes used);
688 * can also change if there was an error
689 * @param mx mx information to write
690 * @return #GNUNET_SYSERR if @a mx is invalid
691 * #GNUNET_NO if @a mx did not fit
692 * #GNUNET_OK if @a mx was added to @a dst
695 GNUNET_DNSPARSER_builder_add_mx (char *dst,
698 const struct GNUNET_DNSPARSER_MxRecord *mx);
702 * Add an SOA record to the UDP packet at the given location.
704 * @param dst where to write the SOA record
705 * @param dst_len number of bytes in @a dst
706 * @param off pointer to offset where to write the SOA information (increment by bytes used)
707 * can also change if there was an error
708 * @param soa SOA information to write
709 * @return #GNUNET_SYSERR if @a soa is invalid
710 * #GNUNET_NO if @a soa did not fit
711 * #GNUNET_OK if @a soa was added to @a dst
714 GNUNET_DNSPARSER_builder_add_soa (char *dst,
717 const struct GNUNET_DNSPARSER_SoaRecord *soa);
721 * Add CERT record to the UDP packet at the given location.
723 * @param dst where to write the CERT record
724 * @param dst_len number of bytes in @a dst
725 * @param off pointer to offset where to write the CERT information (increment by bytes used)
726 * can also change if there was an error
727 * @param cert CERT information to write
728 * @return #GNUNET_SYSERR if @a soa is invalid
729 * #GNUNET_NO if @a soa did not fit
730 * #GNUNET_OK if @a soa was added to @a dst
733 GNUNET_DNSPARSER_builder_add_cert (char *dst,
736 const struct GNUNET_DNSPARSER_CertRecord *cert);
740 * Add an SRV record to the UDP packet at the given location.
742 * @param dst where to write the SRV record
743 * @param dst_len number of bytes in @a dst
744 * @param off pointer to offset where to write the SRV information (increment by bytes used)
745 * can also change if there was an error
746 * @param srv SRV information to write
747 * @return #GNUNET_SYSERR if @a srv is invalid
748 * #GNUNET_NO if @a srv did not fit
749 * #GNUNET_OK if @a srv was added to @a dst
752 GNUNET_DNSPARSER_builder_add_srv (char *dst,
755 const struct GNUNET_DNSPARSER_SrvRecord *srv);
757 /* ***************** low-level parsing API ******************** */
760 * Parse a DNS record entry.
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 record to parse in the udp_payload (to be
765 * incremented by the size of the record)
766 * @param r where to write the record information
767 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the record is malformed
770 GNUNET_DNSPARSER_parse_record (const char *udp_payload,
771 size_t udp_payload_length,
773 struct GNUNET_DNSPARSER_Record *r);
777 * Parse name inside of a DNS query or record.
779 * @param udp_payload entire UDP payload
780 * @param udp_payload_length length of @a udp_payload
781 * @param off pointer to the offset of the name to parse in the udp_payload (to be
782 * incremented by the size of the name)
783 * @return name as 0-terminated C string on success, NULL if the payload is malformed
786 GNUNET_DNSPARSER_parse_name (const char *udp_payload,
787 size_t udp_payload_length,
792 * Parse a DNS query entry.
794 * @param udp_payload entire UDP payload
795 * @param udp_payload_length length of @a udp_payload
796 * @param off pointer to the offset of the query to parse in the udp_payload (to be
797 * incremented by the size of the query)
798 * @param q where to write the query information
799 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the query is malformed
802 GNUNET_DNSPARSER_parse_query (const char *udp_payload,
803 size_t udp_payload_length,
805 struct GNUNET_DNSPARSER_Query *q);
809 * Parse a DNS SOA record.
811 * @param udp_payload reference to UDP packet
812 * @param udp_payload_length length of @a udp_payload
813 * @param off pointer to the offset of the query to parse in the SOA record (to be
814 * incremented by the size of the record), unchanged on error
815 * @return the parsed SOA record, NULL on error
817 struct GNUNET_DNSPARSER_SoaRecord *
818 GNUNET_DNSPARSER_parse_soa (const char *udp_payload,
819 size_t udp_payload_length,
824 * Parse a DNS CERT record.
826 * @param udp_payload reference to UDP packet
827 * @param udp_payload_length length of @a udp_payload
828 * @param off pointer to the offset of the query to parse in the CERT record (to be
829 * incremented by the size of the record), unchanged on error
830 * @return the parsed CERT record, NULL on error
832 struct GNUNET_DNSPARSER_CertRecord *
833 GNUNET_DNSPARSER_parse_cert (const char *udp_payload,
834 size_t udp_payload_length,
839 * Parse a DNS MX record.
841 * @param udp_payload reference to UDP packet
842 * @param udp_payload_length length of @a udp_payload
843 * @param off pointer to the offset of the query to parse in the MX record (to be
844 * incremented by the size of the record), unchanged on error
845 * @return the parsed MX record, NULL on error
847 struct GNUNET_DNSPARSER_MxRecord *
848 GNUNET_DNSPARSER_parse_mx (const char *udp_payload,
849 size_t udp_payload_length,
854 * Parse a DNS SRV record.
856 * @param udp_payload reference to UDP packet
857 * @param udp_payload_length length of @a udp_payload
858 * @param off pointer to the offset of the query to parse in the SRV record (to be
859 * incremented by the size of the record), unchanged on error
860 * @return the parsed SRV record, NULL on error
862 struct GNUNET_DNSPARSER_SrvRecord *
863 GNUNET_DNSPARSER_parse_srv (const char *udp_payload,
864 size_t udp_payload_length,
867 /* ***************** low-level duplication API ******************** */
870 * Duplicate (deep-copy) the given DNS record
872 * @param r the record
873 * @return the newly allocated record
875 struct GNUNET_DNSPARSER_Record *
876 GNUNET_DNSPARSER_duplicate_record (const struct GNUNET_DNSPARSER_Record *r);
880 * Duplicate (deep-copy) the given DNS record
882 * @param r the record
883 * @return the newly allocated record
885 struct GNUNET_DNSPARSER_SoaRecord *
886 GNUNET_DNSPARSER_duplicate_soa_record (const struct GNUNET_DNSPARSER_SoaRecord *r);
890 * Duplicate (deep-copy) the given DNS record
892 * @param r the record
893 * @return the newly allocated record
895 struct GNUNET_DNSPARSER_CertRecord *
896 GNUNET_DNSPARSER_duplicate_cert_record (const struct GNUNET_DNSPARSER_CertRecord *r);
900 * Duplicate (deep-copy) the given DNS record
902 * @param r the record
903 * @return the newly allocated record
905 struct GNUNET_DNSPARSER_MxRecord *
906 GNUNET_DNSPARSER_duplicate_mx_record (const struct GNUNET_DNSPARSER_MxRecord *r);
910 * Duplicate (deep-copy) the given DNS record
912 * @param r the record
913 * @return the newly allocated record
915 struct GNUNET_DNSPARSER_SrvRecord *
916 GNUNET_DNSPARSER_duplicate_srv_record (const struct GNUNET_DNSPARSER_SrvRecord *r);
919 /* ***************** low-level deallocation API ******************** */
922 * Free the given DNS record.
924 * @param r record to free
927 GNUNET_DNSPARSER_free_record (struct GNUNET_DNSPARSER_Record *r);
931 * Free MX information record.
933 * @param mx record to free
936 GNUNET_DNSPARSER_free_mx (struct GNUNET_DNSPARSER_MxRecord *mx);
940 * Free SRV information record.
942 * @param srv record to free
945 GNUNET_DNSPARSER_free_srv (struct GNUNET_DNSPARSER_SrvRecord *srv);
949 * Free SOA information record.
951 * @param soa record to free
954 GNUNET_DNSPARSER_free_soa (struct GNUNET_DNSPARSER_SoaRecord *soa);
958 * Free CERT information record.
960 * @param cert record to free
963 GNUNET_DNSPARSER_free_cert (struct GNUNET_DNSPARSER_CertRecord *cert);
967 * Convert a block of binary data to HEX.
969 * @param data binary data to convert
970 * @param data_size number of bytes in @a data
971 * @return HEX string (lower case)
974 GNUNET_DNSPARSER_bin_to_hex (const void *data,
979 * Convert a HEX string to block of binary data.
981 * @param hex HEX string to convert (may contain mixed case)
982 * @param data where to write result, must be
983 * at least `strlen(hex)/2` bytes long
984 * @return number of bytes written to data
987 GNUNET_DNSPARSER_hex_to_bin (const char *hex,
993 /** @} */ /* end of group */