xref: /netbsd-src/external/mpl/bind/dist/lib/dns/include/dns/update.h (revision 70f7362772ba52b749c976fb5e86e39a8b2c9afc)
1 /*	$NetBSD: update.h,v 1.7 2024/02/21 22:52:11 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 #pragma once
17 
18 /*! \file dns/update.h */
19 
20 /***
21  ***	Imports
22  ***/
23 
24 #include <inttypes.h>
25 
26 #include <isc/lang.h>
27 
28 #include <dns/diff.h>
29 #include <dns/types.h>
30 
31 typedef struct {
32 	void (*func)(void *arg, dns_zone_t *zone, int level,
33 		     const char *message);
34 	void *arg;
35 } dns_update_log_t;
36 
37 ISC_LANG_BEGINDECLS
38 
39 /***
40  ***	Functions
41  ***/
42 
43 uint32_t
44 dns_update_soaserial(uint32_t serial, dns_updatemethod_t method,
45 		     dns_updatemethod_t *used);
46 /*%<
47  * Return the next serial number after 'serial', depending on the
48  * update method 'method':
49  *
50  *\li	* dns_updatemethod_increment increments the serial number by one
51  *\li	* dns_updatemethod_date sets the serial number to YYYYMMDD00
52  *\li	* dns_updatemethod_unixtime sets the serial number to the current
53  *	  time (seconds since UNIX epoch)
54  *\li	* dns_updatemethod_none just returns the given serial
55  *
56  * NOTE: The dns_updatemethod_increment will be used if dns_updatemethod_date or
57  * dns_updatemethod_unixtime is used and the new serial number would be lower
58  * than current serial number.
59  *
60  * Sets *used to the method that was used.
61  */
62 
63 isc_result_t
64 dns_update_signatures(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db,
65 		      dns_dbversion_t *oldver, dns_dbversion_t *newver,
66 		      dns_diff_t *diff, uint32_t sigvalidityinterval);
67 
68 isc_result_t
69 dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db,
70 			 dns_dbversion_t *oldver, dns_dbversion_t *newver,
71 			 dns_diff_t *diff, uint32_t sigvalidityinterval,
72 			 dns_update_state_t **state);
73 
74 ISC_LANG_ENDDECLS
75