rr_functions.c File Reference

Go to the source code of this file.

Functions

ldns_rdfldns_rr_a_address (const ldns_rr *r)
 returns the address of a LDNS_RR_TYPE_A rr More...
 
bool ldns_rr_a_set_address (ldns_rr *r, ldns_rdf *f)
 sets the address of a LDNS_RR_TYPE_A rr More...
 
ldns_rdfldns_rr_ns_nsdname (const ldns_rr *r)
 returns the name of a LDNS_RR_TYPE_NS rr More...
 
ldns_rdfldns_rr_mx_preference (const ldns_rr *r)
 returns the mx pref. More...
 
ldns_rdfldns_rr_mx_exchange (const ldns_rr *r)
 returns the mx host of a LDNS_RR_TYPE_MX rr More...
 
ldns_rdfldns_rr_rrsig_typecovered (const ldns_rr *r)
 returns the type covered of a LDNS_RR_TYPE_RRSIG rr More...
 
bool ldns_rr_rrsig_set_typecovered (ldns_rr *r, ldns_rdf *f)
 sets the typecovered of a LDNS_RR_TYPE_RRSIG rr More...
 
ldns_rdfldns_rr_rrsig_algorithm (const ldns_rr *r)
 returns the algorithm of a LDNS_RR_TYPE_RRSIG RR More...
 
bool ldns_rr_rrsig_set_algorithm (ldns_rr *r, ldns_rdf *f)
 sets the algorithm of a LDNS_RR_TYPE_RRSIG rr More...
 
ldns_rdfldns_rr_rrsig_labels (const ldns_rr *r)
 returns the number of labels of a LDNS_RR_TYPE_RRSIG RR More...
 
bool ldns_rr_rrsig_set_labels (ldns_rr *r, ldns_rdf *f)
 sets the number of labels of a LDNS_RR_TYPE_RRSIG rr More...
 
ldns_rdfldns_rr_rrsig_origttl (const ldns_rr *r)
 returns the original TTL of a LDNS_RR_TYPE_RRSIG RR More...
 
bool ldns_rr_rrsig_set_origttl (ldns_rr *r, ldns_rdf *f)
 sets the original TTL of a LDNS_RR_TYPE_RRSIG rr More...
 
ldns_rdfldns_rr_rrsig_expiration (const ldns_rr *r)
 returns the expiration time of a LDNS_RR_TYPE_RRSIG RR More...
 
bool ldns_rr_rrsig_set_expiration (ldns_rr *r, ldns_rdf *f)
 sets the expiration date of a LDNS_RR_TYPE_RRSIG rr More...
 
ldns_rdfldns_rr_rrsig_inception (const ldns_rr *r)
 returns the inception time of a LDNS_RR_TYPE_RRSIG RR More...
 
bool ldns_rr_rrsig_set_inception (ldns_rr *r, ldns_rdf *f)
 sets the inception date of a LDNS_RR_TYPE_RRSIG rr More...
 
ldns_rdfldns_rr_rrsig_keytag (const ldns_rr *r)
 returns the keytag of a LDNS_RR_TYPE_RRSIG RR More...
 
bool ldns_rr_rrsig_set_keytag (ldns_rr *r, ldns_rdf *f)
 sets the keytag of a LDNS_RR_TYPE_RRSIG rr More...
 
ldns_rdfldns_rr_rrsig_signame (const ldns_rr *r)
 returns the signers name of a LDNS_RR_TYPE_RRSIG RR More...
 
bool ldns_rr_rrsig_set_signame (ldns_rr *r, ldns_rdf *f)
 sets the signers name of a LDNS_RR_TYPE_RRSIG rr More...
 
ldns_rdfldns_rr_rrsig_sig (const ldns_rr *r)
 returns the signature data of a LDNS_RR_TYPE_RRSIG RR More...
 
