1package Net::DNS::RR::CAA; 2 3use strict; 4use warnings; 5our $VERSION = (qw$Id: CAA.pm 1814 2020-10-14 21:49:16Z willem $)[2]; 6 7use base qw(Net::DNS::RR); 8 9 10=head1 NAME 11 12Net::DNS::RR::CAA - DNS CAA resource record 13 14=cut 15 16use integer; 17 18use Net::DNS::Text; 19 20 21sub _decode_rdata { ## decode rdata from wire-format octet string 22 my $self = shift; 23 my ( $data, $offset ) = @_; 24 25 my $limit = $offset + $self->{rdlength}; 26 $self->{flags} = unpack "\@$offset C", $$data; 27 ( $self->{tag}, $offset ) = Net::DNS::Text->decode( $data, $offset + 1 ); 28 $self->{value} = Net::DNS::Text->decode( $data, $offset, $limit - $offset ); 29 return; 30} 31 32 33sub _encode_rdata { ## encode rdata as wire-format octet string 34 my $self = shift; 35 36 return pack 'C a* a*', $self->flags, $self->{tag}->encode, $self->{value}->raw; 37} 38 39 40sub _format_rdata { ## format rdata portion of RR string. 41 my $self = shift; 42 43 my @rdata = ( $self->flags, $self->{tag}->string, $self->{value}->string ); 44 return @rdata; 45} 46 47 48sub _parse_rdata { ## populate RR from rdata in argument list 49 my $self = shift; 50 51 $self->flags(shift); 52 $self->tag( lc shift ); 53 $self->value(shift); 54 return; 55} 56 57 58sub _defaults { ## specify RR attribute default values 59 my $self = shift; 60 61 $self->flags(0); 62 return; 63} 64 65 66sub flags { 67 my $self = shift; 68 69 $self->{flags} = 0 + shift if scalar @_; 70 return $self->{flags} || 0; 71} 72 73 74sub critical { 75 my $self = shift; 76 if ( scalar @_ ) { 77 for ( $self->{flags} ) { 78 $_ = 0x0080 | ( $_ || 0 ); 79 $_ ^= 0x0080 unless shift; 80 } 81 } 82 return 0x0080 & ( $self->{flags} || 0 ); 83} 84 85 86sub tag { 87 my $self = shift; 88 89 $self->{tag} = Net::DNS::Text->new(shift) if scalar @_; 90 return $self->{tag} ? $self->{tag}->value : undef; 91} 92 93 94sub value { 95 my $self = shift; 96 97 $self->{value} = Net::DNS::Text->new(shift) if scalar @_; 98 return $self->{value} ? $self->{value}->value : undef; 99} 100 101 1021; 103__END__ 104 105 106=head1 SYNOPSIS 107 108 use Net::DNS; 109 $rr = Net::DNS::RR->new('name IN CAA flags tag value'); 110 111=head1 DESCRIPTION 112 113Class for Certification Authority Authorization (CAA) DNS resource records. 114 115=head1 METHODS 116 117The available methods are those inherited from the base class augmented 118by the type-specific methods defined in this package. 119 120Use of undocumented package features or direct access to internal data 121structures is discouraged and could result in program termination or 122other unpredictable behaviour. 123 124 125=head2 flags 126 127 $flags = $rr->flags; 128 $rr->flags( $flags ); 129 130Unsigned 8-bit number representing Boolean flags. 131 132=over 4 133 134=item critical 135 136 $rr->critical(1); 137 138 if ( $rr->critical ) { 139 ... 140 } 141 142Issuer critical flag. 143 144=back 145 146=head2 tag 147 148 $tag = $rr->tag; 149 $rr->tag( $tag ); 150 151The property identifier, a sequence of ASCII characters. 152 153Tag values may contain ASCII characters a-z, hyphen and 0-9. 154Tag values should not contain any other characters. 155Matching of tag values is not case sensitive. 156 157=head2 value 158 159 $value = $rr->value; 160 $rr->value( $value ); 161 162A sequence of octets representing the property value. 163Property values are encoded as binary values and may employ 164sub-formats. 165 166 167=head1 COPYRIGHT 168 169Copyright (c)2013,2015 Dick Franks 170 171All rights reserved. 172 173Package template (c)2009,2012 O.M.Kolkman and R.W.Franks. 174 175 176=head1 LICENSE 177 178Permission to use, copy, modify, and distribute this software and its 179documentation for any purpose and without fee is hereby granted, provided 180that the above copyright notice appear in all copies and that both that 181copyright notice and this permission notice appear in supporting 182documentation, and that the name of the author not be used in advertising 183or publicity pertaining to distribution of the software without specific 184prior written permission. 185 186THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 187IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 188FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 189THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 190LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 191FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 192DEALINGS IN THE SOFTWARE. 193 194 195=head1 SEE ALSO 196 197L<perl>, L<Net::DNS>, L<Net::DNS::RR>, RFC8659 198 199=cut 200