1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
package DNS::LDNS::DNSSecZone;
use 5.008008;
use strict;
use warnings;
use DNS::LDNS ':all';
our $VERSION = '0.52';
sub new {
my ($class, %args) = @_;
my $line_nr;
my $status = &LDNS_STATUS_OK;
my $zone;
my $file;
if ($args{filename}) {
unless (open FILE, $args{filename}) {
$DNS::LDNS::last_status = &LDNS_STATUS_FILE_ERR;
$DNS::LDNS::line_nr = 0;
return;
}
$file = \*FILE;
}
elsif ($args{file}) {
$file = $args{file};
}
if ($file) {
$zone = _new_from_file($file,
$args{origin},
$args{ttl} || 0,
$args{class} || 0,
$status, $line_nr);
}
else {
$zone = _new();
}
if ($args{filename}) {
close $file;
}
$DNS::LDNS::last_status = $status;
$DNS::LDNS::line_nr = $line_nr;
if (!defined $zone) {
return;
}
return $zone;
}
sub soa {
my $self = shift;
return DNS::LDNS::GC::own($self->_soa, $self);
}
sub names {
my $self = shift;
return DNS::LDNS::GC::own($self->_names, $self);
}
sub find_rrset {
my ($self, $name, $type) = @_;
return DNS::LDNS::GC::own($self->_find_rrset($name, $type), $self);
}
sub add_rr {
my ($self, $rr) = @_;
# Set a copy of the rr in case it is already owned
my $s = _add_rr($self, my $copy = $rr->clone);
$DNS::LDNS::last_status = $s;
DNS::LDNS::GC::own($copy, $self);
return $s;
}
sub add_empty_nonterminals {
my $self = shift;
my $s = _add_empty_nonterminals($self);
$DNS::LDNS::last_status = $s;
return $s;
}
sub mark_glue {
my $self = shift;
my $s = _mark_glue($self);
$DNS::LDNS::last_status = $s;
return $s;
}
sub sign {
my ($self, $keylist, $policy, $flags) = @_;
my $s = _sign($self, $keylist, $policy, $flags);
$DNS::LDNS::last_status = $s;
return $s;
}
sub sign_nsec3 {
my ($self, $keylist, $policy, $algorithm, $flags, $iterations, $salt,
$signflags) = @_;
my $s = _sign_nsec3($self, $keylist, $policy, $algorithm, $flags,
$iterations, $salt, $signflags);
$DNS::LDNS::last_status = $s;
return $s;
}
sub to_string {
return "DNS::LDNS::DNSSecZone::to_string is not yet implemented";
}
sub DESTROY {
DNS::LDNS::GC::free($_[0]);
}
1;
__END__
=head1 NAME
DNS::LDNS::DNSSecZone - Zone with dnssec data
=head1 SYNOPSIS
use DNS::LDNS ':all'
my z = new DNS::LDNS::DNSSecZone(
filename => '/path/to/myzone',
origin => new DNS::LDNS::RData(LDNS_RDF_TYPE_DNAME, 'myzone'), #optional
ttl => 3600, #optional
class => LDNS_RR_CLASS_, #optional
)
my z = new DNS::LDNS::DNSSecZone(
file => \*FILE,
origin => ..., ttl => ..., class => ...
)
my z = new DNS::LDNS::DNSSecZone
rr = z->soa
rbtree = z->names
rrsets = z->find_rrset
z->add_rr(rr)
z->create_from_zone(zone)
z->add_empty_nonterminals
z->sign(keylist, policy)
z->sign_nsec3(keylist, policy, algorithm, flags, iterations, salt)
z->create_nsecs
z->create_nsec3s(algorithm, flags, iterations, salt)
z->create_rrsigs(key_list, policy, flags)
=head1 TODO
z->to_string
=head1 SEE ALSO
http://www.nlnetlabs.nl/projects/ldns
=head1 AUTHOR
Erik Pihl Ostlyngen, E<lt>erik.ostlyngen@uninett.noE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2013 by UNINETT Norid AS
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.14.2 or,
at your option, any later version of Perl 5 you may have available.
=cut
|