val_kentry.h File Reference

This file contains functions for dealing with validator key entries. More...

#include "util/storage/lruhash.h"

Data Structures

struct  key_entry_key
 A key entry for the validator. More...
struct  key_entry_data
 Key entry for the validator. More...

Functions

size_t key_entry_sizefunc (void *key, void *data)
 function for lruhash operation
int key_entry_compfunc (void *k1, void *k2)
 function for lruhash operation
void key_entry_delkeyfunc (void *key, void *userarg)
 function for lruhash operation
void key_entry_deldatafunc (void *data, void *userarg)
 function for lruhash operation
void key_entry_hash (struct key_entry_key *kk)
 calculate hash for key entry
struct key_entry_keykey_entry_copy_toregion (struct key_entry_key *kkey, struct regional *region)
 Copy a key entry, to be region-allocated.
struct key_entry_keykey_entry_copy (struct key_entry_key *kkey)
 Copy a key entry, malloced.
int key_entry_isnull (struct key_entry_key *kkey)
 See if this is a null entry.
int key_entry_isgood (struct key_entry_key *kkey)
 See if this entry is good.
int key_entry_isbad (struct key_entry_key *kkey)
 See if this entry is bad.
struct key_entry_keykey_entry_create_null (struct regional *region, uint8_t *name, size_t namelen, uint16_t dclass, uint32_t ttl, uint32_t now)
 Create a null entry, in the given region.
struct key_entry_keykey_entry_create_rrset (struct regional *region, uint8_t *name, size_t namelen, uint16_t dclass, struct ub_packed_rrset_key *rrset, uint32_t now)
 Create a key entry from an rrset, in the given region.
struct key_entry_keykey_entry_create_bad (struct regional *region, uint8_t *name, size_t namelen, uint16_t dclass)
 Create a bad entry, in the given region.
struct ub_packed_rrset_keykey_entry_get_rrset (struct key_entry_key *kkey, struct regional *region)
 Obtain rrset from a key entry, allocated in region.
size_t key_entry_keysize (struct key_entry_key *kkey)
 Get keysize of the keyentry.


Detailed Description

This file contains functions for dealing with validator key entries.


Function Documentation

void key_entry_hash ( struct key_entry_key kk  ) 

calculate hash for key entry

Parameters:
kk,: key entry. The lruhash entry.hash value is filled in.

References dname_query_hash(), key_entry_key::entry, lruhash_entry::hash, key_entry_key::key_class, and key_entry_key::name.

Referenced by key_cache_insert(), and key_cache_search().

struct key_entry_key* key_entry_copy_toregion ( struct key_entry_key kkey,
struct regional region 
) [read]

Copy a key entry, to be region-allocated.

Parameters:
kkey,: the key entry key (and data pointer) to copy.
region,: where to allocate it
Returns:
newly region-allocated entry or NULL on a failure to allocate.

References lruhash_entry::data, key_entry_key::entry, lruhash_entry::key, key_entry_key::name, key_entry_key::namelen, packed_rrset_ptr_fixup(), packed_rrset_sizeof(), regional_alloc_init(), and key_entry_data::rrset_data.

Referenced by key_cache_obtain().

struct key_entry_key* key_entry_copy ( struct key_entry_key kkey  )  [read]

Copy a key entry, malloced.

Parameters:
kkey,: the key entry key (and data pointer) to copy.
Returns:
newly allocated entry or NULL on a failure to allocate memory.

References lruhash_entry::data, key_entry_key::entry, lruhash_entry::key, lruhash_entry::lock, memdup(), key_entry_key::name, key_entry_key::namelen, packed_rrset_ptr_fixup(), packed_rrset_sizeof(), and key_entry_data::rrset_data.

Referenced by key_cache_insert().

int key_entry_isnull ( struct key_entry_key kkey  ) 

See if this is a null entry.

Does not do locking.

Parameters:
kkey,: must have data pointer set correctly
Returns:
true if it is a NULL rrset entry.

References lruhash_entry::data, key_entry_key::entry, key_entry_data::isbad, and key_entry_data::rrset_data.

Referenced by process_prime_response(), processFindKey(), processInit(), processValidate(), val_dlv_init(), and val_mark_insecure().

int key_entry_isgood ( struct key_entry_key kkey  ) 

See if this entry is good.

Does not do locking.

Parameters:
kkey,: must have data pointer set correctly
Returns:
true if it is good.

