mirror of https://github.com/getdnsapi/getdns.git
Match getdns.h with current spec
Introducing consts at several places
This commit is contained in:
parent
781a6a271f
commit
f81db41872
|
@ -16,10 +16,12 @@ autom4te.cache
|
||||||
missing
|
missing
|
||||||
libtool
|
libtool
|
||||||
example-all-functions
|
example-all-functions
|
||||||
|
example-reverse
|
||||||
example-simple-answers
|
example-simple-answers
|
||||||
example-synchronous
|
example-synchronous
|
||||||
example-tree
|
example-tree
|
||||||
example_all_functions
|
example_all_functions
|
||||||
|
example_reverse
|
||||||
example_simple_answers
|
example_simple_answers
|
||||||
example_synchronous
|
example_synchronous
|
||||||
example_tree
|
example_tree
|
||||||
|
|
|
@ -1122,7 +1122,7 @@ getdns_context_clear_outbound_request(getdns_dns_req * req)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getdns_strdup(struct mem_funcs *mfs, const char *s)
|
getdns_strdup(const struct mem_funcs *mfs, const char *s)
|
||||||
{
|
{
|
||||||
size_t sz = strlen(s) + 1;
|
size_t sz = strlen(s) + 1;
|
||||||
char *r = GETDNS_XMALLOC(*mfs, char, sz);
|
char *r = GETDNS_XMALLOC(*mfs, char, sz);
|
||||||
|
|
|
@ -101,7 +101,7 @@ getdns_return_t getdns_context_clear_outbound_request(struct getdns_dns_req
|
||||||
getdns_return_t getdns_context_cancel_request(struct getdns_context *context,
|
getdns_return_t getdns_context_cancel_request(struct getdns_context *context,
|
||||||
getdns_transaction_t transaction_id, int fire_callback);
|
getdns_transaction_t transaction_id, int fire_callback);
|
||||||
|
|
||||||
char *getdns_strdup(struct mem_funcs *mfs, const char *str);
|
char *getdns_strdup(const struct mem_funcs *mfs, const char *str);
|
||||||
|
|
||||||
struct getdns_bindata *getdns_bindata_copy(
|
struct getdns_bindata *getdns_bindata_copy(
|
||||||
struct mem_funcs *mfs,
|
struct mem_funcs *mfs,
|
||||||
|
|
|
@ -55,7 +55,7 @@ static size_t sizeof_dname(uint8_t *dname)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getdns_convert_dns_name_to_fqdn(char *name_from_dns_response)
|
getdns_convert_dns_name_to_fqdn(const char *name_from_dns_response)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
ldns_rdf *rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME,
|
ldns_rdf *rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME,
|
||||||
|
@ -68,7 +68,7 @@ getdns_convert_dns_name_to_fqdn(char *name_from_dns_response)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getdns_convert_fqdn_to_dns_name(char *fqdn_as_string)
|
getdns_convert_fqdn_to_dns_name(const char *fqdn_as_string)
|
||||||
{
|
{
|
||||||
ldns_rdf *rdf;
|
ldns_rdf *rdf;
|
||||||
char *data;
|
char *data;
|
||||||
|
@ -91,7 +91,7 @@ getdns_convert_fqdn_to_dns_name(char *fqdn_as_string)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getdns_convert_ulabel_to_alabel(char *ulabel)
|
getdns_convert_ulabel_to_alabel(const char *ulabel)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
@ -122,7 +122,7 @@ getdns_convert_ulabel_to_alabel(char *ulabel)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getdns_convert_alabel_to_ulabel(char *alabel)
|
getdns_convert_alabel_to_ulabel(const char *alabel)
|
||||||
{
|
{
|
||||||
int ret; /* just in case we might want to use it someday */
|
int ret; /* just in case we might want to use it someday */
|
||||||
char *buf;
|
char *buf;
|
||||||
|
@ -137,7 +137,7 @@ getdns_convert_alabel_to_ulabel(char *alabel)
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getdns_display_ip_address(struct getdns_bindata
|
getdns_display_ip_address(const struct getdns_bindata
|
||||||
*bindata_of_ipv4_or_ipv6_address)
|
*bindata_of_ipv4_or_ipv6_address)
|
||||||
{
|
{
|
||||||
char buff[256];
|
char buff[256];
|
||||||
|
|
63
src/dict.c
63
src/dict.c
|
@ -51,17 +51,21 @@
|
||||||
* @return NULL if additnotfnd == FALSE and key is not in dictionary
|
* @return NULL if additnotfnd == FALSE and key is not in dictionary
|
||||||
*/
|
*/
|
||||||
struct getdns_dict_item *
|
struct getdns_dict_item *
|
||||||
getdns_dict_find(struct getdns_dict *dict, char *key, int addifnotfnd)
|
getdns_dict_find(const struct getdns_dict *dict, const char *key)
|
||||||
|
{
|
||||||
|
return (struct getdns_dict_item *)
|
||||||
|
ldns_rbtree_search((ldns_rbtree_t *)&(dict->root), key);
|
||||||
|
} /* getdns_dict_find */
|
||||||
|
|
||||||
|
struct getdns_dict_item *
|
||||||
|
getdns_dict_find_and_add(struct getdns_dict *dict, const char *key)
|
||||||
{
|
{
|
||||||
struct getdns_dict_item *item;
|
struct getdns_dict_item *item;
|
||||||
|
|
||||||
if (!dict || !key)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
item = (struct getdns_dict_item *)
|
item = (struct getdns_dict_item *)
|
||||||
ldns_rbtree_search(&(dict->root), key);
|
ldns_rbtree_search(&(dict->root), key);
|
||||||
|
|
||||||
if (!item && addifnotfnd) {
|
if (!item) {
|
||||||
/* tsearch will add a node automatically for us */
|
/* tsearch will add a node automatically for us */
|
||||||
item = GETDNS_MALLOC(dict->mf, struct getdns_dict_item);
|
item = GETDNS_MALLOC(dict->mf, struct getdns_dict_item);
|
||||||
item->node.key = getdns_strdup(&dict->mf, key);
|
item->node.key = getdns_strdup(&dict->mf, key);
|
||||||
|
@ -69,12 +73,14 @@ getdns_dict_find(struct getdns_dict *dict, char *key, int addifnotfnd)
|
||||||
ldns_rbtree_insert(&(dict->root), (ldns_rbnode_t *) item);
|
ldns_rbtree_insert(&(dict->root), (ldns_rbnode_t *) item);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
} /* getdns_dict_find */
|
} /* getdns_dict_find_and_add */
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------- getdns_dict_get_names
|
/*---------------------------------------- getdns_dict_get_names
|
||||||
*/
|
*/
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_get_names(struct getdns_dict * dict, struct getdns_list ** answer)
|
getdns_dict_get_names(const struct getdns_dict * dict,
|
||||||
|
struct getdns_list ** answer)
|
||||||
{
|
{
|
||||||
struct getdns_dict_item *item;
|
struct getdns_dict_item *item;
|
||||||
size_t index;
|
size_t index;
|
||||||
|
@ -89,7 +95,8 @@ getdns_dict_get_names(struct getdns_dict * dict, struct getdns_list ** answer)
|
||||||
if (!*answer)
|
if (!*answer)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
LDNS_RBTREE_FOR(item, struct getdns_dict_item *, &(dict->root)) {
|
LDNS_RBTREE_FOR(item, struct getdns_dict_item *,
|
||||||
|
(ldns_rbtree_t *)&(dict->root)) {
|
||||||
if (getdns_list_add_item(*answer, &index) != GETDNS_RETURN_GOOD)
|
if (getdns_list_add_item(*answer, &index) != GETDNS_RETURN_GOOD)
|
||||||
continue;
|
continue;
|
||||||
bindata.size = strlen(item->node.key) + 1;
|
bindata.size = strlen(item->node.key) + 1;
|
||||||
|
@ -101,7 +108,7 @@ getdns_dict_get_names(struct getdns_dict * dict, struct getdns_list ** answer)
|
||||||
|
|
||||||
/*---------------------------------------- getdns_dict_get_data_type */
|
/*---------------------------------------- getdns_dict_get_data_type */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_get_data_type(struct getdns_dict * dict, char *name,
|
getdns_dict_get_data_type(const struct getdns_dict * dict, const char *name,
|
||||||
getdns_data_type * answer)
|
getdns_data_type * answer)
|
||||||
{
|
{
|
||||||
struct getdns_dict_item *item;
|
struct getdns_dict_item *item;
|
||||||
|
@ -109,7 +116,7 @@ getdns_dict_get_data_type(struct getdns_dict * dict, char *name,
|
||||||
if (!dict || !name || !answer)
|
if (!dict || !name || !answer)
|
||||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||||
|
|
||||||
item = getdns_dict_find(dict, name, 0);
|
item = getdns_dict_find(dict, name);
|
||||||
if (!item)
|
if (!item)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
|
@ -119,7 +126,7 @@ getdns_dict_get_data_type(struct getdns_dict * dict, char *name,
|
||||||
|
|
||||||
/*---------------------------------------- getdns_dict_get_dict */
|
/*---------------------------------------- getdns_dict_get_dict */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_get_dict(struct getdns_dict * dict, char *name,
|
getdns_dict_get_dict(const struct getdns_dict * dict, const char *name,
|
||||||
struct getdns_dict ** answer)
|
struct getdns_dict ** answer)
|
||||||
{
|
{
|
||||||
struct getdns_dict_item *item;
|
struct getdns_dict_item *item;
|
||||||
|
@ -127,7 +134,7 @@ getdns_dict_get_dict(struct getdns_dict * dict, char *name,
|
||||||
if (!dict || !name || !answer)
|
if (!dict || !name || !answer)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
item = getdns_dict_find(dict, name, 0);
|
item = getdns_dict_find(dict, name);
|
||||||
if (!item)
|
if (!item)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
|
@ -140,7 +147,7 @@ getdns_dict_get_dict(struct getdns_dict * dict, char *name,
|
||||||
|
|
||||||
/*---------------------------------------- getdns_dict_get_list */
|
/*---------------------------------------- getdns_dict_get_list */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_get_list(struct getdns_dict * dict, char *name,
|
getdns_dict_get_list(const struct getdns_dict * dict, const char *name,
|
||||||
struct getdns_list ** answer)
|
struct getdns_list ** answer)
|
||||||
{
|
{
|
||||||
struct getdns_dict_item *item;
|
struct getdns_dict_item *item;
|
||||||
|
@ -148,7 +155,7 @@ getdns_dict_get_list(struct getdns_dict * dict, char *name,
|
||||||
if (!dict || !name || !answer)
|
if (!dict || !name || !answer)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
item = getdns_dict_find(dict, name, 0);
|
item = getdns_dict_find(dict, name);
|
||||||
if (!item)
|
if (!item)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
|
@ -161,7 +168,7 @@ getdns_dict_get_list(struct getdns_dict * dict, char *name,
|
||||||
|
|
||||||
/*---------------------------------------- getdns_dict_get_bindata */
|
/*---------------------------------------- getdns_dict_get_bindata */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_get_bindata(struct getdns_dict * dict, char *name,
|
getdns_dict_get_bindata(const struct getdns_dict * dict, const char *name,
|
||||||
struct getdns_bindata ** answer)
|
struct getdns_bindata ** answer)
|
||||||
{
|
{
|
||||||
struct getdns_dict_item *item;
|
struct getdns_dict_item *item;
|
||||||
|
@ -169,7 +176,7 @@ getdns_dict_get_bindata(struct getdns_dict * dict, char *name,
|
||||||
if (!dict || !name || !answer)
|
if (!dict || !name || !answer)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
item = getdns_dict_find(dict, name, 0);
|
item = getdns_dict_find(dict, name);
|
||||||
if (!item)
|
if (!item)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
|
@ -182,14 +189,15 @@ getdns_dict_get_bindata(struct getdns_dict * dict, char *name,
|
||||||
|
|
||||||
/*---------------------------------------- getdns_dict_get_int */
|
/*---------------------------------------- getdns_dict_get_int */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_get_int(struct getdns_dict * dict, char *name, uint32_t * answer)
|
getdns_dict_get_int(const struct getdns_dict * dict, const char *name,
|
||||||
|
uint32_t * answer)
|
||||||
{
|
{
|
||||||
struct getdns_dict_item *item;
|
struct getdns_dict_item *item;
|
||||||
|
|
||||||
if (!dict || !name || !answer)
|
if (!dict || !name || !answer)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
item = getdns_dict_find(dict, name, 0);
|
item = getdns_dict_find(dict, name);
|
||||||
if (!item)
|
if (!item)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
|
@ -389,7 +397,7 @@ getdns_dict_set_dict(struct getdns_dict * dict, char *name,
|
||||||
if (retval != GETDNS_RETURN_GOOD)
|
if (retval != GETDNS_RETURN_GOOD)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
item = getdns_dict_find(dict, name, 1);
|
item = getdns_dict_find_and_add(dict, name);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
getdns_dict_destroy(newdict);
|
getdns_dict_destroy(newdict);
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
@ -415,7 +423,7 @@ getdns_dict_set_list(struct getdns_dict * dict, char *name,
|
||||||
if (retval != GETDNS_RETURN_GOOD)
|
if (retval != GETDNS_RETURN_GOOD)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
item = getdns_dict_find(dict, name, 1);
|
item = getdns_dict_find_and_add(dict, name);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
getdns_list_destroy(newlist);
|
getdns_list_destroy(newlist);
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
@ -440,7 +448,7 @@ getdns_dict_set_bindata(struct getdns_dict * dict, char *name,
|
||||||
if (!newbindata)
|
if (!newbindata)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
item = getdns_dict_find(dict, name, 1);
|
item = getdns_dict_find_and_add(dict, name);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
getdns_bindata_destroy(&dict->mf, newbindata);
|
getdns_bindata_destroy(&dict->mf, newbindata);
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
@ -460,7 +468,7 @@ getdns_dict_set_int(struct getdns_dict * dict, char *name,
|
||||||
if (!dict || !name)
|
if (!dict || !name)
|
||||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||||
|
|
||||||
item = getdns_dict_find(dict, name, 1);
|
item = getdns_dict_find_and_add(dict, name);
|
||||||
if (!item)
|
if (!item)
|
||||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||||
|
|
||||||
|
@ -531,7 +539,8 @@ getdns_pp_bindata(ldns_buffer * buf, size_t indent,
|
||||||
} /* getdns_pp_bindata */
|
} /* getdns_pp_bindata */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getdns_pp_dict(ldns_buffer * buf, size_t indent, struct getdns_dict *dict);
|
getdns_pp_dict(ldns_buffer * buf, size_t indent,
|
||||||
|
const struct getdns_dict *dict);
|
||||||
|
|
||||||
/*---------------------------------------- getdns_pp_list */
|
/*---------------------------------------- getdns_pp_list */
|
||||||
/**
|
/**
|
||||||
|
@ -627,7 +636,8 @@ getdns_pp_list(ldns_buffer * buf, size_t indent, struct getdns_list *list)
|
||||||
* if an output error is encountered, a negative value
|
* if an output error is encountered, a negative value
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
getdns_pp_dict(ldns_buffer * buf, size_t indent, struct getdns_dict *dict)
|
getdns_pp_dict(ldns_buffer * buf, size_t indent,
|
||||||
|
const struct getdns_dict *dict)
|
||||||
{
|
{
|
||||||
size_t i, length, p = ldns_buffer_position(buf);
|
size_t i, length, p = ldns_buffer_position(buf);
|
||||||
struct getdns_dict_item *item;
|
struct getdns_dict_item *item;
|
||||||
|
@ -640,7 +650,8 @@ getdns_pp_dict(ldns_buffer * buf, size_t indent, struct getdns_dict *dict)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
indent += 2;
|
indent += 2;
|
||||||
LDNS_RBTREE_FOR(item, struct getdns_dict_item *, &(dict->root)) {
|
LDNS_RBTREE_FOR(item, struct getdns_dict_item *,
|
||||||
|
(ldns_rbtree_t *)&(dict->root)) {
|
||||||
if (ldns_buffer_printf(buf, "%s\n%s\"%s\":", (i ? "," : "")
|
if (ldns_buffer_printf(buf, "%s\n%s\"%s\":", (i ? "," : "")
|
||||||
, getdns_indent(indent)
|
, getdns_indent(indent)
|
||||||
, item->node.key) < 0)
|
, item->node.key) < 0)
|
||||||
|
@ -706,7 +717,7 @@ getdns_pp_dict(ldns_buffer * buf, size_t indent, struct getdns_dict *dict)
|
||||||
* or NULL on error
|
* or NULL on error
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
getdns_pretty_print_dict(struct getdns_dict *dict)
|
getdns_pretty_print_dict(const struct getdns_dict *dict)
|
||||||
{
|
{
|
||||||
ldns_buffer *buf;
|
ldns_buffer *buf;
|
||||||
char *ret;
|
char *ret;
|
||||||
|
|
|
@ -371,7 +371,7 @@ getdns_return_t getdns_strerror(getdns_return_t err, char *buf, size_t buflen);
|
||||||
* @return GETDNS_RETURN_GOOD on success
|
* @return GETDNS_RETURN_GOOD on success
|
||||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if list is not valid or params are NULL
|
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if list is not valid or params are NULL
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_list_get_length(struct getdns_list *this_list,
|
getdns_return_t getdns_list_get_length(const struct getdns_list *this_list,
|
||||||
size_t * answer);
|
size_t * answer);
|
||||||
/**
|
/**
|
||||||
* get the enumerated data type of the indexed list item
|
* get the enumerated data type of the indexed list item
|
||||||
|
@ -381,7 +381,7 @@ getdns_return_t getdns_list_get_length(struct getdns_list *this_list,
|
||||||
* @return GETDNS_RETURN_GOOD on success
|
* @return GETDNS_RETURN_GOOD on success
|
||||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_list_get_data_type(struct getdns_list *this_list,
|
getdns_return_t getdns_list_get_data_type(const struct getdns_list *this_list,
|
||||||
size_t index, getdns_data_type * answer);
|
size_t index, getdns_data_type * answer);
|
||||||
/**
|
/**
|
||||||
* retrieve the dictionary value of the specified list item, the caller must not free
|
* retrieve the dictionary value of the specified list item, the caller must not free
|
||||||
|
@ -394,7 +394,7 @@ getdns_return_t getdns_list_get_data_type(struct getdns_list *this_list,
|
||||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
||||||
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_list_get_dict(struct getdns_list *this_list, size_t index,
|
getdns_return_t getdns_list_get_dict(const struct getdns_list *this_list, size_t index,
|
||||||
struct getdns_dict **answer);
|
struct getdns_dict **answer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -408,7 +408,7 @@ getdns_return_t getdns_list_get_dict(struct getdns_list *this_list, size_t index
|
||||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
||||||
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_list_get_list(struct getdns_list *this_list, size_t index,
|
getdns_return_t getdns_list_get_list(const struct getdns_list *this_list, size_t index,
|
||||||
struct getdns_list **answer);
|
struct getdns_list **answer);
|
||||||
/**
|
/**
|
||||||
* retrieve the binary data value of the specified list item, the caller must not
|
* retrieve the binary data value of the specified list item, the caller must not
|
||||||
|
@ -421,7 +421,7 @@ getdns_return_t getdns_list_get_list(struct getdns_list *this_list, size_t index
|
||||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
||||||
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_list_get_bindata(struct getdns_list *this_list, size_t index,
|
getdns_return_t getdns_list_get_bindata(const struct getdns_list *this_list, size_t index,
|
||||||
struct getdns_bindata **answer);
|
struct getdns_bindata **answer);
|
||||||
/**
|
/**
|
||||||
* retrieve the integer value of the specified list item
|
* retrieve the integer value of the specified list item
|
||||||
|
@ -432,7 +432,7 @@ getdns_return_t getdns_list_get_bindata(struct getdns_list *this_list, size_t in
|
||||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
||||||
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_list_get_int(struct getdns_list *this_list, size_t index,
|
getdns_return_t getdns_list_get_int(const struct getdns_list *this_list, size_t index,
|
||||||
uint32_t * answer);
|
uint32_t * answer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -443,7 +443,7 @@ getdns_return_t getdns_list_get_int(struct getdns_list *this_list, size_t index,
|
||||||
* @return GETDNS_RETURN_GOOD on success
|
* @return GETDNS_RETURN_GOOD on success
|
||||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or empty
|
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or empty
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_dict_get_names(struct getdns_dict *this_dict,
|
getdns_return_t getdns_dict_get_names(const struct getdns_dict *this_dict,
|
||||||
struct getdns_list **answer);
|
struct getdns_list **answer);
|
||||||
/**
|
/**
|
||||||
* fetch the data type for the data associated with the specified name
|
* fetch the data type for the data associated with the specified name
|
||||||
|
@ -453,8 +453,8 @@ getdns_return_t getdns_dict_get_names(struct getdns_dict *this_dict,
|
||||||
* @return GETDNS_RETURN_GOOD on success
|
* @return GETDNS_RETURN_GOOD on success
|
||||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_dict_get_data_type(struct getdns_dict *this_dict,
|
getdns_return_t getdns_dict_get_data_type(const struct getdns_dict *this_dict,
|
||||||
char *name, getdns_data_type * answer);
|
const char *name, getdns_data_type * answer);
|
||||||
/**
|
/**
|
||||||
* fetch the dictionary associated with the specified name, the dictionary should
|
* fetch the dictionary associated with the specified name, the dictionary should
|
||||||
* not be free()'d by the caller, it will be freed when the parent dictionary is
|
* not be free()'d by the caller, it will be freed when the parent dictionary is
|
||||||
|
@ -465,8 +465,8 @@ getdns_return_t getdns_dict_get_data_type(struct getdns_dict *this_dict,
|
||||||
* @return GETDNS_RETURN_GOOD on success
|
* @return GETDNS_RETURN_GOOD on success
|
||||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_dict_get_dict(struct getdns_dict *this_dict, char *name,
|
getdns_return_t getdns_dict_get_dict(const struct getdns_dict *this_dict,
|
||||||
struct getdns_dict **answer);
|
const char *name, struct getdns_dict **answer);
|
||||||
/**
|
/**
|
||||||
* fetch the list associated with the specified name
|
* fetch the list associated with the specified name
|
||||||
* the list should not be free()'d by the caller, when the dictionary is destroyed
|
* the list should not be free()'d by the caller, when the dictionary is destroyed
|
||||||
|
@ -477,8 +477,8 @@ getdns_return_t getdns_dict_get_dict(struct getdns_dict *this_dict, char *name,
|
||||||
* @return GETDNS_RETURN_GOOD on success
|
* @return GETDNS_RETURN_GOOD on success
|
||||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_dict_get_list(struct getdns_dict *this_dict, char *name,
|
getdns_return_t getdns_dict_get_list(const struct getdns_dict *this_dict,
|
||||||
struct getdns_list **answer);
|
const char *name, struct getdns_list **answer);
|
||||||
/**
|
/**
|
||||||
* fetch the bindata associated with the specified name, the bindata should not be
|
* fetch the bindata associated with the specified name, the bindata should not be
|
||||||
* free()'d by the caller
|
* free()'d by the caller
|
||||||
|
@ -488,8 +488,8 @@ getdns_return_t getdns_dict_get_list(struct getdns_dict *this_dict, char *name,
|
||||||
* @return GETDNS_RETURN_GOOD on success
|
* @return GETDNS_RETURN_GOOD on success
|
||||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_dict_get_bindata(struct getdns_dict *this_dict,
|
getdns_return_t getdns_dict_get_bindata(const struct getdns_dict *this_dict,
|
||||||
char *name, struct getdns_bindata **answer);
|
const char *name, struct getdns_bindata **answer);
|
||||||
/**
|
/**
|
||||||
* fetch the integer value associated with the specified name
|
* fetch the integer value associated with the specified name
|
||||||
* @param this_dict dictionary from which to fetch the integer
|
* @param this_dict dictionary from which to fetch the integer
|
||||||
|
@ -498,8 +498,8 @@ getdns_return_t getdns_dict_get_bindata(struct getdns_dict *this_dict,
|
||||||
* @return GETDNS_RETURN_GOOD on success
|
* @return GETDNS_RETURN_GOOD on success
|
||||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||||
*/
|
*/
|
||||||
getdns_return_t getdns_dict_get_int(struct getdns_dict *this_dict, char *name,
|
getdns_return_t getdns_dict_get_int(const struct getdns_dict *this_dict,
|
||||||
uint32_t * answer);
|
const char *name, uint32_t * answer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create a new list with no items
|
* create a new list with no items
|
||||||
|
@ -769,13 +769,13 @@ getdns_service_sync(struct getdns_context *context,
|
||||||
/** @}
|
/** @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *getdns_convert_dns_name_to_fqdn(char *name_from_dns_response);
|
char *getdns_convert_dns_name_to_fqdn(const char *name_from_dns_response);
|
||||||
|
|
||||||
char *getdns_convert_fqdn_to_dns_name(char *fqdn_as_string);
|
char *getdns_convert_fqdn_to_dns_name(const char *fqdn_as_string);
|
||||||
|
|
||||||
char *getdns_convert_ulabel_to_alabel(char *ulabel);
|
char *getdns_convert_ulabel_to_alabel(const char *ulabel);
|
||||||
|
|
||||||
char *getdns_convert_alabel_to_ulabel(char *alabel);
|
char *getdns_convert_alabel_to_ulabel(const char *alabel);
|
||||||
|
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_validate_dnssec(struct getdns_bindata *record_to_validate,
|
getdns_validate_dnssec(struct getdns_bindata *record_to_validate,
|
||||||
|
@ -789,9 +789,9 @@ getdns_validate_dnssec(struct getdns_bindata *record_to_validate,
|
||||||
* @param this_dict dictionary to pretty print
|
* @param this_dict dictionary to pretty print
|
||||||
* @return character array (caller must free this) containing pretty string
|
* @return character array (caller must free this) containing pretty string
|
||||||
*/
|
*/
|
||||||
char *getdns_pretty_print_dict(struct getdns_dict *some_dict);
|
char *getdns_pretty_print_dict(const struct getdns_dict *some_dict);
|
||||||
|
|
||||||
char *getdns_display_ip_address(struct getdns_bindata
|
char *getdns_display_ip_address(const struct getdns_bindata
|
||||||
*bindata_of_ipv4_or_ipv6_address);
|
*bindata_of_ipv4_or_ipv6_address);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
13
src/list.c
13
src/list.c
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
/*---------------------------------------- getdns_list_get_length */
|
/*---------------------------------------- getdns_list_get_length */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_list_get_length(struct getdns_list * list, size_t * answer)
|
getdns_list_get_length(const struct getdns_list * list, size_t * answer)
|
||||||
{
|
{
|
||||||
if (!list || !answer)
|
if (!list || !answer)
|
||||||
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||||
|
@ -52,7 +52,7 @@ getdns_list_get_length(struct getdns_list * list, size_t * answer)
|
||||||
|
|
||||||
/*---------------------------------------- getdns_list_get_data_type */
|
/*---------------------------------------- getdns_list_get_data_type */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_list_get_data_type(struct getdns_list * list, size_t index,
|
getdns_list_get_data_type(const struct getdns_list * list, size_t index,
|
||||||
getdns_data_type * answer)
|
getdns_data_type * answer)
|
||||||
{
|
{
|
||||||
if (!list || index >= list->numinuse)
|
if (!list || index >= list->numinuse)
|
||||||
|
@ -67,7 +67,7 @@ getdns_list_get_data_type(struct getdns_list * list, size_t index,
|
||||||
|
|
||||||
/*---------------------------------------- getdns_list_get_dict */
|
/*---------------------------------------- getdns_list_get_dict */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_list_get_dict(struct getdns_list * list, size_t index,
|
getdns_list_get_dict(const struct getdns_list * list, size_t index,
|
||||||
struct getdns_dict ** answer)
|
struct getdns_dict ** answer)
|
||||||
{
|
{
|
||||||
if (!list || index >= list->numinuse)
|
if (!list || index >= list->numinuse)
|
||||||
|
@ -85,7 +85,7 @@ getdns_list_get_dict(struct getdns_list * list, size_t index,
|
||||||
|
|
||||||
/*---------------------------------------- getdns_list_get_list */
|
/*---------------------------------------- getdns_list_get_list */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_list_get_list(struct getdns_list * list, size_t index,
|
getdns_list_get_list(const struct getdns_list * list, size_t index,
|
||||||
struct getdns_list ** answer)
|
struct getdns_list ** answer)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ getdns_list_get_list(struct getdns_list * list, size_t index,
|
||||||
|
|
||||||
/*---------------------------------------- getdns_list_get_bindata */
|
/*---------------------------------------- getdns_list_get_bindata */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_list_get_bindata(struct getdns_list * list, size_t index,
|
getdns_list_get_bindata(const struct getdns_list * list, size_t index,
|
||||||
struct getdns_bindata ** answer)
|
struct getdns_bindata ** answer)
|
||||||
{
|
{
|
||||||
if (!list || index >= list->numinuse)
|
if (!list || index >= list->numinuse)
|
||||||
|
@ -122,7 +122,8 @@ getdns_list_get_bindata(struct getdns_list * list, size_t index,
|
||||||
|
|
||||||
/*---------------------------------------- getdns_list_get_int */
|
/*---------------------------------------- getdns_list_get_int */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_list_get_int(struct getdns_list * list, size_t index, uint32_t * answer)
|
getdns_list_get_int(const struct getdns_list * list, size_t index,
|
||||||
|
uint32_t * answer)
|
||||||
{
|
{
|
||||||
if (!list || index >= list->numinuse)
|
if (!list || index >= list->numinuse)
|
||||||
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||||
|
|
Loading…
Reference in New Issue