bool ldns_rr_rrsig_set_sig (ldns_rr *r, ldns_rdf *f)
 sets the signature data of a LDNS_RR_TYPE_RRSIG rr More...
 
ldns_rdfldns_rr_dnskey_flags (const ldns_rr *r)
 returns the flags of a LDNS_RR_TYPE_DNSKEY rr More...
 
bool ldns_rr_dnskey_set_flags (ldns_rr *r, ldns_rdf *f)
 sets the flags of a LDNS_RR_TYPE_DNSKEY rr More...
 
ldns_rdfldns_rr_dnskey_protocol (const ldns_rr *r)
 returns the protocol of a LDNS_RR_TYPE_DNSKEY rr More...
 
bool ldns_rr_dnskey_set_protocol (ldns_rr *r, ldns_rdf *f)
 sets the protocol of a LDNS_RR_TYPE_DNSKEY rr More...
 
ldns_rdfldns_rr_dnskey_algorithm (const ldns_rr *r)
 returns the algorithm of a LDNS_RR_TYPE_DNSKEY rr More...
 
bool ldns_rr_dnskey_set_algorithm (ldns_rr *r, ldns_rdf *f)
 sets the algorithm of a LDNS_RR_TYPE_DNSKEY rr More...
 
ldns_rdfldns_rr_dnskey_key (const ldns_rr *r)
 returns the key data of a LDNS_RR_TYPE_DNSKEY rr More...
 
bool ldns_rr_dnskey_set_key (ldns_rr *r, ldns_rdf *f)
 sets the key data of a LDNS_RR_TYPE_DNSKEY rr More...
 
size_t ldns_rr_dnskey_key_size_raw (const unsigned char *keydata, const size_t len, const ldns_algorithm alg)
 get the length of the keydata in bits More...
 
size_t ldns_rr_dnskey_key_size (const ldns_rr *key)
 get the length of the keydata in bits More...
 
uint32_t ldns_soa_serial_identity (uint32_t unused __attribute__((unused)), void *data)
 
uint32_t ldns_soa_serial_increment (uint32_t s, void *unused __attribute__((unused)))
 
uint32_t ldns_soa_serial_increment_by (uint32_t s, void *data)
 Function to be used with dns_rr_soa_increment_func_int, to increment the soa serial number with a certain amount. More...
 
uint32_t ldns_soa_serial_datecounter (uint32_t s, void *data)
 Function to be used with ldns_rr_soa_increment_func or ldns_rr_soa_increment_func_int to set the soa serial to the current date succeeded by a two digit iteration (datecounter). More...
 
uint32_t ldns_soa_serial_unixtime (uint32_t s, void *data)
 Function to be used with ldns_rr_soa_increment_func or ldns_rr_soa_increment_func_int to set the soa serial to the number of seconds since unix epoch (1-1-1970 00:00). More...
 
void ldns_rr_soa_increment (ldns_rr *soa)
 Increment the serial number of the given SOA by one. More...
 
void ldns_rr_soa_increment_func (ldns_rr *soa, ldns_soa_serial_increment_func_t f)
 Increment the serial number of the given SOA with the given function. More...
 
void ldns_rr_soa_increment_func_data (ldns_rr *soa, ldns_soa_serial_increment_func_t f, void *data)
 Increment the serial number of the given SOA with the given function passing it the given data argument. More...
 
void ldns_rr_soa_increment_func_int (ldns_rr *soa, ldns_soa_serial_increment_func_t f, int data)
 Increment the serial number of the given SOA with the given function using data as an argument for the function. More...
 

Function Documentation

◆ ldns_rr_a_address()

ldns_rdf* ldns_rr_a_address ( const ldns_rr r)

returns the address of a LDNS_RR_TYPE_A rr

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the address or NULL on failure

Definition at line 61 of file rr_functions.c.

References ldns_rr_get_type(), ldns_rr_rdf(), LDNS_RR_TYPE_A, and LDNS_RR_TYPE_AAAA.

◆ ldns_rr_a_set_address()

