Permalink
Browse files

Working implementation of APNIC objects

  • Loading branch information...
arhuman committed Oct 10, 2013
1 parent 0362eea commit 1b0fd70572a26e09e0dee07164f7c00796840953
View
@@ -1,6 +1,9 @@
Revision history for net-whois-ripe
+ - Add support for APNIC objects through Net::Whois::Generic
+ - Remove duplicate code on query options
+
2.005000 2013-10-10
- Add support for generic objects (from various sources, AFRINIC being the first implemented)
through Net::Whois::Generic
View
@@ -4,50 +4,69 @@ lib/Net/Whois/Generic.pm
lib/Net/Whois/Object.pm
lib/Net/Whois/Object/AsBlock.pm
lib/Net/Whois/Object/AsBlock/AFRINIC.pm
+lib/Net/Whois/Object/AsBlock/APNIC.pm
lib/Net/Whois/Object/AsSet.pm
lib/Net/Whois/Object/AsSet/AFRINIC.pm
+lib/Net/Whois/Object/AsSet/APNIC.pm
lib/Net/Whois/Object/AutNum.pm
lib/Net/Whois/Object/AutNum/AFRINIC.pm
+lib/Net/Whois/Object/AutNum/APNIC.pm
lib/Net/Whois/Object/Domain.pm
lib/Net/Whois/Object/Domain/AFRINIC.pm
+lib/Net/Whois/Object/Domain/APNIC.pm
lib/Net/Whois/Object/FilterSet.pm
lib/Net/Whois/Object/FilterSet/AFRINIC.pm
+lib/Net/Whois/Object/FilterSet/APNIC.pm
lib/Net/Whois/Object/Inet6Num.pm
lib/Net/Whois/Object/Inet6Num/AFRINIC.pm
lib/Net/Whois/Object/Inet6Num/APNIC.pm
lib/Net/Whois/Object/InetNum.pm
lib/Net/Whois/Object/InetNum/AFRINIC.pm
+lib/Net/Whois/Object/InetNum/APNIC.pm
lib/Net/Whois/Object/InetRtr.pm
lib/Net/Whois/Object/InetRtr/AFRINIC.pm
lib/Net/Whois/Object/Information.pm
lib/Net/Whois/Object/Information/AFRINIC.pm
lib/Net/Whois/Object/Irt.pm
lib/Net/Whois/Object/Irt/AFRINIC.pm
+lib/Net/Whois/Object/Irt/APNIC.pm
lib/Net/Whois/Object/KeyCert.pm
lib/Net/Whois/Object/KeyCert/AFRINIC.pm
+lib/Net/Whois/Object/KeyCert/APNIC.pm
lib/Net/Whois/Object/Limerick.pm
lib/Net/Whois/Object/Limerick/AFRINIC.pm
lib/Net/Whois/Object/Mntner.pm
lib/Net/Whois/Object/Mntner/AFRINIC.pm
+lib/Net/Whois/Object/Mntner/APNIC.pm
lib/Net/Whois/Object/Organisation.pm
lib/Net/Whois/Object/Organisation/AFRINIC.pm
+lib/Net/Whois/Object/Organisation/APNIC.pm
lib/Net/Whois/Object/PeeringSet.pm
lib/Net/Whois/Object/PeeringSet/AFRINIC.pm
+lib/Net/Whois/Object/PeeringSet/APNIC.pm
lib/Net/Whois/Object/Person.pm
lib/Net/Whois/Object/Person/AFRINIC.pm
+lib/Net/Whois/Object/Person/APNIC.pm
lib/Net/Whois/Object/Poem.pm
+lib/Net/Whois/Object/Poem/APNIC.pm
lib/Net/Whois/Object/PoeticForm.pm
+lib/Net/Whois/Object/PoeticForm/APNIC.pm
lib/Net/Whois/Object/Response.pm
lib/Net/Whois/Object/Role.pm
lib/Net/Whois/Object/Role/AFRINIC.pm
+lib/Net/Whois/Object/Role/APNIC.pm
lib/Net/Whois/Object/Route.pm
lib/Net/Whois/Object/Route/AFRINIC.pm
+lib/Net/Whois/Object/Route/APNIC.pm
lib/Net/Whois/Object/Route6.pm
lib/Net/Whois/Object/Route6/AFRINIC.pm
+lib/Net/Whois/Object/Route6/APNIC.pm
lib/Net/Whois/Object/RouteSet.pm
lib/Net/Whois/Object/RouteSet/AFRINIC.pm
+lib/Net/Whois/Object/RouteSet/APNIC.pm
lib/Net/Whois/Object/RtrSet.pm
lib/Net/Whois/Object/RtrSet/AFRINIC.pm
+lib/Net/Whois/Object/RtrSet/APNIC.pm
lib/Net/Whois/RIPE.pm
Makefile.PL
MANIFEST
@@ -88,7 +107,9 @@ t/210-FilterSet.t
t/215-SyncUpdates.t
t/216-SyncUpdates-Signed.t
t/300-AFRINIC.t
+t/305-APNIC.t
t/boilerplate.t
t/common.pl
t/pod-coverage.t
t/pod.t
+TODO
View
1 TODO
@@ -1,3 +1,4 @@
* make abuse-c attribute mandatory by end of september
* add option to query to get unfiltered data (-B on RIPE) and check for mail on aassad-ripe
(make it default ?)
+* change hardcoded options on query to non RIPE sources (use RIPE model)
View
@@ -455,18 +455,27 @@ sub _find_rir
#
if ( ($query =~ /^(41|102|105|154|196|197)\.\d+\.\d+\.\d+/)
or ($query =~ /AFRINIC/i)
- or ($query =~ /^2c00::/))
+ or ($query =~ /^2c00::/i))
{
$rir = 'afrinic';
}
elsif ( ( $query =~ /^(23|34|50|64|64|65|66|67|68|69|70|71|72|73|74|75|76|96|97|98|9|100|104|107|108|135|136|142|147|162|166|172|173|174|184|192|198|199|204|205|206|207|208|209|216)/
- or ($query =~ /^(2001:0400|2001:1800|2001:4800:|2600|2610:0000):/)
+ or ($query =~ /^(2001:0400|2001:1800|2001:4800:|2600|2610:0000):/i)
or $query =~ /ARIN/
)
)
{
$rir = 'arin';
+ }
+ elsif ( ( $query =~ /^(10|14|27|36|39|42|49|58|59|60|61|101|103|106|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|169\.208|175|180|182|183|202|203|210|211|218|219|220|221|222|223)\.\d+\.\d+/
+ or ($query =~ /^(2001:0200|2001:0C00|2001:0E00|2001:4400|2001:8000|2001:A000|2001:B000|2400:0000|2001:0DC0|2001:0DE8|2001:0DF0|2001:07FA|2001:0DE0|2001:0DB8):/i)
+ or $query =~ /APNIC/
+ )
+ )
+ {
+ $rir = 'apnic';
+
}
else {
$rir = 'ripe';
@@ -508,7 +517,10 @@ sub adapt_query
elsif ($rir eq 'lacnic') {
$self->hostname($RIR{lacnic}{SERVER});
}
-
+ elsif ($rir eq 'apnic') {
+ $fullquery = $query;
+ $self->hostname($RIR{apnic}{SERVER});
+ }
return $fullquery;
}
@@ -536,13 +548,7 @@ sub query
}
$query = $self->adapt_query($query);
- my $parameters = "";
- $parameters .= q{ } . QUERY_KEEPALIVE if $self->keepalive;
- $parameters .= q{ } . QUERY_UNFILTERED if $self->unfiltered;
- $parameters .= q{ } . QUERY_NON_RECURSIVE unless $self->recursive;
- $parameters .= q{ } . QUERY_REFERRAL if $self->referral;
- my $fullquery = $parameters . $query;
- my $iterator = $self->__query($fullquery);
+ my $iterator = $self->__query($query);
my @objects = Net::Whois::Object->new($iterator);
@@ -0,0 +1,184 @@
+package Net::Whois::Object::AsBlock::APNIC;
+
+use base qw/Net::Whois::Object/;
+
+# whois -h whois.apnic.net -t as-block
+# % [whois.apnic.net]
+# % Whois data copyright terms http://www.apnic.net/db/dbcopyright.html
+#
+# as-block: [mandatory] [single] [primary/lookup key]
+# descr: [optional] [multiple] [ ]
+# remarks: [optional] [multiple] [ ]
+# country: [optional] [single] [ ]
+# admin-c: [mandatory] [multiple] [inverse key]
+# tech-c: [mandatory] [multiple] [inverse key]
+# org: [optional] [multiple] [inverse key]
+# notify: [optional] [multiple] [inverse key]
+# mnt-by: [mandatory] [multiple] [inverse key]
+# mnt-lower: [optional] [multiple] [inverse key]
+# changed: [mandatory] [multiple] [ ]
+# source: [mandatory] [single] [ ]
+
+% This query was served by the APNIC Whois Service version 1.68.5 (WHOIS1)
+
+__PACKAGE__->attributes( 'primary', ['as_block'] );
+__PACKAGE__->attributes( 'mandatory', [ 'as_block', 'admin_c', 'tech_c', 'mnt_by', 'changed', 'source' ] );
+__PACKAGE__->attributes( 'optional', [ 'descr', 'remarks', 'country', 'org', 'notify', 'mnt_lower' ] );
+__PACKAGE__->attributes( 'single', [ 'as_block', 'country', 'source' ] );
+__PACKAGE__->attributes( 'multiple', [ 'descr', 'remarks', 'admin_c', 'tech_c', 'org', 'notify', 'mnt_by', 'mnt_lower', 'changed' ] );
+
+=head1 NAME
+
+Net::Whois::Object::AsBlock::APNIC - an object representation of the RPSL AsBlock block
+
+=head1 DESCRIPTION
+
+An as-block object is needed to delegate a range of AS numbers to a
+given repository. This object may be used for authorisation of the
+creation of aut-num objects within the range specified by the
+"as-block:" attribute.
+
+=head1 METHODS
+
+=head2 B<new( %options )>
+
+Constructor for the Net::Whois::Object::AsBlock::APNIC class
+
+=cut
+
+sub new {
+ my ( $class, @options ) = @_;
+
+ my $self = bless {}, $class;
+ $self->_init(@options);
+
+
+ return $self;
+}
+
+=head2 B<as_block( [$as_block] )>
+
+Accessor to the as_block attribute.
+Accepts an optional as_block, always return the current as_block value.
+
+An as_block is a range of AS numbers delegated to a Regional or National Internet Registry
+(NIR).
+
+The AS numbers in the range are subsequently assigned by the registry to
+members or end-users in the region.
+Information on individual AS numbers within an as-block object are
+stored in the appropriate Internet Registry's Whois Database.
+
+=head2 B<descr( [$descr] )>
+
+Accessor to the descr attribute.
+Accepts an optional descr, always return the current descr value.
+
+Description of the Internet Registry delegated the range of AS numbers shown
+in the as-block.
+
+=head2 B<remarks( [$remarks] )>
+
+Accessor to the remarks attribute.
+Accepts an optional remarks to be added to the remarks array,
+always return the current remarks array.
+
+Information on the registry that maintains details of AS numbers assigned from
+the as-block.
+
+Also includes where to direct a whois client to find further information on
+the AS numbers.
+
+=head2 B<tech_c( [$tech_c] )>
+
+Accessor to the tech_c attribute.
+Accepts an optional tech_c to be added to the tech_c array,
+always return the current tech_c array.
+
+The NIC-handle of a technical contact 'person' or 'role' object. As more than
+one person often fulfills a role function, there may be more than one tech-c
+listed.
+
+A technical contact (tech-c) must be a person responsible for the
+day-to-day operation of the network, but does not need to be
+physically located at the site of the network.
+
+
+=head2 B<admin_c( [$admin_c])>
+
+Accessor to the admin_c attribute.
+Accepts an optional admin_c to be added to the admin_c array,
+always return the current admin_c array.
+
+The NIC-handle of an on-site contact 'person' object. As more than one person
+often fulfills a role function, there may be more than one admin-c listed.
+
+An administrative contact(admin-c) must be someone who is physically
+located at the site of the network.
+
+=head2 B<notify( [$notify] )>
+
+Accessor to the notify attribute.
+Accepts an optional value to be added notify array,
+ always return the current notify array.
+
+The email address to which notifications of changes
+to the object should be sent.
+
+=head2 B<mnt_lower( [$mnt_lower] )>
+
+Accessor to the mnt_lower attribute.
+Accepts an optional mnt_lower value to be added to the mnt_lower array,
+always return the current mnt_lower array.
+
+The identifier of a registered 'mntner' object used to authorize the creation
+of 'aut-num' objects within the range specified by the as-block.
+
+If no 'mnt-lower' is specified, the 'mnt-by' attribute is used for
+authorization.
+
+=head2 B<mnt_by( [$mnt_by] )>
+
+Accessor to the mnt_by attribute.
+Accepts an optional mnt_by value to be added to the mnt_by array,
+always return the current mnt_by array.
+
+Lists a registered 'mntner' used to authorize and authenticate changes to this
+object.
+
+When your database details are protected by a 'mntner' object, then
+only persons with access to the security information of that 'mntner'
+object will be able to change details.
+
+=head2 B<changed( [$changed] )>
+
+Accessor to the changed attribute.
+Accepts an optional changed value to be added to the changed array,
+always return the current changed array.
+
+The email address of who last updated the database object and the date it
+occurred.
+
+Every time a change is made to a database object, this attribute will show
+the email address of the person who made those changes.
+Please use the address format specified in RFC 822 - Standard for
+the Format of ARPA Internet Text Message and provide the date
+format using one of the following two formats: YYYYMMDD or YYMMDD.
+
+=head2 B<source( [$source] )>
+
+Accessor to the source attribute.
+Accepts an optional source, always return the current source.
+
+The database where the object is registered.
+
+=head2 B<org( [$org] )>
+
+Accessor to the org attribute.
+Accepts an optional org, always return the current org.
+
+The organisation entity this object is bound to.
+
+=cut
+
+1;
Oops, something went wrong.

0 comments on commit 1b0fd70

Please sign in to comment.