summaryrefslogtreecommitdiff
path: root/doc/libs6dns/s6dns-fmt.html
blob: 247257a63456d349d4a4111819e5a9e5b0ffc343 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6-dns: the s6dns_fmt library interface</title>
    <meta name="Description" content="s6-dns: the s6dns_fmt library interface" />
    <meta name="Keywords" content="s6-dns dns s6dns_fmt library libs6dns" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">libs6dns</a><br />
<a href="../">s6-dns</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>s6dns_fmt</tt> library interface </h1>

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

<h2> General information </h2>

<p>
 <tt>s6dns_fmt</tt> provides primitives to format RR contents into
printable strings.
</p>

<h2> Functions </h2>

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

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

<p>
<code> size_t s6dns_fmt_hinfo (char *s, size_t max, s6dns_message_rr_hinfo_t const *p) </code> <br />
Writes into string <em>s</em> the HINFO contained in *<em>p</em>: 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 <em>max</em> bytes, 0 ENAMETOOLONG is returned.
To avoid that, S6DNS_FMT_HINFO is a suitable number of bytes to preallocate <em>s</em>.
</p>

<p>
<code> size_t s6dns_fmt_mx (char *s, size_t max, s6dns_message_rr_mx_t const *p) </code> <br />
Writes into string <em>s</em> the MX contained in *<em>p</em>: 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 <em>max</em> bytes, 0 ENAMETOOLONG is returned.
To avoid that, S6DNS_FMT_MX is a suitable number of bytes to preallocate <em>s</em>.
</p>

<p>
<code> size_t s6dns_fmt_soa (char *s, size_t max, s6dns_message_rr_soa_t const *p) </code> <br />
Writes into string <em>s</em> the SOA contained in *<em>p</em>:
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 <em>max</em> bytes, 0 ENAMETOOLONG is returned.
To avoid that, S6DNS_FMT_SOA is a suitable number of bytes to preallocate <em>s</em>.
</p>

<p>
<code> size_t s6dns_fmt_srv (char *s, size_t max, s6dns_message_rr_srv_t const *p) </code> <br />
Writes into string <em>s</em> the SRV contained in *<em>p</em>: 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 <em>max</em> bytes, 0 ENAMETOOLONG is returned.
To avoid that, S6DNS_FMT_SRV is a suitable number of bytes to preallocate <em>s</em>.
</p>

<p>
<code> size_t s6dns_fmt_caa (char *s, size_t max, s6dns_message_rr_caa_t const *p) </code> <br />
Writes into string <em>s</em> the CAA contained in *<em>p</em>: 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 <em>max</em> bytes, 0 ENAMETOOLONG is returned.
To avoid that, S6DNS_FMT_CAA is a suitable number of bytes to preallocate <em>s</em>.
</p>

</body>
</html>