r64521 - in /trunk/libnet-patricia-perl: Changes MANIFEST META.yml Makefile.PL Patricia.pm Patricia.xs debian/changelog libpatricia/patricia.c libpatricia/patricia.h t/ test.pl

jotamjr-guest at users.alioth.debian.org jotamjr-guest at users.alioth.debian.org
Thu Nov 4 06:53:41 UTC 2010


Author: jotamjr-guest
Date: Thu Nov  4 06:53:23 2010
New Revision: 64521

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=64521
Log:
New upstream release

Added:
    trunk/libnet-patricia-perl/t/
      - copied from r64520, branches/upstream/libnet-patricia-perl/current/t/
Removed:
    trunk/libnet-patricia-perl/test.pl
Modified:
    trunk/libnet-patricia-perl/Changes
    trunk/libnet-patricia-perl/MANIFEST
    trunk/libnet-patricia-perl/META.yml
    trunk/libnet-patricia-perl/Makefile.PL
    trunk/libnet-patricia-perl/Patricia.pm
    trunk/libnet-patricia-perl/Patricia.xs
    trunk/libnet-patricia-perl/debian/changelog
    trunk/libnet-patricia-perl/libpatricia/patricia.c
    trunk/libnet-patricia-perl/libpatricia/patricia.h

Modified: trunk/libnet-patricia-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/Changes?rev=64521&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/Changes (original)
+++ trunk/libnet-patricia-perl/Changes Thu Nov  4 06:53:23 2010
@@ -1,12 +1,21 @@
 Revision history for Perl extension Net::Patricia.
 
 TODO
-        - add AF_INET6 support
         - add POD describing Graham Barr's API improvements
+
+1.017 Sun May 23 17:30 2010
+	- miscellaneous bug fixes
+	- add additional hybrid methods if Net::CIDR::Lite is present
+	- corrections to PM_PREREQ
+
+1.016 Sun Feb 14 11:16 2010
+	- miscellaneous bug fixes
+	- rewrote Makefile to simplify it
 
 1.015 Sun Jan 25 19:07 2009 (alpha)
 	- fixed bugs #14244, #20219
 	- added _integer methods to add/remove entries
+        - add AF_INET6 support
 
 1.014 Thu Dec  8 18:05 2005
         - fixed the "climb_inorder" item in the POD

Modified: trunk/libnet-patricia-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/MANIFEST?rev=64521&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/MANIFEST (original)
+++ trunk/libnet-patricia-perl/MANIFEST Thu Nov  4 06:53:23 2010
@@ -1,16 +1,16 @@
-README
 Changes
+COPYING
+demo/demo.c
+libpatricia/copyright
+libpatricia/credits.txt
+libpatricia/Makefile.PL
+libpatricia/patricia.c
+libpatricia/patricia.h
+Makefile.PL
+MANIFEST			This list of files
+META.yml
 Patricia.pm
 Patricia.xs
-MANIFEST
-Makefile.PL
-test.pl
-libpatricia/Makefile.PL
-libpatricia/copyright
-libpatricia/credits.txt
-libpatricia/patricia.c
-libpatricia/patricia.h
-demo/demo.c
+README
+t/01everything.t
 typemap
-COPYING
-META.yml                                 Module meta-data (added by MakeMaker)

Modified: trunk/libnet-patricia-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/META.yml?rev=64521&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/META.yml (original)
+++ trunk/libnet-patricia-perl/META.yml Thu Nov  4 06:53:23 2010
@@ -1,13 +1,24 @@
 --- #YAML:1.0
-name:                Net-Patricia
-version:             1.16
-abstract:            ~
-license:             ~
-author:              ~
-generated_by:        ExtUtils::MakeMaker version 6.42
-distribution_type:   module
-requires:     
-    Socket6:                       0
+name:               Net-Patricia
+version:            1.18
+abstract:           ~
+author:  []
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:
+    Net::CIDR::Lite:  0.20
+    Socket6:          0
+    Test::More:       0.88
+    version:          0
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.55_02
 meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
-    version: 1.3
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: trunk/libnet-patricia-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/Makefile.PL?rev=64521&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/Makefile.PL (original)
+++ trunk/libnet-patricia-perl/Makefile.PL Thu Nov  4 06:53:23 2010
@@ -1,3 +1,4 @@
+use 5.008;
 use ExtUtils::MakeMaker;
 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
 # the contents of the Makefile that is written.
