#include <dns/rdatastruct.h>
#include <dns/rpz.h>
#include <dns/types.h>
+#include <dns/xfrin.h>
#include <dns/zt.h>
/* Define to 1 for detailed reference tracing */
*\li 'state' to be a valid DNS_ZONESTATE_ constant.
*/
+isc_result_t
+dns_zone_getxfr(dns_zone_t *zone, dns_xfrin_t **xfrp, bool *is_running,
+ bool *is_deferred, bool *is_pending, bool *needs_refresh);
+/*%<
+ * Returns the xfrin associated with the zone (if any) with the current
+ * transfer states (as booleans). When no longer needed, the returned xfrin
+ * must be detached.
+ *
+ * Requires:
+ *\li 'zone' to be a valid zone.
+ *\li 'xfrp' to be non NULL and '*xfrp' to be NULL.
+ *\li 'is_running' to be non NULL.
+ *\li 'is_deferred' to be non NULL.
+ *\li 'is_pending' to be non NULL.
+ *\li 'needs_refresh' to be non NULL.
+ *
+ * Returns:
+ * ISC_R_SUCCESS xfrin exists and the information was returned.
+ * ISC_R_NOTFOUND no xfrin was found for the zone.
+ * ISC_R_FAILED error while trying to get the xfrin information
+ */
+
void
dns_zonemgr_unreachableadd(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote,
isc_sockaddr_t *local, isc_time_t *now);
return (count);
}
+isc_result_t
+dns_zone_getxfr(dns_zone_t *zone, dns_xfrin_t **xfrp, bool *is_running,
+ bool *is_deferred, bool *is_pending, bool *needs_refresh) {
+ REQUIRE(DNS_ZONE_VALID(zone));
+ REQUIRE(xfrp != NULL && *xfrp == NULL);
+
+ if (zone->zmgr == NULL) {
+ return (ISC_R_NOTFOUND);
+ }
+
+ RWLOCK(&zone->zmgr->rwlock, isc_rwlocktype_read);
+ LOCK_ZONE(zone);
+ if (zone->xfr != NULL) {
+ dns_xfrin_attach(zone->xfr, xfrp);
+ }
+ if (zone->statelist == &zone->zmgr->xfrin_in_progress) {
+ *is_running = true;
+ *is_deferred = false;
+ *is_pending = false;
+ } else if (zone->statelist == &zone->zmgr->waiting_for_xfrin) {
+ *is_running = false;
+ *is_deferred = true;
+ *is_pending = false;
+ } else if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_REFRESH)) {
+ *is_running = false;
+ *is_deferred = false;
+ *is_pending = true;
+ } else {
+ *is_running = false;
+ *is_deferred = false;
+ *is_pending = false;
+ }
+ *needs_refresh = DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDREFRESH);
+ UNLOCK_ZONE(zone);
+ RWUNLOCK(&zone->zmgr->rwlock, isc_rwlocktype_read);
+
+ return (ISC_R_SUCCESS);
+}
+
void
dns_zone_lock_keyfiles(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));