summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dnssec.c70
-rw-r--r--dnssec_sign.c4
-rw-r--r--dnssec_verify.c34
-rw-r--r--dnssec_zone.c38
-rw-r--r--keys.c2
-rw-r--r--ldns/dnssec.h58
-rw-r--r--ldns/dnssec_sign.h4
-rw-r--r--ldns/dnssec_verify.h14
-rw-r--r--ldns/dnssec_zone.h34
-rw-r--r--ldns/keys.h2
-rw-r--r--ldns/net.h.in4
-rw-r--r--ldns/packet.h10
-rw-r--r--ldns/radix.h12
-rw-r--r--ldns/rbtree.h4
-rw-r--r--ldns/resolver.h6
-rw-r--r--ldns/rr.h16
-rw-r--r--ldns/tsig.h18
-rw-r--r--ldns/update.h4
-rw-r--r--ldns/wire2host.h4
-rw-r--r--ldns/zone.h2
-rw-r--r--net.c4
-rw-r--r--packet.c18
-rw-r--r--radix.c12
-rw-r--r--rbtree.c6
-rw-r--r--resolver.c6
-rw-r--r--rr.c16
-rw-r--r--tsig.c32
-rw-r--r--update.c6
-rw-r--r--wire2host.c2
-rw-r--r--zone.c5
30 files changed, 223 insertions, 224 deletions
diff --git a/dnssec.c b/dnssec.c
index 2471e86a..c9fd74f3 100644
--- a/dnssec.c
+++ b/dnssec.c
@@ -81,7 +81,7 @@ ldns_dnssec_get_dnskey_for_rrsig(const ldns_rr *rrsig,
}
ldns_rdf *
-ldns_nsec_get_bitmap(ldns_rr *nsec) {
+ldns_nsec_get_bitmap(const ldns_rr *nsec) {
if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC) {
return ldns_rr_rdf(nsec, 1);
} else if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC3) {
@@ -94,9 +94,9 @@ ldns_nsec_get_bitmap(ldns_rr *nsec) {
/*return the owner name of the closest encloser for name from the list of rrs */
/* this is NOT the hash, but the original name! */
ldns_rdf *
-ldns_dnssec_nsec3_closest_encloser(ldns_rdf *qname,
+ldns_dnssec_nsec3_closest_encloser(const ldns_rdf *qname,
ATTR_UNUSED(ldns_rr_type qtype),
- ldns_rr_list *nsec3s)
+ const ldns_rr_list *nsec3s)
{
/* remember parameters, they must match */
uint8_t algorithm;
@@ -215,7 +215,7 @@ ldns_dnssec_pkt_has_rrsigs(const ldns_pkt *pkt)
ldns_rr_list *
ldns_dnssec_pkt_get_rrsigs_for_name_and_type(const ldns_pkt *pkt,
- ldns_rdf *name,
+ const ldns_rdf *name,
ldns_rr_type type)
{
uint16_t t_netorder;
@@ -298,7 +298,7 @@ ldns_calc_keytag(const ldns_rr *key)
return ac16;
}
-uint16_t ldns_calc_keytag_raw(uint8_t* key, size_t keysize)
+uint16_t ldns_calc_keytag_raw(const uint8_t* key, size_t keysize)
{
unsigned int i;
uint32_t ac32;
@@ -327,14 +327,14 @@ uint16_t ldns_calc_keytag_raw(uint8_t* key, size_t keysize)
#ifdef HAVE_SSL
DSA *
-ldns_key_buf2dsa(ldns_buffer *key)
+ldns_key_buf2dsa(const ldns_buffer *key)
{
- return ldns_key_buf2dsa_raw((unsigned char*)ldns_buffer_begin(key),
+ return ldns_key_buf2dsa_raw((const unsigned char*)ldns_buffer_begin(key),
ldns_buffer_position(key));
}
DSA *
-ldns_key_buf2dsa_raw(unsigned char* key, size_t len)
+ldns_key_buf2dsa_raw(const unsigned char* key, size_t len)
{
uint8_t T;
uint16_t length;
@@ -386,14 +386,14 @@ ldns_key_buf2dsa_raw(unsigned char* key, size_t len)
}
RSA *
-ldns_key_buf2rsa(ldns_buffer *key)
+ldns_key_buf2rsa(const ldns_buffer *key)
{
- return ldns_key_buf2rsa_raw((unsigned char*)ldns_buffer_begin(key),
+ return ldns_key_buf2rsa_raw((const unsigned char*)ldns_buffer_begin(key),
ldns_buffer_position(key));
}
RSA *
-ldns_key_buf2rsa_raw(unsigned char* key, size_t len)
+ldns_key_buf2rsa_raw(const unsigned char* key, size_t len)
{
uint16_t offset;
uint16_t exp;
@@ -452,7 +452,7 @@ ldns_key_buf2rsa_raw(unsigned char* key, size_t len)
}
int
-ldns_digest_evp(unsigned char* data, unsigned int len, unsigned char* dest,
+ldns_digest_evp(const unsigned char* data, unsigned int len, unsigned char* dest,
const EVP_MD* md)
{
EVP_MD_CTX* ctx;
@@ -764,10 +764,10 @@ ldns_dnssec_create_nsec_bitmap(ldns_rr_type rr_type_list[],
}
int
-ldns_dnssec_rrsets_contains_type(ldns_dnssec_rrsets *rrsets,
+ldns_dnssec_rrsets_contains_type(const ldns_dnssec_rrsets *rrsets,
ldns_rr_type type)
{
- ldns_dnssec_rrsets *cur_rrset = rrsets;
+ const ldns_dnssec_rrsets *cur_rrset = rrsets;
while (cur_rrset) {
if (cur_rrset->type == type) {
return 1;
@@ -778,8 +778,8 @@ ldns_dnssec_rrsets_contains_type(ldns_dnssec_rrsets *rrsets,
}
ldns_rr *
-ldns_dnssec_create_nsec(ldns_dnssec_name *from,
- ldns_dnssec_name *to,
+ldns_dnssec_create_nsec(const ldns_dnssec_name *from,
+ const ldns_dnssec_name *to,
ldns_rr_type nsec_type)
{
ldns_rr *nsec_rr;
@@ -832,14 +832,14 @@ ldns_dnssec_create_nsec(ldns_dnssec_name *from,
}
ldns_rr *
-ldns_dnssec_create_nsec3(ldns_dnssec_name *from,
- ldns_dnssec_name *to,
- ldns_rdf *zone_name,
+ldns_dnssec_create_nsec3(const ldns_dnssec_name *from,
+ const ldns_dnssec_name *to,
+ const ldns_rdf *zone_name,
uint8_t algorithm,
uint8_t flags,
uint16_t iterations,
uint8_t salt_length,
- uint8_t *salt)
+ const uint8_t *salt)
{
ldns_rr *nsec_rr;
ldns_rr_type types[65536];
@@ -971,11 +971,11 @@ ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_list *rrs)
}
ldns_rdf *
-ldns_nsec3_hash_name(ldns_rdf *name,
+ldns_nsec3_hash_name(const ldns_rdf *name,
uint8_t algorithm,
uint16_t iterations,
uint8_t salt_length,
- uint8_t *salt)
+ const uint8_t *salt)
{
size_t hashed_owner_str_len;
ldns_rdf *cann;
@@ -1075,7 +1075,7 @@ ldns_nsec3_add_param_rdfs(ldns_rr *rr,
uint8_t flags,
uint16_t iterations,
uint8_t salt_length,
- uint8_t *salt)
+ const uint8_t *salt)
{
ldns_rdf *salt_rdf = NULL;
uint8_t *salt_data = NULL;
@@ -1121,7 +1121,7 @@ ldns_nsec3_add_param_rdfs(ldns_rr *rr,
}
static int
-rr_list_delegation_only(ldns_rdf *origin, ldns_rr_list *rr_list)
+rr_list_delegation_only(const ldns_rdf *origin, const ldns_rr_list *rr_list)
{
size_t i;
ldns_rr *cur_rr;
@@ -1141,14 +1141,14 @@ rr_list_delegation_only(ldns_rdf *origin, ldns_rr_list *rr_list)
/* this will NOT return the NSEC3 completed, you will have to run the
finalize function on the rrlist later! */
ldns_rr *
-ldns_create_nsec3(ldns_rdf *cur_owner,
- ldns_rdf *cur_zone,
- ldns_rr_list *rrs,
+ldns_create_nsec3(const ldns_rdf *cur_owner,
+ const ldns_rdf *cur_zone,
+ const ldns_rr_list *rrs,
uint8_t algorithm,
uint8_t flags,
uint16_t iterations,
uint8_t salt_length,
- uint8_t *salt,
+ const uint8_t *salt,
bool emptynonterminal)
{
size_t i;
@@ -1329,7 +1329,7 @@ ldns_nsec3_bitmap(const ldns_rr *nsec3_rr)
}
ldns_rdf *
-ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name)
+ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, const ldns_rdf *name)
{
uint8_t algorithm;
uint16_t iterations;
@@ -1354,7 +1354,7 @@ ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name)
}
bool
-ldns_nsec_bitmap_covers_type(const ldns_rdf* bitmap, ldns_rr_type type)
+ldns_nsec_bitmap_covers_type(const ldns_rdf* bitmap, ldns_rr_type type)
{
uint8_t* dptr;
uint8_t* dend;
@@ -1520,8 +1520,8 @@ ldns_nsec_covers_name(const ldns_rr *nsec, const ldns_rdf *name)
/* sig may be null - if so look in the packet */
ldns_status
-ldns_pkt_verify_time(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o,
- ldns_rr_list *k, ldns_rr_list *s,
+ldns_pkt_verify_time(const ldns_pkt *p, ldns_rr_type t, const ldns_rdf *o,
+ const ldns_rr_list *k, const ldns_rr_list *s,
time_t check_time, ldns_rr_list *good_keys)
{
ldns_rr_list *rrset;
@@ -1542,7 +1542,7 @@ ldns_pkt_verify_time(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o,
if (s) {
/* if s is not NULL, the sigs are given to use */
- sigs = s;
+ sigs = (ldns_rr_list *)s;
} else {
/* otherwise get them from the packet */
sigs = ldns_pkt_rr_list_by_name_and_type(p, o,
@@ -1584,8 +1584,8 @@ ldns_pkt_verify_time(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o,
}
ldns_status
-ldns_pkt_verify(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o,
- ldns_rr_list *k, ldns_rr_list *s, ldns_rr_list *good_keys)
+ldns_pkt_verify(const ldns_pkt *p, ldns_rr_type t, const ldns_rdf *o,
+ const ldns_rr_list *k, const ldns_rr_list *s, ldns_rr_list *good_keys)
{
return ldns_pkt_verify_time(p, t, o, k, s, ldns_time(NULL), good_keys);
}
diff --git a/dnssec_sign.c b/dnssec_sign.c
index 137bba94..c9c6c7a8 100644
--- a/dnssec_sign.c
+++ b/dnssec_sign.c
@@ -20,8 +20,8 @@
#endif /* HAVE_SSL */
ldns_rr *
-ldns_create_empty_rrsig(ldns_rr_list *rrset,
- ldns_key *current_key)
+ldns_create_empty_rrsig(const ldns_rr_list *rrset,
+ const ldns_key *current_key)
{
uint32_t orig_ttl;
ldns_rr_class orig_class;
diff --git a/dnssec_verify.c b/dnssec_verify.c
index 1af6635b..a03435bb 100644
--- a/dnssec_verify.c
+++ b/dnssec_verify.c
@@ -1088,8 +1088,8 @@ ldns_dnssec_trust_tree_contains_keys(ldns_dnssec_trust_tree *tree,
ldns_status
ldns_verify_time(
- ldns_rr_list *rrset,
- ldns_rr_list *rrsig,
+ const ldns_rr_list *rrset,
+ const ldns_rr_list *rrsig,
const ldns_rr_list *keys,
time_t check_time,
ldns_rr_list *good_keys
@@ -1809,7 +1809,7 @@ ldns_dnssec_verify_denial_nsec3(ldns_rr *rr,
#ifdef USE_GOST
EVP_PKEY*
-ldns_gost2pkey_raw(unsigned char* key, size_t keylen)
+ldns_gost2pkey_raw(const unsigned char* key, size_t keylen)
{
/* prefix header for X509 encoding */
uint8_t asn[37] = { 0x30, 0x63, 0x30, 0x1c, 0x06, 0x06, 0x2a, 0x85,
@@ -1832,8 +1832,8 @@ ldns_gost2pkey_raw(unsigned char* key, size_t keylen)
}
static ldns_status
-ldns_verify_rrsig_gost_raw(unsigned char* sig, size_t siglen,
- ldns_buffer* rrset, unsigned char* key, size_t keylen)
+ldns_verify_rrsig_gost_raw(const unsigned char* sig, size_t siglen,
+ const ldns_buffer* rrset, const unsigned char* key, size_t keylen)
{
EVP_PKEY *evp_key;
ldns_status result;
@@ -1856,7 +1856,7 @@ ldns_verify_rrsig_gost_raw(unsigned char* sig, size_t siglen,
#ifdef USE_ECDSA
EVP_PKEY*
-ldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo)
+ldns_ecdsa2pkey_raw(const unsigned char* key, size_t keylen, uint8_t algo)
{
unsigned char buf[256+2]; /* sufficient for 2*384/8+1 */
const unsigned char* pp = buf;
@@ -2002,7 +2002,7 @@ ldns_verify_rrsig_buffers_raw(unsigned char* sig, size_t siglen,
* @param sig: signature to take TTL and wildcard values from
*/
static void
-ldns_rrset_use_signature_ttl(ldns_rr_list* rrset_clone, ldns_rr* rrsig)
+ldns_rrset_use_signature_ttl(ldns_rr_list* rrset_clone, const ldns_rr* rrsig)
{
uint32_t orig_ttl;
uint16_t i;
@@ -2051,7 +2051,7 @@ ldns_rrset_use_signature_ttl(ldns_rr_list* rrset_clone, ldns_rr* rrsig)
* @return OK or more specific error.
*/
static ldns_status
-ldns_rrsig2rawsig_buffer(ldns_buffer* rawsig_buf, ldns_rr* rrsig)
+ldns_rrsig2rawsig_buffer(ldns_buffer* rawsig_buf, const ldns_rr* rrsig)
{
uint8_t sig_algo;
@@ -2136,7 +2136,7 @@ ldns_rrsig2rawsig_buffer(ldns_buffer* rawsig_buf, ldns_rr* rrsig)
* @return status code LDNS_STATUS_OK if all is fine.
*/
static ldns_status
-ldns_rrsig_check_timestamps(ldns_rr* rrsig, time_t now)
+ldns_rrsig_check_timestamps(const ldns_rr* rrsig, time_t now)
{
int32_t inception, expiration;
@@ -2171,7 +2171,7 @@ ldns_rrsig_check_timestamps(ldns_rr* rrsig, time_t now)
*/
static ldns_status
ldns_prepare_for_verify(ldns_buffer* rawsig_buf, ldns_buffer* verify_buf,
- ldns_rr_list* rrset_clone, ldns_rr* rrsig)
+ ldns_rr_list* rrset_clone, const ldns_rr* rrsig)
{
ldns_status result;
@@ -2218,7 +2218,7 @@ ldns_prepare_for_verify(ldns_buffer* rawsig_buf, ldns_buffer* verify_buf,
*/
static ldns_status
ldns_verify_test_sig_key(ldns_buffer* rawsig_buf, ldns_buffer* verify_buf,
- ldns_rr* rrsig, ldns_rr* key)
+ const ldns_rr* rrsig, ldns_rr* key)
{
uint8_t sig_algo;
@@ -2285,8 +2285,8 @@ ldns_verify_test_sig_key(ldns_buffer* rawsig_buf, ldns_buffer* verify_buf,
*/
ldns_status
ldns_verify_rrsig_keylist_time(
- ldns_rr_list *rrset,
- ldns_rr *rrsig,
+ const ldns_rr_list *rrset,
+ const ldns_rr *rrsig,
const ldns_rr_list *keys,
time_t check_time,
ldns_rr_list *good_keys)
@@ -2334,8 +2334,8 @@ ldns_verify_rrsig_keylist(ldns_rr_list *rrset,
}
ldns_status
-ldns_verify_rrsig_keylist_notime(ldns_rr_list *rrset,
- ldns_rr *rrsig,
+ldns_verify_rrsig_keylist_notime(const ldns_rr_list *rrset,
+ const ldns_rr *rrsig,
const ldns_rr_list *keys,
ldns_rr_list *good_keys)
{
@@ -2482,8 +2482,8 @@ ldns_verify_rrsig_evp(ldns_buffer *sig,
}
ldns_status
-ldns_verify_rrsig_evp_raw(unsigned char *sig, size_t siglen,
- ldns_buffer *rrset, EVP_PKEY *key, const EVP_MD *digest_type)
+ldns_verify_rrsig_evp_raw(const unsigned char *sig, size_t siglen,
+ const ldns_buffer *rrset, EVP_PKEY *key, const EVP_MD *digest_type)
{
EVP_MD_CTX ctx;
int res;
diff --git a/dnssec_zone.c b/dnssec_zone.c
index 88912591..f610a3cf 100644
--- a/dnssec_zone.c
+++ b/dnssec_zone.c
@@ -78,7 +78,7 @@ ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr)
void
ldns_dnssec_rrs_print_fmt(FILE *out, const ldns_output_format *fmt,
- ldns_dnssec_rrs *rrs)
+ const ldns_dnssec_rrs *rrs)
{
if (!rrs) {
if ((fmt->flags & LDNS_COMMENT_LAYOUT))
@@ -94,7 +94,7 @@ ldns_dnssec_rrs_print_fmt(FILE *out, const ldns_output_format *fmt,
}
void
-ldns_dnssec_rrs_print(FILE *out, ldns_dnssec_rrs *rrs)
+ldns_dnssec_rrs_print(FILE *out, const ldns_dnssec_rrs *rrs)
{
ldns_dnssec_rrs_print_fmt(out, ldns_output_format_default, rrs);
}
@@ -143,7 +143,7 @@ ldns_dnssec_rrsets_deep_free(ldns_dnssec_rrsets *rrsets)
}
ldns_rr_type
-ldns_dnssec_rrsets_type(ldns_dnssec_rrsets *rrsets)
+ldns_dnssec_rrsets_type(const ldns_dnssec_rrsets *rrsets)
{
if (rrsets) {
return rrsets->type;
@@ -271,7 +271,7 @@ ldns_dnssec_rrsets_add_rr(ldns_dnssec_rrsets *rrsets, ldns_rr *rr)
static void
ldns_dnssec_rrsets_print_soa_fmt(FILE *out, const ldns_output_format *fmt,
- ldns_dnssec_rrsets *rrsets,
+ const ldns_dnssec_rrsets *rrsets,
bool follow,
bool show_soa)
{
@@ -300,14 +300,14 @@ ldns_dnssec_rrsets_print_soa_fmt(FILE *out, const ldns_output_format *fmt,
void
ldns_dnssec_rrsets_print_fmt(FILE *out, const ldns_output_format *fmt,
- ldns_dnssec_rrsets *rrsets,
+ const ldns_dnssec_rrsets *rrsets,
bool follow)
{
ldns_dnssec_rrsets_print_soa_fmt(out, fmt, rrsets, follow, true);
}
void
-ldns_dnssec_rrsets_print(FILE *out, ldns_dnssec_rrsets *rrsets, bool follow)
+ldns_dnssec_rrsets_print(FILE *out, const ldns_dnssec_rrsets *rrsets, bool follow)
{
ldns_dnssec_rrsets_print_fmt(out, ldns_output_format_default,
rrsets, follow);
@@ -391,7 +391,7 @@ ldns_dnssec_name_deep_free(ldns_dnssec_name *name)
}
ldns_rdf *
-ldns_dnssec_name_name(ldns_dnssec_name *name)
+ldns_dnssec_name_name(const ldns_dnssec_name *name)
{
if (name) {
return name->name;
@@ -400,7 +400,7 @@ ldns_dnssec_name_name(ldns_dnssec_name *name)
}
bool
-ldns_dnssec_name_is_glue(ldns_dnssec_name *name)
+ldns_dnssec_name_is_glue(const ldns_dnssec_name *name)
{
if (name) {
return name->is_glue;
@@ -489,7 +489,7 @@ ldns_dnssec_name_add_rr(ldns_dnssec_name *name,
}
ldns_dnssec_rrsets *
-ldns_dnssec_name_find_rrset(ldns_dnssec_name *name,
+ldns_dnssec_name_find_rrset(const ldns_dnssec_name *name,
ldns_rr_type type) {
ldns_dnssec_rrsets *result;
@@ -505,8 +505,8 @@ ldns_dnssec_name_find_rrset(ldns_dnssec_name *name,
}
ldns_dnssec_rrsets *
-ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone,
- ldns_rdf *dname,
+ldns_dnssec_zone_find_rrset(const ldns_dnssec_zone *zone,
+ const ldns_rdf *dname,
ldns_rr_type type)
{
ldns_rbnode_t *node;
@@ -526,7 +526,7 @@ ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone,
static void
ldns_dnssec_name_print_soa_fmt(FILE *out, const ldns_output_format *fmt,
- ldns_dnssec_name *name,
+ const ldns_dnssec_name *name,
bool show_soa)
{
if (name) {
@@ -553,13 +553,13 @@ ldns_dnssec_name_print_soa_fmt(FILE *out, const ldns_output_format *fmt,
void
ldns_dnssec_name_print_fmt(FILE *out, const ldns_output_format *fmt,
- ldns_dnssec_name *name)
+ const ldns_dnssec_name *name)
{
ldns_dnssec_name_print_soa_fmt(out, fmt, name, true);
}
void
-ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name)
+ldns_dnssec_name_print(FILE *out, const ldns_dnssec_name *name)
{
ldns_dnssec_name_print_fmt(out, ldns_output_format_default, name);
}
@@ -979,7 +979,7 @@ ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, ldns_rr *rr)
void
ldns_dnssec_zone_names_print_fmt(FILE *out, const ldns_output_format *fmt,
- ldns_rbtree_t *tree,
+ const ldns_rbtree_t *tree,
bool print_soa)
{
ldns_rbnode_t *node;
@@ -996,7 +996,7 @@ ldns_dnssec_zone_names_print_fmt(FILE *out, const ldns_output_format *fmt,
}
void
-ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa)
+ldns_dnssec_zone_names_print(FILE *out, const ldns_rbtree_t *tree, bool print_soa)
{
ldns_dnssec_zone_names_print_fmt(out, ldns_output_format_default,
tree, print_soa);
@@ -1004,7 +1004,7 @@ ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa)
void
ldns_dnssec_zone_print_fmt(FILE *out, const ldns_output_format *fmt,
- ldns_dnssec_zone *zone)
+ const ldns_dnssec_zone *zone)
{
if (zone) {
if (zone->soa) {
@@ -1031,7 +1031,7 @@ ldns_dnssec_zone_print_fmt(FILE *out, const ldns_output_format *fmt,
}
void
-ldns_dnssec_zone_print(FILE *out, ldns_dnssec_zone *zone)
+ldns_dnssec_zone_print(FILE *out, const ldns_dnssec_zone *zone)
{
ldns_dnssec_zone_print_fmt(out, ldns_output_format_default, zone);
}
@@ -1171,7 +1171,7 @@ ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone)
}
bool
-ldns_dnssec_zone_is_nsec3_optout(ldns_dnssec_zone* zone)
+ldns_dnssec_zone_is_nsec3_optout(const ldns_dnssec_zone* zone)
{
ldns_rr* nsec3;
ldns_rbnode_t* node;
diff --git a/keys.c b/keys.c
index 8b438210..2af69a3c 100644
--- a/keys.c
+++ b/keys.c
@@ -1654,7 +1654,7 @@ ldns_read_anchor_file(const char *filename)
}
char *
-ldns_key_get_file_base_name(ldns_key *key)
+ldns_key_get_file_base_name(const ldns_key *key)
{
ldns_buffer *buffer;
char *file_base_name;
diff --git a/ldns/dnssec.h b/ldns/dnssec.h
index 18b1a3e9..c6a744cf 100644
--- a/ldns/dnssec.h
+++ b/ldns/dnssec.h
@@ -81,7 +81,7 @@ ldns_rr *ldns_dnssec_get_dnskey_for_rrsig(const ldns_rr *rrsig, const ldns_rr_li
* \param[in] nsec The nsec to get the covered type bitmap of
* \return An ldns_rdf containing the bitmap, or NULL on error
*/
-ldns_rdf *ldns_nsec_get_bitmap(ldns_rr *nsec);
+ldns_rdf *ldns_nsec_get_bitmap(const ldns_rr *nsec);
#define LDNS_NSEC3_MAX_ITERATIONS 65535
@@ -90,9 +90,9 @@ ldns_rdf *ldns_nsec_get_bitmap(ldns_rr *nsec);
* Returns the dname of the closest (provable) encloser
*/
ldns_rdf *
-ldns_dnssec_nsec3_closest_encloser(ldns_rdf *qname,
+ldns_dnssec_nsec3_closest_encloser(const ldns_rdf *qname,
ldns_rr_type qtype,
- ldns_rr_list *nsec3s);
+ const ldns_rr_list *nsec3s);
/**
* Checks whether the packet contains rrsigs
@@ -104,7 +104,7 @@ ldns_dnssec_pkt_has_rrsigs(const ldns_pkt *pkt);
* Returns a ldns_rr_list containing the signatures covering the given name
* and type
*/
-ldns_rr_list *ldns_dnssec_pkt_get_rrsigs_for_name_and_type(const ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type);
+ldns_rr_list *ldns_dnssec_pkt_get_rrsigs_for_name_and_type(const ldns_pkt *pkt, const ldns_rdf *name, ldns_rr_type type);
/**
* Returns a ldns_rr_list containing the signatures covering the given type
@@ -125,7 +125,7 @@ uint16_t ldns_calc_keytag(const ldns_rr *key);
* \param[in] keysize length of key data.
* \return the keytag
*/
-uint16_t ldns_calc_keytag_raw(uint8_t* key, size_t keysize);
+uint16_t ldns_calc_keytag_raw(const uint8_t* key, size_t keysize);
#if LDNS_BUILD_CONFIG_HAVE_SSL
/**
@@ -134,14 +134,14 @@ uint16_t ldns_calc_keytag_raw(uint8_t* key, size_t keysize);
* \param[in] key the key to convert
* \return a DSA * structure with the key material
*/
-DSA *ldns_key_buf2dsa(ldns_buffer *key);
+DSA *ldns_key_buf2dsa(const ldns_buffer *key);
/**
* Like ldns_key_buf2dsa, but uses raw buffer.
* \param[in] key the uncompressed wireformat of the key.
* \param[in] len length of key data
* \return a DSA * structure with the key material
*/
-DSA *ldns_key_buf2dsa_raw(unsigned char* key, size_t len);
+DSA *ldns_key_buf2dsa_raw(const unsigned char* key, size_t len);
/**
* Utility function to calculate hash using generic EVP_MD pointer.
@@ -151,7 +151,7 @@ DSA *ldns_key_buf2dsa_raw(unsigned char* key, size_t len);
* \param[in] md the message digest to use.
* \return true if worked, false on failure.
*/
-int ldns_digest_evp(unsigned char* data, unsigned int len,
+int ldns_digest_evp(const unsigned char* data, unsigned int len,
unsigned char* dest, const EVP_MD* md);
/**
@@ -161,7 +161,7 @@ int ldns_digest_evp(unsigned char* data, unsigned int len,
* \param[in] keylen length of the key data
* \return the key or NULL on error.
*/
-EVP_PKEY* ldns_gost2pkey_raw(unsigned char* key, size_t keylen);
+EVP_PKEY* ldns_gost2pkey_raw(const unsigned char* key, size_t keylen);
/**
* Converts a holding buffer with key material to EVP PKEY in openssl.
@@ -171,7 +171,7 @@ EVP_PKEY* ldns_gost2pkey_raw(unsigned char* key, size_t keylen);
* \param[in] algo precise algorithm to initialize ECC group values.
* \return the key or NULL on error.
*/
-EVP_PKEY* ldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo);
+EVP_PKEY* ldns_ecdsa2pkey_raw(const unsigned char* key, size_t keylen, uint8_t algo);
#endif /* LDNS_BUILD_CONFIG_HAVE_SSL */
@@ -182,7 +182,7 @@ EVP_PKEY* ldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo);
* \param[in] key the key to convert
* \return a RSA * structure with the key material
*/
-RSA *ldns_key_buf2rsa(ldns_buffer *key);
+RSA *ldns_key_buf2rsa(const ldns_buffer *key);
/**
* Like ldns_key_buf2rsa, but uses raw buffer.
@@ -190,7 +190,7 @@ RSA *ldns_key_buf2rsa(ldns_buffer *key);
* \param[in] len length of key data
* \return a RSA * structure with the key material
*/
-RSA *ldns_key_buf2rsa_raw(unsigned char* key, size_t len);
+RSA *ldns_key_buf2rsa_raw(const unsigned char* key, size_t len);
#endif /* LDNS_BUILD_CONFIG_HAVE_SSL */
/**
@@ -219,14 +219,14 @@ ldns_dnssec_create_nsec_bitmap(ldns_rr_type rr_type_list[],
* \return int 1 if the type was found, 0 otherwise.
*/
int
-ldns_dnssec_rrsets_contains_type (ldns_dnssec_rrsets *rrsets, ldns_rr_type type);
+ldns_dnssec_rrsets_contains_type(const ldns_dnssec_rrsets *rrsets, ldns_rr_type type);
/**
* Creates NSEC
*/
ldns_rr *
-ldns_dnssec_create_nsec(ldns_dnssec_name *from,
- ldns_dnssec_name *to,
+ldns_dnssec_create_nsec(const ldns_dnssec_name *from,
+ const ldns_dnssec_name *to,
ldns_rr_type nsec_type);
@@ -234,14 +234,14 @@ ldns_dnssec_create_nsec(ldns_dnssec_name *from,
* Creates NSEC3
*/
ldns_rr *
-ldns_dnssec_create_nsec3(ldns_dnssec_name *from,
- ldns_dnssec_name *to,
- ldns_rdf *zone_name,
+ldns_dnssec_create_nsec3(const ldns_dnssec_name *from,
+ const ldns_dnssec_name *to,
+ const ldns_rdf *zone_name,
uint8_t algorithm,
uint8_t flags,
uint16_t iterations,
uint8_t salt_length,
- uint8_t *salt);
+ const uint8_t *salt);
/**
* Create a NSEC record
@@ -261,7 +261,7 @@ ldns_rr * ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_li
* \param[in] salt The salt to use
* \return The hashed owner name rdf, without the domain name
*/
-ldns_rdf *ldns_nsec3_hash_name(ldns_rdf *name, uint8_t algorithm, uint16_t iterations, uint8_t salt_length, uint8_t *salt);
+ldns_rdf *ldns_nsec3_hash_name(const ldns_rdf *name, uint8_t algorithm, uint16_t iterations, uint8_t salt_length, const uint8_t *salt);
/**
* Sets all the NSEC3 options. The rr to set them in must be initialized with _new() and
@@ -278,19 +278,19 @@ void ldns_nsec3_add_param_rdfs(ldns_rr *rr,
uint8_t flags,
uint16_t iterations,
uint8_t salt_length,
- uint8_t *salt);
+ const uint8_t *salt);
/* this will NOT return the NSEC3 completed, you will have to run the
finalize function on the rrlist later! */
ldns_rr *
-ldns_create_nsec3(ldns_rdf *cur_owner,
- ldns_rdf *cur_zone,
- ldns_rr_list *rrs,
+ldns_create_nsec3(const ldns_rdf *cur_owner,
+ const ldns_rdf *cur_zone,
+ const ldns_rr_list *rrs,
uint8_t algorithm,
uint8_t flags,
uint16_t iterations,
uint8_t salt_length,
- uint8_t *salt,
+ const uint8_t *salt,
bool emptynonterminal);
/**
@@ -361,7 +361,7 @@ ldns_rdf *ldns_nsec3_bitmap(const ldns_rr *nsec3_rr);
* \param[in] *name The owner name to calculate the hash for
* \return The hashed owner name rdf, without the domain name
*/
-ldns_rdf *ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name);
+ldns_rdf *ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, const ldns_rdf *name);
/**
* Check if RR type t is enumerated and set in the RR type bitmap rdf.
@@ -369,7 +369,7 @@ ldns_rdf *ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name);
* \param[in] type the type to check for
* \return true when t is found and set, otherwise return false
*/
-bool ldns_nsec_bitmap_covers_type(const ldns_rdf* bitmap, ldns_rr_type type);
+bool ldns_nsec_bitmap_covers_type(const const ldns_rdf* bitmap, ldns_rr_type type);
/**
* Checks if RR type t is enumerated in the type bitmap rdf and sets the bit.
@@ -413,7 +413,7 @@ bool ldns_nsec_covers_name(const ldns_rr *nsec, const ldns_rdf *name);
* \return status
*
*/
-ldns_status ldns_pkt_verify(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o, ldns_rr_list *k, ldns_rr_list *s, ldns_rr_list *good_keys);
+ldns_status ldns_pkt_verify(const ldns_pkt *p, ldns_rr_type t, const ldns_rdf *o, const ldns_rr_list *k, const ldns_rr_list *s, ldns_rr_list *good_keys);
/**
* verify a packet
@@ -427,7 +427,7 @@ ldns_status ldns_pkt_verify(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o, ldns_rr_li
* \return status
*
*/
-ldns_status ldns_pkt_verify_time(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o, ldns_rr_list *k, ldns_rr_list *s, time_t check_time, ldns_rr_list *good_keys);
+ldns_status ldns_pkt_verify_time(const ldns_pkt *p, ldns_rr_type t, const ldns_rdf *o, const ldns_rr_list *k, const ldns_rr_list *s, time_t check_time, ldns_rr_list *good_keys);
#endif
diff --git a/ldns/dnssec_sign.h b/ldns/dnssec_sign.h
index 8a9ee895..a88a46af 100644
--- a/ldns/dnssec_sign.h
+++ b/ldns/dnssec_sign.h
@@ -22,8 +22,8 @@ extern "C" {
* \return signature rr
*/
ldns_rr *
-ldns_create_empty_rrsig(ldns_rr_list *rrset,
- ldns_key *key);
+ldns_create_empty_rrsig(const ldns_rr_list *rrset,
+ const ldns_key *key);
/**
* Sign the buffer which contains the wiredata of an rrset, and the
diff --git a/ldns/dnssec_verify.h b/ldns/dnssec_verify.h
index e8b1a910..26e3272b 100644
--- a/ldns/dnssec_verify.h
+++ b/ldns/dnssec_verify.h
@@ -387,8 +387,8 @@ ldns_status ldns_verify(ldns_rr_list *rrset,
* are added to it
* \return status LDNS_STATUS_OK if there is at least one correct key
*/
-ldns_status ldns_verify_time(ldns_rr_list *rrset,
- ldns_rr_list *rrsig,
+ldns_status ldns_verify_time(const ldns_rr_list *rrset,
+ const ldns_rr_list *rrsig,
const ldns_rr_list *keys,
time_t check_time,
ldns_rr_list *good_keys);
@@ -666,7 +666,7 @@ ldns_status ldns_verify_rrsig_keylist(ldns_rr_list *rrset,
* status LDNS_STATUS_OK if at least one key matched. Else an error.
*/
ldns_status ldns_verify_rrsig_keylist_time(
- ldns_rr_list *rrset, ldns_rr *rrsig,
+ const ldns_rr_list *rrset, const ldns_rr *rrsig,
const ldns_rr_list *keys, time_t check_time,
ldns_rr_list *good_keys);
@@ -682,8 +682,8 @@ ldns_status ldns_verify_rrsig_keylist_time(
* \return a list of keys which validate the rrsig + rrset. Returns
* status LDNS_STATUS_OK if at least one key matched. Else an error.
*/
-ldns_status ldns_verify_rrsig_keylist_notime(ldns_rr_list *rrset,
- ldns_rr *rrsig,
+ldns_status ldns_verify_rrsig_keylist_notime(const ldns_rr_list *rrset,
+ const ldns_rr *rrsig,
const ldns_rr_list *keys,
ldns_rr_list *good_keys);
@@ -735,9 +735,9 @@ ldns_status ldns_verify_rrsig_evp(ldns_buffer *sig,
* \param[in] key the EVP key structure
* \param[in] digest_type The digest type of the signature
*/
-ldns_status ldns_verify_rrsig_evp_raw(unsigned char *sig,
+ldns_status ldns_verify_rrsig_evp_raw(const unsigned char *sig,
size_t siglen,
- ldns_buffer *rrset,
+ const ldns_buffer *rrset,
EVP_PKEY *key,
const EVP_MD *digest_type);
#endif
diff --git a/ldns/dnssec_zone.h b/ldns/dnssec_zone.h
index 8ff48d67..e97ea30c 100644
--- a/ldns/dnssec_zone.h
+++ b/ldns/dnssec_zone.h
@@ -141,7 +141,7 @@ ldns_status ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr);
* \param[in] out the file descriptor to print to
* \param[in] rrs the list of RRs to print
*/
-void ldns_dnssec_rrs_print(FILE *out, ldns_dnssec_rrs *rrs);
+void ldns_dnssec_rrs_print(FILE *out, const ldns_dnssec_rrs *rrs);
/**
* Prints the given rrs to the file descriptor
@@ -151,7 +151,7 @@ void ldns_dnssec_rrs_print(FILE *out, ldns_dnssec_rrs *rrs);
* \param[in] rrs the list of RRs to print
*/
void ldns_dnssec_rrs_print_fmt(FILE *out,
- const ldns_output_format *fmt, ldns_dnssec_rrs *rrs);
+ const ldns_output_format *fmt, const ldns_dnssec_rrs *rrs);
/**
* Creates a new list (entry) of RRsets
@@ -181,7 +181,7 @@ void ldns_dnssec_rrsets_deep_free(ldns_dnssec_rrsets *rrsets);
* \param[in] rrsets the rrset to get the type of
* \return the rr type
*/
-ldns_rr_type ldns_dnssec_rrsets_type(ldns_dnssec_rrsets *rrsets);
+ldns_rr_type ldns_dnssec_rrsets_type(const ldns_dnssec_rrsets *rrsets);
/**
* Sets the RR type of the rrset (that is head of the given list)
@@ -211,7 +211,7 @@ ldns_status ldns_dnssec_rrsets_add_rr(ldns_dnssec_rrsets *rrsets, ldns_rr *rr);
* \param[in] follow if set to false, only print the first RRset
*/
void ldns_dnssec_rrsets_print(FILE *out,
- ldns_dnssec_rrsets *rrsets,
+ const ldns_dnssec_rrsets *rrsets,
bool follow);
/**
@@ -224,7 +224,7 @@ void ldns_dnssec_rrsets_print(FILE *out,
*/
void ldns_dnssec_rrsets_print_fmt(FILE *out,
const ldns_output_format *fmt,
- ldns_dnssec_rrsets *rrsets,
+ const ldns_dnssec_rrsets *rrsets,
bool follow);
@@ -263,7 +263,7 @@ void ldns_dnssec_name_deep_free(ldns_dnssec_name *name);
* \param[in] name the dnssec name to get the domain name from
* \return the domain name
*/
-ldns_rdf *ldns_dnssec_name_name(ldns_dnssec_name *name);
+ldns_rdf *ldns_dnssec_name_name(const ldns_dnssec_name *name);
/**
@@ -285,7 +285,7 @@ void ldns_dnssec_name_set_name(ldns_dnssec_name *name,
* \param[in] name the dnssec name to get the domain name from
* \return true if the structure is marked as glue, false otherwise.
*/
-bool ldns_dnssec_name_is_glue(ldns_dnssec_name *name);
+bool ldns_dnssec_name_is_glue(const ldns_dnssec_name *name);
/**
* Sets the NSEC(3) RR of the given dnssec_name structure
@@ -325,7 +325,7 @@ ldns_status ldns_dnssec_name_add_rr(ldns_dnssec_name *name,
* \param[in] type the type of the RRset to find
* \return the RRset, or NULL if not present
*/
-ldns_dnssec_rrsets *ldns_dnssec_name_find_rrset(ldns_dnssec_name *name,
+ldns_dnssec_rrsets *ldns_dnssec_name_find_rrset(const ldns_dnssec_name *name,
ldns_rr_type type);
/**
@@ -336,8 +336,8 @@ ldns_dnssec_rrsets *ldns_dnssec_name_find_rrset(ldns_dnssec_name *name,
* \param[in] type the type of the RRset to find
* \return the RRset, or NULL if not present
*/
-ldns_dnssec_rrsets *ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone,
- ldns_rdf *dname,
+ldns_dnssec_rrsets *ldns_dnssec_zone_find_rrset(const ldns_dnssec_zone *zone,
+ const ldns_rdf *dname,
ldns_rr_type type);
/**
@@ -347,7 +347,7 @@ ldns_dnssec_rrsets *ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone,
* \param[in] out the file descriptor to print to
* \param[in] name the name structure to print the contents of
*/
-void ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name);
+void ldns_dnssec_name_print(FILE *out, const ldns_dnssec_name *name);
/**
* Prints the RRs in the dnssec name structure to the given
@@ -358,7 +358,7 @@ void ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name);
* \param[in] name the name structure to print the contents of
*/
void ldns_dnssec_name_print_fmt(FILE *out,
- const ldns_output_format *fmt, ldns_dnssec_name *name);
+ const ldns_output_format *fmt, const ldns_dnssec_name *name);
/**
* Creates a new dnssec_zone structure
@@ -427,7 +427,7 @@ ldns_status ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone,
* \param[in] tree the tree of ldns_dnssec_name structures to print
* \param[in] print_soa if true, print SOA records, if false, skip them
*/
-void ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa);
+void ldns_dnssec_zone_names_print(FILE *out, const ldns_rbtree_t *tree, bool print_soa);
/**
* Prints the rbtree of ldns_dnssec_name structures to the file descriptor
@@ -438,7 +438,7 @@ void ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa
* \param[in] print_soa if true, print SOA records, if false, skip them
*/
void ldns_dnssec_zone_names_print_fmt(FILE *out, const ldns_output_format *fmt,
- ldns_rbtree_t *tree, bool print_soa);
+ const ldns_rbtree_t *tree, bool print_soa);
/**
* Prints the complete zone to the given file descriptor
@@ -446,7 +446,7 @@ void ldns_dnssec_zone_names_print_fmt(FILE *out, const ldns_output_format *fmt,
* \param[in] out the file descriptor to print to
* \param[in] zone the dnssec_zone to print
*/
-void ldns_dnssec_zone_print(FILE *out, ldns_dnssec_zone *zone);
+void ldns_dnssec_zone_print(FILE *out, const ldns_dnssec_zone *zone);
/**
* Prints the complete zone to the given file descriptor
@@ -456,7 +456,7 @@ void ldns_dnssec_zone_print(FILE *out, ldns_dnssec_zone *zone);
* \param[in] zone the dnssec_zone to print
*/
void ldns_dnssec_zone_print_fmt(FILE *out,
- const ldns_output_format *fmt, ldns_dnssec_zone *zone);
+ const ldns_output_format *fmt, const ldns_dnssec_zone *zone);
/**
* Adds explicit dnssec_name structures for the empty nonterminals
@@ -474,7 +474,7 @@ ldns_status ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone);
* \param[in] zone the zone to check for nsec3 optout records
* return true when the zone has at least one nsec3 optout record.
*/
-bool ldns_dnssec_zone_is_nsec3_optout(ldns_dnssec_zone* zone);
+bool ldns_dnssec_zone_is_nsec3_optout(const ldns_dnssec_zone* zone);
#ifdef __cplusplus
}
diff --git a/ldns/keys.h b/ldns/keys.h
index 019667a7..78332f08 100644
--- a/ldns/keys.h
+++ b/ldns/keys.h
@@ -598,7 +598,7 @@ ldns_rr * ldns_read_anchor_file(const char *filename);
* \param[in] key the key to get the file name from
* \returns A string containing the file base name
*/
-char *ldns_key_get_file_base_name(ldns_key *key);
+char *ldns_key_get_file_base_name(const ldns_key *key);
/**
* See if a key algorithm is supported
diff --git a/ldns/net.h.in b/ldns/net.h.in
index 626d34d5..9faf3a7d 100644
--- a/ldns/net.h.in
+++ b/ldns/net.h.in
@@ -188,7 +188,7 @@ struct sockaddr_storage * ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, u
* \param[in] port what port was used. When NULL this is not set
* \return ldns_rdf* wth the address
*/
-ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port);
+ldns_rdf * ldns_sockaddr_storage2rdf(const struct sockaddr_storage *sock, uint16_t *port);
/**
* Prepares the resolver for an axfr query
@@ -198,7 +198,7 @@ ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *po
* \param[in] c the class to use
* \return ldns_status the status of the transfer
*/
-ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c);
+ldns_status ldns_axfr_start(ldns_resolver *resolver, const ldns_rdf *domain, ldns_rr_class c);
#ifdef __cplusplus
}
diff --git a/ldns/packet.h b/ldns/packet.h
index e66aa34e..2ab38a2b 100644
--- a/ldns/packet.h
+++ b/ldns/packet.h
@@ -486,7 +486,7 @@ ldns_rr_list *ldns_pkt_get_section_clone(const ldns_pkt *p, ldns_pkt_section s);
* \param[in] s the packet's section
* \return a list with the rr's or NULL if none were found
*/
-ldns_rr_list *ldns_pkt_rr_list_by_name(ldns_pkt *p, ldns_rdf *r, ldns_pkt_section s);
+ldns_rr_list *ldns_pkt_rr_list_by_name(const ldns_pkt *p, const ldns_rdf *r, ldns_pkt_section s);
/**
* return all the rr with a specific type from a packet. Optionally
* specify from which section in the packet
@@ -514,7 +514,7 @@ ldns_rr_list *ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, const ld
* \param[in] sec in which section to look
* \param[in] rr the rr to look for
*/
-bool ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr);
+bool ldns_pkt_rr(const ldns_pkt *pkt, ldns_pkt_section sec, const ldns_rr *rr);
/**
@@ -660,7 +660,7 @@ void ldns_pkt_set_tsig(ldns_pkt *p, ldns_rr *t);
* \param[in] p the packet to examine
* \return the type of packet
*/
-ldns_pkt_type ldns_pkt_reply_type(ldns_pkt *p);
+ldns_pkt_type ldns_pkt_reply_type(const ldns_pkt *p);
/**
* return the packet's edns udp size
@@ -792,7 +792,7 @@ ldns_status ldns_pkt_ixfr_request_new_frm_str(ldns_pkt **p, const char *rr_name,
* \param[in] flags packet flags
* \return ldns_pkt* a pointer to the new pkt
*/
-ldns_pkt *ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags);
+ldns_pkt *ldns_pkt_query_new(const ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags);
/**
* creates an IXFR request packet for the given name, type and class.
@@ -803,7 +803,7 @@ ldns_pkt *ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_cl
* \param[in] soa soa record to be added to the authority section
* \return ldns_pkt* a pointer to the new pkt
*/
-ldns_pkt *ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa);
+ldns_pkt *ldns_pkt_ixfr_request_new(const ldns_rdf *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa);
/**
* clones the given packet, creating a fully allocated copy
diff --git a/ldns/radix.h b/ldns/radix.h
index 1885959b..ec70565a 100644
--- a/ldns/radix.h
+++ b/ldns/radix.h
@@ -135,7 +135,7 @@ ldns_status ldns_radix_insert(ldns_radix_t* tree, uint8_t* key,
* @return: unlinked data or NULL if not present.
*
*/
-void* ldns_radix_delete(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len);
+void* ldns_radix_delete(ldns_radix_t* tree, const uint8_t* key, radix_strlen_t len);
/**
* Search data in the tree.
@@ -145,7 +145,7 @@ void* ldns_radix_delete(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len);
* @return: the radix node or NULL if not found.
*
*/
-ldns_radix_node_t* ldns_radix_search(ldns_radix_t* tree, uint8_t* key,
+ldns_radix_node_t* ldns_radix_search(ldns_radix_t* tree, const uint8_t* key,
radix_strlen_t len);
/**
@@ -159,7 +159,7 @@ ldns_radix_node_t* ldns_radix_search(ldns_radix_t* tree, uint8_t* key,
* @return 1 if exact match, 0 otherwise.
*
*/
-int ldns_radix_find_less_equal(ldns_radix_t* tree, uint8_t* key,
+int ldns_radix_find_less_equal(ldns_radix_t* tree, const uint8_t* key,
radix_strlen_t len, ldns_radix_node_t** result);
/**
@@ -168,7 +168,7 @@ int ldns_radix_find_less_equal(ldns_radix_t* tree, uint8_t* key,
* @return: the radix node with the first element.
*
*/
-ldns_radix_node_t* ldns_radix_first(ldns_radix_t* tree);
+ldns_radix_node_t* ldns_radix_first(const ldns_radix_t* tree);
/**
* Get the last element in the tree.
@@ -176,7 +176,7 @@ ldns_radix_node_t* ldns_radix_first(ldns_radix_t* tree);
* @return: the radix node with the last element.
*
*/
-ldns_radix_node_t* ldns_radix_last(ldns_radix_t* tree);
+ldns_radix_node_t* ldns_radix_last(const ldns_radix_t* tree);
/**
* Next element.
@@ -231,7 +231,7 @@ void ldns_radix_traverse_postorder(ldns_radix_node_t* node,
* @param tree: tree.
*
*/
-void ldns_radix_printf(FILE* fd, ldns_radix_t* tree);
+void ldns_radix_printf(FILE* fd, const ldns_radix_t* tree);
#ifdef __cplusplus
}
diff --git a/ldns/rbtree.h b/ldns/rbtree.h
index c891934d..0747a8e5 100644
--- a/ldns/rbtree.h
+++ b/ldns/rbtree.h
@@ -164,14 +164,14 @@ int ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key,
* @param rbtree: tree
* @return: smallest element or NULL if tree empty.
*/
-ldns_rbnode_t *ldns_rbtree_first(ldns_rbtree_t *rbtree);
+ldns_rbnode_t *ldns_rbtree_first(const ldns_rbtree_t *rbtree);
/**
* Returns last (largest) node in the tree
* @param rbtree: tree
* @return: largest element or NULL if tree empty.
*/
-ldns_rbnode_t *ldns_rbtree_last(ldns_rbtree_t *rbtree);
+ldns_rbnode_t *ldns_rbtree_last(const ldns_rbtree_t *rbtree);
/**
* Returns next larger node in the tree
diff --git a/ldns/resolver.h b/ldns/resolver.h
index 228485c0..baaf4414 100644
--- a/ldns/resolver.h
+++ b/ldns/resolver.h
@@ -570,7 +570,7 @@ void ldns_resolver_set_random(ldns_resolver *r, bool b);
* \param[in] n the ip address
* \return ldns_status a status
*/
-ldns_status ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n);
+ldns_status ldns_resolver_push_nameserver(ldns_resolver *r, const ldns_rdf *n);
/**
* Push a new nameserver to the resolver. It must be an
@@ -579,7 +579,7 @@ ldns_status ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n);
* \param[in] rr the resource record
* \return ldns_status a status
*/
-ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr);
+ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *r, const ldns_rr *rr);
/**
* Push a new nameserver rr_list to the resolver.
@@ -587,7 +587,7 @@ ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr);
* \param[in] rrlist the rr_list to push
* \return ldns_status a status
*/
-ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist);
+ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, const ldns_rr_list *rrlist);
/**
* Send the query for using the resolver and take the search list into account
diff --git a/ldns/rr.h b/ldns/rr.h
index 8196c020..dbbed1a6 100644
--- a/ldns/rr.h
+++ b/ldns/rr.h
@@ -649,7 +649,7 @@ void ldns_rr_list_deep_free(ldns_rr_list *rr_list);
* \param[in] right the rightside
* \return a left with right concatenated to it
*/
-bool ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right);
+bool ldns_rr_list_cat(ldns_rr_list *left, const ldns_rr_list *right);
/**
* concatenates two ldns_rr_lists together, but makes clones of the rr's
@@ -658,7 +658,7 @@ bool ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right);
* \param[in] right the rightside
* \return a new rr_list with leftside/rightside concatenated
*/
-ldns_rr_list* ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right);
+ldns_rr_list* ldns_rr_list_cat_clone(const ldns_rr_list *left, const ldns_rr_list *right);
/**
* pushes an rr to an rrlist.
@@ -698,14 +698,14 @@ ldns_rr_list* ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t size);
* \param[in] rr the rr to check
* \return true if rr_list contains rr, false otherwise
*/
-bool ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr);
+bool ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, const ldns_rr *rr);
/**
* checks if an rr_list is a rrset.
* \param[in] rr_list the rr_list to check
* \return true if it is an rrset otherwise false
*/
-bool ldns_is_rrset(ldns_rr_list *rr_list);
+bool ldns_is_rrset(const ldns_rr_list *rr_list);
/**
* pushes an rr to an rrset (which really are rr_list's).
@@ -795,7 +795,7 @@ int ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2);
* -1 if rr1_buf comes before rr2_buf
* +1 if rr2_buf comes before rr1_buf
*/
-int ldns_rr_compare_wire(ldns_buffer *rr1_buf, ldns_buffer *rr2_buf);
+int ldns_rr_compare_wire(const ldns_buffer *rr1_buf, const ldns_buffer *rr2_buf);
/**
* returns true of the given rr's are equal.
@@ -836,14 +836,14 @@ void ldns_rr2canonical(ldns_rr *rr);
* \param[in] rr_list the rr_list to work on
* \return void
*/
-void ldns_rr_list2canonical(ldns_rr_list *rr_list);
+void ldns_rr_list2canonical(const ldns_rr_list *rr_list);
/**
* counts the number of labels of the ownername.
* \param[in] rr count the labels of this rr
* \return the number of labels
*/
-uint8_t ldns_rr_label_count(ldns_rr *rr);
+uint8_t ldns_rr_label_count(const ldns_rr *rr);
/**
* returns the resource record descriptor for the given rr type.
@@ -889,7 +889,7 @@ ldns_rdf_type ldns_rr_descriptor_field_type(const ldns_rr_descriptor *descriptor
* \return a new rr list with only the RRs that match
*
*/
-ldns_rr_list *ldns_rr_list_subtype_by_rdf(ldns_rr_list *l, ldns_rdf *r, size_t pos);
+ldns_rr_list *ldns_rr_list_subtype_by_rdf(const ldns_rr_list *l, const ldns_rdf *r, size_t pos);
/**
* convert an rdf of type LDNS_RDF_TYPE_TYPE to an actual
diff --git a/ldns/tsig.h b/ldns/tsig.h
index 676045fb..0936da93 100644
--- a/ldns/tsig.h
+++ b/ldns/tsig.h
@@ -31,11 +31,11 @@ typedef struct ldns_tsig_credentials_struct
/* XXX More eventually. */
} ldns_tsig_credentials;
-char *ldns_tsig_algorithm(ldns_tsig_credentials *);
-char *ldns_tsig_keyname(ldns_tsig_credentials *);
-char *ldns_tsig_keydata(ldns_tsig_credentials *);
-char *ldns_tsig_keyname_clone(ldns_tsig_credentials *);
-char *ldns_tsig_keydata_clone(ldns_tsig_credentials *);
+char *ldns_tsig_algorithm(const ldns_tsig_credentials *);
+char *ldns_tsig_keyname(const ldns_tsig_credentials *);
+char *ldns_tsig_keydata(const ldns_tsig_credentials *);
+char *ldns_tsig_keyname_clone(const ldns_tsig_credentials *);
+char *ldns_tsig_keydata_clone(const ldns_tsig_credentials *);
/**
* verifies the tsig rr for the given packet and key.
@@ -48,7 +48,7 @@ char *ldns_tsig_keydata_clone(ldns_tsig_credentials *);
* \param[in] mac original mac
* \return true if tsig is correct, false if not, or if tsig is not set
*/
-bool ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, ldns_rdf *mac);
+bool ldns_pkt_tsig_verify(ldns_pkt *pkt, const uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, const ldns_rdf *mac);
/**
* verifies the tsig rr for the given packet and key.
@@ -63,7 +63,7 @@ bool ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const
components are used to verify the _mac. If non-zero, only the TSIG timers are used to verify the mac.
* \return true if tsig is correct, false if not, or if tsig is not set
*/
-bool ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, ldns_rdf *mac,
+bool ldns_pkt_tsig_verify_next(ldns_pkt *pkt, const uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, const ldns_rdf *mac,
int tsig_timers_only);
/**
@@ -77,7 +77,7 @@ bool ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, c
* \return status (OK if success)
*/
ldns_status ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge,
- const char *algorithm_name, ldns_rdf *query_mac);
+ const char *algorithm_name, const ldns_rdf *query_mac);
/**
* creates a tsig rr for the given packet and key.
@@ -92,7 +92,7 @@ ldns_status ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *
* \return status (OK if success)
*/
ldns_status ldns_pkt_tsig_sign_next(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge,
- const char *algorithm_name, ldns_rdf *query_mac, int tsig_timers_only);
+ const char *algorithm_name, const ldns_rdf *query_mac, int tsig_timers_only);
#ifdef __cplusplus
}
diff --git a/ldns/update.h b/ldns/update.h
index d3459d32..e144690d 100644
--- a/ldns/update.h
+++ b/ldns/update.h
@@ -33,7 +33,7 @@ extern "C" {
* \param[in] ad_rrlist list of Additional Data Section RRs (currently unused)
* \return the new packet
*/
-ldns_pkt *ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class clas, ldns_rr_list *pr_rrlist, ldns_rr_list *up_rrlist, ldns_rr_list *ad_rrlist);
+ldns_pkt *ldns_update_pkt_new(const ldns_rdf *zone_rdf, ldns_rr_class clas, const ldns_rr_list *pr_rrlist, const ldns_rr_list *up_rrlist, const ldns_rr_list *ad_rrlist);
/**
* add tsig credentials to
@@ -43,7 +43,7 @@ ldns_pkt *ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class clas, ldns_rr_li
*
* \return status wether successfull or not
*/
-ldns_status ldns_update_pkt_tsig_add(ldns_pkt *p, ldns_resolver *r);
+ldns_status ldns_update_pkt_tsig_add(ldns_pkt *p, const ldns_resolver *r);
/* access functions */
diff --git a/ldns/wire2host.h b/ldns/wire2host.h
index 53155b30..7ce146aa 100644
--- a/ldns/wire2host.h
+++ b/ldns/wire2host.h
@@ -129,7 +129,7 @@ extern "C" {
ldns_status ldns_wire2pkt(ldns_pkt **packet, const uint8_t *data, size_t len);
/**
- * converts the data on the uint8_t bytearray (in wire format) to a DNS packet.
+ * converts the data in the ldns_buffer (in wire format) to a DNS packet.
* This function will initialize and allocate memory space for the packet
* structure.
*
@@ -137,7 +137,7 @@ ldns_status ldns_wire2pkt(ldns_pkt **packet, const uint8_t *data, size_t len);
* \param[in] buffer the buffer with the data
* \return LDNS_STATUS_OK if everything succeeds, error otherwise
*/
-ldns_status ldns_buffer2pkt_wire(ldns_pkt **packet, ldns_buffer *buffer);
+ldns_status ldns_buffer2pkt_wire(ldns_pkt **packet, const ldns_buffer *buffer);
/**
* converts the data on the uint8_t bytearray (in wire format) to a DNS
diff --git a/ldns/zone.h b/ldns/zone.h
index a964883e..f51b6bc0 100644
--- a/ldns/zone.h
+++ b/ldns/zone.h
@@ -99,7 +99,7 @@ void ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist);
* \param[in] list the list to add
* \return a true on succes otherwise falsed
*/
-bool ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list);
+bool ldns_zone_push_rr_list(ldns_zone *z, const ldns_rr_list *list);
/**
* push an single rr to a zone structure. This function use pointer
diff --git a/net.c b/net.c
index b8a5385e..e35492d1 100644
--- a/net.c
+++ b/net.c
@@ -827,7 +827,7 @@ ldns_tcp_read_wire(int sockfd, size_t *size)
#ifndef S_SPLINT_S
ldns_rdf *
-ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port)
+ldns_sockaddr_storage2rdf(const struct sockaddr_storage *sock, uint16_t *port)
{
ldns_rdf *addr;
struct sockaddr_in *data_in;
@@ -862,7 +862,7 @@ ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port)
/* code from resolver.c */
ldns_status
-ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class)
+ldns_axfr_start(ldns_resolver *resolver, const ldns_rdf *domain, ldns_rr_class class)
{
ldns_pkt *query;
ldns_buffer *query_wire;
diff --git a/packet.c b/packet.c
index 62bfd079..6c6f4d2e 100644
--- a/packet.c
+++ b/packet.c
@@ -250,8 +250,8 @@ ldns_pkt_edns_data(const ldns_pkt *packet)
/* return only those rr that share the ownername */
ldns_rr_list *
-ldns_pkt_rr_list_by_name(ldns_pkt *packet,
- ldns_rdf *ownername,
+ldns_pkt_rr_list_by_name(const ldns_pkt *packet,
+ const ldns_rdf *ownername,
ldns_pkt_section sec)
{
ldns_rr_list *rrs;
@@ -360,7 +360,7 @@ ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet,
}
bool
-ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr)
+ldns_pkt_rr(const ldns_pkt *pkt, ldns_pkt_section sec, const ldns_rr *rr)
{
bool result = false;
@@ -836,7 +836,7 @@ ldns_pkt_set_flags(ldns_pkt *packet, uint16_t flags)
static ldns_rr*
-ldns_pkt_authsoa(ldns_rdf* rr_name, ldns_rr_class rr_class)
+ldns_pkt_authsoa(const ldns_rdf* rr_name, ldns_rr_class rr_class)
{
ldns_rr* soa_rr = ldns_rr_new();
ldns_rdf *owner_rdf;
@@ -996,7 +996,7 @@ ldns_pkt_ixfr_request_new_frm_str(ldns_pkt **p, const char *name,
}
static ldns_pkt *
-ldns_pkt_query_new_internal(ldns_rdf *rr_name, ldns_rr_type rr_type,
+ldns_pkt_query_new_internal(const ldns_rdf *rr_name, ldns_rr_type rr_type,
ldns_rr_class rr_class, uint16_t flags, ldns_rr* authsoa_rr)
{
ldns_pkt *packet;
@@ -1024,7 +1024,7 @@ ldns_pkt_query_new_internal(ldns_rdf *rr_name, ldns_rr_type rr_type,
rr_class = LDNS_RR_CLASS_IN;
}
- ldns_rr_set_owner(question_rr, rr_name);
+ ldns_rr_set_owner(question_rr, ldns_rdf_clone(rr_name));
ldns_rr_set_type(question_rr, rr_type);
ldns_rr_set_class(question_rr, rr_class);
ldns_rr_set_question(question_rr, true);
@@ -1039,7 +1039,7 @@ ldns_pkt_query_new_internal(ldns_rdf *rr_name, ldns_rr_type rr_type,
}
ldns_pkt *
-ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type,
+ldns_pkt_query_new(const ldns_rdf *rr_name, ldns_rr_type rr_type,
ldns_rr_class rr_class, uint16_t flags)
{
return ldns_pkt_query_new_internal(rr_name, rr_type,
@@ -1047,7 +1047,7 @@ ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type,
}
ldns_pkt *
-ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class,
+ldns_pkt_ixfr_request_new(const ldns_rdf *rr_name, ldns_rr_class rr_class,
uint16_t flags, ldns_rr* soa)
{
ldns_rr* authsoa_rr = soa;
@@ -1059,7 +1059,7 @@ ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class,
}
ldns_pkt_type
-ldns_pkt_reply_type(ldns_pkt *p)
+ldns_pkt_reply_type(const ldns_pkt *p)
{
ldns_rr_list *tmp;
diff --git a/radix.c b/radix.c
index 7aac258d..43f73653 100644
--- a/radix.c
+++ b/radix.c
@@ -311,7 +311,7 @@ ldns_radix_insert(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len,
* Delete data from the tree.
*
*/
-void* ldns_radix_delete(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len)
+void* ldns_radix_delete(ldns_radix_t* tree, const uint8_t* key, radix_strlen_t len)
{
ldns_radix_node_t* del = ldns_radix_search(tree, key, len);
void* data = NULL;
@@ -331,7 +331,7 @@ void* ldns_radix_delete(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len)
*
*/
ldns_radix_node_t*
-ldns_radix_search(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len)
+ldns_radix_search(ldns_radix_t* tree, const uint8_t* key, radix_strlen_t len)
{
ldns_radix_node_t* node = NULL;
radix_strlen_t pos = 0;
@@ -377,7 +377,7 @@ ldns_radix_search(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len)
*
*/
int
-ldns_radix_find_less_equal(ldns_radix_t* tree, uint8_t* key,
+ldns_radix_find_less_equal(ldns_radix_t* tree, const uint8_t* key,
radix_strlen_t len, ldns_radix_node_t** result)
{
ldns_radix_node_t* node = NULL;
@@ -477,7 +477,7 @@ ldns_radix_find_less_equal(ldns_radix_t* tree, uint8_t* key,
*
*/
ldns_radix_node_t*
-ldns_radix_first(ldns_radix_t* tree)
+ldns_radix_first(const ldns_radix_t* tree)
{
ldns_radix_node_t* first = NULL;
if (!tree || !tree->root) {
@@ -496,7 +496,7 @@ ldns_radix_first(ldns_radix_t* tree)
*
*/
ldns_radix_node_t*
-ldns_radix_last(ldns_radix_t* tree)
+ldns_radix_last(const ldns_radix_t* tree)
{
if (!tree || !tree->root) {
return NULL;
@@ -621,7 +621,7 @@ ldns_radix_node_print(FILE* fd, ldns_radix_node_t* node,
*
*/
void
-ldns_radix_printf(FILE* fd, ldns_radix_t* tree)
+ldns_radix_printf(FILE* fd, const ldns_radix_t* tree)
{
if (!fd || !tree) {
return;
diff --git a/rbtree.c b/rbtree.c
index b89dff7b..01ae9c70 100644
--- a/rbtree.c
+++ b/rbtree.c
@@ -545,7 +545,7 @@ ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key, ldns_rbnode_
*
*/
ldns_rbnode_t *
-ldns_rbtree_first (ldns_rbtree_t *rbtree)
+ldns_rbtree_first(const ldns_rbtree_t *rbtree)
{
ldns_rbnode_t *node = rbtree->root;
@@ -556,7 +556,7 @@ ldns_rbtree_first (ldns_rbtree_t *rbtree)
}
ldns_rbnode_t *
-ldns_rbtree_last (ldns_rbtree_t *rbtree)
+ldns_rbtree_last(const ldns_rbtree_t *rbtree)
{
ldns_rbnode_t *node = rbtree->root;
@@ -571,7 +571,7 @@ ldns_rbtree_last (ldns_rbtree_t *rbtree)
*
*/
ldns_rbnode_t *
-ldns_rbtree_next (ldns_rbnode_t *node)
+ldns_rbtree_next(ldns_rbnode_t *node)
{
ldns_rbnode_t *parent;
diff --git a/resolver.c b/resolver.c
index b0924040..9c523317 100644
--- a/resolver.c
+++ b/resolver.c
@@ -285,7 +285,7 @@ ldns_resolver_pop_nameserver(ldns_resolver *r)
}
ldns_status
-ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n)
+ldns_resolver_push_nameserver(ldns_resolver *r, const ldns_rdf *n)
{
ldns_rdf **nameservers;
size_t ns_count;
@@ -332,7 +332,7 @@ ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n)
}
ldns_status
-ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr)
+ldns_resolver_push_nameserver_rr(ldns_resolver *r, const ldns_rr *rr)
{
ldns_rdf *address;
if ((!rr) || (ldns_rr_get_type(rr) != LDNS_RR_TYPE_A &&
@@ -348,7 +348,7 @@ ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr)
}
ldns_status
-ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist)
+ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, const ldns_rr_list *rrlist)
{
ldns_rr *rr;
ldns_status stat;
diff --git a/rr.c b/rr.c
index 6d0c32e8..3cb2ee26 100644
--- a/rr.c
+++ b/rr.c
@@ -1009,7 +1009,7 @@ ldns_rr_list_deep_free(ldns_rr_list *rr_list)
/* add right to left. So we modify *left! */
bool
-ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right)
+ldns_rr_list_cat(ldns_rr_list *left, const ldns_rr_list *right)
{
size_t r_rr_count;
size_t i;
@@ -1032,7 +1032,7 @@ ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right)
}
ldns_rr_list *
-ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right)
+ldns_rr_list_cat_clone(const ldns_rr_list *left, const ldns_rr_list *right)
{
size_t l_rr_count;
size_t r_rr_count;
@@ -1071,7 +1071,7 @@ ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right)
}
ldns_rr_list *
-ldns_rr_list_subtype_by_rdf(ldns_rr_list *l, ldns_rdf *r, size_t pos)
+ldns_rr_list_subtype_by_rdf(const ldns_rr_list *l, const ldns_rdf *r, size_t pos)
{
size_t i;
ldns_rr_list *subtyped;
@@ -1212,7 +1212,7 @@ ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t howmany)
bool
-ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr)
+ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, const ldns_rr *rr)
{
size_t i;
@@ -1231,7 +1231,7 @@ ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr)
}
bool
-ldns_is_rrset(ldns_rr_list *rr_list)
+ldns_is_rrset(const ldns_rr_list *rr_list)
{
ldns_rr_type t;
ldns_rr_class c;
@@ -1572,7 +1572,7 @@ ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2)
return 0;
}
-int ldns_rr_compare_wire(ldns_buffer *rr1_buf, ldns_buffer *rr2_buf)
+int ldns_rr_compare_wire(const ldns_buffer *rr1_buf, const ldns_buffer *rr2_buf)
{
size_t rr1_len, rr2_len, min_len, i, offset;
@@ -1805,7 +1805,7 @@ ldns_rr2canonical(ldns_rr *rr)
}
void
-ldns_rr_list2canonical(ldns_rr_list *rr_list)
+ldns_rr_list2canonical(const ldns_rr_list *rr_list)
{
size_t i;
for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) {
@@ -1814,7 +1814,7 @@ ldns_rr_list2canonical(ldns_rr_list *rr_list)
}
uint8_t
-ldns_rr_label_count(ldns_rr *rr)
+ldns_rr_label_count(const ldns_rr *rr)
{
if (!rr) {
return 0;
diff --git a/tsig.c b/tsig.c
index 53aa85ec..012911c1 100644
--- a/tsig.c
+++ b/tsig.c
@@ -19,31 +19,31 @@
#endif /* HAVE_SSL */
char *
-ldns_tsig_algorithm(ldns_tsig_credentials *tc)
+ldns_tsig_algorithm(const ldns_tsig_credentials *tc)
{
return tc->algorithm;
}
char *
-ldns_tsig_keyname(ldns_tsig_credentials *tc)
+ldns_tsig_keyname(const ldns_tsig_credentials *tc)
{
return tc->keyname;
}
char *
-ldns_tsig_keydata(ldns_tsig_credentials *tc)
+ldns_tsig_keydata(const ldns_tsig_credentials *tc)
{
return tc->keydata;
}
char *
-ldns_tsig_keyname_clone(ldns_tsig_credentials *tc)
+ldns_tsig_keyname_clone(const ldns_tsig_credentials *tc)
{
return strdup(tc->keyname);
}
char *
-ldns_tsig_keydata_clone(ldns_tsig_credentials *tc)
+ldns_tsig_keydata_clone(const ldns_tsig_credentials *tc)
{
return strdup(tc->keydata);
}
@@ -52,7 +52,7 @@ ldns_tsig_keydata_clone(ldns_tsig_credentials *tc)
* Makes an exact copy of the wire, but with the tsig rr removed
*/
static uint8_t *
-ldns_tsig_prepare_pkt_wire(uint8_t *wire, size_t wire_len, size_t *result_len)
+ldns_tsig_prepare_pkt_wire(const uint8_t *wire, size_t wire_len, size_t *result_len)
{
uint8_t *wire2 = NULL;
uint16_t qd_count;
@@ -152,10 +152,10 @@ ldns_digest_function(char *name)
#ifdef HAVE_SSL
static ldns_status
-ldns_tsig_mac_new(ldns_rdf **tsig_mac, uint8_t *pkt_wire, size_t pkt_wire_size,
- const char *key_data, ldns_rdf *key_name_rdf, ldns_rdf *fudge_rdf,
- ldns_rdf *algorithm_rdf, ldns_rdf *time_signed_rdf, ldns_rdf *error_rdf,
- ldns_rdf *other_data_rdf, ldns_rdf *orig_mac_rdf, int tsig_timers_only)
+ldns_tsig_mac_new(ldns_rdf **tsig_mac, const uint8_t *pkt_wire, size_t pkt_wire_size,
+ const char *key_data, const ldns_rdf *key_name_rdf, const ldns_rdf *fudge_rdf,
+ const ldns_rdf *algorithm_rdf, const ldns_rdf *time_signed_rdf, const ldns_rdf *error_rdf,
+ const ldns_rdf *other_data_rdf, const ldns_rdf *orig_mac_rdf, int tsig_timers_only)
{
ldns_status status;
char *wireformat;
@@ -273,15 +273,15 @@ ldns_tsig_mac_new(ldns_rdf **tsig_mac, uint8_t *pkt_wire, size_t pkt_wire_size,
#ifdef HAVE_SSL
bool
-ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char *key_name,
- const char *key_data, ldns_rdf *orig_mac_rdf)
+ldns_pkt_tsig_verify(ldns_pkt *pkt, const uint8_t *wire, size_t wirelen, const char *key_name,
+ const char *key_data, const ldns_rdf *orig_mac_rdf)
{
return ldns_pkt_tsig_verify_next(pkt, wire, wirelen, key_name, key_data, orig_mac_rdf, 0);
}
bool
-ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char* key_name,
- const char *key_data, ldns_rdf *orig_mac_rdf, int tsig_timers_only)
+ldns_pkt_tsig_verify_next(ldns_pkt *pkt, const uint8_t *wire, size_t wirelen, const char* key_name,
+ const char *key_data, const ldns_rdf *orig_mac_rdf, int tsig_timers_only)
{
ldns_rdf *fudge_rdf;
ldns_rdf *algorithm_rdf;
@@ -350,14 +350,14 @@ ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const ch
#ifdef HAVE_SSL
ldns_status
ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data,
- uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac)
+ uint16_t fudge, const char *algorithm_name, const ldns_rdf *query_mac)
{
return ldns_pkt_tsig_sign_next(pkt, key_name, key_data, fudge, algorithm_name, query_mac, 0);
}
ldns_status
ldns_pkt_tsig_sign_next(ldns_pkt *pkt, const char *key_name, const char *key_data,
- uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac, int tsig_timers_only)
+ uint16_t fudge, const char *algorithm_name, const ldns_rdf *query_mac, int tsig_timers_only)
{
ldns_rr *tsig_rr;
ldns_rdf *key_name_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, key_name);
diff --git a/update.c b/update.c
index 74e9d192..0b4ee93a 100644
--- a/update.c
+++ b/update.c
@@ -24,8 +24,8 @@
*/
ldns_pkt *
-ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class c,
- ldns_rr_list *pr_rrlist, ldns_rr_list *up_rrlist, ldns_rr_list *ad_rrlist)
+ldns_update_pkt_new(const ldns_rdf *zone_rdf, ldns_rr_class c,
+ const ldns_rr_list *pr_rrlist, const ldns_rr_list *up_rrlist, const ldns_rr_list *ad_rrlist)
{
ldns_pkt *p;
@@ -67,7 +67,7 @@ ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class c,
}
ldns_status
-ldns_update_pkt_tsig_add(ldns_pkt *p, ldns_resolver *r)
+ldns_update_pkt_tsig_add(ldns_pkt *p, const ldns_resolver *r)
{
#ifdef HAVE_SSL
uint16_t fudge = 300; /* Recommended fudge. [RFC2845 6.4] */
diff --git a/wire2host.c b/wire2host.c
index e4922155..680d2f9d 100644
--- a/wire2host.c
+++ b/wire2host.c
@@ -392,7 +392,7 @@ ldns_wire2pkt_hdr(ldns_pkt *packet, const uint8_t *wire, size_t max, size_t *pos
}
ldns_status
-ldns_buffer2pkt_wire(ldns_pkt **packet, ldns_buffer *buffer)
+ldns_buffer2pkt_wire(ldns_pkt **packet, const ldns_buffer *buffer)
{
/* lazy */
return ldns_wire2pkt(packet, ldns_buffer_begin(buffer),
diff --git a/zone.c b/zone.c
index 6b3f3377..e9520748 100644
--- a/zone.c
+++ b/zone.c
@@ -44,16 +44,15 @@ ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist)
}
bool
-ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list)
+ldns_zone_push_rr_list(ldns_zone *z, const ldns_rr_list *list)
{
return ldns_rr_list_cat(ldns_zone_rrs(z), list);
-
}
bool
ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr)
{
- return ldns_rr_list_push_rr( ldns_zone_rrs(z), rr);
+ return ldns_rr_list_push_rr(ldns_zone_rrs(z), rr);
}