OpenDNSSEC-signer  1.4.7
util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 NLNet Labs. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
19  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
21  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
23  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  */
26 
32 #ifndef UTIL_UTIL_H
33 #define UTIL_UTIL_H
34 
35 #include "config.h"
36 #include "shared/status.h"
37 
38 #ifdef HAVE_SYS_TYPES_H
39 # include <sys/types.h>
40 #endif
41 #ifdef HAVE_UNISTD_H
42 # include <unistd.h>
43 #endif
44 
45 #include <ldns/ldns.h>
46 
47 #define SE_SOA_RDATA_SERIAL 2
48 #define SE_SOA_RDATA_EXPIRE 5
49 #define SE_SOA_RDATA_MINIMUM 6
50 
51 /* copycode: This define is taken from BIND9 */
52 #define DNS_SERIAL_GT(a, b) ((int)(((a) - (b)) & 0xFFFFFFFF) > 0)
53 
60 int util_is_dnssec_rr(ldns_rr* rr);
61 
69 int util_serial_gt(uint32_t serial_new, uint32_t serial_old);
70 
78 int util_soa_compare(ldns_rr* rr1, ldns_rr* rr2);
79 
88 ldns_status util_dnssec_rrs_compare(ldns_rr* rr1, ldns_rr* rr2, int* cmp);
89 
97 ldns_status util_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr);
98 
105 int util_check_pidfile(const char* pidfile);
106 
114 int util_write_pidfile(const char* pidfile, pid_t pid);
115 
123 ods_status util_rr_print(FILE* fd, const ldns_rr* rr);
124 
131 size_t util_b64_pton_calculate_size(size_t srcsize);
132 
133 #endif /* UTIL_UTIL_H */
int util_is_dnssec_rr(ldns_rr *rr)
Definition: util.c:53
enum ods_enum_status ods_status
Definition: status.h:90
ods_status util_rr_print(FILE *fd, const ldns_rr *rr)
Definition: util.c:378
int util_serial_gt(uint32_t serial_new, uint32_t serial_old)
Definition: util.c:72
ldns_status util_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr)
Definition: util.c:182
int util_write_pidfile(const char *pidfile, pid_t pid)
Definition: util.c:333
int util_soa_compare(ldns_rr *rr1, ldns_rr *rr2)
Definition: util.c:102
size_t util_b64_pton_calculate_size(size_t srcsize)
Definition: util.c:416
int util_check_pidfile(const char *pidfile)
Definition: util.c:283
ldns_status util_dnssec_rrs_compare(ldns_rr *rr1, ldns_rr *rr2, int *cmp)
Definition: util.c:140