Remove getdns_address.c. Update context to use copy.

This commit is contained in:
Neel Goyal 2013-08-13 10:02:09 -04:00
parent cd1ff4a3b8
commit 7975c98c3f
6 changed files with 70 additions and 71 deletions

View File

@ -1,6 +1,6 @@
AM_CPPFLAGS = -Wall -Werror -g -fPIC -I$(srcdir)/ -I /usr/local/include -std=c99
lib_LTLIBRARIES = libgetdns.la
libgetdns_la_SOURCES = getdns_address.c getdns_context.c getdns_convert.c \
libgetdns_la_SOURCES = getdns_context.c getdns_convert.c \
getdns_dict.c getdns_general.c getdns_hostname.c getdns_list.c \
getdns_service.c getdns_sync.c getdns_validate_dnssec.c \
getdns_core_only.h getdns_libevent.h getdns_context.h

View File

@ -92,10 +92,10 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libgetdns_la_LIBADD =
am_libgetdns_la_OBJECTS = getdns_address.lo getdns_context.lo \
getdns_convert.lo getdns_dict.lo getdns_general.lo \
getdns_hostname.lo getdns_list.lo getdns_service.lo \
getdns_sync.lo getdns_validate_dnssec.lo
am_libgetdns_la_OBJECTS = getdns_context.lo getdns_convert.lo \
getdns_dict.lo getdns_general.lo getdns_hostname.lo \
getdns_list.lo getdns_service.lo getdns_sync.lo \
getdns_validate_dnssec.lo
libgetdns_la_OBJECTS = $(am_libgetdns_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
@ -237,7 +237,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -Wall -Werror -g -fPIC -I$(srcdir)/ -I /usr/local/include -std=c99
lib_LTLIBRARIES = libgetdns.la
libgetdns_la_SOURCES = getdns_address.c getdns_context.c getdns_convert.c \
libgetdns_la_SOURCES = getdns_context.c getdns_convert.c \
getdns_dict.c getdns_general.c getdns_hostname.c getdns_list.c \
getdns_service.c getdns_sync.c getdns_validate_dnssec.c \
getdns_core_only.h getdns_libevent.h getdns_context.h
@ -320,7 +320,6 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdns_address.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdns_context.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdns_convert.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdns_dict.Plo@am__quote@

View File

@ -1,60 +0,0 @@
/**
*
* /brief getdns core functions
*
* This is the meat of the API
* Originally taken from the getdns API description pseudo implementation.
*
*/
/* The MIT License (MIT)
* Copyright (c) 2013 Verisign, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <getdns_core_only.h>
/* stuff to make it compile pedantically */
#define UNUSED_PARAM(x) ((void)(x))
/*
* getdns_address
*
*/
getdns_return_t
getdns_address(
getdns_context_t context,
const char *name,
struct getdns_dict *extensions,
void *userarg,
getdns_transaction_t *transaction_id,
getdns_callback_t callback
)
{
UNUSED_PARAM(context);
UNUSED_PARAM(name);
UNUSED_PARAM(extensions);
UNUSED_PARAM(userarg);
UNUSED_PARAM(transaction_id);
UNUSED_PARAM(callback);
return GETDNS_RETURN_GOOD;
} /* getdns_address */
/* getdns_address.c */

View File

@ -386,6 +386,13 @@ getdns_context_set_dns_root_servers(
struct getdns_list *addresses
)
{
getdns_list *copy = NULL;
if (addresses != NULL) {
if (getdns_list_copy(addresses, &copy) != GETDNS_RETURN_GOOD) {
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
addresses = copy;
}
getdns_list_destroy(context->dns_root_servers);
context->dns_root_servers = addresses;
@ -429,8 +436,14 @@ getdns_context_set_suffix(
struct getdns_list *value
)
{
getdns_list *copy = NULL;
if (value != NULL) {
if (getdns_list_copy(value, &copy) != GETDNS_RETURN_GOOD) {
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
value = copy;
}
getdns_list_destroy(context->suffix);
context->suffix = value;
dispatch_updated(context, GETDNS_CONTEXT_CODE_SUFFIX);
@ -448,8 +461,14 @@ getdns_context_set_dnssec_trust_anchors(
struct getdns_list *value
)
{
getdns_list *copy = NULL;
if (value != NULL) {
if (getdns_list_copy(value, &copy) != GETDNS_RETURN_GOOD) {
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
value = copy;
}
getdns_list_destroy(context->dnssec_trust_anchors);
context->dnssec_trust_anchors = value;
dispatch_updated(context, GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS);
@ -487,6 +506,11 @@ getdns_context_set_stub_resolution(
if (upstream_list == NULL) {
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
getdns_list *copy = NULL;
if (getdns_list_copy(upstream_list, &copy) != GETDNS_RETURN_GOOD) {
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
upstream_list = copy;
getdns_context_set_resolution_type(context, GETDNS_CONTEXT_STUB);

View File

@ -217,9 +217,9 @@
* \defgroup extvals Values Associated With Extensions
* @{
*/
#define GETDNS_EXTENSION_TRUE 1000
#define GETDNS_EXTENSION_TRUE 1
#define GETDNS_EXTENSION_TRUE_TEXT Turn on the extension
#define GETDNS_EXTENSION_FALSE 1001
#define GETDNS_EXTENSION_FALSE 0
#define GETDNS_EXTENSION_FALSE_TEXT Do not turn on the extension
/** @}
*/
@ -245,6 +245,8 @@
#define GETDNS_STR_IPV6 "IPv6"
#define GETDNS_STR_ADDRESS_TYPE "address_type"
#define GETDNS_STR_ADDRESS_DATA "address_data"
#define GETDNS_STR_EXTENSION_RETURN_BOTH_V4_AND_V6 "return_both_v4_and_v6"
/** @}
*/

View File

@ -57,4 +57,38 @@ getdns_general(
return GETDNS_RETURN_GOOD;
} /* getdns_general */
/*
* getdns_address
*
*/
getdns_return_t
getdns_address(
getdns_context_t context,
const char *name,
struct getdns_dict *extensions,
void *userarg,
getdns_transaction_t *transaction_id,
getdns_callback_t callback
)
{
int cleanup_extensions = 0;
if (!extensions) {
extensions = getdns_dict_create();
cleanup_extensions = 1;
}
getdns_dict_set_int(extensions,
GETDNS_STR_EXTENSION_RETURN_BOTH_V4_AND_V6,
GETDNS_EXTENSION_TRUE);
getdns_return_t result =
getdns_general(context, name, GETDNS_RRTYPE_A,
extensions, userarg, transaction_id,
callback);
if (cleanup_extensions) {
getdns_dict_destroy(extensions);
}
return result;
}
/* getdns_general.c */