bool ldns_rr_a_set_address ( ldns_rr r,
ldns_rdf f 
)

sets the address of a LDNS_RR_TYPE_A rr

Parameters
[in]rthe rr to use
[in]fthe address to set
Returns
true on success, false otherwise

Definition at line 72 of file rr_functions.c.

References LDNS_FREE, ldns_rr_get_type(), ldns_rr_set_rdf(), LDNS_RR_TYPE_A, and LDNS_RR_TYPE_AAAA.

◆ ldns_rr_ns_nsdname()

ldns_rdf* ldns_rr_ns_nsdname ( const ldns_rr r)

returns the name of a LDNS_RR_TYPE_NS rr

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the name or NULL on failure

Definition at line 91 of file rr_functions.c.

◆ ldns_rr_mx_preference()

ldns_rdf* ldns_rr_mx_preference ( const ldns_rr r)

returns the mx pref.

of a LDNS_RR_TYPE_MX rr

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the preference or NULL on failure

Definition at line 98 of file rr_functions.c.

◆ ldns_rr_mx_exchange()

ldns_rdf* ldns_rr_mx_exchange ( const ldns_rr r)

returns the mx host of a LDNS_RR_TYPE_MX rr

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the name of the MX host or NULL on failure

Definition at line 104 of file rr_functions.c.

◆ ldns_rr_rrsig_typecovered()

ldns_rdf* ldns_rr_rrsig_typecovered ( const ldns_rr r)

returns the type covered of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the type covered or NULL on failure

Definition at line 111 of file rr_functions.c.

◆ ldns_rr_rrsig_set_typecovered()

bool ldns_rr_rrsig_set_typecovered ( ldns_rr r,
ldns_rdf f 
)

sets the typecovered of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe rr to use
[in]fthe typecovered to set
Returns
true on success, false otherwise

Definition at line 117 of file rr_functions.c.

◆ ldns_rr_rrsig_algorithm()

ldns_rdf* ldns_rr_rrsig_algorithm ( const ldns_rr r)

returns the algorithm of a LDNS_RR_TYPE_RRSIG RR

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the algorithm or NULL on failure

Definition at line 123 of file rr_functions.c.

◆ ldns_rr_rrsig_set_algorithm()

bool ldns_rr_rrsig_set_algorithm ( ldns_rr r,
ldns_rdf f 
)

sets the algorithm of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe rr to use
[in]fthe algorithm to set
Returns
true on success, false otherwise

Definition at line 129 of file rr_functions.c.

◆ ldns_rr_rrsig_labels()

ldns_rdf* ldns_rr_rrsig_labels ( const ldns_rr r)

returns the number of labels of a LDNS_RR_TYPE_RRSIG RR

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the number of labels or NULL on failure

Definition at line 135 of file rr_functions.c.

◆ ldns_rr_rrsig_set_labels()

bool ldns_rr_rrsig_set_labels ( ldns_rr r,
ldns_rdf f 
)

sets the number of labels of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe rr to use
[in]fthe number of labels to set
Returns
true on success, false otherwise

Definition at line 141 of file rr_functions.c.

◆ ldns_rr_rrsig_origttl()

ldns_rdf* ldns_rr_rrsig_origttl ( const ldns_rr r)

returns the original TTL of a LDNS_RR_TYPE_RRSIG RR

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the original TTL or NULL on failure

Definition at line 147 of file rr_functions.c.

◆ ldns_rr_rrsig_set_origttl()

bool ldns_rr_rrsig_set_origttl ( ldns_rr r,
ldns_rdf f 
)

sets the original TTL of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe rr to use
[in]fthe original TTL to set
Returns
true on success, false otherwise

Definition at line 153 of file rr_functions.c.

◆ ldns_rr_rrsig_expiration()

ldns_rdf* ldns_rr_rrsig_expiration ( const ldns_rr r)

