Lines Matching refs:cd

72 #define MAYBE_LOCK(cd) \
74 if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
75 cd->in_configure == ISC_FALSE) \
76 LOCK(&cd->lock); \
79 #define MAYBE_UNLOCK(cd) \
81 if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
82 cd->in_configure == ISC_FALSE) \
83 UNLOCK(&cd->lock); \
107 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
113 if (cd->dlz_allnodes == NULL) {
117 MAYBE_LOCK(cd);
118 result = cd->dlz_allnodes(zone, cd->dbdata, allnodes);
119 MAYBE_UNLOCK(cd);
128 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
134 if (cd->dlz_allowzonexfr == NULL) {
138 MAYBE_LOCK(cd);
139 result = cd->dlz_allowzonexfr(cd->dbdata, name, client);
140 MAYBE_UNLOCK(cd);
148 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
153 if (cd->dlz_authority == NULL) {
157 MAYBE_LOCK(cd);
158 result = cd->dlz_authority(zone, cd->dbdata, lookup);
159 MAYBE_UNLOCK(cd);
166 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
171 MAYBE_LOCK(cd);
172 result = cd->dlz_findzonedb(cd->dbdata, name);
173 MAYBE_UNLOCK(cd);
184 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
189 MAYBE_LOCK(cd);
190 result = cd->dlz_lookup(zone, name, cd->dbdata, lookup,
192 MAYBE_UNLOCK(cd);
200 dl_load_symbol(dlopen_data_t *cd, const char *symbol, isc_boolean_t mandatory) {
201 void *ptr = dlsym(cd->dl_handle, symbol);
205 "required symbol '%s'", cd->dl_path, symbol);
217 dlopen_data_t *cd;
235 cd = isc_mem_get(mctx, sizeof(*cd));
236 if (cd == NULL) {
240 memset(cd, 0, sizeof(*cd));
242 cd->mctx = mctx;
244 cd->dl_path = isc_mem_strdup(cd->mctx, argv[1]);
245 if (cd->dl_path == NULL) {
249 cd->dlzname = isc_mem_strdup(cd->mctx, dlzname);
250 if (cd->dlzname == NULL) {
255 result = isc_mutex_init(&cd->lock);
275 cd->dl_handle = dlopen(cd->dl_path, dlopen_flags);
276 if (cd->dl_handle == NULL) {
279 cd->dl_path, dlerror());
284 cd->dlz_version = (dlz_dlopen_version_t *)
285 dl_load_symbol(cd, "dlz_version", ISC_TRUE);
286 cd->dlz_create = (dlz_dlopen_create_t *)
287 dl_load_symbol(cd, "dlz_create", ISC_TRUE);
288 cd->dlz_lookup = (dlz_dlopen_lookup_t *)
289 dl_load_symbol(cd, "dlz_lookup", ISC_TRUE);
290 cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *)
291 dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE);
293 if (cd->dlz_create == NULL ||
294 cd->dlz_lookup == NULL ||
295 cd->dlz_findzonedb == NULL)
301 cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *)
302 dl_load_symbol(cd, "dlz_allowzonexfr", ISC_FALSE);
303 cd->dlz_allnodes = (dlz_dlopen_allnodes_t *)
304 dl_load_symbol(cd, "dlz_allnodes",
305 ISC_TF(cd->dlz_allowzonexfr != NULL));
306 cd->dlz_authority = (dlz_dlopen_authority_t *)
307 dl_load_symbol(cd, "dlz_authority", ISC_FALSE);
308 cd->dlz_newversion = (dlz_dlopen_newversion_t *)
309 dl_load_symbol(cd, "dlz_newversion", ISC_FALSE);
310 cd->dlz_closeversion = (dlz_dlopen_closeversion_t *)
311 dl_load_symbol(cd, "dlz_closeversion",
312 ISC_TF(cd->dlz_newversion != NULL));
313 cd->dlz_configure = (dlz_dlopen_configure_t *)
314 dl_load_symbol(cd, "dlz_configure", ISC_FALSE);
315 cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *)
316 dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE);
317 cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *)
318 dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE);
319 cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *)
320 dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE);
321 cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *)
322 dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE);
323 cd->dlz_destroy = (dlz_dlopen_destroy_t *)
324 dl_load_symbol(cd, "dlz_destroy", ISC_FALSE);
327 cd->version = cd->dlz_version(&cd->flags);
328 if (cd->version != DLZ_DLOPEN_VERSION) {
332 cd->version, DLZ_DLOPEN_VERSION, cd->dl_path);
343 MAYBE_LOCK(cd);
344 result = cd->dlz_create(dlzname, argc-1, argv+1,
345 &cd->dbdata,
351 MAYBE_UNLOCK(cd);
355 *dbdata = cd;
361 if (cd->dl_path != NULL)
362 isc_mem_free(mctx, cd->dl_path);
363 if (cd->dlzname != NULL)
364 isc_mem_free(mctx, cd->dlzname);
366 (void) isc_mutex_destroy(&cd->lock);
368 if (cd->dl_handle)
369 dlclose(cd->dl_handle);
371 isc_mem_put(mctx, cd, sizeof(*cd));
382 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
387 if (cd->dlz_destroy) {
388 MAYBE_LOCK(cd);
389 cd->dlz_destroy(cd->dbdata);
390 MAYBE_UNLOCK(cd);
393 if (cd->dl_path)
394 isc_mem_free(cd->mctx, cd->dl_path);
395 if (cd->dlzname)
396 isc_mem_free(cd->mctx, cd->dlzname);
399 if (cd->dl_handle)
400 dlclose(cd->dl_handle);
403 (void) isc_mutex_destroy(&cd->lock);
405 mctx = cd->mctx;
406 isc_mem_put(mctx, cd, sizeof(*cd));
417 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
422 if (cd->dlz_newversion == NULL)
425 MAYBE_LOCK(cd);
426 result = cd->dlz_newversion(zone, cd->dbdata, versionp);
427 MAYBE_UNLOCK(cd);
438 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
442 if (cd->dlz_newversion == NULL) {
447 MAYBE_LOCK(cd);
448 cd->dlz_closeversion(zone, commit, cd->dbdata, versionp);
449 MAYBE_UNLOCK(cd);
457 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
462 if (cd->dlz_configure == NULL)
465 MAYBE_LOCK(cd);
466 cd->in_configure = ISC_TRUE;
467 result = cd->dlz_configure(view, cd->dbdata);
468 cd->in_configure = ISC_FALSE;
469 MAYBE_UNLOCK(cd);
483 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
488 if (cd->dlz_ssumatch == NULL)
491 MAYBE_LOCK(cd);
492 ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen,
493 keydata, cd->dbdata);
494 MAYBE_UNLOCK(cd);
507 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
512 if (cd->dlz_addrdataset == NULL)
515 MAYBE_LOCK(cd);
516 result = cd->dlz_addrdataset(name, rdatastr, cd->dbdata, version);
517 MAYBE_UNLOCK(cd);
529 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
534 if (cd->dlz_subrdataset == NULL)
537 MAYBE_LOCK(cd);
538 result = cd->dlz_subrdataset(name, rdatastr, cd->dbdata, version);
539 MAYBE_UNLOCK(cd);
551 dlopen_data_t *cd = (dlopen_data_t *) dbdata;
556 if (cd->dlz_delrdataset == NULL)
559 MAYBE_LOCK(cd);
560 result = cd->dlz_delrdataset(name, type, cd->dbdata, version);
561 MAYBE_UNLOCK(cd);