OpenDNSSEC-enforcer
1.4.5
Main Page
Data Structures
Files
File List
Globals
enforcer
ksm
ksm_parameter_value.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008-2009 Nominet UK. 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
27
/*+
28
* KsmParameterValue - Return Values of Parameters
29
*
30
* Abstract:
31
* This set of functions encapsulates the parameter collection object.
32
* It provides functions for extracting parameters - and derived
33
* parameters - from that object.
34
-*/
35
36
#include "
ksm/ksm.h
"
37
#include "
ksm/ksmdef.h
"
38
#include "
ksm/message.h
"
39
40
#define max(x,y) ((x) > (y) ? (x) : (y))
41
#define min(x,y) ((x) < (y) ? (x) : (y))
42
43
44
/*+
45
* KsmParameterXxxxx - Return Parameter Xxxx
46
*
47
* Description:
48
* Returns the value of the named parameter from the object. In some
49
* cases, these values are derived from other parameters.
50
*
51
* Arguments:
52
* KSM_PARCOLL* collection
53
* Parameter collection object.
54
*
55
* Returns:
56
* int
57
* Value of the parameter.
58
-*/
59
60
int
KsmParameterClockskew
(
KSM_PARCOLL
* collection)
61
{
62
/* check the argument */
63
if
(collection == NULL) {
64
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
65
return
-1;
66
}
67
return
collection->
clockskew
;
68
}
69
70
int
KsmParameterKskLifetime
(
KSM_PARCOLL
* collection)
71
{
72
/* check the argument */
73
if
(collection == NULL) {
74
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
75
return
-1;
76
}
77
return
collection->
ksklife
;
78
}
79
80
int
KsmParameterStandbyKSKeys
(
KSM_PARCOLL
* collection)
81
{
82
/* check the argument */
83
if
(collection == NULL) {
84
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
85
return
-1;
86
}
87
return
collection->
standbyksks
;
88
}
89
90
int
KsmParameterStandbyZSKeys
(
KSM_PARCOLL
* collection)
91
{
92
/* check the argument */
93
if
(collection == NULL) {
94
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
95
return
-1;
96
}
97
return
collection->
standbyzsks
;
98
}
99
100
int
KsmParameterPropagationDelay
(
KSM_PARCOLL
* collection)
101
{
102
/* check the argument */
103
if
(collection == NULL) {
104
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
105
return
-1;
106
}
107
return
collection->
propdelay
;
108
}
109
110
int
KsmParameterSigningInterval
(
KSM_PARCOLL
* collection)
111
{
112
/* check the argument */
113
if
(collection == NULL) {
114
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
115
return
-1;
116
}
117
return
collection->
signint
;
118
}
119
120
int
KsmParameterSoaMin
(
KSM_PARCOLL
* collection)
121
{
122
/* check the argument */
123
if
(collection == NULL) {
124
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
125
return
-1;
126
}
127
return
collection->
soamin
;
128
}
129
130
int
KsmParameterSoaTtl
(
KSM_PARCOLL
* collection)
131
{
132
/* check the argument */
133
if
(collection == NULL) {
134
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
135
return
-1;
136
}
137
return
collection->
soattl
;
138
}
139
140
int
KsmParameterZskLifetime
(
KSM_PARCOLL
* collection)
141
{
142
/* check the argument */
143
if
(collection == NULL) {
144
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
145
return
-1;
146
}
147
return
collection->
zsklife
;
148
}
149
150
int
KsmParameterZskTtl
(
KSM_PARCOLL
* collection)
151
{
152
/* check the argument */
153
if
(collection == NULL) {
154
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
155
return
-1;
156
}
157
return
collection->
zskttl
;
158
}
159
160
int
KsmParameterKskTtl
(
KSM_PARCOLL
* collection)
161
{
162
/* check the argument */
163
if
(collection == NULL) {
164
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
165
return
-1;
166
}
167
return
collection->
kskttl
;
168
}
169
170
int
KsmParameterKskPropagationDelay
(
KSM_PARCOLL
* collection)
171
{
172
/* check the argument */
173
if
(collection == NULL) {
174
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
175
return
-1;
176
}
177
return
collection->
kskpropdelay
;
178
}
179
180
int
KsmParameterRegistrationDelay
(
KSM_PARCOLL
* collection)
181
{
182
/* check the argument */
183
if
(collection == NULL) {
184
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
185
return
-1;
186
}
187
return
collection->
regdelay
;
188
}
189
190
int
KsmParameterPubSafety
(
KSM_PARCOLL
* collection)
191
{
192
/* check the argument */
193
if
(collection == NULL) {
194
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
195
return
-1;
196
}
197
return
collection->
pub_safety
;
198
}
199
200
int
KsmParameterRetSafety
(
KSM_PARCOLL
* collection)
201
{
202
/* check the argument */
203
if
(collection == NULL) {
204
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
205
return
-1;
206
}
207
return
collection->
ret_safety
;
208
}
209
210
/*
211
* Initial publication interval
212
*
213
* Make sure that you add "publish safety margin" for "real world" use
214
*/
215
int
KsmParameterInitialPublicationInterval
(
KSM_PARCOLL
* collection)
216
{
217
int
ncache;
/* Negative cache time */
218
int
pubint;
/* Publication interval */
219
/* check the argument */
220
if
(collection == NULL) {
221
MsgLog
(
KSM_INVARG
,
"NULL collection"
);
222
return
-1;
223
}
224
225
ncache =
min
(
KsmParameterSoaTtl
(collection),
226
KsmParameterSoaMin
(collection));
227
pubint =
max
(
KsmParameterZskTtl
(collection), ncache) +
228
KsmParameterPropagationDelay
(collection);
229
230
return
pubint;
231
}
Generated on Tue Jul 22 2014 00:37:50 for OpenDNSSEC-enforcer by
1.8.1.2