Lines Matching refs:context

9 /* $Id: context.c,v 1.3 2009/09/02 23:48:02 tbox Exp $ */
27 #include <irs/context.h>
56 * An IRS context is a thread-specific object, and does not need to
130 irs_context_t *context = arg;
132 irs_context_destroy(&context);
169 irs_context_t *context;
181 context = irs_g_context;
187 context = isc_thread_key_getspecific(irs_context_key);
188 if (context == NULL) {
189 result = irs_context_create(&context);
192 result = isc_thread_key_setspecific(irs_context_key, context);
194 irs_context_destroy(&context);
200 *contextp = context;
208 irs_context_t *context;
234 context = isc_mem_get(mctx, sizeof(*context));
235 if (context == NULL) {
240 context->mctx = mctx;
241 context->actx = actx;
242 context->taskmgr = taskmgr;
243 context->socketmgr = socketmgr;
244 context->timermgr = timermgr;
245 context->resconf = NULL;
246 context->dnsconf = NULL;
247 context->task = NULL;
248 result = isc_task_create(taskmgr, 0, &context->task);
257 context->dnsclient = client;
260 result = irs_resconf_load(mctx, RESOLV_CONF, &context->resconf);
264 nameservers = irs_resconf_getnameservers(context->resconf);
271 result = irs_dnsconf_load(mctx, DNS_CONF, &context->dnsconf);
274 trustedkeys = irs_dnsconf_gettrustedkeys(context->dnsconf);
285 context->magic = IRS_CONTEXT_MAGIC;
286 *contextp = context;
291 if (context->task != NULL)
292 isc_task_detach(&context->task);
293 if (context->resconf != NULL)
294 irs_resconf_destroy(&context->resconf);
295 if (context->dnsconf != NULL)
296 irs_dnsconf_destroy(&context->dnsconf);
300 isc_mem_putanddetach(&mctx, context, sizeof(*context));
307 irs_context_t *context;
310 context = *contextp;
311 REQUIRE(IRS_CONTEXT_VALID(context));
313 isc_task_detach(&context->task);
314 irs_dnsconf_destroy(&context->dnsconf);
315 irs_resconf_destroy(&context->resconf);
316 dns_client_destroy(&context->dnsclient);
318 ctxs_destroy(NULL, &context->actx, &context->taskmgr,
319 &context->socketmgr, &context->timermgr);
321 context->magic = 0;
323 isc_mem_putanddetach(&context->mctx, context, sizeof(*context));
335 irs_context_getmctx(irs_context_t *context) {
336 REQUIRE(IRS_CONTEXT_VALID(context));
338 return (context->mctx);
342 irs_context_getappctx(irs_context_t *context) {
343 REQUIRE(IRS_CONTEXT_VALID(context));
345 return (context->actx);
349 irs_context_gettaskmgr(irs_context_t *context) {
350 REQUIRE(IRS_CONTEXT_VALID(context));
352 return (context->taskmgr);
356 irs_context_gettimermgr(irs_context_t *context) {
357 REQUIRE(IRS_CONTEXT_VALID(context));
359 return (context->timermgr);
363 irs_context_gettask(irs_context_t *context) {
364 REQUIRE(IRS_CONTEXT_VALID(context));
366 return (context->task);
370 irs_context_getdnsclient(irs_context_t *context) {
371 REQUIRE(IRS_CONTEXT_VALID(context));
373 return (context->dnsclient);
377 irs_context_getresconf(irs_context_t *context) {
378 REQUIRE(IRS_CONTEXT_VALID(context));
380 return (context->resconf);
384 irs_context_getdnsconf(irs_context_t *context) {
385 REQUIRE(IRS_CONTEXT_VALID(context));
387 return (context->dnsconf);