Files
zonemaster.es/zonemaster-ldns/lib/Zonemaster/LDNS/RR.pm
Malin 8d4eaa1489 feat: add full Zonemaster stack with Docker and Spanish UI
- Clone all 5 Zonemaster component repos (LDNS, Engine, CLI, Backend, GUI)
- Dockerfile.backend: 8-stage multi-stage build LDNS→Engine→CLI→Backend
- Dockerfile.gui: Astro static build served via nginx
- docker-compose.yml: backend (internal) + frontend (port 5353)
- nginx.conf: root redirects to /es/, /api/ proxied to backend
- zonemaster-gui/config.ts: defaultLanguage set to 'es' (Spanish)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 08:19:24 +02:00

208 lines
5.1 KiB
Perl
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package Zonemaster::LDNS::RR;
use strict;
use warnings;
use Zonemaster::LDNS::RR::A;
use Zonemaster::LDNS::RR::A6;
use Zonemaster::LDNS::RR::AAAA;
use Zonemaster::LDNS::RR::AFSDB;
use Zonemaster::LDNS::RR::APL;
use Zonemaster::LDNS::RR::ATMA;
use Zonemaster::LDNS::RR::CAA;
use Zonemaster::LDNS::RR::CDNSKEY;
use Zonemaster::LDNS::RR::CDS;
use Zonemaster::LDNS::RR::CERT;
use Zonemaster::LDNS::RR::CNAME;
use Zonemaster::LDNS::RR::DHCID;
use Zonemaster::LDNS::RR::DLV;
use Zonemaster::LDNS::RR::DNAME;
use Zonemaster::LDNS::RR::DNSKEY;
use Zonemaster::LDNS::RR::DS;
use Zonemaster::LDNS::RR::EID;
use Zonemaster::LDNS::RR::EUI48;
use Zonemaster::LDNS::RR::EUI64;
use Zonemaster::LDNS::RR::GID;
use Zonemaster::LDNS::RR::GPOS;
use Zonemaster::LDNS::RR::HINFO;
use Zonemaster::LDNS::RR::HIP;
use Zonemaster::LDNS::RR::HTTPS;
use Zonemaster::LDNS::RR::IPSECKEY;
use Zonemaster::LDNS::RR::ISDN;
use Zonemaster::LDNS::RR::KEY;
use Zonemaster::LDNS::RR::KX;
use Zonemaster::LDNS::RR::L32;
use Zonemaster::LDNS::RR::L64;
use Zonemaster::LDNS::RR::LOC;
use Zonemaster::LDNS::RR::LP;
use Zonemaster::LDNS::RR::MAILA;
use Zonemaster::LDNS::RR::MAILB;
use Zonemaster::LDNS::RR::MB;
use Zonemaster::LDNS::RR::MD;
use Zonemaster::LDNS::RR::MF;
use Zonemaster::LDNS::RR::MG;
use Zonemaster::LDNS::RR::MINFO;
use Zonemaster::LDNS::RR::MR;
use Zonemaster::LDNS::RR::MX;
use Zonemaster::LDNS::RR::NAPTR;
use Zonemaster::LDNS::RR::NID;
use Zonemaster::LDNS::RR::NIMLOC;
use Zonemaster::LDNS::RR::NINFO;
use Zonemaster::LDNS::RR::NS;
use Zonemaster::LDNS::RR::NSAP;
use Zonemaster::LDNS::RR::NSEC;
use Zonemaster::LDNS::RR::NSEC3;
use Zonemaster::LDNS::RR::NSEC3PARAM;
use Zonemaster::LDNS::RR::NULL;
use Zonemaster::LDNS::RR::NXT;
use Zonemaster::LDNS::RR::PTR;
use Zonemaster::LDNS::RR::PX;
use Zonemaster::LDNS::RR::RKEY;
use Zonemaster::LDNS::RR::RP;
use Zonemaster::LDNS::RR::RRSIG;
use Zonemaster::LDNS::RR::RT;
use Zonemaster::LDNS::RR::SIG;
use Zonemaster::LDNS::RR::SINK;
use Zonemaster::LDNS::RR::SOA;
use Zonemaster::LDNS::RR::SPF;
use Zonemaster::LDNS::RR::SRV;
use Zonemaster::LDNS::RR::SSHFP;
use Zonemaster::LDNS::RR::SVCB;
use Zonemaster::LDNS::RR::TA;
use Zonemaster::LDNS::RR::TALINK;
use Zonemaster::LDNS::RR::TKEY;
use Zonemaster::LDNS::RR::TLSA;
use Zonemaster::LDNS::RR::TXT;
use Zonemaster::LDNS::RR::TYPE;
use Zonemaster::LDNS::RR::UID;
use Zonemaster::LDNS::RR::UINFO;
use Zonemaster::LDNS::RR::UNSPEC;
use Zonemaster::LDNS::RR::URI;
use Zonemaster::LDNS::RR::WKS;
use Zonemaster::LDNS::RR::X25;
use Carp;
use overload '<=>' => \&do_compare, 'cmp' => \&do_compare, '""' => \&to_string;
sub new {
my ( $class, $string ) = @_;
if ( $string ) {
return $class->new_from_string( $string );
}
else {
croak "Must provide string to create RR";
}
}
sub name {
my ( $self ) = @_;
return $self->owner;
}
sub do_compare {
my ( $self, $other, $swapped ) = @_;
return $self->compare( $other );
}
sub to_string {
my ( $self ) = @_;
return $self->string;
}
1;
=head1 NAME
Zonemaster::LDNS::RR - common baseclass for all classes representing resource records.
=head1 SYNOPSIS
my $rr = Zonemaster::LDNS::RR->new('www.iis.se IN A 91.226.36.46');
=head1 OVERLOADS
This class overloads stringify and comparisons ('""', '<=>' and 'cmp').
=head1 CLASS METHOD
=over
=item new($string)
Creates a new RR object, which is an instance of a suitable subclass of
L<Zonemaster::LDNS::RR>, given a string representing an RR in common
presentation format.
If a subclass of L<Zonemaster::LDNS::RR> exists that is suitable for the
resource records type (e.g. L<Zonemaster::LDNS::RR::AAAA>,
L<Zonemaster::LDNS::RR::TXT>, etc.), then the resulting object is an instance
of that subclass.
If no such subclass exists (e.g. when passed a resource record of an unknown
type or a type not yet supported by Zonemaster-LDNS), the resulting object is
an instance of L<Zonemaster::LDNS::RR>. The instance methods defined in this
class will still work, but there is no support for structured access to the
resource records RDATA.
=back
=head1 INSTANCE METHODS
=over
=item owner()
Returns the owner name of the RR.
=item name()
An alias of L<owner()>.
=item ttl()
Returns the ttl of the RR.
=item type()
Return the type of the RR.
=item class()
Returns the class of the RR.
=item string()
Returns a string with the RR in presentation format.
=item compare($other)
Compares two L<Zonemaster::LDNS::RR>. The TTL field is ignored, and the comparison of domain names is case insensitive.
Returns an integer, where 0 indicates equality.
=item do_compare($other)
Calls the XS C<compare> method with the arguments it needs, rather than the ones overloading gives.
=item to_string
Calls the XS C<string> method with the arguments it needs, rather than the ones overloading gives. Functionally identical to L<string()> from the
Perl level, except for being a tiny little bit slower.
=item rd_count()
The number of RDATA objects in this RR.
=item rdf($postion)
The raw data of the RDATA object in the given position. The first item is in
position 0. If an attempt is made to fetch RDATA from a position that doesn't
have any, an exception will be thrown.
=back