returns the expiration time of a LDNS_RR_TYPE_RRSIG RR

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the expiration time or NULL on failure

Definition at line 159 of file rr_functions.c.

◆ ldns_rr_rrsig_set_expiration()

bool ldns_rr_rrsig_set_expiration ( ldns_rr r,
ldns_rdf f 
)

sets the expiration date of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe rr to use
[in]fthe expiration date to set
Returns
true on success, false otherwise

Definition at line 165 of file rr_functions.c.

◆ ldns_rr_rrsig_inception()

ldns_rdf* ldns_rr_rrsig_inception ( const ldns_rr r)

returns the inception time of a LDNS_RR_TYPE_RRSIG RR

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the inception time or NULL on failure

Definition at line 171 of file rr_functions.c.

◆ ldns_rr_rrsig_set_inception()

bool ldns_rr_rrsig_set_inception ( ldns_rr r,
ldns_rdf f 
)

sets the inception date of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe rr to use
[in]fthe inception date to set
Returns
true on success, false otherwise

Definition at line 177 of file rr_functions.c.

◆ ldns_rr_rrsig_keytag()

ldns_rdf* ldns_rr_rrsig_keytag ( const ldns_rr r)

returns the keytag of a LDNS_RR_TYPE_RRSIG RR

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the keytag or NULL on failure

Definition at line 183 of file rr_functions.c.

◆ ldns_rr_rrsig_set_keytag()

bool ldns_rr_rrsig_set_keytag ( ldns_rr r,
ldns_rdf f 
)

sets the keytag of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe rr to use
[in]fthe keytag to set
Returns
true on success, false otherwise

Definition at line 189 of file rr_functions.c.

◆ ldns_rr_rrsig_signame()

ldns_rdf* ldns_rr_rrsig_signame ( const ldns_rr r)

returns the signers name of a LDNS_RR_TYPE_RRSIG RR

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the signers name or NULL on failure

Definition at line 195 of file rr_functions.c.

◆ ldns_rr_rrsig_set_signame()

bool ldns_rr_rrsig_set_signame ( ldns_rr r,
ldns_rdf f 
)

sets the signers name of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe rr to use
[in]fthe signers name to set
Returns
true on success, false otherwise

Definition at line 201 of file rr_functions.c.

◆ ldns_rr_rrsig_sig()

ldns_rdf* ldns_rr_rrsig_sig ( const ldns_rr r)

returns the signature data of a LDNS_RR_TYPE_RRSIG RR

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the signature data or NULL on failure

Definition at line 207 of file rr_functions.c.

◆ ldns_rr_rrsig_set_sig()

bool ldns_rr_rrsig_set_sig ( ldns_rr r,
ldns_rdf f 
)

sets the signature data of a LDNS_RR_TYPE_RRSIG rr

Parameters
[in]rthe rr to use
[in]fthe signature data to set
Returns
true on success, false otherwise

Definition at line 213 of file rr_functions.c.

◆ ldns_rr_dnskey_flags()

ldns_rdf* ldns_rr_dnskey_flags ( const ldns_rr r)

returns the flags of a LDNS_RR_TYPE_DNSKEY rr

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the flags or NULL on failure

Definition at line 220 of file rr_functions.c.

◆ ldns_rr_dnskey_set_flags()

bool ldns_rr_dnskey_set_flags ( ldns_rr r,
ldns_rdf f 
)

sets the flags of a LDNS_RR_TYPE_DNSKEY rr

Parameters
[in]rthe rr to use
[in]fthe flags to set
Returns
true on success, false otherwise

Definition at line 226 of file rr_functions.c.

◆ ldns_rr_dnskey_protocol()

ldns_rdf* ldns_rr_dnskey_protocol ( const ldns_rr r)

returns the protocol of a LDNS_RR_TYPE_DNSKEY rr

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the protocol or NULL on failure

Definition at line 232 of file rr_functions.c.

◆ ldns_rr_dnskey_set_protocol()

