r48166 - in /branches/upstream/libsocket-multicast6-perl/current: Build.PL Changes MANIFEST META.yml Makefile.PL Multicast6.xs lib/Socket/Multicast6.pm lib/Socket/Multicast6.xs ppport.h t/10-socket-options.t t/20-pack-ipv6-mreq.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Thu Dec 3 23:48:29 UTC 2009


Author: gregoa
Date: Thu Dec  3 23:48:25 2009
New Revision: 48166

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48166
Log:
[svn-upgrade] Integrating new upstream version, libsocket-multicast6-perl (0.04)

Added:
    branches/upstream/libsocket-multicast6-perl/current/Build.PL
    branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.xs
    branches/upstream/libsocket-multicast6-perl/current/t/20-pack-ipv6-mreq.t
Removed:
    branches/upstream/libsocket-multicast6-perl/current/Makefile.PL
    branches/upstream/libsocket-multicast6-perl/current/Multicast6.xs
    branches/upstream/libsocket-multicast6-perl/current/ppport.h
Modified:
    branches/upstream/libsocket-multicast6-perl/current/Changes
    branches/upstream/libsocket-multicast6-perl/current/MANIFEST
    branches/upstream/libsocket-multicast6-perl/current/META.yml
    branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.pm
    branches/upstream/libsocket-multicast6-perl/current/t/10-socket-options.t

Added: branches/upstream/libsocket-multicast6-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocket-multicast6-perl/current/Build.PL?rev=48166&op=file
==============================================================================
--- branches/upstream/libsocket-multicast6-perl/current/Build.PL (added)
+++ branches/upstream/libsocket-multicast6-perl/current/Build.PL Thu Dec  3 23:48:25 2009
@@ -1,0 +1,81 @@
+use Module::Build;
+
+my $class = Module::Build->subclass(
+  code => q{
+    use Devel::PPPort;
+    use ExtUtils::Constant;
+
+    sub ACTION_build {
+        my $self = shift;
+        $self->depends_on('ppport_h','constants');
+        $self->SUPER::ACTION_build;
+    }
+
+    sub ACTION_ppport_h {
+        my $self = shift;
+        my $filepath = 'lib/Socket/ppport.h';
+        unless (-e $filepath) {
+            print "Writing $filepath\n";
+            Devel::PPPort::WriteFile($filepath);
+        }
+        $self->add_to_cleanup($filepath);
+    }
+
+    sub ACTION_constants {
+        my $self = shift;
+        my $c_file_path = 'lib/Socket/const-c.inc';
+        my $xs_file_path = 'lib/Socket/const-xs.inc';
+        unless (-e $c_file_path && -e $xs_file_path) {
+            print "Writing $c_file_path and $xs_file_path\n";
+            ExtUtils::Constant::WriteConstants(
+                NAME => 'Socket::Multicast6',
+                NAMES => [qw(
+                    IP_MULTICAST_IF
+                    IP_MULTICAST_TTL
+                    IP_MULTICAST_LOOP
+                    IP_ADD_MEMBERSHIP
+                    IP_DROP_MEMBERSHIP
+                    IP_ADD_SOURCE_MEMBERSHIP
+                    IP_DROP_SOURCE_MEMBERSHIP
+                    IPV6_MULTICAST_IF
+                    IPV6_MULTICAST_HOPS
+                    IPV6_MULTICAST_LOOP
+                    IPV6_JOIN_GROUP
+                    IPV6_LEAVE_GROUP
+                    MCAST_JOIN_GROUP
+                    MCAST_BLOCK_SOURCE
+                    MCAST_UNBLOCK_SOURCE
+                    MCAST_LEAVE_GROUP
+                    MCAST_JOIN_SOURCE_GROUP
+                    MCAST_LEAVE_SOURCE_GROUP
+                )],
+                C_FILE => $c_file_path,
+                XS_FILE => $xs_file_path
+            );
+        }
+        $self->add_to_cleanup($c_file_path);
+        $self->add_to_cleanup($xs_file_path);
+    }
+  },
+);
+
+my $build = $class->new
+(
+    module_name => 'Socket::Multicast6',
+    license => 'perl',
+    build_requires => {
+      'Module::Build' 	=> '0.20',
+      'ExtUtils::Constant' => 0,
+      'ExtUtils::CBuilder' => 0,
+      'Devel::PPPort' => 0,
+    },
+    requires => {
+      'perl'			=> '5.6.1',
+      'Socket'		=> 0,
+      'Test::More'		=> 0,
+      'Socket'		=> 0,
+      'Socket6'		=> 0.19,
+    }
+);
+
+$build->create_build_script;

