ttl.c File Reference

#include <config.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <isc/buffer.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/result.h>
#include <dns/ttl.h>

Go to the source code of this file.

Defines

#define RETERR(x)

Functions

static isc_result_t bind_ttl (isc_textregion_t *source, isc_uint32_t *ttl)
static isc_result_t ttlfmt (unsigned int t, const char *s, isc_boolean_t verbose, isc_boolean_t space, isc_buffer_t *target)
isc_result_t dns_ttl_totext (isc_uint32_t src, isc_boolean_t verbose, isc_buffer_t *target)
isc_result_t dns_ttl_totext2 (isc_uint32_t src, isc_boolean_t verbose, isc_boolean_t upcase, isc_buffer_t *target)
 Output a TTL or other time interval in a human-readable form. The time interval is given as a count of seconds in 'src'. The text representation is appended to 'target'.
isc_result_t dns_counter_fromtext (isc_textregion_t *source, isc_uint32_t *ttl)
 Converts a counter from either a plain number or a BIND 8 style value.
isc_result_t dns_ttl_fromtext (isc_textregion_t *source, isc_uint32_t *ttl)
 Converts a ttl from either a plain number or a BIND 8 style value.


Detailed Description

Definition in file ttl.c.


Define Documentation

#define RETERR (  ) 

Value:

do { \
        isc_result_t _r = (x); \
        if (_r != ISC_R_SUCCESS) \
                return (_r); \
        } while (0)

Definition at line 39 of file ttl.c.


Function Documentation

static isc_result_t bind_ttl ( isc_textregion_t source,
isc_uint32_t ttl 
) [static]

Definition at line 158 of file ttl.c.

References isc_textregion::base, DNS_R_SYNTAX, INSIST, isc_parse_uint32(), ISC_R_RANGE, ISC_R_SUCCESS, isc_textregion::length, and s.

Referenced by dns_counter_fromtext(), and dns_ttl_fromtext().

static isc_result_t ttlfmt ( unsigned int  t,
const char *  s,
isc_boolean_t  verbose,
isc_boolean_t  space,
isc_buffer_t target 
) [static]

Definition at line 52 of file ttl.c.

References isc_region::base, INSIST, isc_buffer_add, isc_buffer_availableregion, ISC_R_NOSPACE, ISC_R_SUCCESS, and isc_region::length.

Referenced by dns_ttl_totext2().

isc_result_t dns_ttl_totext ( isc_uint32_t  src,
isc_boolean_t  verbose,
isc_buffer_t target 
)

Definition at line 81 of file ttl.c.

References dns_ttl_totext2(), and ISC_TRUE.

Referenced by dns_message_pseudosectiontotext(), dump_rdataset(), and totext_soa().

isc_result_t dns_ttl_totext2 ( isc_uint32_t  src,
isc_boolean_t  verbose,
isc_boolean_t  upcase,
isc_buffer_t target 
)

Output a TTL or other time interval in a human-readable form. The time interval is given as a count of seconds in 'src'. The text representation is appended to 'target'.

If 'verbose' is ISC_FALSE, use the terse BIND 8 style, like "1w2d3h4m5s".

If 'verbose' is ISC_TRUE, use a verbose style like the SOA comments in "dig", like "1 week 2 days 3 hours 4 minutes 5 seconds".

If 'upcase' is ISC_TRUE, we conform to the BIND 8 style in which the unit letter is capitalized if there is only a single unit letter to print (for example, "1m30s", but "2M")

If 'upcase' is ISC_FALSE, unit letters are always in lower case.

Returns:

Definition at line 86 of file ttl.c.

References isc_region::base, days, INSIST, isc_buffer_usedregion, ISC_R_SUCCESS, ISC_TF, isc_region::length, POST, RETERR, and ttlfmt().

Referenced by dns_ttl_totext(), and rdataset_totext().

isc_result_t dns_counter_fromtext ( isc_textregion_t source,
isc_uint32_t ttl 
)

Converts a counter from either a plain number or a BIND 8 style value.

Returns:

Definition at line 143 of file ttl.c.

References bind_ttl().

Referenced by fromtext_soa().

isc_result_t dns_ttl_fromtext ( isc_textregion_t source,
isc_uint32_t ttl 
)

Converts a ttl from either a plain number or a BIND 8 style value.

Returns:

Definition at line 148 of file ttl.c.

References bind_ttl(), DNS_R_BADTTL, ISC_R_RANGE, and ISC_R_SUCCESS.

Referenced by dst_key_read_public(), load_text(), ns_server_nta(), and parse_ttlval().


Generated on Tue Apr 28 17:41:13 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha