]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Built the CPAN file structure for the Vici::Session perl module
authorAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 17 Nov 2015 12:32:54 +0000 (13:32 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 18 Nov 2015 19:13:11 +0000 (20:13 +0100)
14 files changed:
configure.ac
src/libcharon/plugins/vici/perl/.gitignore [new file with mode: 0644]
src/libcharon/plugins/vici/perl/MANIFEST.in [deleted file]
src/libcharon/plugins/vici/perl/Makefile.am
src/libcharon/plugins/vici/perl/Vici-Session/Changes [new file with mode: 0644]
src/libcharon/plugins/vici/perl/Vici-Session/MANIFEST [new file with mode: 0644]
src/libcharon/plugins/vici/perl/Vici-Session/Makefile.PL [new file with mode: 0644]
src/libcharon/plugins/vici/perl/Vici-Session/README [new file with mode: 0644]
src/libcharon/plugins/vici/perl/Vici-Session/lib/Vici/Message.pm [moved from src/libcharon/plugins/vici/perl/Vici/Message.pm with 70% similarity]
src/libcharon/plugins/vici/perl/Vici-Session/lib/Vici/Packet.pm [moved from src/libcharon/plugins/vici/perl/Vici/Packet.pm with 62% similarity]
src/libcharon/plugins/vici/perl/Vici-Session/lib/Vici/Session.pm [moved from src/libcharon/plugins/vici/perl/Vici/Session.pm with 58% similarity]
src/libcharon/plugins/vici/perl/Vici-Session/lib/Vici/Transport.pm [new file with mode: 0644]
src/libcharon/plugins/vici/perl/Vici-Session/t/Vici-Session.t [new file with mode: 0644]
src/libcharon/plugins/vici/perl/Vici/Transport.pm [deleted file]

index 969704463bd4e44d875f8ee71d4f026c0a0ae9f0..1017952e7bde65eb0eea93055a15bd47127c0e72 100644 (file)
@@ -449,6 +449,10 @@ if test x$python_eggs_install = xtrue; then
        python_eggs=true
 fi
 
+if test x$perl_cpan_install = xtrue; then
+       python_cpan=true
+fi
+
 # ===========================================
 #  check required libraries and header files
 # ===========================================
@@ -1249,6 +1253,8 @@ if test x$python_eggs = xtrue; then
 fi
 AM_CONDITIONAL(PYTHON_EGGS_INSTALL, [test "x$python_eggs_install" = xtrue])
 
+AM_CONDITIONAL(PERL_CPAN_INSTALL, [test "x$perl_cpan_install" = xtrue])
+
 # ===============================================
 #  collect plugin list for strongSwan components
 # ===============================================
diff --git a/src/libcharon/plugins/vici/perl/.gitignore b/src/libcharon/plugins/vici/perl/.gitignore
new file mode 100644 (file)
index 0000000..02793d8
--- /dev/null
@@ -0,0 +1,5 @@
+Makefile.old
+Vici-Session/MYMETA.json
+Vici-Session/MYMETA.yml
+Vici-Session/pm_to_blib
+Vici-Session/blib/
diff --git a/src/libcharon/plugins/vici/perl/MANIFEST.in b/src/libcharon/plugins/vici/perl/MANIFEST.in
deleted file mode 100644 (file)
index 1aba38f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-include LICENSE
index a160d9c9e9052ff1e6115da8e748684d44451ef2..026d322a936476e59528690c8b848848ef02c50c 100644 (file)
@@ -1,6 +1,27 @@
 EXTRA_DIST = LICENSE \
-       Vici/Message.pm \
-       Vici/Packet.pm \
-       Vici/Session.pm \
-       Vici/Transport.pm
+       Vici-Session/Changes \
+       Vici-Session/Makefile.PL \
+       Vici-Session/MANIFEST \
+       Vici-Session/README \
+       Vici-Session/t/Vici-Session.t \
+       Vici-Session/lib/Vici/Message.pm \
+       Vici-Session/lib/Vici/Packet.pm \
+       Vici-Session/lib/Vici/Session.pm \
+       Vici-Session/lib/Vici/Transport.pm
+
+all-local: Vici-Session/pm_to_blib
+
+Vici-Session/Makefile: $(srcdir)/Vici-Session/Makefile.PL
+       (cd $(srcdir)/Vici-Session; $(PERL) Makefile.PL)
+
+Vici-Session/pm_to_blib: $(EXTRA_DIST) $(srcdir)/Vici-Session/Makefile
+       (cd $(srcdir)/Vici-Session; make)
+
+clean-local:
+       (cd $(srcdir)/Vici-Session; make clean)
+
+if PERL_CPAN_INSTALL
+install-exec-local: Vici-Session/pm_to_blib
+       (cd $(srcdir)/Vici-Session; make install)
+endif
 
diff --git a/src/libcharon/plugins/vici/perl/Vici-Session/Changes b/src/libcharon/plugins/vici/perl/Vici-Session/Changes
new file mode 100644 (file)
index 0000000..0c30328
--- /dev/null
@@ -0,0 +1,6 @@
+Revision history for Perl extension Vici::Session.
+
+0.9  Tue Nov 17 11:45:21 2015
+       - original version; created by h2xs 1.23 with options
+               -X -n Vici::Session
+
diff --git a/src/libcharon/plugins/vici/perl/Vici-Session/MANIFEST b/src/libcharon/plugins/vici/perl/Vici-Session/MANIFEST
new file mode 100644 (file)
index 0000000..a66a1c6
--- /dev/null
@@ -0,0 +1,9 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+t/Vici-Session.t
+lib/Vici/Session.pm
+lib/Vici/Message.pm
+lib/Vici/Packet.pm
+lib/Vici/Transport.pm
diff --git a/src/libcharon/plugins/vici/perl/Vici-Session/Makefile.PL b/src/libcharon/plugins/vici/perl/Vici-Session/Makefile.PL
new file mode 100644 (file)
index 0000000..6b48010
--- /dev/null
@@ -0,0 +1,12 @@
+use 5.018002;
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    NAME              => 'Vici::Session',
+    VERSION_FROM      => 'lib/Vici/Session.pm', # finds $VERSION
+    PREREQ_PM         => {}, # e.g., Module::Name => 1.1
+    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM  => 'lib/Vici/Session.pm', # retrieve abstract from module
+       AUTHOR         => 'Andreas Steffen <andreas.steffen@>strongswan.org') : ()),
+);
diff --git a/src/libcharon/plugins/vici/perl/Vici-Session/README b/src/libcharon/plugins/vici/perl/Vici-Session/README
new file mode 100644 (file)
index 0000000..faba28b
--- /dev/null
@@ -0,0 +1,40 @@
+Vici-Session version 0.01
+=========================
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the
+README file from a module distribution so that people browsing the
+archive can use it get an idea of the modules uses. It is usually a
+good idea to provide version information here so that people can
+decide whether fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+  blah blah blah
+
+COPYRIGHT AND LICENCE
+
+Put the correct copyright and licence information here.
+
+Copyright (C) 2015 by Andreas Steffen
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.18.2 or,
+at your option, any later version of Perl 5 you may have available.
+
+
similarity index 70%
rename from src/libcharon/plugins/vici/perl/Vici/Message.pm
rename to src/libcharon/plugins/vici/perl/Vici-Session/lib/Vici/Message.pm
index 81cbbaa17aed92184dfab0e3791a936b85274e3f..7a638528834ade352c6584abe3e36806d9754e68 100644 (file)
@@ -1,12 +1,16 @@
 package Vici::Message;
 
 require Exporter;
