ttl.c revision f3ca27e9fe307b55e35ea8d7b37351650630e5a3
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999-2001 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * copyright notice and this permission notice appear in all copies.
19c7b1a0293498a3e36692c59646ed6e15ffc8d0Tinderbox User * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
6715db6593ce9a271ac3131cd7a886feaa386a2eEvan Hunt * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
0f66aced2640d964aeb6db41210711ba0640d7f2Evan Hunt * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0f66aced2640d964aeb6db41210711ba0640d7f2Evan Hunt/* $Id: ttl.c,v 1.22 2001/11/12 19:05:34 gson Exp $ */
19c7b1a0293498a3e36692c59646ed6e15ffc8d0Tinderbox User#define RETERR(x) do { \
0f66aced2640d964aeb6db41210711ba0640d7f2Evan Hunt return (_r); \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntstatic isc_result_t bind_ttl(isc_textregion_t *source, isc_uint32_t *ttl);
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * Helper for dns_ttl_totext().
0f66aced2640d964aeb6db41210711ba0640d7f2Evan Huntttlfmt(unsigned int t, const char *s, isc_boolean_t verbose,
0f66aced2640d964aeb6db41210711ba0640d7f2Evan Hunt len = snprintf(tmp, sizeof(tmp), "%u%c", t, s[0]);
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * Derived from bind8 ns_format_ttl().
30eec077db2bdcb6f2a0dc388a3cdde2ede75ec1Mark Andrewsdns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, isc_buffer_t *target) {
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt RETERR(ttlfmt(weeks, "week", verbose, ISC_TF(x > 0), target));
0f66aced2640d964aeb6db41210711ba0640d7f2Evan Hunt RETERR(ttlfmt(days, "day", verbose, ISC_TF(x > 0), target));
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt RETERR(ttlfmt(hours, "hour", verbose, ISC_TF(x > 0), target));
if (mins != 0) {
if (secs != 0 ||
INSIST (x > 0);
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
return(DNS_R_SYNTAX);
s = buf;
return (DNS_R_SYNTAX);
tmp += n;
if (tmp != 0)
return (DNS_R_SYNTAX);
tmp = n;
return (DNS_R_SYNTAX);
return (ISC_R_SUCCESS);