context.c revision 307d2084502eddc7ce921e5ce439aec3531d90e0
/*
* Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
*
* This code is derived from software contributed to ISC by
* Berkeley Software Design, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND BERKELEY SOFTWARE DESIGN, INC.
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE
* FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: context.c,v 1.2 2009/09/01 00:22:27 jinmei 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() {
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
}
}
}
}
}
}
}
}
}