GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::ACL::Match::Prefix(3) User Contributed Perl Documentation Net::ACL::Match::Prefix(3)

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

    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

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

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.

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.

     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

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

Martin Lorensen <bgp@martin.lorensen.dk>
2003-06-06 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.