xref: /minix/external/bsd/bind/dist/lib/dns/include/dns/ttl.h (revision bb9622b5)
1 /*	$NetBSD: ttl.h,v 1.4 2014/12/10 04:37:58 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 1999-2001  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* Id: ttl.h,v 1.19 2007/06/19 23:47:17 tbox Exp  */
21 
22 #ifndef DNS_TTL_H
23 #define DNS_TTL_H 1
24 
25 /*! \file dns/ttl.h */
26 
27 /***
28  ***	Imports
29  ***/
30 
31 #include <isc/lang.h>
32 #include <isc/types.h>
33 
34 ISC_LANG_BEGINDECLS
35 
36 /***
37  ***	Functions
38  ***/
39 
40 isc_result_t
41 dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose,
42 	       isc_buffer_t *target);
43 /*%<
44  * Output a TTL or other time interval in a human-readable form.
45  * The time interval is given as a count of seconds in 'src'.
46  * The text representation is appended to 'target'.
47  *
48  * If 'verbose' is ISC_FALSE, use the terse BIND 8 style, like "1w2d3h4m5s".
49  *
50  * If 'verbose' is ISC_TRUE, use a verbose style like the SOA comments
51  * in "dig", like "1 week 2 days 3 hours 4 minutes 5 seconds".
52  *
53  * Returns:
54  * \li	ISC_R_SUCCESS
55  * \li	ISC_R_NOSPACE
56  */
57 
58 isc_result_t
59 dns_counter_fromtext(isc_textregion_t *source, isc_uint32_t *ttl);
60 /*%<
61  * Converts a counter from either a plain number or a BIND 8 style value.
62  *
63  * Returns:
64  *\li	ISC_R_SUCCESS
65  *\li	DNS_R_SYNTAX
66  */
67 
68 isc_result_t
69 dns_ttl_fromtext(isc_textregion_t *source, isc_uint32_t *ttl);
70 /*%<
71  * Converts a ttl from either a plain number or a BIND 8 style value.
72  *
73  * Returns:
74  *\li	ISC_R_SUCCESS
75  *\li	DNS_R_BADTTL
76  */
77 
78 ISC_LANG_ENDDECLS
79 
80 #endif /* DNS_TTL_H */
81