@@ -9,7 +10,11 @@
     'INC'	=> '',     # e.g., '-I/usr/include/other' 
     'MYEXTLIB'	=> 'libpatricia/libpatricia$(LIB_EXT)',     # e.g., '-I/usr/include/other' 
     'dist'      => {'COMPRESS'=>'gzip -9f', 'SUFFIX' => 'gz'},
-    'PREREQ_PM'	=> {'Socket6' => 0},
+    'PREREQ_PM'	=> {'Socket6' => 0,
+		    'version' => 0,
+		    'Test::More' => '0.88',
+		    'Net::CIDR::Lite' => '0.20',
+		   },
 );
 
 sub MY::postamble {

Modified: trunk/libnet-patricia-perl/Patricia.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/Patricia.pm?rev=64521&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/Patricia.pm (original)
+++ trunk/libnet-patricia-perl/Patricia.pm Thu Nov  4 06:53:23 2010
@@ -24,13 +24,12 @@
 use strict;
 use warnings;
 
-require 5.006_000;
+require 5.008;
 
 use version;
 use Carp;
 use vars qw($VERSION @ISA @EXPORT);
-use Socket qw(AF_INET AF_INET6 inet_aton inet_ntoa);
-use Socket6 qw(inet_pton inet_ntop);
+use Socket qw(AF_INET AF_INET6);
 
 BEGIN {
   require Exporter;
@@ -39,7 +38,7 @@
   @EXPORT = qw(AF_INET AF_INET6);
 }
 
-'$Revision: 1.16 $' =~ m/(\d+)\.(\d+)(_\d+|)/ && ( $VERSION = "$1.$2$3");
+'$Revision: 1.18 $' =~ m/(\d+)\.(\d+)((_\d+)|)/ && ( $VERSION = "$1.$2$3");
 
 bootstrap Net::Patricia $VERSION;
 
@@ -56,7 +55,7 @@
     return bless _new(128), 'Net::Patricia::AF_INET6';
   }
 
-  undef;
+  croak "new: unimplemented type";
 }
 
 ##
@@ -68,9 +67,9 @@
   my $bits;
 
   if (ref ($self) eq 'Net::Patricia::AF_INET6') { 
-	$bits = ($str =~ s,/(\d+)$,,) ? $1 : 128; 
+	$bits = ($str =~ s|/(\d+)$||) ? $1 : 128; 
   } else { 
-	$bits = ($str =~ s,/(\d+)$,,) ? $1 : 32; 
+	$bits = ($str =~ s|/(\d+)$||) ? $1 : 32; 
   }
   ($str,$bits);
 }
@@ -100,112 +99,167 @@
   $self->remove($self->_ip_bits($str))
 }
 
+BEGIN {
+  eval {
+    my $class = 'Net::CIDR::Lite';
+    eval "require $class";
+  };
+  last if (@_);
+
+  sub add_cidr {
+    my ($self, $range, $data) = @_;
+    my $cidr = Net::CIDR::Lite->new();
+    $cidr->add_range($range);
+
+    my @list = ();
+    for ($cidr->list()) {
+      push(@list, $_) if ($self->add_string($_, $data));
+    }
+    @list;
+  }
+
+  sub remove_cidr {
+    my ($self, $range) = @_;
+    my $cidr = Net::CIDR::Lite->new();
+    $cidr->add_range($range);
+
+    my @list = ();
+    for ($cidr->list()) {
+      push(@list, $_) if ($self->remove_string($_));
+    }
+    @list;
+  }
+}
+
 ##
 ## AF_INET
 ##
 
