Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Net::ACL::Match::Prefix
Class matching IP network prefixes.

Net::ACL::Match::Prefix - Class matching IP network prefixes.



NAME

Net::ACL::Match::Prefix - Class matching IP network prefixes.


SYNOPSIS


    use Net::ACL::Match::Prefix;

    # Constructor

    $match = new Net::ACL::Match::Prefix('10.0.0.0/8');

    $match = new Net::ACL::Match::Prefix('10.0.0.0/8 ge 25');

    # Accessor Methods

    $rc = $match->match('10.0.0.0/16'); # ACL_NOMATCH

    $rc = $match->match('127.0.0.0/8'); # ACL_NOMATCH

    $rc = $match->match('10.0.0.0/8');  # ACL_MATCH


DESCRIPTION

This module is just a wrapper of the Net::Netmask module to allow it to operate automatically with Net::ACL::Rule.


CONSTRUCTOR

new() - create a new Net::ACL::Match::Prefix object

    $match = new Net::ACL::Match::Prefix(0,'10.0.0.0/8');

This is the constructor for Net::ACL::Match::Prefix objects. It returns a reference to the newly created object. The first argument is the argument number of the match function that should be matched.

Normally the remaining arguments is parsed directly to the constructor of Net::Netmask. However if the last argument matches /(le|ge) \d+$/, the suffix will be removed before the Net::Netmask constructor is called and the digits will be used only allow prefixes greater then or equal (ge) OR less then or equal (le) then that prefix length to match.


ACCESSOR METHODS

match()
The method uses Net::Netmask to verify that the base address and the size of the prefixes are the same.

mode()
This method returns the mode of the prefix match object. The mode could be either 0 (normal), le for less then or equal compare, or ge for greater then or equal compare. If called with a value, the mode is changed to that value.

size()
This method returns the size of the prefix to be matched if mode is le or ge. If called with a value, the size is changed to that value.


EXAMPLES


     my $norm = new Net::ACL::Match::Prefix(0,'10.0.0.0/8');

     my $ge24 = new Net::ACL::Match::Prefix(0,'10.0.0.0/8 ge 24');

     my $le24 = new Net::ACL::Match::Prefix(0,'10.0.0.0/8 1e 24');

     $norm->match('10.0.0.0/8')  == ACL_MATCH

     $ge24->match('10.0.0.0/8')  == ACL_MATCH

     $le24->match('10.0.0.0/8')  == ACL_MATCH

     $norm->match('10.1.0.0/16') == ACL_NOMATCH

     $ge24->match('10.1.0.0/16') == ACL_MATCH

     $le24->match('10.1.0.0/16') == ACL_MATCH


SEE ALSO

Net::Netmask, Net::ACL, Net::ACL::Rule, Net::ACL::Match::IP, Net::ACL::Match


AUTHOR

Martin Lorensen <bgp@martin.lorensen.dk>

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy