r48161 - in /branches/upstream/libio-socket-multicast6-perl/current: Build.PL Changes MANIFEST META.yml Makefile.PL README examples/unicast-recieve.pl examples/unicast-send.pl lib/IO/Socket/Multicast6.pm t/05interface.t
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Thu Dec 3 23:40:44 UTC 2009
Author: gregoa
Date: Thu Dec 3 23:40:39 2009
New Revision: 48161
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48161
Log:
[svn-upgrade] Integrating new upstream version, libio-socket-multicast6-perl (0.03)
Added:
branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-recieve.pl (with props)
branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-send.pl (with props)
branches/upstream/libio-socket-multicast6-perl/current/t/05interface.t
Removed:
branches/upstream/libio-socket-multicast6-perl/current/Makefile.PL
Modified:
branches/upstream/libio-socket-multicast6-perl/current/Build.PL
branches/upstream/libio-socket-multicast6-perl/current/Changes
branches/upstream/libio-socket-multicast6-perl/current/MANIFEST
branches/upstream/libio-socket-multicast6-perl/current/META.yml
branches/upstream/libio-socket-multicast6-perl/current/README
branches/upstream/libio-socket-multicast6-perl/current/lib/IO/Socket/Multicast6.pm
Modified: branches/upstream/libio-socket-multicast6-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-socket-multicast6-perl/current/Build.PL?rev=48161&op=diff
==============================================================================
--- branches/upstream/libio-socket-multicast6-perl/current/Build.PL (original)
+++ branches/upstream/libio-socket-multicast6-perl/current/Build.PL Thu Dec 3 23:40:39 2009
@@ -30,9 +30,6 @@
'Socket::Multicast6' => '0.01',
'IO::Socket::INET6' => '2.51',
},
-
- create_makefile_pl => 'passthrough',
-
);
$build->create_build_script;
Modified: branches/upstream/libio-socket-multicast6-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-socket-multicast6-perl/current/Changes?rev=48161&op=diff
==============================================================================
--- branches/upstream/libio-socket-multicast6-perl/current/Changes (original)
+++ branches/upstream/libio-socket-multicast6-perl/current/Changes Thu Dec 3 23:40:39 2009
@@ -1,4 +1,9 @@
Revision history for Perl extension IO::Socket::Multicast6
+
+0.03 Wed Nov 11 17:06:22 GMT 2009
+ - Minor changes to documentation
+ - Changed to import all symbols from Socket and Socket6
+ - Added missing files to the manifest
0.02 Tue Sep 19 14:25:15 BST 2006
- added support for mcast_send and mcast_dest
@@ -6,4 +11,4 @@
- Resuse_Addr is now enabled by default
0.01 Tue Aug 15 15:40:30 BST 2006
- - original version based on IO::Socket::Multicast v1.04
+ - original version based on IO::Socket::Multicast v1.04
Modified: branches/upstream/libio-socket-multicast6-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-socket-multicast6-perl/current/MANIFEST?rev=48161&op=diff
==============================================================================
--- branches/upstream/libio-socket-multicast6-perl/current/MANIFEST (original)
+++ branches/upstream/libio-socket-multicast6-perl/current/MANIFEST Thu Dec 3 23:40:39 2009
@@ -2,12 +2,14 @@
Changes
examples/multicast-recieve.pl
examples/multicast-send.pl
+examples/unicast-recieve.pl
+examples/unicast-send.pl
lib/IO/Socket/Multicast6.pm
-Makefile.PL
MANIFEST
META.yml
README
t/00use.t
+t/05interface.t
t/10loopback.t
t/10ttl.t
t/20add-drop.t
Modified: branches/upstream/libio-socket-multicast6-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-socket-multicast6-perl/current/META.yml?rev=48161&op=diff
==============================================================================
--- branches/upstream/libio-socket-multicast6-perl/current/META.yml (original)
+++ branches/upstream/libio-socket-multicast6-perl/current/META.yml Thu Dec 3 23:40:39 2009
@@ -1,11 +1,13 @@
---
name: IO-Socket-Multicast6
-version: 0.02
+version: 0.03
author:
- 'Based on L<IO::Socket::Multicast> by Lincoln Stein, lstein at cshl.org.'
- 'IO::Socket::Multicast6 by Nicholas J Humfrey, E<lt>njh at cpan.orgE<gt>.'
abstract: Send and receive IPv4 and IPv6 multicast messages
license: perl
+resources:
+ license: http://dev.perl.org/licenses/
requires:
IO::Interface: 1.01
IO::Socket::INET6: 2.51
@@ -19,5 +21,8 @@
provides:
IO::Socket::Multicast6:
file: lib/IO/Socket/Multicast6.pm
- version: 0.02
-generated_by: Module::Build version 0.26
+ version: 0.03
+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/libio-socket-multicast6-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-socket-multicast6-perl/current/README?rev=48161&op=diff
==============================================================================
--- branches/upstream/libio-socket-multicast6-perl/current/README (original)
+++ branches/upstream/libio-socket-multicast6-perl/current/README Thu Dec 3 23:40:39 2009
@@ -18,6 +18,7 @@
# Drop a multicast group
$s->mcast_drop('FF15::0561');
+
# create a new IPv4 UDP socket ready to send datagrams to port 1100
my $s = IO::Socket::Multicast6->new(
@@ -141,6 +142,10 @@
distinguish which group a message was addressed to by identifying
which socket it was received on.
+ $success = $socket->mcast_add_source($multicast_add, $source_addr
+ [,$interface])
+ Same as mcast_add() but for Source Specific Multicast (SSM).
+
$success = $socket->mcast_drop($multicast_address)
This reverses the action of mcast_add(), removing the indicated
multicast address from the list of subscribed groups.
@@ -241,8 +246,8 @@
use constant GROUP => 'FF15::0561';
use constant PORT => '2000';
-
- my $sock = IO::Socket::Multicast6->new(
+
+ my $sock = IO::Socket::Multicast6->new(
Proto=>'udp',
Domain=>AF_INET6,
PeerAddr=>GROUP,
@@ -272,8 +277,8 @@
Domain=>AF_INET6,
LocalAddr=>GROUP,
LocalPort=>PORT);
-
- $sock->mcast_add(GROUP) || die "Couldn't set group: $!\n";
+
+ $sock->mcast_add(GROUP) || die "Couldn't set group: $!\n";
while (1) {
my $data;
@@ -286,15 +291,21 @@
crash on versions of Linux earlier than 2.2.0 because of a kernel bug in
the implementation of the multicast socket options.
+SEE ALSO
+ <http://www.ietf.org/rfc/rfc2553.txt>
+
+ perl(1), IO::Socket(3), Socket::Multicast6(3), IO::Socket::INET6(3).
+
AUTHOR
Based on IO::Socket::Multicast by Lincoln Stein, lstein at cshl.org.
IO::Socket::Multicast6 by Nicholas J Humfrey, <njh at cpan.org>.
- This module is distributed under the same terms as Perl itself.
-
-SEE ALSO
- <http://www.ietf.org/rfc/rfc2553.txt>
-
- perl(1), IO::Socket(3), Socket::Multicast6(3), IO::Socket::INET6(3).
-
+COPYRIGHT AND LICENSE
+ Copyright (C) 2006-2009 Nicholas J Humfrey Copyright (C) 2000-2005
+ Lincoln Stein
+
+ 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.
+
Added: branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-recieve.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-recieve.pl?rev=48161&op=file
==============================================================================
--- branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-recieve.pl (added)
+++ branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-recieve.pl Thu Dec 3 23:40:39 2009
@@ -1,0 +1,18 @@
+#!/usr/bin/perl
+
+use strict;
+use lib '../blib/lib','../blib/arch';
+use IO::Socket::Multicast6;
+
+use constant PORT => '2000';
+
+my $sock = new IO::Socket::Multicast6(
+# Domain=>AF_INET,
+ LocalPort=>PORT,
+ ReuseAddr=>1);
+
+while (1) {
+ my $data;
+ next unless $sock->recv($data,1024);
+ print "Got ".length($data)." bytes: $data\n";
+}
Propchange: branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-recieve.pl
------------------------------------------------------------------------------
svn:executable = *
Added: branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-send.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-send.pl?rev=48161&op=file
==============================================================================
--- branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-send.pl (added)
+++ branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-send.pl Thu Dec 3 23:40:39 2009
@@ -1,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use lib '../blib/lib','../blib/arch';
+use IO::Socket::Multicast6;
+
+use constant DESTINATION => '127.0.0.1:2000';
+
+my $sock = new IO::Socket::Multicast6(
+ Domain=>AF_INET,
+ ReuseAddr=>1);
+
+print "Socket's domain: ".$sock->sockdomain()."\n";
+
+while (1) {
+ my $message = localtime();
+ $sock->mcast_send($message,DESTINATION) || die "Couldn't send: $!";
+} continue {
+ sleep 5;
+}
Propchange: branches/upstream/libio-socket-multicast6-perl/current/examples/unicast-send.pl
------------------------------------------------------------------------------
svn:executable = *
Modified: branches/upstream/libio-socket-multicast6-perl/current/lib/IO/Socket/Multicast6.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-socket-multicast6-perl/current/lib/IO/Socket/Multicast6.pm?rev=48161&op=diff
==============================================================================
--- branches/upstream/libio-socket-multicast6-perl/current/lib/IO/Socket/Multicast6.pm (original)
+++ branches/upstream/libio-socket-multicast6-perl/current/lib/IO/Socket/Multicast6.pm Thu Dec 3 23:40:39 2009
@@ -6,15 +6,14 @@
use IO::Socket::INET6;
use IO::Interface::Simple;
use Socket::Multicast6 qw/ :all /;
-use Socket6 qw/ AF_INET6 IPPROTO_IP IPPROTO_IPV6
- inet_pton inet_ntop pack_sockaddr_in6/;
-use Socket qw/ AF_INET sockaddr_family pack_sockaddr_in /;
+use Socket;
+use Socket6;
use Carp 'croak';
@ISA = qw(IO::Socket::INET6);
-$VERSION = '0.02';
+$VERSION = '0.03';
# Regular expressions to match IP addresses
@@ -58,6 +57,31 @@
or croak "Could not set IPV6_JOIN_GROUP socket option: $!";
} else {
croak("mcast_add failed, unsupported socket family." );
+ }
+
+ # Success
+ return 1;
+}
+
+sub mcast_add_source {
+ my $sock = shift;
+ my $group = shift || croak 'usage: $sock->mcast_add_source($mcast_addr, $source_addr [,$interface])';
+ my $source = shift || croak 'usage: $sock->mcast_add_source($mcast_addr, $source_addr [,$interface])';
+ my $interface = shift;
+
+ if ($sock->sockdomain() == AF_INET) {
+ my $if_addr = _get_if_ipv4addr($interface);
+ my $ip_mreq = pack_ip_mreq_source(
+ inet_pton( AF_INET, $group ),
+ inet_pton( AF_INET, $source ),
+ inet_pton( AF_INET, $if_addr ) );
+
+ setsockopt($sock, IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP, $ip_mreq )
+ or croak "Could not set IP_ADD_SOURCE_MEMBERSHIP socket option: $!";
+ } elsif ($sock->sockdomain() == AF_INET6) {
+ croak("mcast_add_source failed, IPv6 is currently unsupported." );
+ } else {
+ croak("mcast_add_source failed, unsupported socket family." );
}
# Success
@@ -431,6 +455,12 @@
which group a message was addressed to by identifying which socket it
was received on.
+
+=item $success = $socket->mcast_add_source($multicast_add, $source_addr [,$interface])
+
+Same as mcast_add() but for Source Specific Multicast (SSM).
+
+
=item $success = $socket->mcast_drop($multicast_address)
This reverses the action of mcast_add(), removing the indicated
@@ -596,19 +626,25 @@
in the implementation of the multicast socket options.
+=head1 SEE ALSO
+
+L<http://www.ietf.org/rfc/rfc2553.txt>
+
+perl(1), IO::Socket(3), Socket::Multicast6(3), IO::Socket::INET6(3).
+
=head1 AUTHOR
Based on L<IO::Socket::Multicast> by Lincoln Stein, lstein at cshl.org.
IO::Socket::Multicast6 by Nicholas J Humfrey, E<lt>njh at cpan.orgE<gt>.
-This module is distributed under the same terms as Perl itself.
-
-
-=head1 SEE ALSO
-
-L<http://www.ietf.org/rfc/rfc2553.txt>
-
-perl(1), IO::Socket(3), Socket::Multicast6(3), IO::Socket::INET6(3).
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006-2009 Nicholas J Humfrey
+Copyright (C) 2000-2005 Lincoln Stein
+
+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.
=cut
Added: branches/upstream/libio-socket-multicast6-perl/current/t/05interface.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-socket-multicast6-perl/current/t/05interface.t?rev=48161&op=file
==============================================================================
--- branches/upstream/libio-socket-multicast6-perl/current/t/05interface.t (added)
+++ branches/upstream/libio-socket-multicast6-perl/current/t/05interface.t Thu Dec 3 23:40:39 2009
@@ -1,0 +1,49 @@
+#
+# Try attaching to a multicast interface
+#
+
+use strict;
+use Test::More tests => 10;
+
+
+# load IO::Socket::Multicast6 and IO::Interface
+BEGIN {
+ use_ok( 'IO::Interface::Simple' );
+ use_ok( 'IO::Socket::Multicast6' );
+}
+
+
+# Find first multicast enabled interface
+my $iface = undef;
+my @interfaces = IO::Interface::Simple->interfaces;
+foreach my $if (@interfaces) {
+ next unless ($if->is_running);
+ next unless ($if->is_multicast);
+
+ # Found multicast enabled interface
+ $iface = $if->name();
+ last;
+}
+
+unless (defined $iface) {
+ die( "Failed to find multicast enabled interface." );
+}
+
+
+# Create an IPv4 multicast socket
+my $sock4 = new IO::Socket::Multicast6( Domain => AF_INET );
+ok( $sock4, "Create IPv4 multicast socket" );
+
+ok( defined $sock4->mcast_if(), "Get outgoing interface of IPv4 socket" );
+ok( defined $sock4->mcast_if($iface), "Set outgoing interface of IPv4 socket" );
+ok( $sock4->mcast_if() eq $iface, "Verify outgoing interface of IPv4 socket" );
+
+
+# Create an IPv6 multicast socket
+my $sock6 = new IO::Socket::Multicast6( Domain => AF_INET6 );
+ok( $sock6, "Create IPv6 multicast socket" );
+
+ok( defined $sock6->mcast_if(), "Get outgoing interface of IPv6 socket" );
+ok( defined $sock6->mcast_if($iface), "Set outgoing interface of IPv6 socket" );
+ok( $sock6->mcast_if() eq $iface, "Verify outgoing interface of IPv6 socket" );
+
More information about the Pkg-perl-cvs-commits
mailing list