OpenDNSSEC-signer  1.4.1
util.h
Go to the documentation of this file.
1 /*
2  * $Id: util.h 6638 2012-09-06 14:31:36Z matthijs $
3  *
4  * Copyright (c) 2009 NLNet Labs. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
34 #ifndef UTIL_UTIL_H
35 #define UTIL_UTIL_H
36 
37 #include "config.h"
38 #include "shared/status.h"
39 
40 #ifdef HAVE_SYS_TYPES_H
41 # include <sys/types.h>
42 #endif
43 #ifdef HAVE_UNISTD_H
44 # include <unistd.h>
45 #endif
46 
47 #include <ldns/ldns.h>
48 
49 #define SE_SOA_RDATA_SERIAL 2
50 #define SE_SOA_RDATA_EXPIRE 5
51 #define SE_SOA_RDATA_MINIMUM 6
52 
53 /* copycode: This define is taken from BIND9 */
54 #define DNS_SERIAL_GT(a, b) ((int)(((a) - (b)) & 0xFFFFFFFF) > 0)
55 
62 int util_is_dnssec_rr(ldns_rr* rr);
63 
71 int util_serial_gt(uint32_t serial_new, uint32_t serial_old);
72 
80 int util_soa_compare(ldns_rr* rr1, ldns_rr* rr2);
81 
90 ldns_status util_dnssec_rrs_compare(ldns_rr* rr1, ldns_rr* rr2, int* cmp);
91 
99 ldns_status util_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr);
100 
107 int util_check_pidfile(const char* pidfile);
108 
116 int util_write_pidfile(const char* pidfile, pid_t pid);
117 
125 ods_status util_rr_print(FILE* fd, const ldns_rr* rr);
126 
133 size_t util_b64_pton_calculate_size(size_t srcsize);
134 
135 #endif /* UTIL_UTIL_H */
ldns_status util_dnssec_rrs_compare(ldns_rr *rr1, ldns_rr *rr2, int *cmp)
Definition: util.c:142
size_t util_b64_pton_calculate_size(size_t srcsize)
Definition: util.c:418
enum ods_enum_status ods_status
Definition: status.h:89
ods_status util_rr_print(FILE *fd, const ldns_rr *rr)
Definition: util.c:380
int util_serial_gt(uint32_t serial_new, uint32_t serial_old)
Definition: util.c:74
int util_write_pidfile(const char *pidfile, pid_t pid)
Definition: util.c:335
ldns_status util_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr)
Definition: util.c:184
int util_check_pidfile(const char *pidfile)
Definition: util.c:285
int util_soa_compare(ldns_rr *rr1, ldns_rr *rr2)
Definition: util.c:104
int util_is_dnssec_rr(ldns_rr *rr)
Definition: util.c:55