+use AutoLoader qw(AUTOLOAD);
 
 our @ISA = qw(Exporter);
-our @EXPORT = qw(new, from_data, hash, encode, raw);
-our @VERSION = 0.9;
+our @EXPORT = qw(
+    new, from_data, hash, encode, raw
+);
+our $VERSION = '0.9';
 
 use strict;
+use warnings;
 use Switch;
 use Vici::Transport;
 
@@ -210,5 +214,58 @@ sub raw_hash {
 }
 
 1;
+__END__
+=head1 NAME
 
+Vici::Message - Perl extension for building and parsing strongSwan VICI messages
+
+=head1 SYNOPSIS
+
+  use Vici::Message;
+
+=head1 DESCRIPTION
+
+The Vici::Message module is needed by the Vici::Session module to build and
+parse messages used in the communication with the open source strongSwan IPsec
+daemon (https://www.strongswan.com) via the documented Versatile IKE
+Configuration Interface (VICI). VICI allows the configuration, management and
+monitoring of multiple IPsec connections.
+
+=head2 EXPORT
+
+None by default.
+
+=head1 SEE ALSO
+
+strongSwan Wiki:  https://wiki.strongswan.org/projects/strongswan/wiki/Vici
+
+strongSwan Mailing list:  users@lists.strongswan.org
+
+=head1 AUTHOR
+
+Andreas Steffen, E<lt>andreas.steffen@strongswan.orgE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2015 by Andreas Steffen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+=cut
 
similarity index 62%
rename from src/libcharon/plugins/vici/perl/Vici/Packet.pm
rename to src/libcharon/plugins/vici/perl/Vici-Session/lib/Vici/Packet.pm
index 4f731ecd96ac86704877a3f95316406cc1bd737b..bcd1725938bd49272555903b8aed494d20e2ff05 100644 (file)
@@ -1,12 +1,16 @@
 package Vici::Packet;
 
 require Exporter;
+use AutoLoader qw(AUTOLOAD);
 
 our @ISA = qw(Exporter);
-our @EXPORT = qw(new, request, register, unregister, streamed_request);
-our @VERSION = 0.9;
+our @EXPORT = qw(
+    new, request, register, unregister, streamed_request
+);
+our $VERSION = '0.9';
 
 use strict;
+use warnings;
 use Switch;
 use Vici::Transport;
 
@@ -146,5 +150,57 @@ sub streamed_request {
 }
 
 1;
+__END__
+=head1 NAME
 
+Vici::Packet - Perl extension for sending and receiving strongSwan VICI packets
 
+=head1 SYNOPSIS
+
+  use Vici::Packet;
+
+=head1 DESCRIPTION
+
+The Vici::Packet module is needed by the Vici::Session module to send and
+receive packets used in the communication with the open source strongSwan IPsec
+daemon (https://www.strongswan.com) via the documented Versatile IKE
+Configuration Interface (VICI). VICI allows the configuration, management and
+monitoring of multiple IPsec connections.
+
+=head2 EXPORT
+
+None by default.
+
+=head1 SEE ALSO
+
+strongSwan Wiki:  https://wiki.strongswan.org/projects/strongswan/wiki/Vici
+
+strongSwan Mailing list:  users@lists.strongswan.org
+
+=head1 AUTHOR
+
+Andreas Steffen, E<lt>andreas.steffen@strongswan.orgE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2015 by Andreas Steffen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+=cut
similarity index 58%
rename from src/libcharon/plugins/vici/perl/Vici/Session.pm
rename to src/libcharon/plugins/vici/perl/Vici-Session/lib/Vici/Session.pm
index c05a1a81988355d743e539bb758bc5ee71235e86..9b7070c123cf86e35bf2e8b676367dee20cb8bbc 100644 (file)
@@ -1,14 +1,18 @@
 package Vici::Session;
 
 require Exporter;
+use AutoLoader qw(AUTOLOAD);
 
 our @ISA = qw(Exporter);
-our @EXPORT = qw(new, version, stats, reload_settings, initiate, list_sas,
-                 list_policies, list_conns, get_conns, list_certs,
-                 list_authorities, get_authorities, get_pools);
-our @VERSION = 0.9;
+our @EXPORT = qw(
+    new, version, stats, reload_settings, initiate, list_sas, list_policies,
+    list_conns, get_conns, list_certs, list_authorities, get_authorities,
+    get_pools
+);
+our $VERSION = '0.9';
 
 use strict;
+use warnings;
 use Vici::Packet;
 use Vici::Message;
 
@@ -124,3 +128,56 @@ sub get_pools {
 }
 
 1;
+__END__
+=head1 NAME
+
+Vici::Session - Perl binding for the strongSwan VICI configuration interface
+
+=head1 SYNOPSIS
+
+  use Vici::Session;
+
+=head1 DESCRIPTION
+
+The Vici::Session module allows a Perl script to communicate with the open
+source strongSwan IPsec daemon (https://www.strongswan.com) via the documented
+Versatile IKE Configuration Interface (VICI). VICI allows the configuration,
+management and monitoring of multiple IPsec connections.
+
+=head2 EXPORT
+
+None by default.
+
+=head1 SEE ALSO
+
+strongSwan Wiki:  https://wiki.strongswan.org/projects/strongswan/wiki/Vici
+
+strongSwan Mailing list:  users@lists.strongswan.org
+
+=head1 AUTHOR
+
+Andreas Steffen, E<lt>andreas.steffen@strongswan.orgE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2015 by Andreas Steffen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+=cut
diff --git a/src/libcharon/plugins/vici/perl/Vici-Session/lib/Vici/Transport.pm b/src/libcharon/plugins/vici/perl/Vici-Session/lib/Vici/Transport.pm
new file mode 100644 (file)
index 0000000..88a09fb
--- /dev/null
@@ -0,0 +1,96 @@
+package Vici::Transport;
+
+require Exporter;
+use AutoLoader qw(AUTOLOAD);
+
+our @ISA = qw(Exporter);
+our @EXPORT = qw(
+    new, send, receive
+);
+our $VERSION = '0.9';
+
+use strict;
+use warnings;
+
+sub new {
+    my $class = shift;
+    my $self = {
+        Socket => shift,
+    };
+    bless($self, $class);
+    return $self;
+}
+
+sub send {
+    my ($self, $data) = @_;
+    my $packet = pack('N/a*', $data);
+    $self->{'Socket'}->send($packet);
+}
+
+sub receive {
+    my $self = shift;
+    my $packet_header;
+    my $data;
+
+    $self->{'Socket'}->recv($packet_header, 4);
+    my $packet_len = unpack('N', $packet_header);
+    $self->{'Socket'}->recv($data, $packet_len);
+       return $data;
+}
+
+1;
+__END__
+=head1 NAME
+
+Vici::Transport - Perl extension for communicating via a strongSwan VICI socket
+
+=head1 SYNOPSIS
+
+  use Vici::Transport;
+
+=head1 DESCRIPTION
+
+The Vici::Transport module is needed by the Vici::Packet module to send
+and receive packets over the UNIX socket used in the communication with the
+open source strongSwan IPsec daemon (https://www.strongswan.com) via the
+documented Versatile IKE Configuration Interface (VICI). VICI allows the
+onfiguration, management and monitoring of multiple IPsec connections.
+
+=head2 EXPORT
+
+None by default.
+
+=head1 SEE ALSO
+
+strongSwan Wiki:  https://wiki.strongswan.org/projects/strongswan/wiki/Vici
+
+strongSwan Mailing list:  users@lists.strongswan.org
+
+=head1 AUTHOR
+
+Andreas Steffen, E<lt>andreas.steffen@strongswan.orgE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2015 by Andreas Steffen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+=cut
+
diff --git a/src/libcharon/plugins/vici/perl/Vici-Session/t/Vici-Session.t b/src/libcharon/plugins/vici/perl/Vici-Session/t/Vici-Session.t
new file mode 100644 (file)
index 0000000..4c321f3
--- /dev/null
@@ -0,0 +1,18 @@
+# Before 'make install' is performed this script should be runnable with
+# 'make test'. After 'make install' it should work as 'perl Vici-Session.t'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+BEGIN { use_ok('Vici::Session') };
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+
diff --git a/src/libcharon/plugins/vici/perl/Vici/Transport.pm b/src/libcharon/plugins/vici/perl/Vici/Transport.pm
deleted file mode 100644 (file)
index 4444467..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package Vici::Transport;
-
-require Exporter;
-
-our @ISA = qw(Exporter);
-our @EXPORT = qw(new, send, receive);
-our @VERSION = 0.9;
-
-use strict;
-
-sub new {
-    my $class = shift;
-    my $self = {
-        Socket => shift,
-    };
-    bless($self, $class);
-    return $self;
-}
-
-sub send {
-    my ($self, $data) = @_;
-    my $packet = pack('N/a*', $data);
-    $self->{'Socket'}->send($packet);
-}
-
-sub receive {
-    my $self = shift;
-    my $packet_header;
-    my $data;
-
-    $self->{'Socket'}->recv($packet_header, 4);
-    my $packet_len = unpack('N', $packet_header);
-    $self->{'Socket'}->recv($data, $packet_len);
-       return $data;
-}
-
-1;
-
-