struct fstrm_iothr *iothr;
struct fstrm_iothr_options *fopt;
+ isc_task_t *reopen_task;
+
isc_region_t identity;
isc_region_t version;
char *path;
isc_result_t
dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
struct fstrm_iothr_options **foptp, dns_dtenv_t **envp)
+{
+ return (dns_dt_create2(mctx, mode, path, foptp, NULL, envp));
+}
+
+isc_result_t
+dns_dt_create2(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
+ struct fstrm_iothr_options **foptp, isc_task_t *reopen_task,
+ dns_dtenv_t **envp)
{
isc_result_t result = ISC_R_SUCCESS;
fstrm_res res;
env->fopt = *foptp;
*foptp = NULL;
+ env->reopen_task = reopen_task;
+
isc_mem_attach(mctx, &env->mctx);
env->magic = DTENV_MAGIC;
isc_result_t
dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
struct fstrm_iothr_options **foptp, dns_dtenv_t **envp);
+
+isc_result_t
+dns_dt_create2(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
+ struct fstrm_iothr_options **foptp, isc_task_t *reopen_task,
+ dns_dtenv_t **envp);
/*%<
* Create and initialize the dnstap environment.
*
* should also be set. Other options may be set if desired.
* If dns_dt_create succeeds the *foptp is set to NULL.
*
+ *\li 'reopen_task' needs to be set to the task in the context of which
+ * dns_dt_reopen() will be called. This is not an optional parameter:
+ * using dns_dt_create() (which sets 'reopen_task' to NULL) is only
+ * allowed in unit tests.
+ *
* Requires:
*
*\li 'mctx' is a valid memory context.
*
*\li 'path' is a valid C string.
*
- *\li 'fopt' is non NULL.
+ *\li 'foptp' is non NULL.
*
*\li envp != NULL && *envp == NULL
*
isc_result_t
dns_dt_reopen(dns_dtenv_t *env, int roll);
/*%<
- * Reopens files established by dns_dt_create().
+ * Reopens files established by dns_dt_create2().
*
* If 'roll' is non-negative and 'env->mode' is dns_dtmode_file,
* then the file is automatically rolled over before reopening.