---
name: "getdns_convert"
section: "3"
platform: "linux"
package: "getdns"
version: "1.7.3-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/getdns_convert"
---

# getdns\_convert(3)

## NAME

**getdns\_convert,** **getdns\_convert\_dns\_name\_to\_fqdn,** **getdns\_convert\_fqdn\_to\_dns\_name** -- convert dname between presentation- and wire-format

## LIBRARY

DNS Resolver library (libgetdns, -lgetdns)

## SYNOPSIS

\#include \<getdns.h\>

getdns\_return\_t \
 **getdns\_convert\_dns\_name\_to\_fqdn** (const getdns\_bindata \*dns\_name\_wire\_fmt,\

char \*\*fqdn\_as\_string)

getdns\_return\_t \
 **getdns\_convert\_fqdn\_to\_dns\_name** (char \*fqdn\_as\_string, \

const getdns\_bindata \*\*dns\_name\_wire\_fmt)

## DESCRIPTION

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 "www.example.com". 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**

## EXAMPLES

TBD

## SEE ALSO

[**libgetdns**(3)](/libgetdns/3.md)
