mirror of https://github.com/getdnsapi/getdns.git
Issue #410: Document ownership with getdns_context_get_api_information()
+ const for extensions and namespaces TODO: Look at other cases that are not const for no good reason. Thanks Stefan Bühler
This commit is contained in:
parent
2d76a5fd52
commit
e3b007a43a
|
@ -1,4 +1,5 @@
|
|||
* 2018-0?-??: Version 1.4.3
|
||||
* Issue #410: Unspecified ownership of get_api_information()
|
||||
* Fix for DNSSEC bug in finding most specific key when
|
||||
trust anchor proves non-existance of one of the labels
|
||||
along the authentication chain other than the non-
|
||||
|
|
|
@ -2132,7 +2132,7 @@ getdns_context_set_resolution_type(struct getdns_context *context,
|
|||
*/
|
||||
getdns_return_t
|
||||
getdns_context_set_namespaces(getdns_context *context,
|
||||
size_t namespace_count, getdns_namespace_t *namespaces)
|
||||
size_t namespace_count, const getdns_namespace_t *namespaces)
|
||||
{
|
||||
size_t i;
|
||||
getdns_return_t r = GETDNS_RETURN_GOOD;
|
||||
|
|
|
@ -492,7 +492,7 @@ extformatcmp(const void *a, const void *b)
|
|||
|
||||
/*---------------------------------------- validate_extensions */
|
||||
static getdns_return_t
|
||||
validate_extensions(struct getdns_dict * extensions)
|
||||
validate_extensions(const getdns_dict * extensions)
|
||||
{
|
||||
/**
|
||||
* this is a comprehensive list of extensions and their data types
|
||||
|
@ -555,7 +555,7 @@ validate_extensions(struct getdns_dict * extensions)
|
|||
|
||||
static getdns_return_t
|
||||
getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions,
|
||||
const char *name, uint16_t request_type, const getdns_dict *extensions,
|
||||
void *userarg, getdns_network_req **return_netreq_p,
|
||||
getdns_callback_t callbackfn, internal_cb_t internal_cb, int usenamespaces)
|
||||
{
|
||||
|
@ -706,7 +706,7 @@ getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
|
|||
|
||||
getdns_return_t
|
||||
_getdns_general_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions,
|
||||
const char *name, uint16_t request_type, const getdns_dict *extensions,
|
||||
void *userarg, getdns_network_req **netreq_p,
|
||||
getdns_callback_t callback, internal_cb_t internal_cb)
|
||||
{
|
||||
|
@ -718,33 +718,33 @@ _getdns_general_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
|
||||
getdns_return_t
|
||||
_getdns_address_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, getdns_dict *extensions, void *userarg,
|
||||
const char *name, const getdns_dict *extensions, void *userarg,
|
||||
getdns_transaction_t *transaction_id, getdns_callback_t callback)
|
||||
{
|
||||
getdns_dict *my_extensions = extensions;
|
||||
getdns_dict *my_extensions = NULL;
|
||||
getdns_return_t r;
|
||||
uint32_t value;
|
||||
getdns_network_req *netreq = NULL;
|
||||
|
||||
if (!my_extensions) {
|
||||
if (!extensions) {
|
||||
if (!(my_extensions=getdns_dict_create_with_context(context)))
|
||||
return GETDNS_RETURN_MEMORY_ERROR;
|
||||
} else if (
|
||||
getdns_dict_get_int(my_extensions, "return_both_v4_and_v6", &value)
|
||||
getdns_dict_get_int(extensions, "return_both_v4_and_v6", &value)
|
||||
&& (r = _getdns_dict_copy(extensions, &my_extensions)))
|
||||
return r;
|
||||
|
||||
if (my_extensions != extensions && (r = getdns_dict_set_int(
|
||||
if (my_extensions && (r = getdns_dict_set_int(
|
||||
my_extensions, "return_both_v4_and_v6", GETDNS_EXTENSION_TRUE)))
|
||||
return r;
|
||||
|
||||
r = getdns_general_ns(context, loop,
|
||||
name, GETDNS_RRTYPE_AAAA, my_extensions,
|
||||
name, GETDNS_RRTYPE_AAAA, my_extensions ? my_extensions : extensions,
|
||||
userarg, &netreq, callback, NULL, 1);
|
||||
if (netreq && transaction_id)
|
||||
*transaction_id = netreq->owner->trans_id;
|
||||
|
||||
if (my_extensions != extensions)
|
||||
if (my_extensions)
|
||||
getdns_dict_destroy(my_extensions);
|
||||
|
||||
return r;
|
||||
|
@ -752,7 +752,7 @@ _getdns_address_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
|
||||
getdns_return_t
|
||||
_getdns_hostname_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
getdns_dict *address, getdns_dict *extensions, void *userarg,
|
||||
const getdns_dict *address, const getdns_dict *extensions, void *userarg,
|
||||
getdns_transaction_t *transaction_id, getdns_callback_t callback)
|
||||
{
|
||||
struct getdns_bindata *address_data;
|
||||
|
@ -842,7 +842,7 @@ _getdns_hostname_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
|
||||
getdns_return_t
|
||||
_getdns_service_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, getdns_dict *extensions, void *userarg,
|
||||
const char *name, const getdns_dict *extensions, void *userarg,
|
||||
getdns_transaction_t * transaction_id, getdns_callback_t callback)
|
||||
{
|
||||
getdns_return_t r;
|
||||
|
@ -859,7 +859,7 @@ _getdns_service_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
*/
|
||||
getdns_return_t
|
||||
getdns_general(getdns_context *context,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions,
|
||||
const char *name, uint16_t request_type, const getdns_dict *extensions,
|
||||
void *userarg, getdns_transaction_t * transaction_id,
|
||||
getdns_callback_t callbackfn)
|
||||
{
|
||||
|
@ -881,7 +881,7 @@ getdns_general(getdns_context *context,
|
|||
*/
|
||||
getdns_return_t
|
||||
getdns_address(getdns_context *context,
|
||||
const char *name, getdns_dict *extensions, void *userarg,
|
||||
const char *name, const getdns_dict *extensions, void *userarg,
|
||||
getdns_transaction_t *transaction_id, getdns_callback_t callbackfn)
|
||||
{
|
||||
if (!context) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
@ -896,7 +896,7 @@ getdns_address(getdns_context *context,
|
|||
*/
|
||||
getdns_return_t
|
||||
getdns_hostname(getdns_context *context,
|
||||
getdns_dict *address, getdns_dict *extensions, void *userarg,
|
||||
const getdns_dict *address, const getdns_dict *extensions, void *userarg,
|
||||
getdns_transaction_t *transaction_id, getdns_callback_t callbackfn)
|
||||
{
|
||||
if (!context) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
@ -910,7 +910,7 @@ getdns_hostname(getdns_context *context,
|
|||
*/
|
||||
getdns_return_t
|
||||
getdns_service(getdns_context *context,
|
||||
const char *name, getdns_dict *extensions, void *userarg,
|
||||
const char *name, const getdns_dict *extensions, void *userarg,
|
||||
getdns_transaction_t *transaction_id, getdns_callback_t callbackfn)
|
||||
{
|
||||
if (!context) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
|
|
@ -63,25 +63,25 @@ int _getdns_submit_netreq(getdns_network_req *netreq, uint64_t *now_ms);
|
|||
|
||||
getdns_return_t
|
||||
_getdns_general_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions,
|
||||
const char *name, uint16_t request_type, const getdns_dict *extensions,
|
||||
void *userarg, getdns_network_req **netreq_p,
|
||||
getdns_callback_t callbackfn, internal_cb_t internal_cb);
|
||||
|
||||
getdns_return_t
|
||||
_getdns_address_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, getdns_dict *extensions,
|
||||
const char *name, const getdns_dict *extensions,
|
||||
void *userarg, getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn);
|
||||
|
||||
getdns_return_t
|
||||
_getdns_hostname_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
getdns_dict *address, getdns_dict *extensions,
|
||||
const getdns_dict *address, const getdns_dict *extensions,
|
||||
void *userarg, getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn);
|
||||
|
||||
getdns_return_t
|
||||
_getdns_service_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, getdns_dict *extensions,
|
||||
const char *name, const getdns_dict *extensions,
|
||||
void *userarg, getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn);
|
||||
|
||||
|
|
|
@ -1030,7 +1030,7 @@ getdns_return_t
|
|||
getdns_general(getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
getdns_dict *extensions,
|
||||
const getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t * transaction_id, getdns_callback_t callbackfn);
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ getdns_general(getdns_context *context,
|
|||
getdns_return_t
|
||||
getdns_address(getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
const getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t * transaction_id, getdns_callback_t callbackfn);
|
||||
|
||||
|
@ -1065,8 +1065,8 @@ getdns_address(getdns_context *context,
|
|||
*/
|
||||
getdns_return_t
|
||||
getdns_hostname(getdns_context *context,
|
||||
getdns_dict *address,
|
||||
getdns_dict *extensions,
|
||||
const getdns_dict *address,
|
||||
const getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t * transaction_id, getdns_callback_t callbackfn);
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ getdns_hostname(getdns_context *context,
|
|||
getdns_return_t
|
||||
getdns_service(getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
const getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t * transaction_id, getdns_callback_t callbackfn);
|
||||
/** @}
|
||||
|
@ -1201,7 +1201,7 @@ getdns_return_t
|
|||
getdns_general_sync(getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
getdns_dict *extensions,
|
||||
const getdns_dict *extensions,
|
||||
getdns_dict **response);
|
||||
|
||||
/**
|
||||
|
@ -1216,7 +1216,7 @@ getdns_general_sync(getdns_context *context,
|
|||
getdns_return_t
|
||||
getdns_address_sync(getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
const getdns_dict *extensions,
|
||||
getdns_dict **response);
|
||||
|
||||
/**
|
||||
|
@ -1230,8 +1230,8 @@ getdns_address_sync(getdns_context *context,
|
|||
*/
|
||||
getdns_return_t
|
||||
getdns_hostname_sync(getdns_context *context,
|
||||
getdns_dict *address,
|
||||
getdns_dict *extensions,
|
||||
const getdns_dict *address,
|
||||
const getdns_dict *extensions,
|
||||
getdns_dict **response);
|
||||
|
||||
/**
|
||||
|
@ -1246,7 +1246,7 @@ getdns_hostname_sync(getdns_context *context,
|
|||
getdns_return_t
|
||||
getdns_service_sync(getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
const getdns_dict *extensions,
|
||||
getdns_dict **response);
|
||||
|
||||
/** @}
|
||||
|
@ -1444,7 +1444,7 @@ getdns_context_set_resolution_type(getdns_context *context,
|
|||
*/
|
||||
getdns_return_t
|
||||
getdns_context_set_namespaces(getdns_context *context,
|
||||
size_t namespace_count, getdns_namespace_t *namespaces);
|
||||
size_t namespace_count, const getdns_namespace_t *namespaces);
|
||||
|
||||
/**
|
||||
* Specifies what transport are used for DNS lookups. The default is
|
||||
|
@ -1812,6 +1812,8 @@ getdns_context_set_extended_memory_functions(getdns_context *context,
|
|||
* GETDNS_RESOLUTION_STUB.
|
||||
* - all_context (a dict) with names for all the other settings in
|
||||
* context.
|
||||
* The application is responsible for cleaning up the returned dictionary
|
||||
* object with getdns_dict_destroy.
|
||||
*/
|
||||
getdns_dict*
|
||||
getdns_context_get_api_information(getdns_context* context);
|
||||
|
|
|
@ -92,7 +92,7 @@ getdns_dict *no_dnssec_checking_disabled_opportunistic
|
|||
= &no_dnssec_checking_disabled_opportunistic_spc;
|
||||
|
||||
static int
|
||||
is_extension_set(getdns_dict *extensions, const char *name, int default_value)
|
||||
is_extension_set(const getdns_dict *extensions, const char *name, int default_value)
|
||||
{
|
||||
getdns_return_t r;
|
||||
uint32_t value;
|
||||
|
@ -167,7 +167,7 @@ network_req_init(getdns_network_req *net_req, getdns_dns_req *owner,
|
|||
int with_opt, int edns_maximum_udp_payload_size,
|
||||
uint8_t edns_extended_rcode, uint8_t edns_version, int edns_do_bit,
|
||||
uint16_t opt_options_size, size_t noptions, getdns_list *options,
|
||||
size_t wire_data_sz, size_t max_query_sz, getdns_dict *extensions)
|
||||
size_t wire_data_sz, size_t max_query_sz, const getdns_dict *extensions)
|
||||
{
|
||||
uint8_t *buf;
|
||||
getdns_dict *option;
|
||||
|
@ -699,7 +699,7 @@ static const uint8_t no_suffixes[] = { 1, 0 };
|
|||
/* create a new dns req to be submitted */
|
||||
getdns_dns_req *
|
||||
_getdns_dns_req_new(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions,
|
||||
const char *name, uint16_t request_type, const getdns_dict *extensions,
|
||||
uint64_t *now_ms)
|
||||
{
|
||||
int dnssec_return_status = is_extension_set(
|
||||
|
|
10
src/sync.c
10
src/sync.c
|
@ -164,7 +164,7 @@ getdns_sync_cb(getdns_context *context, getdns_callback_type_t callback_type,
|
|||
|
||||
getdns_return_t
|
||||
getdns_general_sync(getdns_context *context, const char *name,
|
||||
uint16_t request_type, getdns_dict *extensions, getdns_dict **response)
|
||||
uint16_t request_type, const getdns_dict *extensions, getdns_dict **response)
|
||||
{
|
||||
getdns_sync_data data;
|
||||
getdns_return_t r;
|
||||
|
@ -190,7 +190,7 @@ getdns_general_sync(getdns_context *context, const char *name,
|
|||
|
||||
getdns_return_t
|
||||
getdns_address_sync(getdns_context *context, const char *name,
|
||||
getdns_dict *extensions, getdns_dict **response)
|
||||
const getdns_dict *extensions, getdns_dict **response)
|
||||
{
|
||||
getdns_sync_data data;
|
||||
getdns_return_t r;
|
||||
|
@ -215,8 +215,8 @@ getdns_address_sync(getdns_context *context, const char *name,
|
|||
}
|
||||
|
||||
getdns_return_t
|
||||
getdns_hostname_sync(getdns_context *context, getdns_dict *address,
|
||||
getdns_dict *extensions, getdns_dict **response)
|
||||
getdns_hostname_sync(getdns_context *context, const getdns_dict *address,
|
||||
const getdns_dict *extensions, getdns_dict **response)
|
||||
{
|
||||
getdns_sync_data data;
|
||||
getdns_return_t r;
|
||||
|
@ -242,7 +242,7 @@ getdns_hostname_sync(getdns_context *context, getdns_dict *address,
|
|||
|
||||
getdns_return_t
|
||||
getdns_service_sync(getdns_context *context, const char *name,
|
||||
getdns_dict *extensions, getdns_dict **response)
|
||||
const getdns_dict *extensions, getdns_dict **response)
|
||||
{
|
||||
getdns_sync_data data;
|
||||
getdns_return_t r;
|
||||
|
|
|
@ -431,7 +431,8 @@ extern getdns_dict *no_dnssec_checking_disabled_opportunistic;
|
|||
|
||||
/* dns request utils */
|
||||
getdns_dns_req *_getdns_dns_req_new(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions, uint64_t *now_ms);
|
||||
const char *name, uint16_t request_type, const getdns_dict *extensions,
|
||||
uint64_t *now_ms);
|
||||
|
||||
void _getdns_dns_req_free(getdns_dns_req * req);
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ int rbtree_find_less_equal(rbtree_type *rbtree, const void *key,
|
|||
* @param rbtree: tree
|
||||
* @return: smallest element or NULL if tree empty.
|
||||
*/
|
||||
rbnode_type *rbtree_first(rbtree_type *rbtree);
|
||||
rbnode_type *rbtree_first(const rbtree_type *rbtree);
|
||||
|
||||
/**
|
||||
* Returns last (largest) node in the tree
|
||||
|
|
|
@ -546,7 +546,7 @@ rbtree_find_less_equal(rbtree_type *rbtree, const void *key,
|
|||
*
|
||||
*/
|
||||
rbnode_type *
|
||||
rbtree_first (rbtree_type *rbtree)
|
||||
rbtree_first (const rbtree_type *rbtree)
|
||||
{
|
||||
rbnode_type *node;
|
||||
|
||||
|
|
Loading…
Reference in New Issue