NAME
Net::Netid - obtain basic IP host identfications from Domain Name Servers
SYNOPSIS
use Net::Netid qw(netid ipid net2dot dot2net net2num ip2dot clean_ip_str
clean_netid clean_ipid clean_ip2dot);
\%results = Net::Netid->netid($str, \%options)
\%results = Net::Netid->netid($str, @options)
\%results = Net::Netid->netid($str)
($domain, $host, $ip_addr_dot, $ip_addr_network) = Net::Netid->ipid($str)
($domain, $host, $ip_addr_dot, $ip_addr_network) = Net::Netid->ipid($str, $network)
$ip_addr_dot = Net::Netid->ip2dot($ip_addr_str)
$ip_addr_dot = Net::Netid->ip2dot($ip_addr_str, $network)
$ip_addr_dot = Net::Netid->net2dot($ip_addr_integer)
$ip_addr_integer = Net::Netid->dot2net($ip_addr_dot)
($ip_addr_dot,$port) = Net::Netid->clean_ip_str($ip_addr_str)
\%results = Net::Netid->clean_netid($str, \%options)
\%results = Net::Netid->clean_netid($str, @options)
\%results = Net::Netid->clean_netid($str)
($domain, $host, $ip_addr_dot, $ip_addr_network) = Net::Netid->clean_ipid($str)
($domain, $host, $ip_addr_dot, $ip_addr_network) = Net::Netid->clean_ipid($str, $network)
$ip_addr_dot = Net::Netid->clean_ip2dot($ip_addr_str, $network)
\%results = netid($str, \%options)
\%results = netid($str, @options)
\%results = netid($str)
($domain, $host, $ip_addr_dot, $ip_addr_network) = ipid($str)
($domain, $host, $ip_addr_dot, $ip_addr_network) = ipid($str, $network)
$ip_addr_dot = ip2dot($ip_addr_str)
$ip_addr_dot = ip2dot($ip_addr_str, $network)
$ip_addr_dot = net2dot($ip_addr_integer)
$ip_addr_integer = dot2net($ip_addr_dot)
($ip_addr_dot,$port) = clean_ip_str($ip_addr_str)
\%results = clean_netid($str, \%options)
\%results = clean_netid($str, @options)
\%results = clean_netid($str)
($domain, $host, $ip_addr_dot, $ip_addr_network) = clean_ipid($str)
($domain, $host, $ip_addr_dot, $ip_addr_network) = clean_ipid($str, $network)
$ip_addr_dot = clean_ip2dot($ip_addr_str, $network)
DESCRIPTION
The "Net::Netid" module contains various methods used lookup the basic information, domaind name, IP address, name server, mail box exchanger avaiable for a Internet host from Internet Domain Name Servers (DNS).
The following may be used either as methods of the "Net::Netid" module or as stand-alone subroutines imported into the using module:
netid description
\%results = netid($str, \%options)
\%results = netid($str, @options)
\%results = netid($str)
The netid
method lookups the basic information avaiable for the Internet host identified by $str
on the Internet Domain Name Servers (DNS).
The netid
method $str
input may be either an Internet address string (dot or number notation), domain string or a packed four byte integer. The intenet address may be either an integer, integer string or a dot notation string. The @options
input may have the following keys: qw(report results network)
.
The netid
method will use the ipid
method to find the $domain, $host, $ip_addr_dot for $str and $options{network}
. If $options{network} is present, $str should be a four byte integer. The netid
method will then use the system nslookup
and $ip_addr_dot
to find the name server and mail exchanger domain and ip addresses: qw(ns_domain ns_ip_addr_dot mx_domain mx_ip_addr_dot)
The netid
will place these results in the following %results
hash keys:
C<qw(domain host ip_addr_dot ns_domain ns_ip_addr_dot mx_domain mx_ip_addr_dot)>
The \%result
hash reference is either the supplied result =
\%result> option or if this option is not present the reference to a hash created by netid
.
If the report =
1> option is present, the netid
method will also format the results in a report and add it to the %result hash under the key netid_report.
ipid description
($domain, $host, $ip_addr_dot, $ip_addr_network) = ipid($str)
($domain, $host, $ip_addr_dot, $ip_addr_network) = ipid($str, $network)
The ipid
method lookups a host Internet address and domain name identified by $str
on the Internet Domain Name Servers (DNS).
The ipid
method $str
input may be either an Internet address string (dot or number notation), domain string or a packed four byte integer. If $str
is a packed four byte integer, the second argument, $network
, should be supplied.
The netid
method will set either $domain $ip_addr_dot or $ip_addr_network
to $str
based on netid
determination of $str
. The netid
method will then use the Domain Name Servers to fill in the missing information.
ip2dot description
$ip_addr_dot = ip2dot($ip_addr_str)
$ip_addr_dot = ip2dot($ip_addr_str, $network)
The ip2dot
method converts a Internet Address string, $ip_addr_str
, to a Internet Address string in the decimal dot notation. If the conversion, fails, the ip2dot
returns an undef.
The ipid
method $ip_addr_str
input may be either an Internet address string (dot or number notation), or a packed four byte integer. If $ip_addr_str
is a packed four byte integer, the second argument, $network
, should be supplied.
net2dot description
$ip_addr_dot = net2dot($ip_addr_integer)
The net2dot
method converts a packed four byte network Internet Address integer, $ip_addr_integer, to a dot notation string, $ip_addr_dot.
dot2net description
$ip_addr_integer = dot2net($ip_addr_dot)
The dot2net
method converts a dot notation string, $ip_addr_dot integer, $ip_addr_integer, to a packed four byte network Internet Address.
clean_ip_str description
($ip_addr_dot,$port) = clean_ip_str($str)
The clean_ip_str
cleans up string, $str
, that identifies an Internet host. The method will extract the string from common punctuation such as surrounding brackets. The method will unescape any web %XX
hexadecimal escapes and separate out any port number.
clean_netid description
\%results = clean_netid($str, \@options)
\%results = clean_netid($str, @options)
\%results = clean_netid($str)
The clean_netid
method will use the clean_ip_str
on the host identification string, $str
, and use the cleaned string to call netid
.
clean_ipid description
($domain, $host, $ip_addr_dot, $ip_addr_network) = clean_ipid($str, $network)
The clean_netid
method will use the clean_ip_str
on the host identification string, $str
, and use the cleaned string to call ipid
.
clean_ip2dot description
$ip_addr_dot = clean_ip2dot($ip_addr_str, $network)
The clean_netid
method will use the clean_ip_str
on the host address string, $ip_addr_str
, and use the cleaned string to call ip2dot
.
REQUIREMENTS
Coming soon.
DEMONSTRATION
~~~~~~ Demonstration overview ~~~~~
Perl code begins with the prompt
=>
The selected results from executing the Perl Code follow on the next lines. For example,
=> 2 + 2
4
~~~~~~ The demonstration follows ~~~~~
=> use File::Package;
=> my $fp = 'File::Package';
=> my $nid = 'Net::Netid';
=> my $loaded;
=> my $errors = $fp->load_package( $nid)
=> $errors
''
=> my $net = Net::Netid->dot2net('240.192.31.14')
'ðÀ'
=> Net::Netid->net2dot($net)
'240.192.31.14'
=> Net::Netid->ip2dot('google.com')
undef
=> Net::Netid->ip2dot('002.010.0344.0266')
'2.8.228.182'
=> my @result= Net::Netid->ipid('google.com')
=> $result[1]
'www.google.com'
=> @result = Net::Netid->ipid($result[2])
=> $result[1]
'www.google.com'
=> my $hash_p = Net::Netid->netid('google.com');
=> $hash_p->{mx_domain} = 'smtp.google.com' if $hash_p->{mx_domain} =~ /smtp\d\.google.com/;
=> [$hash_p->{host},$hash_p->{ns_domain},$hash_p->{mx_domain}]
[
'www.google.com',
'ns1.google.com',
'smtp.google.com'
]
=> $hash_p = Net::Netid->netid($hash_p->{ip_addr_dot});
=> $hash_p->{mx_domain} = 'smtp.google.com' if $hash_p->{mx_domain} =~ /smtp\d\.google.com/;
=> [$hash_p->{host},$hash_p->{ns_domain},$hash_p->{mx_domain}]
[
'www.google.com',
'ns1.google.com',
'smtp.google.com'
]
=> [my ($ip,$post) = Net::Netid->clean_ip_str(' <234.077.0xff.0b1010>')]
[
'234.077.0xff.0b1010',
''
]
=> [($ip,$post) = Net::Netid->clean_ip_str(' [%32%33%34.077.0xff.0b1010]')]
[
'234.077.0xff.0b1010',
''
]
=> @result= Net::Netid->clean_ipid('google.com')
=> $result[1]
'www.google.com'
=> @result = Net::Netid->clean_ipid($result[2])
=> $result[1]
'www.google.com'
=> $hash_p = Net::Netid->clean_netid('google.com');
=> $hash_p->{mx_domain} = 'smtp.google.com' if $hash_p->{mx_domain} =~ /smtp\d\.google.com/;
=> [$hash_p->{host},$hash_p->{ns_domain},$hash_p->{mx_domain}]
[
'www.google.com',
'ns1.google.com',
''
]
=> $hash_p = Net::Netid->clean_netid($hash_p->{ip_addr_dot});
=> $hash_p->{mx_domain} = 'smtp.google.com' if $hash_p->{mx_domain} =~ /smtp\d\.google.com/;
=> [$hash_p->{host},$hash_p->{ns_domain},$hash_p->{mx_domain}]
[
'www.google.com',
'ns1.google.com',
'smtp.google.com'
]
=> Net::Netid->clean_ip2dot('google.com')
undef
=> Net::Netid->clean_ip2dot('002.010.0344.0266')
'2.8.228.182'
QUALITY ASSURANCE
The module "t::Net::Netid" is the Software Test Description(STD) module for the "Net::Netid". module.
To generate all the test output files, run the generated test script, run the demonstration script and include it results in the "Net::Netid" POD, execute the following in any directory:
tmake -test_verbose -replace -run -pm=t::Net::Netid
Note that tmake.pl must be in the execution path $ENV{PATH}
and the "t" directory containing "t::Net::Netid" on the same level as the "lib" directory that contains the "Net::Netid" module.
NOTES
AUTHOR
The holder of the copyright and maintainer is
<support@SoftwareDiamonds.com>
COPYRIGHT NOTICE
Copyrighted (c) 2002 Software Diamonds
All Rights Reserved
BINDING REQUIREMENTS NOTICE
Binding requirements are indexed with the pharse 'shall[dd]' where dd is an unique number for each header section. This conforms to standard federal government practices, 490A ("3.2.3.6" in STD490A). In accordance with the License, Software Diamonds is not liable for any requirement, binding or otherwise.
LICENSE
Software Diamonds permits the redistribution and use in source and binary forms, with or without modification, provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
SOFTWARE DIAMONDS, http::www.softwarediamonds.com, PROVIDES THIS SOFTWARE 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWARE DIAMONDS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING USE OF THIS SOFTWARE, EVEN IF ADVISED OF NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE POSSIBILITY OF SUCH DAMAGE.
SEE_ALSO:
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 680:
Non-ASCII character seen before =encoding in ''ðÀ''. Assuming CP1252