1 /* $NetBSD: soa.h,v 1.4 2014/12/10 04:37:58 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") 5 * Copyright (C) 2000, 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: soa.h,v 1.12 2009/09/10 01:47:09 each Exp */ 21 22 #ifndef DNS_SOA_H 23 #define DNS_SOA_H 1 24 25 /***** 26 ***** Module Info 27 *****/ 28 29 /*! \file dns/soa.h 30 * \brief 31 * SOA utilities. 32 */ 33 34 /*** 35 *** Imports 36 ***/ 37 38 #include <isc/lang.h> 39 #include <isc/types.h> 40 41 #include <dns/types.h> 42 43 ISC_LANG_BEGINDECLS 44 45 #define DNS_SOA_BUFFERSIZE ((2 * DNS_NAME_MAXWIRE) + (4 * 5)) 46 47 isc_result_t 48 dns_soa_buildrdata(dns_name_t *origin, dns_name_t *contact, 49 dns_rdataclass_t rdclass, 50 isc_uint32_t serial, isc_uint32_t refresh, 51 isc_uint32_t retry, isc_uint32_t expire, 52 isc_uint32_t minimum, unsigned char *buffer, 53 dns_rdata_t *rdata); 54 /*%< 55 * Build the rdata of an SOA record. 56 * 57 * Requires: 58 *\li buffer Points to a temporary buffer of at least 59 * DNS_SOA_BUFFERSIZE bytes. 60 *\li rdata Points to an initialized dns_rdata_t. 61 * 62 * Ensures: 63 * \li *rdata Contains a valid SOA rdata. The 'data' member 64 * refers to 'buffer'. 65 */ 66 67 isc_uint32_t 68 dns_soa_getserial(dns_rdata_t *rdata); 69 isc_uint32_t 70 dns_soa_getrefresh(dns_rdata_t *rdata); 71 isc_uint32_t 72 dns_soa_getretry(dns_rdata_t *rdata); 73 isc_uint32_t 74 dns_soa_getexpire(dns_rdata_t *rdata); 75 isc_uint32_t 76 dns_soa_getminimum(dns_rdata_t *rdata); 77 /* 78 * Extract an integer field from the rdata of a SOA record. 79 * 80 * Requires: 81 * rdata refers to the rdata of a well-formed SOA record. 82 */ 83 84 void 85 dns_soa_setserial(isc_uint32_t val, dns_rdata_t *rdata); 86 void 87 dns_soa_setrefresh(isc_uint32_t val, dns_rdata_t *rdata); 88 void 89 dns_soa_setretry(isc_uint32_t val, dns_rdata_t *rdata); 90 void 91 dns_soa_setexpire(isc_uint32_t val, dns_rdata_t *rdata); 92 void 93 dns_soa_setminimum(isc_uint32_t val, dns_rdata_t *rdata); 94 /* 95 * Change an integer field of a SOA record by modifying the 96 * rdata in-place. 97 * 98 * Requires: 99 * rdata refers to the rdata of a well-formed SOA record. 100 */ 101 102 103 ISC_LANG_ENDDECLS 104 105 #endif /* DNS_SOA_H */ 106