bool ldns_rr_dnskey_set_protocol ( ldns_rr r,
ldns_rdf f 
)

sets the protocol of a LDNS_RR_TYPE_DNSKEY rr

Parameters
[in]rthe rr to use
[in]fthe protocol to set
Returns
true on success, false otherwise

Definition at line 238 of file rr_functions.c.

◆ ldns_rr_dnskey_algorithm()

ldns_rdf* ldns_rr_dnskey_algorithm ( const ldns_rr r)

returns the algorithm of a LDNS_RR_TYPE_DNSKEY rr

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the algorithm or NULL on failure

Definition at line 244 of file rr_functions.c.

◆ ldns_rr_dnskey_set_algorithm()

bool ldns_rr_dnskey_set_algorithm ( ldns_rr r,
ldns_rdf f 
)

sets the algorithm of a LDNS_RR_TYPE_DNSKEY rr

Parameters
[in]rthe rr to use
[in]fthe algorithm to set
Returns
true on success, false otherwise

Definition at line 250 of file rr_functions.c.

◆ ldns_rr_dnskey_key()

ldns_rdf* ldns_rr_dnskey_key ( const ldns_rr r)

returns the key data of a LDNS_RR_TYPE_DNSKEY rr

Parameters
[in]rthe resource record
Returns
a ldns_rdf* with the key data or NULL on failure

Definition at line 256 of file rr_functions.c.

◆ ldns_rr_dnskey_set_key()

bool ldns_rr_dnskey_set_key ( ldns_rr r,
ldns_rdf f 
)

sets the key data of a LDNS_RR_TYPE_DNSKEY rr

Parameters
[in]rthe rr to use
[in]fthe key data to set
Returns
true on success, false otherwise

Definition at line 262 of file rr_functions.c.

◆ ldns_rr_dnskey_key_size_raw()

size_t ldns_rr_dnskey_key_size_raw ( const unsigned char *  keydata,
const size_t  len,
const ldns_algorithm  alg 
)

get the length of the keydata in bits

Parameters
[in]keydatathe raw key data
[in]lenthe length of the keydata
[in]algthe cryptographic algorithm this is a key for
Returns
the keysize in bits, or 0 on error

Definition at line 268 of file rr_functions.c.

References LDNS_SIGN_DSA, LDNS_SIGN_DSA_NSEC3, LDNS_SIGN_ECC_GOST, LDNS_SIGN_ECDSAP256SHA256, LDNS_SIGN_ECDSAP384SHA384, LDNS_SIGN_ED25519, LDNS_SIGN_ED448, LDNS_SIGN_HMACMD5, LDNS_SIGN_RSAMD5, LDNS_SIGN_RSASHA1, LDNS_SIGN_RSASHA1_NSEC3, LDNS_SIGN_RSASHA256, and LDNS_SIGN_RSASHA512.

◆ ldns_rr_dnskey_key_size()

size_t ldns_rr_dnskey_key_size ( const ldns_rr key)

get the length of the keydata in bits

Parameters
[in]keythe key rr to use
Returns
the keysize in bits

Definition at line 344 of file rr_functions.c.

References ldns_rdf2native_int8(), ldns_rdf_data(), ldns_rdf_size(), ldns_rr_dnskey_algorithm(), ldns_rr_dnskey_key(), and ldns_rr_dnskey_key_size_raw().

◆ ldns_soa_serial_identity()

uint32_t ldns_soa_serial_identity ( uint32_t unused   __attribute__(unused),
void *  data 
)

Definition at line 356 of file rr_functions.c.

◆ ldns_soa_serial_increment()

uint32_t ldns_soa_serial_increment ( uint32_t  s,
void *unused   __attribute__(unused) 
)

Definition at line 361 of file rr_functions.c.

References ldns_soa_serial_increment_by().

◆ ldns_soa_serial_increment_by()

uint32_t ldns_soa_serial_increment_by ( uint32_t  s,
void *  data 
)

