isc_time_settoepoch(&now);
}
- hashval = dns_name_hash(name, false);
+ hashval = dns_name_hash(name);
hash = hashval % bc->size;
LOCK(&bc->tlocks[hash]);
prev = NULL;
goto skip;
}
- hash = dns_name_hash(name, false) % bc->size;
+ hash = dns_name_hash(name) % bc->size;
prev = NULL;
LOCK(&bc->tlocks[hash]);
for (bad = bc->table[hash]; bad != NULL; bad = next) {
if (result != ISC_R_SUCCESS) {
isc_time_settoepoch(&now);
}
- hash = dns_name_hash(name, false) % bc->size;
+ hash = dns_name_hash(name) % bc->size;
LOCK(&bc->tlocks[hash]);
prev = NULL;
for (bad = bc->table[hash]; bad != NULL; bad = next) {
* \li FALSE The least significant label of 'name' is not '*'.
*/
-unsigned int
-dns_name_hash(const dns_name_t *name, bool case_sensitive);
+uint32_t
+dns_name_hash(const dns_name_t *name);
/*%<
* Provide a hash value for 'name'.
*
- * Note: if 'case_sensitive' is false, then names which differ only in
- * case will have the same hash value.
- *
- * Requires:
- * \li 'name' is a valid name
- *
- * Returns:
- * \li A hash value
- */
-
-unsigned int
-dns_name_fullhash(const dns_name_t *name, bool case_sensitive);
-/*%<
- * Provide a hash value for 'name'. Unlike dns_name_hash(), this function
- * always takes into account of the entire name to calculate the hash value.
- *
- * Note: if 'case_sensitive' is false, then names which differ only in
- * case will have the same hash value.
+ * Note: This function always takes into account of the entire name to calculate
+ * the hash value. The names which differ only in case will have the same hash
+ * value.
*
* Requires:
*\li 'name' is a valid name
return (false);
}
-unsigned int
-dns_name_hash(const dns_name_t *name, bool case_sensitive) {
- unsigned int length;
-
- /*
- * Provide a hash value for 'name'.
- */
+uint32_t
+dns_name_hash(const dns_name_t *name) {
REQUIRE(VALID_NAME(name));
- if (name->labels == 0) {
- return (0);
- }
-
- length = name->length;
- if (length > 16) {
- length = 16;
- }
-
- return (isc_hash32(name->ndata, length, case_sensitive));
-}
-
-unsigned int
-dns_name_fullhash(const dns_name_t *name, bool case_sensitive) {
- /*
- * Provide a hash value for 'name'.
- */
- REQUIRE(VALID_NAME(name));
-
- if (name->labels == 0) {
- return (0);
- }
-
- return (isc_hash32(name->ndata, name->length, case_sensitive));
+ return (isc_hash32(name->ndata, name->length, false));
}
dns_namereln_t
dns_name_getlabelsequence(name, nlabels - tlabels,
hlabels + tlabels,
&hash_name);
- hashval = dns_name_fullhash(&hash_name, false);
+ hashval = dns_name_hash(&hash_name);
dns_name_getlabelsequence(search_name,
nlabels - tlabels, tlabels,
REQUIRE(name != NULL);
- node->hashval = dns_name_fullhash(name, false);
+ node->hashval = dns_name_hash(name);
hash = isc_hash_bits32(node->hashval, rbt->hashbits[rbt->hindex]);
node->hashnext = rbt->hashtable[rbt->hindex][hash];
*/
wild = origin;
}
- key->s.qname_hash = dns_name_fullhash(wild, false);
+ key->s.qname_hash = dns_name_hash(wild);
} else {
- key->s.qname_hash = dns_name_fullhash(qname, false);
+ key->s.qname_hash = dns_name_hash(qname);
}
}
assert_int_equal(result, ISC_R_SUCCESS);
/* Check case-insensitive hashing first */
- h1 = dns_name_hash(n1, false);
- h2 = dns_name_hash(n2, false);
+ h1 = dns_name_hash(n1);
+ h2 = dns_name_hash(n2);
if (verbose) {
print_message("# %s hashes to %u, "
assert_int_equal((h1 == h2), testcases[i].expect);
/* Now case-sensitive */
- h1 = dns_name_hash(n1, false);
- h2 = dns_name_hash(n2, false);
+ h1 = dns_name_hash(n1);
+ h2 = dns_name_hash(n2);
if (verbose) {
print_message("# %s hashes to %u, "