1
2getdns_convert(3) getdns getdns_convert(3)
3
4
5
7 getdns_convert, getdns_convert_dns_name_to_fqdn, getdns_con‐
8 vert_fqdn_to_dns_name -- convert dname between presentation- and wire-
9 format
10
11
13 DNS Resolver library (libgetdns, -lgetdns)
14
15
17 #include <getdns.h>
18
19 getdns_return_t
20 getdns_convert_dns_name_to_fqdn (const getdns_bindata
21 *dns_name_wire_fmt,
22 char **fqdn_as_string)
23
24 getdns_return_t
25 getdns_convert_fqdn_to_dns_name (char *fqdn_as_string,
26 const getdns_bindata **dns_name_wire_fmt)
27
28
30 Names in DNS fields are stored in a fashion very different from the
31 normal presentation format normally used in applications. The DNS for‐
32 mat is described in the first paragraph in Section 3.1 of RFC 1035; the
33 presentation format here is a null-terminated string with interior
34 dots. These helper functions only work with names in the DNS format
35 that are not compressed. They are useful for converting domain names in
36 the replies_tree to and from the FQDN presentation format.
37
38 getdns_convert_dns_name_to_fqdn() converts a domain name in DNS format
39 to the presentation format. For example, the hex sequence 03 77 77 77
40 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 would be converted to "www.exam‐
41 ple.com". getdns_convert_fqdn_to_dns_name() does the reverse: it con‐
42 verts a null-terminated string in FQDN format to bytes in DNS format.
43
44
45 dns_name_wire_fmt The non-compressed DNS wire format name (per RFC
46 1035) in a bindata structure that will be converted to/from an fqdn.
47 In getdns_convert_fqdn_to_dns_name storage is allocated using the
48 system allocator (malloc) and must be freed by the caller.
49
50
51 fqdn_as_string a null terminated string to be converted to/from non-
52 compressed DNS wire format name (per RFC 1035). In getdns_con‐
53 vert_dns_name_to_fqdn storage is allocated using the system alloca‐
54 tor (malloc) and must be freed by the caller.
55
56
57
58
60 Upon successful completion the function returns GETDNS_RETURN_GOOD
61
62
64 TBD
65
66
68 libgetdns(3)
69
70
71
72
73getdns 1.6.0 December 2015 getdns_convert(3)