NAME

Net::ASN - Perl extension for manipulating autonomous system numbers

SYNOPSIS

##OO implementation (methods)

use Net::ASN;

my $asn = Net::ASN->new($ARGV[0]);

print "type     : " . $asn->gettype     . "\n";
print "asplain16: " . $asn->toasplain16 . "\n";
print "asplain32: " . $asn->toasplain   . "\n";
print "asdot    : " . $asn->toasdot     . "\n";
print "asdotplus: " . $asn->toasdotplus . "\n";
print "\n";

##Non OO implementation (functions)

use Net::ASN qw(:all);

my $asplain = 12345;

print "ASN in asdotplus format is " . plaintodotplus($asplain) . "\n";

my $asdotplus = '1.1';

print "ASN in asplain format is "   . dotplustoplain($asdotplus) . "\n";

DESCRIPTION

Net::ASN provides functions for parsing autonomous system numbers (ASNs) as defined in RFC 1771 and extended by RFC4893, also converting between formats discussed in RFC5396.

Both an OO implementation (method based) and non-OO (function based) are provided for convenience.

METHODS

new
my $asn = Net::ASN->new(1234);		#Automatic parsing
or
my $asn = Net::ASN->new(1234,1);	#Parse as ASDOT

Creates a new Net::ASN object, prompting parsing of the supplied parameter, an ASN. Currently, only ASPLAIN and ASDOT+ are automatically recognised as input formats. If you wish to force input as ASDOT you must provide a second argument to the constructor.

gettype
my $type = $asn->gettype;

Returns the type of ASN the parser assumes it is dealing with.

toasplain
my $asplain = $asn->toasplain;

Returns the ASPLAIN representation of the parsed ASN

toasplain16
my $asplain = $asn->toasplain16;

Returns the ASPLAIN representation of the parsed ASN if the ASPLAIN representation is is less than or equal to 65535, else returns AS_TRANS

Use for compabability with 16 bit ASN systems.

toasdot
my $asdot = $asn->toasdot;

Returns the ASDOT representation of the parsed ASN. If the parsed ASN is ASPLAIN and less than or equal to 65535 then returns the ASPLAIN

toasdotplus
my $asdotplus = $asn->toasdotplus;

Returns the ASDOT+ representation of the parsed ASN.

isprivate
my $isprivate = $asn->isprivate;

Returns 1 if the number falls within the private reserved ranges according to RFC6996, 0 otherwise. Will accept any format that Net::ASN can convert to ASPLAIN

FUNCTIONS

plaintodot
my $asdot = plaintodot($asn);

Returns the ASDOT representation of the ASN ($asn) If $asn is ASPLAIN and less than or equal to 65535 then returns the ASPLAIN (Assumes your ASN is in ASPLAIN format)

plaintodotplus
my $asdotplus = plaintodotplus($asn);

Returns the ASDOT+ representation of the ASN ($asn) (Assumes your ASN is in ASPLAIN format)

dottodotplus
my $asplain = dottodotplus($asn);

Returns the ASDOT+ representation of the ASN ($asn) (Assumes your ASN is in ASDOT format)

dottoplain
my $asplain = dottoplain($asn);

Returns the ASPLAIN representation of the ASN ($asn) (Assumes your ASN is in ASDOT format)

dottoplain16
my $asplain = dottoplain16($asn);

Returns the ASPLAIN representation of the ASN ($asn) if the ASPLAIN representation is is less than or equal to 65535, else returns AS_TRANS (Assumes your ASN is in ASDOT format)

dotplustodot
my $asdot = dotplustodot($asn);

Returns the ASDOT representation of the ASN ($asn) (Assumes your ASN is in ASDOT+ format)

dotplustoplain
my $asplain = dotplustoplain($asn);

Returns the ASPLAIN representation of the ASN ($asn) (Assumes your ASN is in ASDOT+ format)

dotplustoplain16
my $asplain = dotplustoplain16($asn);

Returns the ASPLAIN representation of the ASN ($asn) if the ASPLAIN representation is is less than or equal to 65535, else returns AS_TRANS (Assumes your ASN is in ASDOT+ format)

isprivateasn
my $isprivateasn = isprivateasn($asn);

Returns 1 if the number falls within the private reserved ranges according to RFC6996, 0 otherwise. Will accept any format that Net::ASN can convert to ASPLAIN

AUTHOR

David J. Freedman <lochii AT convergence DOT cx>

COPYRIGHT

Copyright (c) 2008 Convergence Inc. All rights reserved.

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

SEE ALSO

REPOSITORY

https://github.com/lochiiconnectivity/netasn.git

perl(1)