mirror of https://github.com/getdnsapi/getdns.git
Internal symbols always prefixed with _getdns
This commit is contained in:
parent
1f638ccd0b
commit
b9e8455e27
|
@ -260,7 +260,7 @@ add_local_host(getdns_context *context, getdns_dict *address, const char *str)
|
|||
if (!hnas_found) GETDNS_FREE(context->mf, hnas);
|
||||
return;
|
||||
}
|
||||
if (getdns_list_append_dict(*addrs, address) && !hnas_found) {
|
||||
if (_getdns_list_append_dict(*addrs, address) && !hnas_found) {
|
||||
getdns_list_destroy(*addrs);
|
||||
GETDNS_FREE(context->mf, hnas);
|
||||
|
||||
|
@ -1529,7 +1529,7 @@ getdns_context_set_dns_root_servers(struct getdns_context *context,
|
|||
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
|
||||
}
|
||||
if (addresses != NULL) {
|
||||
if (getdns_list_copy(addresses, ©) != GETDNS_RETURN_GOOD) {
|
||||
if (_getdns_list_copy(addresses, ©) != GETDNS_RETURN_GOOD) {
|
||||
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
|
||||
}
|
||||
addresses = copy;
|
||||
|
@ -1600,7 +1600,7 @@ getdns_context_set_suffix(struct getdns_context *context, struct getdns_list * v
|
|||
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
|
||||
}
|
||||
if (value != NULL) {
|
||||
if (getdns_list_copy(value, ©) != GETDNS_RETURN_GOOD) {
|
||||
if (_getdns_list_copy(value, ©) != GETDNS_RETURN_GOOD) {
|
||||
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
|
||||
}
|
||||
value = copy;
|
||||
|
@ -1954,7 +1954,7 @@ cancel_dns_req(getdns_dns_req *req)
|
|||
}
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_cancel_request(getdns_context *context,
|
||||
_getdns_context_cancel_request(getdns_context *context,
|
||||
getdns_transaction_t transaction_id, int fire_callback)
|
||||
{
|
||||
getdns_dns_req *dnsreq;
|
||||
|
@ -1991,7 +1991,7 @@ getdns_cancel_callback(getdns_context *context,
|
|||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
context->processing = 1;
|
||||
getdns_return_t r = getdns_context_cancel_request(context, transaction_id, 1);
|
||||
getdns_return_t r = _getdns_context_cancel_request(context, transaction_id, 1);
|
||||
context->processing = 0;
|
||||
getdns_context_request_count_changed(context);
|
||||
return r;
|
||||
|
@ -2168,7 +2168,7 @@ _getdns_ns_dns_setup(struct getdns_context *context)
|
|||
}
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_prepare_for_resolution(struct getdns_context *context,
|
||||
_getdns_context_prepare_for_resolution(struct getdns_context *context,
|
||||
int usenamespaces)
|
||||
{
|
||||
int i;
|
||||
|
@ -2236,10 +2236,10 @@ getdns_context_prepare_for_resolution(struct getdns_context *context,
|
|||
}
|
||||
context->resolution_type_set = context->resolution_type;
|
||||
return r;
|
||||
} /* getdns_context_prepare_for_resolution */
|
||||
} /* _getdns_context_prepare_for_resolution */
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_track_outbound_request(getdns_dns_req *dnsreq)
|
||||
_getdns_context_track_outbound_request(getdns_dns_req *dnsreq)
|
||||
{
|
||||
if (!dnsreq)
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
@ -2254,7 +2254,7 @@ getdns_context_track_outbound_request(getdns_dns_req *dnsreq)
|
|||
}
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_clear_outbound_request(getdns_dns_req *dnsreq)
|
||||
_getdns_context_clear_outbound_request(getdns_dns_req *dnsreq)
|
||||
{
|
||||
if (!dnsreq)
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
@ -2268,7 +2268,7 @@ getdns_context_clear_outbound_request(getdns_dns_req *dnsreq)
|
|||
}
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_request_timed_out(struct getdns_dns_req *req)
|
||||
_getdns_context_request_timed_out(struct getdns_dns_req *req)
|
||||
{
|
||||
/* Don't use req after callback */
|
||||
getdns_context* context = req->context;
|
||||
|
@ -2278,7 +2278,7 @@ getdns_context_request_timed_out(struct getdns_dns_req *req)
|
|||
getdns_dict *response = create_getdns_response(req);
|
||||
|
||||
/* cancel the req - also clears it from outbound and cleans up*/
|
||||
getdns_context_cancel_request(context, trans_id, 0);
|
||||
_getdns_context_cancel_request(context, trans_id, 0);
|
||||
context->processing = 1;
|
||||
cb(context, GETDNS_CALLBACK_TIMEOUT, response, user_arg, trans_id);
|
||||
context->processing = 0;
|
||||
|
@ -2287,7 +2287,7 @@ getdns_context_request_timed_out(struct getdns_dns_req *req)
|
|||
}
|
||||
|
||||
char *
|
||||
getdns_strdup(const struct mem_funcs *mfs, const char *s)
|
||||
_getdns_strdup(const struct mem_funcs *mfs, const char *s)
|
||||
{
|
||||
size_t sz = strlen(s) + 1;
|
||||
char *r = GETDNS_XMALLOC(*mfs, char, sz);
|
||||
|
@ -2298,7 +2298,7 @@ getdns_strdup(const struct mem_funcs *mfs, const char *s)
|
|||
}
|
||||
|
||||
struct getdns_bindata *
|
||||
getdns_bindata_copy(struct mem_funcs *mfs,
|
||||
_getdns_bindata_copy(struct mem_funcs *mfs,
|
||||
const struct getdns_bindata *src)
|
||||
{
|
||||
/* Don't know why, but nodata allows
|
||||
|
@ -2328,7 +2328,7 @@ getdns_bindata_copy(struct mem_funcs *mfs,
|
|||
}
|
||||
|
||||
void
|
||||
getdns_bindata_destroy(struct mem_funcs *mfs,
|
||||
_getdns_bindata_destroy(struct mem_funcs *mfs,
|
||||
struct getdns_bindata *bindata)
|
||||
{
|
||||
if (!bindata)
|
||||
|
@ -2409,7 +2409,7 @@ cancel_outstanding_requests(struct getdns_context* context, int fire_callback) {
|
|||
acc.ids = GETDNS_XMALLOC(context->my_mf, getdns_transaction_t, context->outbound_requests.count);
|
||||
_getdns_traverse_postorder(&context->outbound_requests, accumulate_outstanding_transactions, &acc);
|
||||
for (i = 0; i < acc.idx; ++i) {
|
||||
getdns_context_cancel_request(context, acc.ids[i], fire_callback);
|
||||
_getdns_context_cancel_request(context, acc.ids[i], fire_callback);
|
||||
}
|
||||
GETDNS_FREE(context->my_mf, acc.ids);
|
||||
}
|
||||
|
@ -2504,7 +2504,7 @@ priv_get_context_settings(getdns_context* context) {
|
|||
(void) getdns_dict_set_int(d, "tls_port",
|
||||
(uint32_t) upstream_port(upstream));
|
||||
}
|
||||
r |= getdns_list_append_dict(upstreams, d);
|
||||
r |= _getdns_list_append_dict(upstreams, d);
|
||||
getdns_dict_destroy(d);
|
||||
}
|
||||
r |= getdns_dict_set_list(result, "upstream_recursive_servers",
|
||||
|
@ -2592,7 +2592,7 @@ getdns_context_set_use_threads(getdns_context* context, int use_threads) {
|
|||
}
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_local_namespace_resolve(
|
||||
_getdns_context_local_namespace_resolve(
|
||||
getdns_dns_req *dnsreq, getdns_dict **response)
|
||||
{
|
||||
getdns_context *context = dnsreq->context;
|
||||
|
@ -2659,10 +2659,10 @@ getdns_context_local_namespace_resolve(
|
|||
if (!(jaa = getdns_list_create_with_context(context)))
|
||||
goto error;
|
||||
for (i = 0; !getdns_list_get_dict(hnas->ipv4addrs, i, &addr); i++)
|
||||
if (getdns_list_append_dict(jaa, addr))
|
||||
if (_getdns_list_append_dict(jaa, addr))
|
||||
break;
|
||||
for (i = 0; !getdns_list_get_dict(hnas->ipv6addrs, i, &addr); i++)
|
||||
if (getdns_list_append_dict(jaa, addr))
|
||||
if (_getdns_list_append_dict(jaa, addr))
|
||||
break;
|
||||
if (!getdns_dict_set_list(*response, "just_address_answers", jaa)) {
|
||||
getdns_list_destroy(jaa);
|
||||
|
@ -2807,7 +2807,7 @@ getdns_context_get_dns_root_servers(getdns_context *context,
|
|||
RETURN_IF_NULL(value, GETDNS_RETURN_INVALID_PARAMETER);
|
||||
*value = NULL;
|
||||
if (context->dns_root_servers) {
|
||||
return getdns_list_copy(context->dns_root_servers, value);
|
||||
return _getdns_list_copy(context->dns_root_servers, value);
|
||||
}
|
||||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
@ -2827,7 +2827,7 @@ getdns_context_get_suffix(getdns_context *context, getdns_list **value) {
|
|||
RETURN_IF_NULL(value, GETDNS_RETURN_INVALID_PARAMETER);
|
||||
*value = NULL;
|
||||
if (context->suffix) {
|
||||
return getdns_list_copy(context->suffix, value);
|
||||
return _getdns_list_copy(context->suffix, value);
|
||||
}
|
||||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
@ -2890,7 +2890,7 @@ getdns_context_get_upstream_recursive_servers(getdns_context *context,
|
|||
(void) getdns_dict_set_int(d, "tls_port",
|
||||
(uint32_t) upstream_port(upstream));
|
||||
}
|
||||
r |= getdns_list_append_dict(upstreams, d);
|
||||
r |= _getdns_list_append_dict(upstreams, d);
|
||||
getdns_dict_destroy(d);
|
||||
}
|
||||
if (r != GETDNS_RETURN_GOOD) {
|
||||
|
|
|
@ -215,35 +215,35 @@ struct getdns_context {
|
|||
* @param usenamespaces if 0 then only use the DNS, else use context namespace list
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
*/
|
||||
getdns_return_t getdns_context_prepare_for_resolution(struct getdns_context *context,
|
||||
getdns_return_t _getdns_context_prepare_for_resolution(struct getdns_context *context,
|
||||
int usenamespaces);
|
||||
|
||||
/* track an outbound request */
|
||||
getdns_return_t getdns_context_track_outbound_request(struct getdns_dns_req
|
||||
getdns_return_t _getdns_context_track_outbound_request(struct getdns_dns_req
|
||||
*req);
|
||||
/* clear the outbound request from being tracked - does not cancel it */
|
||||
getdns_return_t getdns_context_clear_outbound_request(struct getdns_dns_req
|
||||
getdns_return_t _getdns_context_clear_outbound_request(struct getdns_dns_req
|
||||
*req);
|
||||
|
||||
getdns_return_t getdns_context_request_timed_out(struct getdns_dns_req
|
||||
getdns_return_t _getdns_context_request_timed_out(struct getdns_dns_req
|
||||
*req);
|
||||
|
||||
/* cancel callback internal - flag to indicate if req should be freed and callback fired */
|
||||
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);
|
||||
|
||||
char *getdns_strdup(const 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,
|
||||
const struct getdns_bindata *src);
|
||||
|
||||
void getdns_bindata_destroy(
|
||||
void _getdns_bindata_destroy(
|
||||
struct mem_funcs *mfs,
|
||||
struct getdns_bindata *bindata);
|
||||
|
||||
/* perform name resolution in /etc/hosts */
|
||||
getdns_return_t getdns_context_local_namespace_resolve(
|
||||
getdns_return_t _getdns_context_local_namespace_resolve(
|
||||
getdns_dns_req* req, struct getdns_dict **response);
|
||||
|
||||
int filechg_check(struct getdns_context *context, struct filechg *fchg);
|
||||
|
|
22
src/dict.c
22
src/dict.c
|
@ -74,7 +74,7 @@ getdns_dict_find_and_add(struct getdns_dict *dict, const char *key)
|
|||
if (!item) {
|
||||
/* add a node */
|
||||
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);
|
||||
item->data.n = 0;
|
||||
_getdns_rbtree_insert(&(dict->root), (_getdns_rbnode_t *) item);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ getdns_dict_get_names(const getdns_dict *dict, getdns_list **answer)
|
|||
|
||||
RBTREE_FOR(item, struct getdns_dict_item *,
|
||||
(_getdns_rbtree_t *)&(dict->root)) {
|
||||
getdns_list_append_string(*answer, item->node.key);
|
||||
_getdns_list_append_string(*answer, item->node.key);
|
||||
}
|
||||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_dict_get_names */
|
||||
|
@ -271,7 +271,7 @@ getdns_dict_create()
|
|||
return getdns_dict_create_with_context(NULL);
|
||||
} /* getdns_dict_create */
|
||||
|
||||
/*---------------------------------------- getdns_dict_copy */
|
||||
/*---------------------------------------- _getdns_dict_copy */
|
||||
/**
|
||||
* private function used to make a copy of a dict structure,
|
||||
* the caller is responsible * for freeing storage allocated to returned value
|
||||
|
@ -281,7 +281,7 @@ getdns_dict_create()
|
|||
* @return NULL on error (out of memory, invalid srcdict)
|
||||
*/
|
||||
getdns_return_t
|
||||
getdns_dict_copy(const struct getdns_dict * srcdict,
|
||||
_getdns_dict_copy(const struct getdns_dict * srcdict,
|
||||
struct getdns_dict ** dstdict)
|
||||
{
|
||||
struct getdns_dict_item *item;
|
||||
|
@ -335,7 +335,7 @@ getdns_dict_copy(const struct getdns_dict * srcdict,
|
|||
}
|
||||
}
|
||||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_dict_copy */
|
||||
} /* _getdns_dict_copy */
|
||||
|
||||
/*---------------------------------------- getdns_dict_item_free */
|
||||
/**
|
||||
|
@ -356,7 +356,7 @@ getdns_dict_item_free(_getdns_rbnode_t * node, void *arg)
|
|||
|
||||
switch (item->dtype) {
|
||||
case t_bindata:
|
||||
getdns_bindata_destroy(&dict->mf, item->data.bindata);
|
||||
_getdns_bindata_destroy(&dict->mf, item->data.bindata);
|
||||
break;
|
||||
case t_dict:
|
||||
getdns_dict_destroy(item->data.dict);
|
||||
|
@ -393,7 +393,7 @@ getdns_dict_set_dict(struct getdns_dict * dict, const char *name,
|
|||
if (!dict || !name || !child_dict)
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
retval = getdns_dict_copy(child_dict, &newdict);
|
||||
retval = _getdns_dict_copy(child_dict, &newdict);
|
||||
if (retval != GETDNS_RETURN_GOOD)
|
||||
return retval;
|
||||
|
||||
|
@ -419,7 +419,7 @@ getdns_dict_set_list(struct getdns_dict * dict, const char *name,
|
|||
if (!dict || !name || !child_list)
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
retval = getdns_list_copy(child_list, &newlist);
|
||||
retval = _getdns_list_copy(child_list, &newlist);
|
||||
if (retval != GETDNS_RETURN_GOOD)
|
||||
return retval;
|
||||
|
||||
|
@ -444,13 +444,13 @@ getdns_dict_set_bindata(struct getdns_dict * dict, const char *name,
|
|||
if (!dict || !name || !child_bindata)
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
newbindata = getdns_bindata_copy(&dict->mf, child_bindata);
|
||||
newbindata = _getdns_bindata_copy(&dict->mf, child_bindata);
|
||||
if (!newbindata)
|
||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||
|
||||
item = getdns_dict_find_and_add(dict, name);
|
||||
if (!item) {
|
||||
getdns_bindata_destroy(&dict->mf, newbindata);
|
||||
_getdns_bindata_destroy(&dict->mf, newbindata);
|
||||
return GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||
}
|
||||
item->dtype = t_bindata;
|
||||
|
@ -472,7 +472,7 @@ getdns_dict_util_set_string(getdns_dict *dict, char *name, const char *value)
|
|||
return GETDNS_RETURN_MEMORY_ERROR;
|
||||
|
||||
newbindata->size = strlen(value);
|
||||
if (!(newbindata->data = (void *)getdns_strdup(&dict->mf, value)))
|
||||
if (!(newbindata->data = (void *)_getdns_strdup(&dict->mf, value)))
|
||||
goto error_free_bindata;
|
||||
|
||||
if ((item = getdns_dict_find_and_add(dict, name))) {
|
||||
|
|
10
src/dnssec.c
10
src/dnssec.c
|
@ -1247,7 +1247,7 @@ static void val_chain_node_cb(getdns_dns_req *dnsreq)
|
|||
getdns_rrset *rrset;
|
||||
rrsig_iter *rrsig, rrsig_spc;
|
||||
|
||||
getdns_context_clear_outbound_request(dnsreq);
|
||||
_getdns_context_clear_outbound_request(dnsreq);
|
||||
switch (netreq->request_type) {
|
||||
case GETDNS_RRTYPE_DS : node->ds.pkt = netreq->response;
|
||||
node->ds.pkt_len = netreq->response_len;
|
||||
|
@ -1284,7 +1284,7 @@ static void val_chain_node_soa_cb(getdns_dns_req *dnsreq)
|
|||
rrset_iter i_spc;
|
||||
getdns_rrset *rrset;
|
||||
|
||||
getdns_context_clear_outbound_request(dnsreq);
|
||||
_getdns_context_clear_outbound_request(dnsreq);
|
||||
|
||||
if ((rrset = rrset_by_type(&i_spc, netreq, GETDNS_RRTYPE_SOA))) {
|
||||
|
||||
|
@ -2681,7 +2681,7 @@ static void append_rrs2val_chain_list(getdns_context *ctxt,
|
|||
&ctxt->mf, &rr->rr_i)))
|
||||
continue;
|
||||
|
||||
(void)getdns_list_append_dict(val_chain_list, rr_dict);
|
||||
(void)_getdns_list_append_dict(val_chain_list, rr_dict);
|
||||
getdns_dict_destroy(rr_dict);
|
||||
}
|
||||
for ( rrsig = rrsig_iter_init(&rrsig_spc, rrset)
|
||||
|
@ -2700,7 +2700,7 @@ static void append_rrs2val_chain_list(getdns_context *ctxt,
|
|||
&ctxt->mf, &rrsig->rr_i)))
|
||||
continue;
|
||||
|
||||
(void)getdns_list_append_dict(val_chain_list, rr_dict);
|
||||
(void)_getdns_list_append_dict(val_chain_list, rr_dict);
|
||||
getdns_dict_destroy(rr_dict);
|
||||
}
|
||||
}
|
||||
|
@ -2732,7 +2732,7 @@ static void append_empty_ds2val_chain_list(
|
|||
(void) getdns_dict_set_bindata(rdata_dict, "rdata_raw", &bindata);
|
||||
getdns_dict_destroy(rdata_dict);
|
||||
|
||||
(void)getdns_list_append_dict(val_chain_list, rr_dict);
|
||||
(void)_getdns_list_append_dict(val_chain_list, rr_dict);
|
||||
getdns_dict_destroy(rr_dict);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ static void
|
|||
ub_resolve_timeout(void *arg)
|
||||
{
|
||||
getdns_dns_req *dns_req = (getdns_dns_req *) arg;
|
||||
(void) getdns_context_request_timed_out(dns_req);
|
||||
(void) _getdns_context_request_timed_out(dns_req);
|
||||
}
|
||||
|
||||
void _getdns_call_user_callback(getdns_dns_req *dns_req,
|
||||
|
@ -62,7 +62,7 @@ void _getdns_call_user_callback(getdns_dns_req *dns_req,
|
|||
void *user_arg = dns_req->user_pointer;
|
||||
|
||||
/* clean up */
|
||||
getdns_context_clear_outbound_request(dns_req);
|
||||
_getdns_context_clear_outbound_request(dns_req);
|
||||
dns_req_free(dns_req);
|
||||
|
||||
cb(context,
|
||||
|
@ -194,7 +194,7 @@ getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
|
|||
|
||||
/* Set up the context assuming we won't use the specified namespaces.
|
||||
This is (currently) identical to setting up a pure DNS namespace */
|
||||
if ((r = getdns_context_prepare_for_resolution(context, 0)))
|
||||
if ((r = _getdns_context_prepare_for_resolution(context, 0)))
|
||||
return r;
|
||||
|
||||
/* create the request */
|
||||
|
@ -208,7 +208,7 @@ getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
|
|||
if (dnsreq_p)
|
||||
*dnsreq_p = req;
|
||||
|
||||
getdns_context_track_outbound_request(req);
|
||||
_getdns_context_track_outbound_request(req);
|
||||
|
||||
if (!usenamespaces)
|
||||
/* issue all network requests */
|
||||
|
@ -220,7 +220,7 @@ getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
|
|||
else for (i = 0; i < context->namespace_count; i++) {
|
||||
if (context->namespaces[i] == GETDNS_NAMESPACE_LOCALNAMES) {
|
||||
|
||||
if (!(r = getdns_context_local_namespace_resolve(
|
||||
if (!(r = _getdns_context_local_namespace_resolve(
|
||||
req, &localnames_response))) {
|
||||
|
||||
_getdns_call_user_callback
|
||||
|
@ -245,7 +245,7 @@ getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
|
|||
|
||||
if (r != 0) {
|
||||
/* clean up the request */
|
||||
getdns_context_clear_outbound_request(req);
|
||||
_getdns_context_clear_outbound_request(req);
|
||||
dns_req_free(req);
|
||||
return r;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ _getdns_address_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
return GETDNS_RETURN_MEMORY_ERROR;
|
||||
} else if (
|
||||
getdns_dict_get_int(my_extensions, "return_both_v4_and_v6", &value)
|
||||
&& (r = getdns_dict_copy(extensions, &my_extensions)))
|
||||
&& (r = _getdns_dict_copy(extensions, &my_extensions)))
|
||||
return r;
|
||||
|
||||
if (my_extensions != extensions && (r = getdns_dict_set_int(
|
||||
|
|
46
src/list.c
46
src/list.c
|
@ -165,9 +165,9 @@ getdns_list_realloc(struct getdns_list *list)
|
|||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_list_realloc */
|
||||
|
||||
/*---------------------------------------- getdns_list_copy */
|
||||
/*---------------------------------------- _getdns_list_copy */
|
||||
getdns_return_t
|
||||
getdns_list_copy(const struct getdns_list * srclist,
|
||||
_getdns_list_copy(const struct getdns_list * srclist,
|
||||
struct getdns_list ** dstlist)
|
||||
{
|
||||
int i;
|
||||
|
@ -191,7 +191,7 @@ getdns_list_copy(const struct getdns_list * srclist,
|
|||
return GETDNS_RETURN_GENERIC_ERROR;
|
||||
|
||||
for (i = 0; i < srclist->numinuse; i++) {
|
||||
retval = getdns_list_add_item(*dstlist, &index);
|
||||
retval = _getdns_list_add_item(*dstlist, &index);
|
||||
if (retval != GETDNS_RETURN_GOOD) {
|
||||
getdns_list_destroy(*dstlist);
|
||||
*dstlist = NULL;
|
||||
|
@ -225,7 +225,7 @@ getdns_list_copy(const struct getdns_list * srclist,
|
|||
}
|
||||
}
|
||||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_list_copy */
|
||||
} /* _getdns_list_copy */
|
||||
|
||||
struct getdns_list *
|
||||
getdns_list_create_with_extended_memory_functions(
|
||||
|
@ -313,7 +313,7 @@ getdns_list_destroy_item(struct getdns_list *list, size_t index)
|
|||
break;
|
||||
|
||||
case t_bindata:
|
||||
getdns_bindata_destroy(&list->mf,
|
||||
_getdns_bindata_destroy(&list->mf,
|
||||
list->items[index].data.bindata);
|
||||
break;
|
||||
|
||||
|
@ -339,9 +339,9 @@ getdns_list_destroy(struct getdns_list *list)
|
|||
GETDNS_FREE(list->mf, list);
|
||||
} /* getdns_list_destroy */
|
||||
|
||||
/*---------------------------------------- getdns_list_add_item */
|
||||
/*---------------------------------------- _getdns_list_add_item */
|
||||
getdns_return_t
|
||||
getdns_list_add_item(struct getdns_list *list, size_t * index)
|
||||
_getdns_list_add_item(struct getdns_list *list, size_t * index)
|
||||
{
|
||||
getdns_return_t retval;
|
||||
|
||||
|
@ -358,7 +358,7 @@ getdns_list_add_item(struct getdns_list *list, size_t * index)
|
|||
list->items[*index].data.n = 0;
|
||||
list->numinuse++;
|
||||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_list_add_item */
|
||||
} /* _getdns_list_add_item */
|
||||
|
||||
/*---------------------------------------- getdns_list_set_dict */
|
||||
getdns_return_t
|
||||
|
@ -374,12 +374,12 @@ getdns_list_set_dict(struct getdns_list * list, size_t index,
|
|||
if (index > list->numinuse)
|
||||
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
retval = getdns_dict_copy(child_dict, &newdict);
|
||||
retval = _getdns_dict_copy(child_dict, &newdict);
|
||||
if (retval != GETDNS_RETURN_GOOD)
|
||||
return retval;
|
||||
|
||||
if (index == list->numinuse) {
|
||||
retval = getdns_list_add_item(list, &index);
|
||||
retval = _getdns_list_add_item(list, &index);
|
||||
if (retval != GETDNS_RETURN_GOOD) {
|
||||
getdns_dict_destroy(newdict);
|
||||
return retval;
|
||||
|
@ -406,12 +406,12 @@ getdns_list_set_list(struct getdns_list * list, size_t index,
|
|||
if (index > list->numinuse)
|
||||
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
retval = getdns_list_copy(child_list, &newlist);
|
||||
retval = _getdns_list_copy(child_list, &newlist);
|
||||
if (retval != GETDNS_RETURN_GOOD)
|
||||
return retval;
|
||||
|
||||
if (index == list->numinuse) {
|
||||
retval = getdns_list_add_item(list, &index);
|
||||
retval = _getdns_list_add_item(list, &index);
|
||||
if (retval != GETDNS_RETURN_GOOD) {
|
||||
getdns_list_destroy(newlist);
|
||||
return retval;
|
||||
|
@ -438,14 +438,14 @@ getdns_list_set_bindata(struct getdns_list * list, size_t index,
|
|||
if (index > list->numinuse)
|
||||
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
newbindata = getdns_bindata_copy(&list->mf, child_bindata);
|
||||
newbindata = _getdns_bindata_copy(&list->mf, child_bindata);
|
||||
if (!newbindata)
|
||||
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
if (index == list->numinuse) {
|
||||
retval = getdns_list_add_item(list, &index);
|
||||
retval = _getdns_list_add_item(list, &index);
|
||||
if (retval != GETDNS_RETURN_GOOD) {
|
||||
getdns_bindata_destroy(&list->mf, newbindata);
|
||||
_getdns_bindata_destroy(&list->mf, newbindata);
|
||||
return retval;
|
||||
}
|
||||
} else
|
||||
|
@ -473,13 +473,13 @@ getdns_list_set_string(getdns_list *list, size_t index, const char *value)
|
|||
return GETDNS_RETURN_MEMORY_ERROR;
|
||||
|
||||
newbindata->size = strlen(value);
|
||||
if (!(newbindata->data = (void *)getdns_strdup(&list->mf, value))) {
|
||||
if (!(newbindata->data = (void *)_getdns_strdup(&list->mf, value))) {
|
||||
GETDNS_FREE(list->mf, newbindata);
|
||||
return GETDNS_RETURN_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
if (index == list->numinuse) {
|
||||
retval = getdns_list_add_item(list, &index);
|
||||
retval = _getdns_list_add_item(list, &index);
|
||||
if (retval != GETDNS_RETURN_GOOD) {
|
||||
GETDNS_FREE(list->mf, newbindata->data);
|
||||
GETDNS_FREE(list->mf, newbindata);
|
||||
|
@ -507,7 +507,7 @@ getdns_list_set_int(struct getdns_list * list, size_t index,
|
|||
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
if (index == list->numinuse) {
|
||||
retval = getdns_list_add_item(list, &index);
|
||||
retval = _getdns_list_add_item(list, &index);
|
||||
if (retval != GETDNS_RETURN_GOOD)
|
||||
return retval;
|
||||
} else
|
||||
|
@ -519,31 +519,31 @@ getdns_list_set_int(struct getdns_list * list, size_t index,
|
|||
} /* getdns_list_set_int */
|
||||
|
||||
getdns_return_t
|
||||
getdns_list_append_dict(getdns_list *list, const getdns_dict *child_dict)
|
||||
_getdns_list_append_dict(getdns_list *list, const getdns_dict *child_dict)
|
||||
{
|
||||
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
return getdns_list_set_dict(list, list->numinuse, child_dict);
|
||||
}
|
||||
getdns_return_t
|
||||
getdns_list_append_list(getdns_list *list, const getdns_list *child_list)
|
||||
_getdns_list_append_list(getdns_list *list, const getdns_list *child_list)
|
||||
{
|
||||
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
return getdns_list_set_list(list, list->numinuse, child_list);
|
||||
}
|
||||
getdns_return_t
|
||||
getdns_list_append_bindata(getdns_list *list, const getdns_bindata *child_bindata)
|
||||
_getdns_list_append_bindata(getdns_list *list, const getdns_bindata *child_bindata)
|
||||
{
|
||||
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
return getdns_list_set_bindata(list, list->numinuse, child_bindata);
|
||||
}
|
||||
getdns_return_t
|
||||
getdns_list_append_string(getdns_list *list, const char *value)
|
||||
_getdns_list_append_string(getdns_list *list, const char *value)
|
||||
{
|
||||
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
return getdns_list_set_string(list, list->numinuse, value);
|
||||
}
|
||||
getdns_return_t
|
||||
getdns_list_append_int(getdns_list *list, uint32_t child_int)
|
||||
_getdns_list_append_int(getdns_list *list, uint32_t child_int)
|
||||
{
|
||||
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
return getdns_list_set_int(list, list->numinuse, child_int);
|
||||
|
|
|
@ -57,7 +57,7 @@ apl_n_dict_set_value(getdns_dict *dict, uint8_t *rdf)
|
|||
static getdns_return_t
|
||||
apl_n_list_append_value(getdns_list *list, uint8_t *rdf)
|
||||
{
|
||||
return getdns_list_append_int(list, (*rdf >> 7));
|
||||
return _getdns_list_append_int(list, (*rdf >> 7));
|
||||
}
|
||||
static _getdns_rdf_special apl_n = {
|
||||
apl_n_rdf_end, apl_n_dict_set_value, apl_n_list_append_value
|
||||
|
@ -79,7 +79,7 @@ static getdns_return_t
|
|||
apl_afdpart_list_append_value(getdns_list *list, uint8_t *rdf)
|
||||
{
|
||||
getdns_bindata bindata = { (rdf[-1] & 0x7F), rdf };
|
||||
return getdns_list_append_bindata(list, &bindata);
|
||||
return _getdns_list_append_bindata(list, &bindata);
|
||||
}
|
||||
static _getdns_rdf_special apl_afdpart = {
|
||||
apl_afdpart_rdf_end,
|
||||
|
@ -165,7 +165,7 @@ ipseckey_gateway_list_append_value(getdns_list *list, uint8_t *rdf)
|
|||
else if (! bindata.size)
|
||||
return GETDNS_RETURN_GOOD;
|
||||
else
|
||||
return getdns_list_append_bindata(list, &bindata);
|
||||
return _getdns_list_append_bindata(list, &bindata);
|
||||
}
|
||||
static _getdns_rdf_special ipseckey_gateway = {
|
||||
ipseckey_gateway_rdf_end,
|
||||
|
@ -187,7 +187,7 @@ hip_pk_algorithm_dict_set_value(getdns_dict *dict, uint8_t *rdf)
|
|||
static getdns_return_t
|
||||
hip_pk_algorithm_list_append_value(getdns_list *list, uint8_t *rdf)
|
||||
{
|
||||
return getdns_list_append_int(list, rdf[1]);
|
||||
return _getdns_list_append_int(list, rdf[1]);
|
||||
}
|
||||
static _getdns_rdf_special hip_pk_algorithm = {
|
||||
hip_pk_algorithm_rdf_end,
|
||||
|
@ -211,7 +211,7 @@ static getdns_return_t
|
|||
hip_hit_list_append_value(getdns_list *list, uint8_t *rdf)
|
||||
{
|
||||
getdns_bindata bindata = { rdf[-1], rdf + 3 };
|
||||
return getdns_list_append_bindata(list, &bindata);
|
||||
return _getdns_list_append_bindata(list, &bindata);
|
||||
}
|
||||
static _getdns_rdf_special hip_hit = {
|
||||
hip_hit_rdf_end, hip_hit_dict_set_value, hip_hit_list_append_value
|
||||
|
@ -234,7 +234,7 @@ static getdns_return_t
|
|||
hip_public_key_list_append_value(getdns_list *list, uint8_t *rdf)
|
||||
{
|
||||
getdns_bindata bindata = { gldns_read_uint16(rdf), rdf + 2 + rdf[-2] };
|
||||
return getdns_list_append_bindata(list, &bindata);
|
||||
return _getdns_list_append_bindata(list, &bindata);
|
||||
}
|
||||
static _getdns_rdf_special hip_public_key = {
|
||||
hip_public_key_rdf_end,
|
||||
|
|
|
@ -532,7 +532,7 @@ stub_timeout_cb(void *userarg)
|
|||
stub_cleanup(netreq);
|
||||
if (netreq->fd >= 0) close(netreq->fd);
|
||||
if (netreq->owner->user_callback)
|
||||
(void) getdns_context_request_timed_out(netreq->owner);
|
||||
(void) _getdns_context_request_timed_out(netreq->owner);
|
||||
else {
|
||||
netreq->state = NET_REQ_FINISHED;
|
||||
_getdns_check_dns_req_complete(netreq->owner);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#define GETDNS_LIST_BLOCKSZ 10
|
||||
|
||||
|
||||
/* TODO: might want a separate unit test for getdns_list_copy() - right now the code gets
|
||||
/* TODO: might want a separate unit test for _getdns_list_copy() - right now the code gets
|
||||
covered as a result of other tests */
|
||||
|
||||
/*---------------------------------------- tst_bindatasetget */
|
||||
|
|
|
@ -321,12 +321,12 @@ _getdns_rr_iter2rr_dict(struct mem_funcs *mf, _getdns_rr_iter *i)
|
|||
|
||||
switch (val_type) {
|
||||
case t_int:
|
||||
if (getdns_list_append_int(repeat_list,
|
||||
if (_getdns_list_append_int(repeat_list,
|
||||
int_val))
|
||||
goto rdata_error;
|
||||
break;
|
||||
case t_bindata:
|
||||
if (getdns_list_append_bindata(repeat_list,
|
||||
if (_getdns_list_append_bindata(repeat_list,
|
||||
&bindata))
|
||||
goto rdata_error;
|
||||
break;
|
||||
|
@ -346,7 +346,7 @@ _getdns_rr_iter2rr_dict(struct mem_funcs *mf, _getdns_rr_iter *i)
|
|||
_getdns_list_create_with_mf(mf)))
|
||||
goto rdata_error;
|
||||
|
||||
if (getdns_list_append_dict(
|
||||
if (_getdns_list_append_dict(
|
||||
repeat_list, repeat_dict))
|
||||
goto rdata_error;
|
||||
|
||||
|
@ -381,7 +381,7 @@ _getdns_rr_iter2rr_dict(struct mem_funcs *mf, _getdns_rr_iter *i)
|
|||
if (!repeat_list && !(repeat_list =
|
||||
_getdns_list_create_with_mf(mf)))
|
||||
goto rdata_error;
|
||||
if (getdns_list_append_dict(repeat_list, repeat_dict))
|
||||
if (_getdns_list_append_dict(repeat_list, repeat_dict))
|
||||
goto rdata_error;
|
||||
getdns_dict_destroy(repeat_dict);
|
||||
repeat_dict = NULL;
|
||||
|
@ -552,7 +552,7 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req,
|
|||
|
||||
continue;
|
||||
}
|
||||
if (getdns_list_append_dict(sections[section], rr_dict))
|
||||
if (_getdns_list_append_dict(sections[section], rr_dict))
|
||||
goto error;
|
||||
|
||||
|
||||
|
@ -597,7 +597,7 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req,
|
|||
|
||||
getdns_dict_set_bindata(rr_dict,"address_data",&bindata) ||
|
||||
|
||||
(just_addrs && getdns_list_append_dict(just_addrs, rr_dict))) {
|
||||
(just_addrs && _getdns_list_append_dict(just_addrs, rr_dict))) {
|
||||
|
||||
goto error;
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ create_getdns_response(getdns_dns_req *completed_request)
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (getdns_list_append_dict(replies_tree, reply)) {
|
||||
if (_getdns_list_append_dict(replies_tree, reply)) {
|
||||
getdns_dict_destroy(reply);
|
||||
goto error;
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ create_getdns_response(getdns_dns_req *completed_request)
|
|||
/* buffer */
|
||||
full_data.data = netreq->response;
|
||||
full_data.size = netreq->response_len;
|
||||
if (getdns_list_append_bindata(replies_full, &full_data))
|
||||
if (_getdns_list_append_bindata(replies_full, &full_data))
|
||||
goto error;
|
||||
}
|
||||
if (getdns_dict_set_list(result, "replies_tree", replies_tree))
|
||||
|
@ -1123,7 +1123,7 @@ void _getdns_wire2list(uint8_t *pkt, size_t pkt_len, getdns_list *l)
|
|||
if (!(rr_dict = _getdns_rr_iter2rr_dict(&l->mf, rr)))
|
||||
continue;
|
||||
|
||||
(void)getdns_list_append_dict(l, rr_dict);
|
||||
(void)_getdns_list_append_dict(l, rr_dict);
|
||||
getdns_dict_destroy(rr_dict);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,17 +69,17 @@ getdns_return_t getdns_apply_network_result(getdns_network_req* netreq, struct u
|
|||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_GENERAL_ERROR if out of memory
|
||||
*/
|
||||
getdns_return_t getdns_list_add_item(struct getdns_list *list, size_t * index);
|
||||
getdns_return_t getdns_list_append_dict(getdns_list *list,
|
||||
getdns_return_t _getdns_list_add_item(struct getdns_list *list, size_t * index);
|
||||
getdns_return_t _getdns_list_append_dict(getdns_list *list,
|
||||
const getdns_dict *child_dict);
|
||||
getdns_return_t getdns_list_append_list(getdns_list *list,
|
||||
getdns_return_t _getdns_list_append_list(getdns_list *list,
|
||||
const getdns_list *child_list);
|
||||
getdns_return_t getdns_list_append_bindata(getdns_list *list,
|
||||
getdns_return_t _getdns_list_append_bindata(getdns_list *list,
|
||||
const getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_list_append_string(getdns_list *list,
|
||||
getdns_return_t _getdns_list_append_string(getdns_list *list,
|
||||
const char *value);
|
||||
|
||||
getdns_return_t getdns_list_append_int(getdns_list *list,
|
||||
getdns_return_t _getdns_list_append_int(getdns_list *list,
|
||||
uint32_t child_uint32);
|
||||
|
||||
/**
|
||||
|
@ -93,7 +93,7 @@ getdns_return_t getdns_list_append_int(getdns_list *list,
|
|||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if list is invalid
|
||||
* @return GETDNS_RETURN_GENERIC_ERROR if out of memory
|
||||
*/
|
||||
getdns_return_t getdns_list_copy(const struct getdns_list *srclist,
|
||||
getdns_return_t _getdns_list_copy(const struct getdns_list *srclist,
|
||||
struct getdns_list **dstlist);
|
||||
|
||||
/**
|
||||
|
@ -105,7 +105,7 @@ getdns_return_t getdns_list_copy(const struct getdns_list *srclist,
|
|||
* @return GETDNS_RETURN_GOOD on success
|
||||
*/
|
||||
getdns_return_t
|
||||
getdns_dict_copy(const struct getdns_dict *srcdict,
|
||||
_getdns_dict_copy(const struct getdns_dict *srcdict,
|
||||
struct getdns_dict **dstdict);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue