context.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2009, 2014, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: context.c,v 1.3 2009/09/02 23:48:02 tbox Exp $ */
#include <config.h>
#ifndef RESOLV_CONF
/*% location of resolve.conf */
#define RESOLV_CONF "/etc/resolv.conf"
#endif
#ifndef DNS_CONF
/*% location of dns.conf */
#endif
#ifndef ISC_PLATFORM_USETHREADS
#else
static isc_mutex_t thread_key_mutex;
static isc_thread_key_t irs_context_key;
#endif
struct irs_context {
/*
* An IRS context is a thread-specific object, and does not need to
* be locked.
*/
unsigned int magic;
};
static void
{
if (socketmgrp != NULL)
}
static isc_result_t
{
if (result != ISC_R_SUCCESS)
goto fail;
if (result != ISC_R_SUCCESS)
goto fail;
if (result != ISC_R_SUCCESS)
goto fail;
if (result != ISC_R_SUCCESS)
goto fail;
if (result != ISC_R_SUCCESS)
goto fail;
return (ISC_R_SUCCESS);
fail:
return (result);
}
#ifdef ISC_PLATFORM_USETHREADS
static void
free_specific_context(void *arg) {
}
static void
thread_key_mutex_init(void) {
}
static isc_result_t
thread_key_init(void) {
if (result != ISC_R_SUCCESS)
return (result);
if (!thread_key_initialized) {
if (!thread_key_initialized &&
free_specific_context) != 0) {
} else
}
return (result);
}
#endif /* ISC_PLATFORM_USETHREADS */
#ifndef ISC_PLATFORM_USETHREADS
if (irs_g_context == NULL) {
if (result != ISC_R_SUCCESS)
return (result);
}
#else
result = thread_key_init();
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS) {
return (result);
}
}
#endif /* ISC_PLATFORM_USETHREADS */
return (ISC_R_SUCCESS);
}
result = dns_lib_init();
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS) {
return (result);
}
return (ISC_R_NOMEMORY);
}
if (result != ISC_R_SUCCESS)
goto fail;
/* Create a DNS client object */
0, &client);
if (result != ISC_R_SUCCESS)
goto fail;
/* Read resolver configuration file */
if (result != ISC_R_SUCCESS)
goto fail;
/* Set nameservers */
if (result != ISC_R_SUCCESS)
goto fail;
/* Read advanced DNS configuration (if any) */
if (result != ISC_R_SUCCESS)
goto fail;
trustedkey != NULL;
if (result != ISC_R_SUCCESS)
goto fail;
}
return (ISC_R_SUCCESS);
fail:
return (result);
}
void
#ifndef ISC_PLATFORM_USETHREADS
#else
#endif
}
}
}
}
}
}
}
}
}