Modified: branches/upstream/libsocket-multicast6-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocket-multicast6-perl/current/Changes?rev=48166&op=diff
==============================================================================
--- branches/upstream/libsocket-multicast6-perl/current/Changes (original)
+++ branches/upstream/libsocket-multicast6-perl/current/Changes Thu Dec  3 23:48:25 2009
@@ -1,11 +1,17 @@
 Revision history for Perl extension Socket::Multicast6.
+
+0.04  Sat Nov 28 23:54:08 GMT 2009
+    - Added missing test to the manifest
+
+0.03  Mon Nov 23 21:02:39 GMT 2009
+    - Minor changes to documentation
+    - Changed build system to use Module::Build
 
 0.02  Mon Sep 25 16:52:17 BST 2006
     - Now imports SSM/Protocol-Independent Multicast symbols
     - Rewrote part of pack_ip_mreq()
     - Added pack_ip_mreq_source() and test for it
 
+0.01  Wed Sep 13 14:51:53 BST 2006
+    - original version based on Socket::Multicast version 0.01
 
-0.01  Wed Sep 13 14:51:53 BST 2006
-	- original version based on Socket::Multicast version 0.01
-

Modified: branches/upstream/libsocket-multicast6-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocket-multicast6-perl/current/MANIFEST?rev=48166&op=diff
==============================================================================
--- branches/upstream/libsocket-multicast6-perl/current/MANIFEST (original)
+++ branches/upstream/libsocket-multicast6-perl/current/MANIFEST Thu Dec  3 23:48:25 2009
@@ -1,12 +1,12 @@
+Build.PL
 Changes
 lib/Socket/Multicast6.pm
-Multicast6.xs
-ppport.h
-Makefile.PL
+lib/Socket/Multicast6.xs
 MANIFEST
 README
 t/00-Socket-Multicast.t
 t/10-socket-options.t
 t/20-pack-ip-mreq.t
+t/20-pack-ipv6-mreq.t
 t/30-pack-ip-mreq-source.t
 META.yml

Modified: branches/upstream/libsocket-multicast6-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocket-multicast6-perl/current/META.yml?rev=48166&op=diff
==============================================================================
--- branches/upstream/libsocket-multicast6-perl/current/META.yml (original)
+++ branches/upstream/libsocket-multicast6-perl/current/META.yml Thu Dec  3 23:48:25 2009
@@ -1,15 +1,29 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Socket-Multicast6
-version:      0.02
-version_from: lib/Socket/Multicast6.pm
-installdirs:  site
+---
+name: Socket-Multicast6
+version: 0.04
+author:
+  - |-
+    Based on L<Socket::Multicast> by Jonathan Steinert, E<lt>hachi at cpan.orgE<gt>
+    Socket::Multicast6 by Nicholas J Humfrey, E<lt>njh at cpan.orgE<gt>
+abstract: Constructors and constants for IPv4 and IPv6 multicast socket operations.
+license: perl
+resources:
+  license: http://dev.perl.org/licenses/
 requires:
-    ExtUtils::Constant:            0
-    ExtUtils::MakeMaker:           0
-    Socket:                        0
-    Socket6:                       0
-    Test::More:                    0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+  Socket: 0
+  Socket6: 0.19
+  Test::More: 0
+  perl: 5.6.1
+build_requires:
+  Devel::PPPort: 0
+  ExtUtils::CBuilder: 0
+  ExtUtils::Constant: 0
+  Module::Build: 0.20
+provides:
+  Socket::Multicast6:
+    file: lib/Socket/Multicast6.pm
+    version: 0.04
+generated_by: Module::Build version 0.280801
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.2.html
+  version: 1.2

Modified: branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.pm?rev=48166&op=diff
==============================================================================
--- branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.pm (original)
+++ branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.pm Thu Dec  3 23:48:25 2009
@@ -5,7 +5,7 @@
 use vars qw(@ISA $VERSION);
 use Carp;
 
-our $VERSION = '0.02';
+our $VERSION = '0.04';
 
 require XSLoader;
 XSLoader::load('Socket::Multicast6', $VERSION);