Function to be used with dns_rr_soa_increment_func_int, to increment the soa serial number with a certain amount.

Parameters
[in]sthe current serial number.
[in]datathe amount to add to the current serial number.

Definition at line 366 of file rr_functions.c.

◆ ldns_soa_serial_datecounter()

uint32_t ldns_soa_serial_datecounter ( uint32_t  s,
void *  data 
)

Function to be used with ldns_rr_soa_increment_func or ldns_rr_soa_increment_func_int to set the soa serial to the current date succeeded by a two digit iteration (datecounter).

When data is given (i.e. the function is called via ldns_rr_soa_increment_func_int), it is used as the current time. When the resulting serial number is smaller than the current serial number, the current serial number is increased by one.

Parameters
[in]sthe current serial number.
[in]datathe time in seconds since 1-1-1970 00:00

Definition at line 371 of file rr_functions.c.

◆ ldns_soa_serial_unixtime()

uint32_t ldns_soa_serial_unixtime ( uint32_t  s,
void *  data 
)

Function to be used with ldns_rr_soa_increment_func or ldns_rr_soa_increment_func_int to set the soa serial to the number of seconds since unix epoch (1-1-1970 00:00).

When data is given (i.e. the function is called via ldns_rr_soa_increment_func_int), it is used as the current time. When the resulting serial number is smaller than the current serial number, the current serial number is increased by one.

Parameters
[in]sthe current serial number.
[in]datathe time in seconds since 1-1-1970 00:00

Definition at line 383 of file rr_functions.c.

◆ ldns_rr_soa_increment()

void ldns_rr_soa_increment ( ldns_rr soa)

Increment the serial number of the given SOA by one.

Parameters
[in]soaThe soa rr to be incremented

Definition at line 391 of file rr_functions.c.

References ldns_rr_soa_increment_func_data(), and ldns_soa_serial_increment().

◆ ldns_rr_soa_increment_func()

void ldns_rr_soa_increment_func ( ldns_rr soa,
ldns_soa_serial_increment_func_t  f 
)

Increment the serial number of the given SOA with the given function.

Included functions to be used here are: ldns_rr_soa_increment, ldns_soa_serial_unixtime and ldns_soa_serial_datecounter.

Parameters
[in]soaThe soa rr to be incremented
[in]fthe function to use to increment the soa rr.

Definition at line 397 of file rr_functions.c.

References ldns_rr_soa_increment_func_data().

◆ ldns_rr_soa_increment_func_data()

void ldns_rr_soa_increment_func_data ( ldns_rr soa,
ldns_soa_serial_increment_func_t  f,
void *  data 
)

Increment the serial number of the given SOA with the given function passing it the given data argument.

Parameters
[in]soaThe soa rr to be incremented
[in]fthe function to use to increment the soa rr.
[in]datathis argument will be passed to f as the second argument.

Definition at line 403 of file rr_functions.c.

References LDNS_FREE, ldns_native2rdf_int32(), ldns_rdf2native_int32(), LDNS_RDF_TYPE_INT32, ldns_rr_get_type(), ldns_rr_rdf(), ldns_rr_set_rdf(), and LDNS_RR_TYPE_SOA.

◆ ldns_rr_soa_increment_func_int()

void ldns_rr_soa_increment_func_int ( ldns_rr soa,
ldns_soa_serial_increment_func_t  f,
int  data 
)

Increment the serial number of the given SOA with the given function using data as an argument for the function.

Included functions to be used here are: ldns_soa_serial_identity, ldns_rr_soa_increment_by, ldns_soa_serial_unixtime and ldns_soa_serial_datecounter.

Parameters
[in]soaThe soa rr to be incremented
[in]fthe function to use to increment the soa rr.
[in]datathis argument will be passed to f as the second argument (by casting it to void*).

Definition at line 426 of file rr_functions.c.

References ldns_rr_soa_increment_func_data().