Arnaud "Arhuman" Assad > Net-Whois-RIPE-2.005001 > Net::Whois::Generic

Download:
Net-Whois-RIPE-2.005001.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source   Latest Release: Net-Whois-RIPE-2.005004

NAME ^

Net::Whois::Generic - a pure-Perl implementation of a multi source Whois client.

SYNOPSIS ^

Net::Whois::Generic is my first attempt to unify Whois information from different sources. Historically Net::Whois::RIPE was the first written, then Net::Whois::Object was added to provide a RPSL encapsultation of the data returned from RIPE database, with an API more object oriented.

Net::Whois::Generic is a new interface designed to be more generic and to encapsulate data from various sources (RIPE, but also AFRINIC, APNIC...) The current implementation is barely a proof of concept, AFRINIC and APNIC are the only other sources implemented, but I expect to turn it into a generic/robust implementation based on the users feedback.

Usage is very similar to the Net::Whois::Object :

    my $c = Net::Whois::Generic->new( disconnected => 1, unfiltered => 1 );

    my ($org) = $c->query( 'ORG-AFNC1-AFRINIC', { type => 'organisation' } );
    # $org is a 'Net::Whois::Object::Organisation::AFRINIC' object;
    
    
    my @o = $c->query('101.0.0.0/8');
    # @o contains various Net::Whois::Object:Inetnum::APNIC, and Net::Whois::Object::Information objects

As Net::Whois::Generic started as an improvment of Net::Whois::RIPE, and have a good amount of code in common, for this reason (and some others) it is currently bundled inside the the Net::Whois::RIPE package. This might change in the future although.

METHODS ^

new( %options )

Constructor. Returns a new Net::Whois::Generic object with an open connection to the RIPE Database service of choice (defaulting to whois.ripe.net:43).

The %options hash migth contain configuration options for the RIPE Database server. Not all options provided by the RIPE Database server are suitable for this implementation, but the idea is to provide everything someone can show a use for. The options currently recognized are:

hostname (IPv4 address or DNS name. Default is whois.ripe.net)

The hostname or IP address of the service to connect to

port (integer, default is 43)

The TCP port of the service to connect to

timeout (integer, default is 5)

The time-out (in seconds) for the TCP connection.

referral (boolean, default is false)

When true, prevents the server from using the referral mechanism for domain lookups, so that the RIPE Database server returns an object in the RIPE Database with the exact match with the lookup argument, rather than doing a referral lookup.

recursive (boolean, default is false)

When set to true, prevents recursion into queried objects for personal information. This prevents lots of unsolicited objects from showing up on queries.

grouping (boolean, default is false)

When true enables object grouping in server responses. There's little utility to enable this option, as the objects will be parsed and returned on a much reasonable format most of the time. For the brave or more knowledgeable people that want to have they answers in plain text, this can help stablishing a 'good' ordering for the RPSL objects returned by a query ('good' is RIPE NCC's definition of 'good' in this case).

unfiltered (boolean, default is false)

When true enables unfiltered object output responses. This produces objects that can be presented back to the RIPE Database for updating.

types (list of valid RIPE Database object types, default is empty, meaning all types)

Restrict the RPSL object types allowed in the response to those in the list. Using this option will cause the Net::Whois::Generic object to query the RIPE Database for the available object types for validating the list. The response will be cached for speed and bandwidth.

disconnected (boolean, default is false)

Prevents the constructor from automatically opening a connection to the service specified (conneting the socket is the default behavior). When set (true), the programmer is responsible for calling connect in order to stablish a connection to the RIPE Database service desired.

hostname( [$hostname] )

Accessor to the hostname. Accepts an optional hostname, always return the current hostname.

port()

Accessor to the port. Accepts an optional port, always return the current port.

timeout()

Accessor to the timeout configuration option. Accepts an optional timeout, always return the current timeout.

referral()

Accessor to the referral configuration option. Accepts an optional referral, always return the current referral.

recursive()

Accessor to the recursive configuration option. Accepts an optional recursive, always return the current recursive.

grouping()

Accessor to the grouping configuration option. Accepts an optional grouping, always return the current grouping.

unfiltered()

Accessor to the unfiltered configuration option.

connect()

Initiates a connection with the current object's configuration.

ios()

Accessor to the IO::Select object coordinating the I/O to the IO::Socket object used by this module to communicate with the RIPE Database Server. You shouldn't use this object, but the "send()" and "query( $query_string )" methods instead.

socket()

Read-only accessor to the IO::Socket object used by this module.

send()

Sends a message to the RIPE Database server instance to which we're connected to. Dies if it cannot write, or if there's no open connection to the server.

Return true if the message could be written to the socket, false otherwise.

reconnect()

Reconnects to the server in case we lost connection.

disconnect()

Disconnects this client from the server. This renders the client useless until you call "connect()" again. This method is called by "DESTROY()" as part of an object's clean-up process.

is_connected()

Returns true if this instance is connected to the RIPE Database service configured.

DESTROY()

Net::Whois::Generic object destructor. Called by the Perl interpreter upon destruction of an instance.

_find_rir( $query_string )

Guess the associated RIR based on the query.

adapt_query( $query_string[, $rir] )

Adapt a query to set various parameter (whois server, query options...) based on the query. Takes an optional parameter $rir, to force a specific RIR to be used.

query( $query_string )

Sends a query to the server. Returns an Iterator object that will return one RPSL block at a time.

object_types()

Return a list of known object types from the RIPE Database.

RIPE currently returns 21 types (Limerik have been removed): as-block as-set aut-num domain filter-set inet6num inetnum inet-rtr irt key-cert mntner organisation peering-set person poem poetic-form role route route6 route-set rtr-set

Due to some strange mis-behaviour in the protocol (or documentation?) the RIPE Database server won't allow a keep-alive token with this query, meaning the connection will be terminated after this query.

_process_response( $response )

Process a response (error code, error message...)

AUTHOR ^

Arnaud "Arhuman" Assad, <arhuman at gmail.com>

CAVEATS ^

Update

Update of objects from database other than RIPE is not currently implemented...

Sources

Currently the only sources implemented are RIPE, AFRINIC, and APNIC.

Maturity

The Net::Whois::Generic interface is highly experimental. There are probably bugs, without any doubt missing documentation and examples but please don't hesitate to contact me to suggest corrections and improvments.

BUGS ^

Please report any bugs or feature requests to bug-net-whois-ripe at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=net-whois-ripe. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO ^

There are several tools similar to Net::Whois::Generic, I'll list some of them below and some reasons why Net::Whois::Generic exists anyway:

Net::Whois::IANA - A universal WHOIS extractor: update not possible, no RPSL parser

Net::Whois::ARIN - ARIN whois client: update not possible, only subset of ARIN objects handled

Net::Whois::Parser - Module for parsing whois information: no query handling, parser can (must?) be added

Net::Whois::RIPE - RIPE whois client: the basis for Net::Whois::Generic but only handle RIPE.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Net::Whois::Generic

You can also look for information at:

ACKNOWLEDGEMENTS ^

Thanks to Jaguar Networks which grants me time to work on this module.

COPYRIGHT & LICENSE ^

Copyright 2013 Arnaud "Arhuman" Assad, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: