getdns_convert man page

getdns_convert, getdns_convert_dns_name_to_fqdn, getdns_convert_fqdn_to_dns_name -- convert dname between presentation- and wire-format


DNS Resolver library (libgetdns, -lgetdns)


#include <getdns.h>

getdns_convert_dns_name_to_fqdn (const getdns_bindata *dns_name_wire_fmt,

char **fqdn_as_string)

getdns_convert_fqdn_to_dns_name (char *fqdn_as_string,

const getdns_bindata **dns_name_wire_fmt)


Names in DNS fields are stored in a fashion very different from the normal presentation format normally used in applications. The DNS format is described in the first paragraph in Section 3.1 of RFC 1035; the presentation format here is a null-terminated string with interior dots. These helper functions only work with names in the DNS format that are not compressed. They are useful for converting domain names in the replies_tree to and from the FQDN presentation format.

getdns_convert_dns_name_to_fqdn() converts a domain name in DNS format to the presentation format. For example, the hex sequence 03 77 77 77 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 would be converted to "". getdns_convert_fqdn_to_dns_name() does the reverse: it converts a null-terminated string in FQDN format to bytes in DNS format.

dns_name_wire_fmt The non-compressed DNS wire format name (per RFC 1035) in a bindata structure that will be converted to/from an fqdn.  In getdns_convert_fqdn_to_dns_name storage is allocated using the system allocator (malloc) and must be freed by the caller.

fqdn_as_string a null terminated string to be converted to/from non-compressed DNS wire format name (per RFC 1035). In getdns_convert_dns_name_to_fqdn storage is allocated using the system allocator (malloc) and must be freed by the caller.

Return Values

Upon successful completion the function returns GETDNS_RETURN_GOOD



See Also


Referenced By


The man pages getdns_convert_dns_name_to_fqdn(3) and getdns_convert_fqdn_to_dns_name(3) are aliases of getdns_convert(3).

December 2015 getdns 1.2.1