OpenDNSSEC-enforcer
1.3.9
Main Page
Data Structures
Files
File List
Globals
enforcer
ksm
ksm_policy_value.c
Go to the documentation of this file.
1
/*
2
* $Id: ksm_policy_value.c 1841 2009-09-22 10:43:03Z sion $
3
*
4
* Copyright (c) 2008-2009 Nominet UK. 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
29
/*+
30
* KsmPolicyValue - Return Values of Parameters
31
*
32
* Abstract:
33
* This set of functions encapsulates the parameter collection object.
34
* It provides functions for extracting parameters - and derived
35
* parameters - from that object.
36
-*/
37
38
#include "
ksm/ksm.h
"
39
#include "
ksm/ksmdef.h
"
40
#include "
ksm/message.h
"
41
42
#define max(x,y) ((x) > (y) ? (x) : (y))
43
#define min(x,y) ((x) < (y) ? (x) : (y))
44
45
46
/*+
47
* KsmParameterXxxxx - Return Parameter Xxxx
48
*
49
* Description:
50
* Returns the value of the named parameter from the object. In some
51
* cases, these values are derived from other parameters.
52
*
53
* Arguments:
54
* KSM_PARCOLL* collection
55
* Parameter collection object.
56
*
57
* Returns:
58
* int
59
* Value of the parameter.
60
-*/
61
62
int
KsmPolicyClockskew
(
KSM_SIGNATURE_POLICY
*policy)
63
{
64
/* check the argument */
65
if
(policy == NULL) {
66
MsgLog
(
KSM_INVARG
,
"NULL policy"
);
67
return
-1;
68
}
69
return
policy->
clockskew
;
70
}
71
72
int
KsmPolicyKeyLifetime
(
KSM_KEY_POLICY
*policy)
73
{
74
/* check the argument */
75
if
(policy == NULL) {
76
MsgLog
(
KSM_INVARG
,
"NULL policy"
);
77
return
-1;
78
}
79
return
policy->
lifetime
;
80
}
81
82
int
KsmPolicyStandbyKeys
(
KSM_KEY_POLICY
*policy)
83
{
84
/* check the argument */
85
if
(policy == NULL) {
86
MsgLog
(
KSM_INVARG
,
"NULL policy"
);
87
return
-1;
88
}
89
return
policy->
overlap
;
90
}
91
92
int
KsmPolicyPropagationDelay
(
KSM_SIGNER_POLICY
*policy)
93
{
94
/* check the argument */
95
if
(policy == NULL) {
96
MsgLog
(
KSM_INVARG
,
"NULL policy"
);
97
return
-1;
98
}
99
return
policy->
propdelay
;
100
}
101
102
/*int KsmParameterSigningInterval(KSM_PARCOLL* collection)
103
//{
104
// return collection->signint;
105
}*/
106
107
int
KsmPolicySoaMin
(
KSM_SIGNER_POLICY
*policy)
108
{
109
/* check the argument */
110
if
(policy == NULL) {
111
MsgLog
(
KSM_INVARG
,
"NULL policy"
);
112
return
-1;
113
}
114
return
policy->
soamin
;
115
}
116
117
int
KsmPolicySoaTtl
(
KSM_SIGNER_POLICY
*policy)
118
{
119
/* check the argument */
120
if
(policy == NULL) {
121
MsgLog
(
KSM_INVARG
,
"NULL policy"
);
122
return
-1;
123
}
124
return
policy->
soattl
;
125
}
126
127
int
KsmPolicyKeyTtl
(
KSM_KEY_POLICY
*policy)
128
{
129
/* check the argument */
130
if
(policy == NULL) {
131
MsgLog
(
KSM_INVARG
,
"NULL policy"
);
132
return
-1;
133
}
134
return
policy->
ttl
;
135
}
136
137
/*
138
* Initial publication interval
139
*/
140
int
KsmPolicyInitialPublicationInterval
(
KSM_POLICY
*policy)
141
{
142
int
ncache;
/* Negative cache time */
143
int
pubint;
/* Publication interval */
144
145
/* check the argument */
146
if
(policy == NULL) {
147
MsgLog
(
KSM_INVARG
,
"NULL policy"
);
148
return
-1;
149
}
150
ncache =
min
(policy->
signer
->
soattl
, policy->
signer
->
soamin
);
151
pubint =
max
(policy->
zsk
->
ttl
, ncache) + policy->
signer
->
propdelay
;
152
153
return
pubint;
154
}
Generated on Sun Mar 3 2013 15:04:12 for OpenDNSSEC-enforcer by
1.8.1.2