References lruhash_entry::data, key_entry_key::entry, key_entry_data::isbad, and key_entry_data::rrset_data.

Referenced by key_entry_keysize(), nsec3_prove_nameerror(), nsec3_prove_nodata(), nsec3_prove_nods(), nsec3_prove_nxornodata(), nsec3_prove_wildcard(), primeResponseToKE(), process_dnskey_response(), and process_ds_response().

int key_entry_isbad ( struct key_entry_key kkey  ) 

See if this entry is bad.

Does not do locking.

Parameters:
kkey,: must have data pointer set correctly
Returns:
true if it is bad.

References lruhash_entry::data, key_entry_key::entry, and key_entry_data::isbad.

Referenced by process_dnskey_response(), process_prime_response(), processFindKey(), processInit(), and processValidate().

struct key_entry_key* key_entry_create_null ( struct regional region,
uint8_t *  name,
size_t  namelen,
uint16_t  dclass,
uint32_t  ttl,
uint32_t  now 
) [read]

Create a null entry, in the given region.

Parameters:
region,: where to allocate
name,: the key name
namelen,: length of name
dclass,: class of key entry. (host order);
ttl,: what ttl should the key have. relative.
now,: current time (added to ttl).
Returns:
new key entry or NULL on alloc failure

References key_entry_data::isbad, key_entry_setup(), key_entry_data::rrset_data, key_entry_data::rrset_type, and key_entry_data::ttl.

Referenced by ds_response_to_ke(), primeResponseToKE(), and val_verify_new_DNSKEYs().

struct key_entry_key* key_entry_create_rrset ( struct regional region,
uint8_t *  name,
size_t  namelen,
uint16_t  dclass,
struct ub_packed_rrset_key rrset,
uint32_t  now 
) [read]

Create a key entry from an rrset, in the given region.

Parameters:
region,: where to allocate.
name,: the key name
namelen,: length of name
dclass,: class of key entry. (host order);
rrset,: data for key entry. This is copied to the region.
now,: current time (added to ttl of rrset)
Returns:
new key entry or NULL on alloc failure

References lruhash_entry::data, ub_packed_rrset_key::entry, key_entry_data::isbad, key_entry_setup(), packed_rrset_ptr_fixup(), packed_rrset_sizeof(), regional_alloc_init(), ub_packed_rrset_key::rk, key_entry_data::rrset_data, key_entry_data::rrset_type, packed_rrset_data::ttl, key_entry_data::ttl, and packed_rrset_key::type.

Referenced by ds_response_to_ke(), primeResponseToKE(), and val_verify_new_DNSKEYs().

struct key_entry_key* key_entry_create_bad ( struct regional region,
uint8_t *  name,
size_t  namelen,
uint16_t  dclass 
) [read]

Create a bad entry, in the given region.

Parameters:
region,: where to allocate
name,: the key name
namelen,: length of name
dclass,: class of key entry. (host order);
Returns:
new key entry or NULL on alloc failure

References key_entry_data::isbad, key_entry_setup(), key_entry_data::rrset_data, key_entry_data::rrset_type, and key_entry_data::ttl.

Referenced by ds_response_to_ke(), primeResponseToKE(), process_dnskey_response(), and val_verify_new_DNSKEYs().

struct ub_packed_rrset_key* key_entry_get_rrset ( struct key_entry_key kkey,
struct regional region 
) [read]

Obtain rrset from a key entry, allocated in region.

Parameters:
kkey,: key entry to convert to a rrset.
region,: where to allocate rrset
Returns:
rrset copy; if no rrset or alloc error returns NULL.

References lruhash_entry::data, key_entry_key::entry, key_entry_key::key_class, key_entry_key::name, key_entry_key::namelen, packed_rrset_ptr_fixup(), packed_rrset_sizeof(), regional_alloc(), regional_alloc_init(), key_entry_data::rrset_data, and key_entry_data::rrset_type.

Referenced by process_ds_response().

size_t key_entry_keysize ( struct key_entry_key kkey  ) 

Get keysize of the keyentry.

Parameters:
kkey,: key, must be a good key, with contents.
Returns:
size in bits of the key.

References packed_rrset_data::count, lruhash_entry::data, DNSKEY_BIT_ZSK, dnskey_get_keysize(), key_entry_key::entry, kd_get_flags(), and key_entry_isgood().

Referenced by nsec3_iteration_count_high().


Generated on Thu Mar 26 09:45:02 2009 for unbound by  doxygen 1.5.8