Add dns_db_getzoneversion

Provides a database method to return a database specific EDNS
ZONEVERSION option.  The default EDNS ZONEVERSION is serial.
This commit is contained in:
Mark Andrews 2024-08-29 11:26:58 +10:00
parent 998b93acca
commit 5c126a7e66
2 changed files with 30 additions and 0 deletions

View file

@ -1200,3 +1200,14 @@ dns__db_logtoomanyrecords(dns_db_t *db, const dns_name_t *name,
(db->attributes & DNS_DBATTR_CACHE) != 0 ? "cache" : "zone",
isc_result_totext(DNS_R_TOOMANYRECORDS), limit);
}
isc_result_t
dns_db_getzoneversion(dns_db_t *db, isc_buffer_t *b) {
REQUIRE(db != NULL);
REQUIRE(b != NULL);
if (db->methods->getzoneversion != NULL) {
return (db->methods->getzoneversion)(db, b);
}
return ISC_R_NOTIMPLEMENTED;
}

View file

@ -182,6 +182,7 @@ typedef struct dns_dbmethods {
dns_name_t *name);
void (*setmaxrrperset)(dns_db_t *db, uint32_t value);
void (*setmaxtypepername)(dns_db_t *db, uint32_t value);
isc_result_t (*getzoneversion)(dns_db_t *db, isc_buffer_t *b);
} dns_dbmethods_t;
typedef isc_result_t (*dns_dbcreatefunc_t)(isc_mem_t *mctx,
@ -1805,3 +1806,21 @@ dns_db_setmaxtypepername(dns_db_t *db, uint32_t value);
* stored at a given node, then any subsequent attempt to add an rdataset
* with a new RR type will return ISC_R_TOOMANYRECORDS.
*/
isc_result_t
dns_db_getzoneversion(dns_db_t *db, isc_buffer_t *b);
/*%<
* Provides a database specific EDNS ZONEVERSION option.
*
* Requires:
* \li 'db' is a valid database
* \li 'b' is a valid buffer
*
* Returns:
* \li ISC_R_SUCCESS when it has populated the buffer with the ZONEVERSION
* response (maybe empty implying no ZONEVERSION to be returned).
* \li ISC_R_NOSPACE if the buffer is too small.
* \li ISC_R_NOTIMPLEMENTED if there is not a database specific
* ZONEVERSION
* \li ISC_R_FAILURE other failures
*/