diff --git a/lib/ns/include/ns/query.h b/lib/ns/include/ns/query.h index a1851abc1e..8476705386 100644 --- a/lib/ns/include/ns/query.h +++ b/lib/ns/include/ns/query.h @@ -38,6 +38,34 @@ typedef struct ns_dbversion { ISC_LINK(struct ns_dbversion) link; } ns_dbversion_t; +/*% + * recursion type; various features can initiate recursion and this enum value + * allows common code paths to differentiate between them + */ +typedef enum { + RECTYPE_PREFETCH, + RECTYPE_RPZ, + RECTYPE_COUNT, +} ns_query_rectype_t; + +/*% + * Helper macros for accessing isc_nmhandle_t pointers for a specific recursion + * a given client is associated with. + */ +#define HANDLE_RECTYPE_PREFETCH(client) \ + ((client)->query.recursions[RECTYPE_PREFETCH].handle) +#define HANDLE_RECTYPE_RPZ(client) \ + ((client)->query.recursions[RECTYPE_RPZ].handle) + +/*% + * Helper macros for accessing dns_fetch_t pointers for a specific recursion a + * given client is associated with. + */ +#define FETCH_RECTYPE_PREFETCH(client) \ + ((client)->query.recursions[RECTYPE_PREFETCH].fetch) +#define FETCH_RECTYPE_RPZ(client) \ + ((client)->query.recursions[RECTYPE_RPZ].fetch) + /*% * nameserver recursion parameters, to uniquely identify a recursion * query; this is used to detect a recursion loop @@ -94,6 +122,11 @@ struct ns_query { bool is_zone; } redirect; + struct { + isc_nmhandle_t *handle; + dns_fetch_t *fetch; + } recursions[RECTYPE_COUNT]; + ns_query_recparam_t recparam; dns_keytag_t root_key_sentinel_keyid;