1package Net::DNS::Check::Test::soa_refresh_range;
2
3use strict;
4use vars qw(@ISA $VERSION);
5
6@ISA     = qw(Net::DNS::Check::Test);
7
8
9sub new {
10   	my ($class) 	= shift;
11
12	my ($self) = bless {}, $class;
13
14	if ( @_ ) {
15		$self->_process_args(@_);
16	}
17
18	$self->test();
19
20	return $self;
21}
22
23
24sub test()
25{
26	my ($self) = shift;
27
28	return unless ( $self->{config} );
29
30	my $soa_min_refresh = $self->{config}->soa_min_refresh();
31	my $soa_max_refresh = $self->{config}->soa_max_refresh();
32
33	my $test_status = 1;
34	my $test_detail = {};
35
36    foreach my $nsquery ( @{$self->{nsquery}} ) {
37        my $soa_refresh = scalar $nsquery->soa_refresh();
38		my $ns_name	= $nsquery->ns_name();
39
40		$test_detail->{$ns_name}->{desc} 	= $soa_refresh;
41
42		if ($soa_min_refresh > 0 && $soa_refresh < $soa_min_refresh ) {
43			$test_status = 0;
44			$test_detail->{$ns_name}->{status} 	= 0;
45		} elsif ( $soa_max_refresh > 0 && $soa_refresh > $soa_max_refresh ) {
46			$test_status = 0;
47			$test_detail->{$ns_name}->{status} 	= 0;
48		} else {
49			$test_detail->{$ns_name}->{status} 	= 1;
50		}
51	}
52
53	$self->{test_status} = $test_status;
54	$self->{test_detail} = $test_detail;
55
56	return $test_status;
57}
58
591;
60
61__END__
62
63=head1 NAME
64
65Net::DNS::Check::Test::soa_refresh_range - Check if the refresh time in the SOA RR is within the range set in the configuration object
66
67=head1 SYNOPSIS
68
69C<use Net::DNS::Check::Test::soa_refresh_range>;
70
71=head1 DESCRIPTION
72
73Check if the refresh time in the SOA RR is within the range set in the configuration object.
74
75=head1 METHODS
76
77=head1 COPYRIGHT
78
79Copyright (c) 2005 Lorenzo Luconi Trombacchi  - IIT-CNR
80
81All rights reserved.  This program is free software; you may redistribute
82it and/or modify it under the same terms as Perl itself.
83
84=head1 SEE ALSO
85
86L<perl(1)>
87
88=cut
89
90