A.J. Brown wrote:
Hello all,
I wrote a library for matching IP addresses, ranges, and networks against
eachother with support for subnet masks, CIDR, and IPv6 a few months ago. It's
useful for writing IP filters (firewall-esque) and such. It uses bitwise
mathematical calculations to do the matching, so it's quick and solid.
I'd like to adapt it into Zend Framework. What are your thoughts on creating a
Zend_Net package?
Here are some quick off-the-top classes I think would be useful:
Zend_Net_Address (for example)
* Class to represent and translate IP addresses (IPv4 -> IPv6 for example)
* Class to represent and translate network addresses
* Class to represent other protocol addresses, such as MAC address
* Class to handle matching an input IP or range against a pool of classes from
the above examples
quick ex:
$oNetwork = new Zend_Net_Address_Network_IPv4( '192.168.0.0', '255.255.255.0' );
// give me an array of Zend_Net_Address_Host_IPv4 objects within this network
$aAddressesIp4 = $oNetwork->getAddresses();
// tell me the class of some IPv4 address
$oHost = new Zend_Net_Address_IPv4( $sUserInput );
echo $oHost->getNetworkClass();
// is the address a private address?
echo $oHost->isPrivate() ? 'yes' : 'no';
What are your thoughts? I can think of a few use-cases where this would be
useful for rapid development and easy cooperation with the rest of Zend
Framework.
-- A.J. Brown
Zend Certfied PHP Engineer
HOME: http://ajbrown.me
BLOG: http://coding-adventures.blogspot.com
Hi A.J.,
I'd be interested in this class. Have you submitted a CLA to Zend? If
so, why don't you submit a proposal at
http://framework.zend.com/wiki/display/ZFPROP/Home
Thanks.
-Justin