Subject: | IPv6 routes by origin patch |
Date: | Wed, 29 Jul 2009 19:34:06 -0700 |
To: | bug-Net-IRR [...] rt.cpan.org |
From: | Greg Skinner <gds [...] gds.best.vwh.net> |
Perl version v5.8.8 built for i386-openbsd
Unix version OpenBSD 4.3 GENERIC#0 i386
Net-IRR-0.06 distribution
The following patch allows one to query IPv6 routes by origin from RADB. I
also included some spelling corrections. It is possible to implement this
functionality by passing additional arguments to get_routes_by_origin. If you
think that's a better idea, let me know. Otherwise, please include this in the
next release of Net::IRR. Thanks.
*** IRR4.pm Wed Aug 11 10:19:35 2004
--- IRR6.pm Wed Jul 29 19:05:29 2009
***************
*** 52,57 ****
--- 52,68 ----
return ();
}
+ sub get_ipv6_routes_by_origin {
+ my ($self, $as) = @_;
+ croak 'usage: $whois->get_ipv6_routes_by_origin( $as_number )' unless @_ == 2;
+ $as = 'as'.$as unless $as =~ /^as/i;
+ $self->{tcp}->send("!6${as}\n");
+ if (my $data = $self->_response()) {
+ return wantarray ? split(" ", $data) : $data;
+ }
+ return ();
+ }
+
# RIPE-181 Only
sub get_routes_by_community {
my ($self, $community) = @_;
***************
*** 225,231 ****
This module provides an object oriented perl interface to the Internet Route Registry. The interface uses the RIPE/RPSL Tool Query Language as defined in Appendix B of the IRRd User Guide. The guide can be found at http://www.irrd.net/, however an understanding of the query language is not required to use this module.
! Net::IRR supports IRRd's multiple-command mode. Multiple-command mode is good for intensive queries since only one TCP connection needs to be made for multiple queries. The interface also allows for additional queries that aren't supported by standard UNIX I<whois> utitilies.
Hopefully this module will stimulate development of new Route Registry tools written in Perl. An example of Route Registry tools can be found by googling for RAToolset which is now known as the IRRToolset. The RAToolset was originally developed by ISI, http://www.isi.edu/, and is now maintained by RIPE, http://www.ripe.net/.
--- 236,242 ----
This module provides an object oriented perl interface to the Internet Route Registry. The interface uses the RIPE/RPSL Tool Query Language as defined in Appendix B of the IRRd User Guide. The guide can be found at http://www.irrd.net/, however an understanding of the query language is not required to use this module.
! Net::IRR supports IRRd's multiple-command mode. Multiple-command mode is good for intensive queries since only one TCP connection needs to be made for multiple queries. The interface also allows for additional queries that aren't supported by standard UNIX I<whois> utilities.
Hopefully this module will stimulate development of new Route Registry tools written in Perl. An example of Route Registry tools can be found by googling for RAToolset which is now known as the IRRToolset. The RAToolset was originally developed by ISI, http://www.isi.edu/, and is now maintained by RIPE, http://www.ripe.net/.
***************
*** 247,269 ****
=item $whois->get_routes_by_origin('AS5650')
! Get routes with a specified origin AS. This method takes an autonomous system number and returns the set of routes it originates. Upon success this method returns a list of routes in list context or a string of space seperated routes. undef is returned upon failure.
=item $whois->get_routes_by_community($community_name)
! This method is for RIPE-181 only. It is not supported by RPSL. This method takes a community object name and returns the set of routes it originates. Upon success this method returns a list of routes in list context or a string of space seperated routes. undef is returned upon failure.
=item $whois->get_sync_info()
! This method provides database syncronization information. This makes it possible to view the mirror status of a database. This method optionally takes the name of a database such as RADB or ELI. If no argument is given the method will return information about all databases originating from and mirrored by the registry server. If the optional argument is given the database specified will be checked and it's status returned. This method returns undef if no database exists or if access is denied.
=item $whois->get_as_set("AS-ELI", 1)
! This method takes an AS-SET object name and returns the ASNs registered for the AS-SET object. The method takes an optional second argument which enables AS-SET key expasion since an AS-SET can contain both ASNs and AS-SET keys. undef is returned upon failure.
=item $whois->get_route_set("ROUTES-ELI", 1)
! This method takes an ROUTE-SET object name and returns the ROUTEs registered for the ROUTE-SET object. The method takes an optional second argument which enables ROUTE-SET key expasion since a ROUTE-SET can contain both ROUTEs and ROUTE-SET keys. undef is returned upon failure.
=item $whois->match('aut-num', 'AS5650'); - get RPSL objects registered in the database
--- 258,284 ----
=item $whois->get_routes_by_origin('AS5650')
! Get routes with a specified origin AS. This method takes an autonomous system number and returns the set of routes it originates. Upon success this method returns a list of routes in list context or a string of space separated routes. undef is returned upon failure.
+ =item $whois->get_ipv6_routes_by_origin('AS5650')
+
+ Same as $whois->get_routes_by_origin(), but returns IPv6 instead of IPv4 routes.
+
=item $whois->get_routes_by_community($community_name)
! This method is for RIPE-181 only. It is not supported by RPSL. This method takes a community object name and returns the set of routes it originates. Upon success this method returns a list of routes in list context or a string of space separated routes. undef is returned upon failure.
=item $whois->get_sync_info()
! This method provides database synchronization information. This makes it possible to view the mirror status of a database. This method optionally takes the name of a database such as RADB or ELI. If no argument is given the method will return information about all databases originating from and mirrored by the registry server. If the optional argument is given the database specified will be checked and it's status returned. This method returns undef if no database exists or if access is denied.
=item $whois->get_as_set("AS-ELI", 1)
! This method takes an AS-SET object name and returns the ASNs registered for the AS-SET object. The method takes an optional second argument which enables AS-SET key expansion since an AS-SET can contain both ASNs and AS-SET keys. undef is returned upon failure.
=item $whois->get_route_set("ROUTES-ELI", 1)
! This method takes an ROUTE-SET object name and returns the ROUTEs registered for the ROUTE-SET object. The method takes an optional second argument which enables ROUTE-SET key expansion since a ROUTE-SET can contain both ROUTEs and ROUTE-SET keys. undef is returned upon failure.
=item $whois->match('aut-num', 'AS5650'); - get RPSL objects registered in the database
***************
*** 287,293 ****
=item $whois->update($database, 'ADD', $rpsl_rr_object)
! This method is used to add or delete a database object. This method takes three arguments. The first argument is the database to update. The second arguemnt is the action which can be either "ADD" or "DEL". The third and final required arguement is a route object in RPSL format.
=item $whois->error()
--- 302,308 ----
=item $whois->update($database, 'ADD', $rpsl_rr_object)
! This method is used to add or delete a database object. This method takes three arguments. The first argument is the database to update. The second argument is the action which can be either "ADD" or "DEL". The third and final required argument is a route object in RPSL format.
=item $whois->error()