@@ -187,7 +187,8 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2006 by Jonathan Steinert, Nicholas J Humfrey
+Copyright (C) 2006 Nicholas J Humfrey
+Copyright (C) 2006 Jonathan Steinert
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself, either Perl version 5.6.1 or,

Added: branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.xs?rev=48166&op=file
==============================================================================
--- branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.xs (added)
+++ branches/upstream/libsocket-multicast6-perl/current/lib/Socket/Multicast6.xs Thu Dec  3 23:48:25 2009
@@ -1,0 +1,184 @@
+/*
+    Copyright (C) 2006 Nicholas J Humfrey
+    Copyright (C) 2006 Jonathan Steinert
+    
+    This library is free software; you can redistribute it and/or modify
+    it under the same terms as Perl itself, either Perl version 5.6.1 or,
+    at your option, any later version of Perl 5 you may have available.
+*/
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include "ppport.h"
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifdef WIN32
+// winsock.h is for winsock <= 1.1
+// #include <winsock.h>
+
+// ws2tcpip.h is for winsock >= 2.0
+#include <ws2tcpip.h>
+#endif
+
+#include "const-c.inc"
+
+MODULE = Socket::Multicast6		PACKAGE = Socket::Multicast6
+
+INCLUDE: const-xs.inc
+
+PROTOTYPES: ENABLE
+
+void
+pack_ip_mreq(imr_multiaddr_sv, imr_interface_sv)
+	SV* imr_multiaddr_sv
+	SV* imr_interface_sv
+  CODE:
+	{
+	struct ip_mreq mreq;
+	STRLEN addrlen;
+	char * addr;
+	
+	// Clear out final struct
+	Zero( &mreq, 1, struct ip_mreq );
+
+
+	// Byte load multicast address
+	addr = SvPVbyte(imr_multiaddr_sv, addrlen);
+
+	if (addrlen == sizeof(mreq.imr_multiaddr) || addrlen == 4)
+
+		// Copy across the multicast address
+		Copy( addr, &mreq.imr_multiaddr, 1, struct in_addr );
+
+	else
+		croak("Bad arg length for %s, length is %d, should be %d",
+		      "Socket::Multicast6::pack_ip_mreq",
+		      addrlen, sizeof(mreq.imr_multiaddr));
+
+
+
+	// Byte load interface address
+	addr = SvPVbyte(imr_interface_sv, addrlen);
+
+	if (addrlen == sizeof(mreq.imr_interface) || addrlen == 4)
+
+		// Copy across the interface address
+		Copy( addr, &mreq.imr_interface, 1, struct in_addr );
+
+	else
+		croak("Bad arg length for %s, length is %d, should be %d",
+		      "Socket::Multicast6::pack_ip_mreq",
+		      addrlen, sizeof(mreq.imr_interface));
+
+	// new mortal string, return it.
+	ST(0) = sv_2mortal(newSVpvn((char *)&mreq, sizeof(mreq)));
+	}
+
+
+
+void
+pack_ip_mreq_source(imr_multiaddr_sv, imr_source_sv, imr_interface_sv)
+	SV* imr_multiaddr_sv
+	SV* imr_source_sv
+	SV* imr_interface_sv
+  CODE:
+	{
+#ifdef IP_ADD_SOURCE_MEMBERSHIP
+	struct ip_mreq_source mreq;
+	STRLEN addrlen;
+	char * addr;
+	
+	// Clear out final struct
+	Zero( &mreq, 1, struct ip_mreq_source );
+
+
+	// Byte load multicast address
+	addr = SvPVbyte(imr_multiaddr_sv, addrlen);
+
+	if (addrlen == sizeof(mreq.imr_multiaddr) || addrlen == 4)
+
+		// Copy across the multicast address
+		Copy( addr, &mreq.imr_multiaddr, 1, struct in_addr );
+
+	else
+		croak("Bad arg length for %s, length is %d, should be %d",
+		      "Socket::Multicast6::ip_mreq_source",
+		      addrlen, sizeof(mreq.imr_multiaddr));
+
+
+
+	// Byte load source address
+	addr = SvPVbyte(imr_source_sv, addrlen);
+
+	if (addrlen == sizeof(mreq.imr_sourceaddr) || addrlen == 4)
+
+		// Copy across the source address
+		Copy( addr, &mreq.imr_sourceaddr, 1, struct in_addr );
+
+	else
+		croak("Bad arg length for %s, length is %d, should be %d",
+		      "Socket::Multicast6::ip_mreq_source",
+		      addrlen, sizeof(mreq.imr_sourceaddr));
+
+
+
+	// Byte load interface address
+	addr = SvPVbyte(imr_interface_sv, addrlen);
+
+	if (addrlen == sizeof(mreq.imr_interface) || addrlen == 4)
+
+		// Copy across the interface address
+		Copy( addr, &mreq.imr_interface, 1, struct in_addr );
+
+	else
+		croak("Bad arg length for %s, length is %d, should be %d",
+		      "Socket::Multicast6::ip_mreq_source",
+		      addrlen, sizeof(mreq.imr_interface));
+
+	// new mortal string, return it.
+	ST(0) = sv_2mortal(newSVpvn((char *)&mreq, sizeof(mreq)));
+#else 
+	XSRETURN_UNDEF;
+#endif
+	}
+
+
+void
+pack_ipv6_mreq(imr_multiaddr_sv, imr_interface_idx)
+	SV* imr_multiaddr_sv
+	unsigned int imr_interface_idx
+  CODE:
+	{
+
+	struct ipv6_mreq mreq;
+	STRLEN addrlen;
+	char * addr;
+
+	// Clear out final struct
+	Zero( &mreq, sizeof mreq, char );
+
+	// Copy across the interface number
+	mreq.ipv6mr_interface = imr_interface_idx;
+
+
+	// Byte load multicast address
+	addr = SvPVbyte(imr_multiaddr_sv, addrlen);
+
+	if (addrlen == sizeof(mreq.ipv6mr_multiaddr) || addrlen == 16)
+
+		// Copy accross the multicast address
+		Copy( addr, &mreq.ipv6mr_multiaddr, 1, struct in6_addr );
+
+	else
+		croak("Bad arg length for %s, length is %d, should be %d",
+		      "Socket::Multicast6::pack_ipv6_mreq",
+		      addrlen, sizeof(mreq.ipv6mr_multiaddr));
+
+	// new mortal string, return it.
+	ST(0) = sv_2mortal(newSVpvn((char *)&mreq, sizeof(mreq)));
+	}
+

