OpenDNSSEC-signer  1.4.8.2
Macros | Functions
util.h File Reference
#include "config.h"
#include "shared/status.h"
#include <ldns/ldns.h>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SE_SOA_RDATA_SERIAL   2
 
#define SE_SOA_RDATA_EXPIRE   5
 
#define SE_SOA_RDATA_MINIMUM   6
 
#define DNS_SERIAL_GT(a, b)   ((int)(((a) - (b)) & 0xFFFFFFFF) > 0)
 

Functions

int util_is_dnssec_rr (ldns_rr *rr)
 
int util_serial_gt (uint32_t serial_new, uint32_t serial_old)
 
int util_soa_compare (ldns_rr *rr1, ldns_rr *rr2)
 
ldns_status util_dnssec_rrs_compare (ldns_rr *rr1, ldns_rr *rr2, int *cmp)
 
ldns_status util_dnssec_rrs_add_rr (ldns_dnssec_rrs *rrs, ldns_rr *rr)
 
int util_check_pidfile (const char *pidfile)
 
int util_write_pidfile (const char *pidfile, pid_t pid)
 
ods_status util_rr_print (FILE *fd, const ldns_rr *rr)
 
size_t util_b64_pton_calculate_size (size_t srcsize)
 

Macro Definition Documentation

#define DNS_SERIAL_GT (   a,
 
)    ((int)(((a) - (b)) & 0xFFFFFFFF) > 0)

Definition at line 52 of file util.h.

Referenced by util_serial_gt().

#define SE_SOA_RDATA_EXPIRE   5

Definition at line 48 of file util.h.

Referenced by axfr(), ixfr(), and soa_request().

#define SE_SOA_RDATA_MINIMUM   6

Definition at line 49 of file util.h.

Referenced by util_soa_compare_rdata().

#define SE_SOA_RDATA_SERIAL   2

Utility tools.

Definition at line 47 of file util.h.

Referenced by backup_read_ixfr(), ixfr(), util_soa_compare_rdata(), and zone_update_serial().

Function Documentation

size_t util_b64_pton_calculate_size ( size_t  srcsize)

Calculates the size needed to store the result of b64_pton.

Parameters
[in]lenstrlen
Returns
size of b64_pton

Calculates the size needed to store the result of b64_pton.

Definition at line 416 of file util.c.

Referenced by tsig_key_create().

int util_check_pidfile ( const char *  pidfile)

Check process id file.

Parameters
[in]pidfilepid filename
Returns
int status (0 if process id in pidfile is running)

Check process id file.

If the file exists then either we didn't shutdown cleanly or a signer daemon is already running: in either case shutdown.

The pidfile exists already

Consider stale pidfile

Consider state pidfile

All good, carry on

Definition at line 283 of file util.c.

References ods_log_crit(), ods_log_error(), and ods_log_warning().

Referenced by engine_start().

ldns_status util_dnssec_rrs_add_rr ( ldns_dnssec_rrs *  rrs,
ldns_rr *  rr 
)

A more efficient ldns_dnssec_rrs_add_rr(), get rid of ldns_rr_compare().

Parameters
[in]rrsRRset
[in]rrto add
Returns
ldns_status status

A more efficient ldns_dnssec_rrs_add_rr(), get rid of ldns_rr_compare().

Definition at line 182 of file util.c.

References ods_log_warning(), util_dnssec_rrs_add_rr(), and util_dnssec_rrs_compare().

Referenced by util_dnssec_rrs_add_rr().

ldns_status util_dnssec_rrs_compare ( ldns_rr *  rr1,
ldns_rr *  rr2,
int *  cmp 
)

Compare RRs only on RDATA.

Parameters
[in]rr1RR
[in]rr2another RR
[out]cmpcompare value
Returns
status compare status

Compare RRs only on RDATA.

Definition at line 140 of file util.c.

Referenced by rrset_lookup_rr(), and util_dnssec_rrs_add_rr().

int util_is_dnssec_rr ( ldns_rr *  rr)

Check if a RR is a DNSSEC RR (RRSIG, NSEC, NSEC3 or NSEC3PARAMS).

Parameters
[in]rrRR
Returns
int 1 on true, 0 on false

Check if a RR is a DNSSEC RR (RRSIG, NSEC, NSEC3 or NSEC3PARAMS).

Definition at line 53 of file util.c.

ods_status util_rr_print ( FILE *  fd,
const ldns_rr *  rr 
)

Print an LDNS RR, check status.

Parameters
[in]fdfile descriptor
[in]rrRR
Returns
ods_status status

Print an LDNS RR, check status.

Definition at line 378 of file util.c.

References ODS_STATUS_ASSERT_ERR, ODS_STATUS_FWRITE_ERR, ODS_STATUS_MALLOC_ERR, and ODS_STATUS_OK.

Referenced by nsec3params_backup(), and rrset_print().

int util_serial_gt ( uint32_t  serial_new,
uint32_t  serial_old 
)

Compare SERIALs.

Parameters
serial_newnew SERIAL value
serial_oldold SERIAL value
Returns
int 0 if the new SERIAL <= old SERIAL, non-zero otherwise

Compare SERIALs.

Definition at line 72 of file util.c.

References DNS_SERIAL_GT.

Referenced by ixfr(), and namedb_update_serial().

int util_soa_compare ( ldns_rr *  rr1,
ldns_rr *  rr2 
)

Compare RRs, ignore SOA SERIAL.

Parameters
[in]rr1RR
[in]rr2another RR
Returns
int 0 if equal SOA RRs, 1 otherwise

Compare SOA RRs.

Definition at line 102 of file util.c.

References util_soa_compare_rdata().

int util_write_pidfile ( const char *  pidfile,
pid_t  pid 
)

Write process id to file.

Parameters
[in]pidfilepid filename
[in]pidprocess id
Returns
int status

Write process id to file.

Definition at line 333 of file util.c.

References ods_fclose(), ods_fopen(), ods_log_assert, ods_log_debug(), and ods_log_error().