00001 /* 00002 * Copyright (C) 2004-2007, 2014 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 1999-2001 Internet Software Consortium. 00004 * 00005 * Permission to use, copy, modify, and/or distribute this software for any 00006 * purpose with or without fee is hereby granted, provided that the above 00007 * copyright notice and this permission notice appear in all copies. 00008 * 00009 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00010 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00011 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00012 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00013 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00014 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00015 * PERFORMANCE OF THIS SOFTWARE. 00016 */ 00017 00018 /* $Id: ttl.h,v 1.19 2007/06/19 23:47:17 tbox Exp $ */ 00019 00020 #ifndef DNS_TTL_H 00021 #define DNS_TTL_H 1 00022 00023 /*! \file dns/ttl.h */ 00024 00025 /*** 00026 *** Imports 00027 ***/ 00028 00029 #include <isc/lang.h> 00030 #include <isc/types.h> 00031 00032 ISC_LANG_BEGINDECLS 00033 00034 /*** 00035 *** Functions 00036 ***/ 00037 00038 isc_result_t 00039 dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, 00040 isc_buffer_t *target); 00041 isc_result_t 00042 dns_ttl_totext2(isc_uint32_t src, isc_boolean_t verbose, 00043 isc_boolean_t upcase, isc_buffer_t *target); 00044 /*%< 00045 * Output a TTL or other time interval in a human-readable form. 00046 * The time interval is given as a count of seconds in 'src'. 00047 * The text representation is appended to 'target'. 00048 * 00049 * If 'verbose' is ISC_FALSE, use the terse BIND 8 style, like "1w2d3h4m5s". 00050 * 00051 * If 'verbose' is ISC_TRUE, use a verbose style like the SOA comments 00052 * in "dig", like "1 week 2 days 3 hours 4 minutes 5 seconds". 00053 * 00054 * If 'upcase' is ISC_TRUE, we conform to the BIND 8 style in which 00055 * the unit letter is capitalized if there is only a single unit 00056 * letter to print (for example, "1m30s", but "2M") 00057 * 00058 * If 'upcase' is ISC_FALSE, unit letters are always in lower case. 00059 * 00060 * Returns: 00061 * \li ISC_R_SUCCESS 00062 * \li ISC_R_NOSPACE 00063 */ 00064 00065 isc_result_t 00066 dns_counter_fromtext(isc_textregion_t *source, isc_uint32_t *ttl); 00067 /*%< 00068 * Converts a counter from either a plain number or a BIND 8 style value. 00069 * 00070 * Returns: 00071 *\li ISC_R_SUCCESS 00072 *\li DNS_R_SYNTAX 00073 */ 00074 00075 isc_result_t 00076 dns_ttl_fromtext(isc_textregion_t *source, isc_uint32_t *ttl); 00077 /*%< 00078 * Converts a ttl from either a plain number or a BIND 8 style value. 00079 * 00080 * Returns: 00081 *\li ISC_R_SUCCESS 00082 *\li DNS_R_BADTTL 00083 */ 00084 00085 ISC_LANG_ENDDECLS 00086 00087 #endif /* DNS_TTL_H */