Modified: branches/upstream/libsocket-multicast6-perl/current/t/10-socket-options.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocket-multicast6-perl/current/t/10-socket-options.t?rev=48166&op=diff
==============================================================================
--- branches/upstream/libsocket-multicast6-perl/current/t/10-socket-options.t (original)
+++ branches/upstream/libsocket-multicast6-perl/current/t/10-socket-options.t Thu Dec  3 23:48:25 2009
@@ -1,7 +1,7 @@
 use Test::More tests => 14;
 
-use Socket qw/ AF_INET /;
-use Socket6 qw/ AF_INET6 IPPROTO_IP IPPROTO_IPV6 /;
+use Socket;
+use Socket6;
 use Socket::Multicast6 qw/ :all /;
 
 my @socket_options = (

Added: branches/upstream/libsocket-multicast6-perl/current/t/20-pack-ipv6-mreq.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocket-multicast6-perl/current/t/20-pack-ipv6-mreq.t?rev=48166&op=file
==============================================================================
--- branches/upstream/libsocket-multicast6-perl/current/t/20-pack-ipv6-mreq.t (added)
+++ branches/upstream/libsocket-multicast6-perl/current/t/20-pack-ipv6-mreq.t Thu Dec  3 23:48:25 2009
@@ -1,0 +1,26 @@
+use Test::More tests => 5;
+
+use Socket;
+use Socket6;
+use Socket::Multicast6;
+
+
+my @IPV6_MCAST_ADDRS = (
+	'ff01::0',
+	'ff02::1',
+	'ff05::1:3',
+	'ff1e:4838:dead::beef',
+	'ff78:140:2001:630:d0:f000:feed:80',
+);	
+
+
+foreach my $addr (@IPV6_MCAST_ADDRS) {
+	my $multiaddr = inet_pton( AF_INET6, $addr );
+	my $interface = int rand(255);
+
+	my $pack_ip_mreq = Socket::Multicast6::pack_ipv6_mreq( $multiaddr, $interface );
+
+	my $manual = $multiaddr . pack('I',$interface);
+
+	is( $pack_ip_mreq, $manual, "Packed structures match" );
+}




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