libs6dns
s6-dns
Software
skarnet.org

The s6dns_fmt library interface

The following functions and structures are declared in the s6-dns/s6dns-fmt.h header, and implemented in the libs6dns.a or libs6dns.so library.

General information

s6dns_fmt provides primitives to format RR contents into printable strings.

Functions

size_t s6dns_fmt_domain (char *s, size_t max, s6dns_domain_t const *d)
Writes into string s the domain contained in *d (in string form). Returns the number of bytes written, or 0 in case of failure. If the output would be more than max bytes, 0 ENAMETOOLONG is returned. To avoid that, S6DNS_FMT_DOMAIN is a suitable number of bytes to preallocate s. This function is actually an alias to s6dns_domain_tostring.

size_t s6dns_fmt_domainlist (char *s, size_t max, s6dns_domain_t const *list, unsigned int n, char const *delim, size_t delimlen)
Writes into string s the list of n domains (in string form) pointed to by list. Between each domain (and not after the last one), string delim of length delimlen is appended. The function returns the number of bytes written, or 0 in case of failure. If the output would be more than max bytes, 0 ENAMETOOLONG is returned. To avoid that, S6DNS_FMT_DOMAINLIST(n) is a suitable number of bytes to preallocate s.

size_t s6dns_fmt_hinfo (char *s, size_t max, s6dns_message_rr_hinfo_t const *p)
Writes into string s the HINFO contained in *p: cpu, then os, separated by a space. Returns the number of bytes written, or 0 in case of failure. If the output would be more than max bytes, 0 ENAMETOOLONG is returned. To avoid that, S6DNS_FMT_HINFO is a suitable number of bytes to preallocate s.

size_t s6dns_fmt_mx (char *s, size_t max, s6dns_message_rr_mx_t const *p)
Writes into string s the MX contained in *p: preference, then exchanger name, separated by a space. Returns the number of bytes written, or 0 in case of failure. If the output would be more than max bytes, 0 ENAMETOOLONG is returned. To avoid that, S6DNS_FMT_MX is a suitable number of bytes to preallocate s.

size_t s6dns_fmt_soa (char *s, size_t max, s6dns_message_rr_soa_t const *p)
Writes into string s the SOA contained in *p: mname, then rname, then serial number, refresh time, retry time, expiration time and minimum time, separated by spaces. Returns the number of bytes written, or 0 in case of failure. If the output would be more than max bytes, 0 ENAMETOOLONG is returned. To avoid that, S6DNS_FMT_SOA is a suitable number of bytes to preallocate s.

size_t s6dns_fmt_srv (char *s, size_t max, s6dns_message_rr_srv_t const *p)
Writes into string s the SRV contained in *p: priority, then weight, then port, then target, separated by spaces. Returns the number of bytes written, or 0 in case of failure. If the output would be more than max bytes, 0 ENAMETOOLONG is returned. To avoid that, S6DNS_FMT_SRV is a suitable number of bytes to preallocate s.

size_t s6dns_fmt_caa (char *s, size_t max, s6dns_message_rr_caa_t const *p)
Writes into string s the CAA contained in *p: flags, then tag, then value, separated by spaces. Returns the number of bytes written, or 0 in case of failure. If the output would be more than max bytes, 0 ENAMETOOLONG is returned. To avoid that, S6DNS_FMT_CAA is a suitable number of bytes to preallocate s.