- at Net::Patricia::AF_INET::ISA = qw(Net::Patricia);
-
-sub Net::Patricia::AF_INET::add {
+package Net::Patricia::AF_INET;
+
+use Carp;
+use Socket qw(AF_INET inet_aton inet_ntoa);
+use vars qw(@ISA @EXPORT);
+
+BEGIN {
+  require Exporter;
+  require DynaLoader;
+  @ISA = qw(Exporter DynaLoader Net::Patricia);
+  @EXPORT = qw(AF_INET);
+}
+
+sub add {
   my ($self, $ip, $bits, $data) = @_;
   $data ||= defined $bits ? "$ip/$bits" : $ip;
   my $packed = inet_aton($ip) || croak("invalid key");
-  _add($self,AF_INET,$packed,(defined $bits ? $bits : 32), $data);
-}
-
-sub Net::Patricia::AF_INET::add_integer {
+  $self->SUPER::_add(AF_INET,$packed,(defined $bits ? $bits : 32), $data);
+}
+
+sub add_integer {
   my ($self, $num, $bits, $data) = @_;
   my $packed = pack("N", $num);
   my $ip = inet_ntoa($packed) || croak("invalid address");
   $data ||= defined $bits ? "$ip/$bits" : $ip;
-  _add($self,AF_INET,$packed,(defined $bits ? $bits : 32), $data);
-}
-
-sub Net::Patricia::AF_INET::match_integer {
+  $self->SUPER::_add(AF_INET,$packed,(defined $bits ? $bits : 32), $data);
+}
+
+sub match_integer {
   my ($self, $num, $bits) = @_;
-  _match($self,AF_INET,pack("N",$num),(defined $bits ? $bits : 32));
-}
-
-sub Net::Patricia::AF_INET::exact_integer {
+  $self->SUPER::_match(AF_INET,pack("N",$num),(defined $bits ? $bits : 32));
+}
+
+sub exact_integer {
   my ($self, $num, $bits) = @_;
-  _exact($self,AF_INET,pack("N",$num),(defined $bits ? $bits : 32));
-}
-
-sub Net::Patricia::AF_INET::match {
+  $self->SUPER::_exact(AF_INET,pack("N",$num),(defined $bits ? $bits : 32));
+}
+
+sub match {
   my ($self, $ip, $bits) = @_;
   my $packed = inet_aton($ip) || croak("invalid key");
-  _match($self,AF_INET,$packed,(defined $bits ? $bits : 32));
-}
-
-sub Net::Patricia::AF_INET::exact {
+  $self->SUPER::_match(AF_INET,$packed,(defined $bits ? $bits : 32));
+}
+
+sub exact {
   my ($self, $ip, $bits) = @_;
   my $packed = inet_aton($ip) || croak("invalid key");
-  _exact($self,AF_INET,$packed,(defined $bits ? $bits : 32));
-}
-
-sub Net::Patricia::AF_INET::remove {
+  $self->SUPER::_exact(AF_INET,$packed,(defined $bits ? $bits : 32));
+}
+
+sub remove {
   my ($self, $ip, $bits) = @_;
   my $packed = inet_aton($ip) || return undef;
-  _remove($self,AF_INET,$packed,(defined $bits ? $bits : 32));
-}
-
-sub Net::Patricia::AF_INET::remove_integer {
+  $self->SUPER::_remove(AF_INET,$packed,(defined $bits ? $bits : 32));
+}
+
+sub remove_integer {
   my ($self, $num, $bits) = @_;
-  _remove($self,AF_INET,pack("N",$num),(defined $bits ? $bits : 32));
+  $self->SUPER::_remove(AF_INET,pack("N",$num),(defined $bits ? $bits : 32));
 }
 
 ##
 ## AF_INET6
 ##
 
- at Net::Patricia::AF_INET6::ISA = qw(Net::Patricia);
-
-sub Net::Patricia::AF_INET6::add {
+package Net::Patricia::AF_INET6;
+
+use Carp;
+use Socket qw(AF_INET6);
+use Socket6 qw(inet_pton inet_ntop);
+use vars qw(@ISA @EXPORT);
+
+BEGIN {
+  require Exporter;
+  require DynaLoader;
+  @ISA = qw(Exporter DynaLoader Net::Patricia);
+  @EXPORT = qw(AF_INET6);
+}
+
+sub add {
   my ($self, $ip, $bits, $data) = @_;
   $data ||= $bits ? "$ip/$bits" : $ip;
   my $packed = inet_pton(AF_INET6, $ip) || croak("invalid key");
-  _add($self,AF_INET6,$packed,(defined $bits ? $bits : 128), $data);
-}
-
-sub Net::Patricia::AF_INET6::add_integer {
+  $self->SUPER::_add(AF_INET6,$packed,(defined $bits ? $bits : 128), $data);
+}
+
+sub add_integer {
   my ($self, $num, $bits, $data) = @_;
   my $packed = pack("N", $num);
   my $ip = inet_ntop(AF_INET6, $packed) || croak("invalid address");
   $data ||= defined $bits ? "$ip/$bits" : $ip;
-  _add($self,AF_INET6,$packed,(defined $bits ? $bits : 128), $data);
-}
-
-sub Net::Patricia::AF_INET6::match_integer {
+  $self->SUPER::_add(AF_INET6,$packed,(defined $bits ? $bits : 128), $data);
+}
+
+sub match_integer {
   my ($self, $num, $bits) = @_;
-  _match($self,AF_INET6,pack("N",$num),(defined $bits ? $bits : 128));
-}
-
-sub Net::Patricia::AF_INET6::exact_integer {
+  $self->SUPER::_match(AF_INET6,pack("N",$num),(defined $bits ? $bits : 128));
+}
+
+sub exact_integer {
   my ($self, $num, $bits) = @_;
-  _exact($self,AF_INET6,pack("N",$num),(defined $bits ? $bits : 128));
-}
-
-sub Net::Patricia::AF_INET6::match {
+  $self->SUPER::_exact(AF_INET6,pack("N",$num),(defined $bits ? $bits : 128));
+}
+
+sub match {
   my ($self, $ip, $bits) = @_;
   my $packed = inet_pton(AF_INET6, $ip) || croak("invalid key");
-  _match($self,AF_INET6,$packed,(defined $bits ? $bits : 128));
-}
-
-sub Net::Patricia::AF_INET6::exact {
+  $self->SUPER::_match(AF_INET6,$packed,(defined $bits ? $bits : 128));
+}
+
+sub exact {
   my ($self, $ip, $bits) = @_;
   my $packed = inet_pton(AF_INET6, $ip) || croak("invalid key");
-  _exact($self,AF_INET6,$packed,(defined $bits ? $bits : 128));
-}
-
-sub Net::Patricia::AF_INET6::remove {
+  $self->SUPER::_exact(AF_INET6,$packed,(defined $bits ? $bits : 128));
+}
+
+sub remove {
   my ($self, $ip, $bits) = @_;
   my $packed = inet_pton(AF_INET6, $ip) || return undef;
-  _remove($self,AF_INET6,$packed,(defined $bits ? $bits : 128));
-}
-
-sub Net::Patricia::AF_INET6::remove_integer {
+  $self->SUPER::_remove(AF_INET6,$packed,(defined $bits ? $bits : 128));
+}
+
+sub remove_integer {
   my ($self, $num, $bits) = @_;
-  _remove($self,AF_INET6,pack("N",$num),(defined $bits ? $bits : 128));
+  $self->SUPER::_remove(AF_INET6,pack("N",$num),(defined $bits ? $bits : 128));
 }
 
 1;

Modified: trunk/libnet-patricia-perl/Patricia.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/Patricia.xs?rev=64521&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/Patricia.xs (original)
+++ trunk/libnet-patricia-perl/Patricia.xs Thu Nov  4 06:53:23 2010
@@ -150,7 +150,7 @@
 
 static void deref_data(SV *data) {
    SvREFCNT_dec(data);
-   data = (void *)0;
+   data = NULL;
 }
 
 static size_t
@@ -163,7 +163,7 @@
     }
 
     if (node->prefix) {
-        if ((SV *)0 != coderef) {
+        if (NULL != coderef) {
             PUSHMARK(SP);
             XPUSHs(sv_mortalcopy((SV *)node->data));
             PUTBACK;
@@ -214,7 +214,7 @@
 	PPCODE:
 		Fill_Prefix(prefix, family, addr, bits, tree->maxbits);
 	   	node = patricia_lookup(tree, &prefix);
-		if ((patricia_node_t *)0 != node) {
+		if (NULL != node) {
 		   /* { */
 		   if (node->data) {
 		      deref_data(node->data);
@@ -239,7 +239,7 @@
 	PPCODE:
 		Fill_Prefix(prefix, family, addr, bits, tree->maxbits);
 		node = patricia_search_best(tree, &prefix);
-		if ((patricia_node_t *)0 != node) {
+		if (NULL != node) {
 		   XPUSHs((SV *)node->data);
 		} else {
 		   XSRETURN_UNDEF;
@@ -258,7 +258,7 @@
 	PPCODE:
 		Fill_Prefix(prefix, family, addr, bits, tree->maxbits);
 		node = patricia_search_exact(tree, &prefix);
-		if ((patricia_node_t *)0 != node) {
+		if (NULL != node) {
 		   XPUSHs((SV *)node->data);
 		} else {
 		   XSRETURN_UNDEF;
@@ -278,7 +278,7 @@
 	PPCODE:
 		Fill_Prefix(prefix, family, addr, bits, tree->maxbits);
 	   	node = patricia_search_exact(tree, &prefix);
-		if ((Net__PatriciaNode)0 != node) {
+		if (NULL != node) {
 		   XPUSHs(sv_mortalcopy((SV *)node->data));
 		   deref_data(node->data);
 		   patricia_remove(tree, node);
@@ -290,9 +290,9 @@
 climb(tree, ...)
 	Net::Patricia			tree
 	PREINIT:
-		patricia_node_t *node = (patricia_node_t *)0;
+		patricia_node_t *node = NULL;
 		size_t n = 0;
-		SV *func = (SV *)0;
+		SV *func = NULL;
 	CODE:
 		if (2 == items) {
 		   func = ST(1);
@@ -300,7 +300,7 @@
 	           croak("Usage: Net::Patricia::climb(tree[,CODEREF])");
 		}
 		PATRICIA_WALK (tree->head, node) {
-		   if ((SV *)0 != func) {
+		   if (NULL != func) {
 		      PUSHMARK(SP);
 		      XPUSHs(sv_mortalcopy((SV *)node->data));
 		      PUTBACK;
@@ -318,9 +318,9 @@
 	Net::Patricia			tree
 	PREINIT:
 		size_t n = 0;
-		SV *func = (SV *)0;
+		SV *func = NULL;
 	CODE:
-		func = (SV *)0;
+		func = NULL;
 		if (2 == items) {
 		   func = ST(1);
 		} else if (2 < items) {

Modified: trunk/libnet-patricia-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/debian/changelog?rev=64521&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/debian/changelog (original)
+++ trunk/libnet-patricia-perl/debian/changelog Thu Nov  4 06:53:23 2010
@@ -1,3 +1,9 @@
+libnet-patricia-perl (1.18-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Jotam Jr. Trejo <jotamjr at debian.org.sv>  Thu, 04 Nov 2010 00:54:18 -0600
+
 libnet-patricia-perl (1.16-1) unstable; urgency=low
 
   [ Nathan Handler ]

Modified: trunk/libnet-patricia-perl/libpatricia/patricia.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/libpatricia/patricia.c?rev=64521&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/libpatricia/patricia.c (original)
+++ trunk/libnet-patricia-perl/libpatricia/patricia.c Thu Nov  4 06:53:23 2010
@@ -59,43 +59,6 @@
 	    return (1);
     }
     return (0);
-}
-
-/* inet_pton substitute implementation
- * Uses inet_addr to convert an IP address in dotted decimal notation into 
- * unsigned long and copies the result to dst.
- * Only supports AF_INET.  Follows standard error return conventions of 
- * inet_pton.
- */
-int
-inet_pton (int af, const char *src, void *dst)
-{
-    u_long result;  
-
-    if (af == AF_INET) {
-	result = inet_addr(src);
-	if (result == -1)
-	    return 0;
-	else {
-	    memcpy (dst, &result, sizeof(struct in_addr));
-	    return 1;
-	}
-    }
-#ifdef NT
-#ifdef HAVE_IPV6
-    else if (af == AF_INET6) {
-	struct in6_addr Address;
-	return (inet6_addr(src, &Address));
-    }
-#endif /* HAVE_IPV6 */
-#endif /* NT */
-#ifndef NT
-    else {
-
-	errno = EAFNOSUPPORT;
-	return -1;
-    }
-#endif /* NT */
 }
 
 /* this allows imcomplete prefix */
@@ -1017,7 +980,7 @@
 {
     patricia_node_t *node;
 
-    if (node = try_search_exact (tree, string))
+    if ((node = try_search_exact (tree, string)))
         patricia_remove (tree, node);
 }
 
@@ -1035,7 +998,7 @@
         printf ("try_search_best: %s/%d found\n", 
 	        prefix_toa (node->prefix), node->prefix->bitlen);
     Deref_Prefix (prefix);
-    return (prefix);
+    return (node);
 }
 
 /* } */

Modified: trunk/libnet-patricia-perl/libpatricia/patricia.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/libpatricia/patricia.h?rev=64521&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/libpatricia/patricia.h (original)
+++ trunk/libnet-patricia-perl/libpatricia/patricia.h Thu Nov  4 06:53:23 2010
@@ -87,7 +87,10 @@
 patricia_tree_t *New_Patricia (int maxbits);
 void Clear_Patricia (patricia_tree_t *patricia, void_fn_t func);
 void Destroy_Patricia (patricia_tree_t *patricia, void_fn_t func);
+
 void patricia_process (patricia_tree_t *patricia, void_fn_t func);
+
+char *prefix_toa (prefix_t * prefix);
 
 /* { from demo.c */
 




More information about the Pkg-perl-cvs-commits mailing list