|
|
8dd1d3 |
From d5ae3d1db19b52676489c2312efd21ab5e86aee4 Mon Sep 17 00:00:00 2001
|
|
|
8dd1d3 |
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
|
8dd1d3 |
Date: Tue, 14 Aug 2018 11:46:08 +0100
|
|
|
8dd1d3 |
Subject: [PATCH] Add NWFilterBinding.pm module missed in dist
|
|
|
8dd1d3 |
|
|
|
8dd1d3 |
---
|
|
|
8dd1d3 |
lib/Sys/Virt/NWFilterBinding.pm | 107 ++++++++++++++++++++++++++++++++
|
|
|
8dd1d3 |
1 file changed, 107 insertions(+)
|
|
|
8dd1d3 |
create mode 100644 lib/Sys/Virt/NWFilterBinding.pm
|
|
|
8dd1d3 |
|
|
|
8dd1d3 |
diff --git a/lib/Sys/Virt/NWFilterBinding.pm b/lib/Sys/Virt/NWFilterBinding.pm
|
|
|
8dd1d3 |
new file mode 100644
|
|
|
8dd1d3 |
index 0000000..2c56b3f
|
|
|
8dd1d3 |
--- /dev/null
|
|
|
8dd1d3 |
+++ b/lib/Sys/Virt/NWFilterBinding.pm
|
|
|
8dd1d3 |
@@ -0,0 +1,107 @@
|
|
|
8dd1d3 |
+# -*- perl -*-
|
|
|
8dd1d3 |
+#
|
|
|
8dd1d3 |
+# Copyright (C) 2018 Red Hat
|
|
|
8dd1d3 |
+#
|
|
|
8dd1d3 |
+# This program is free software; You can redistribute it and/or modify
|
|
|
8dd1d3 |
+# it under either:
|
|
|
8dd1d3 |
+#
|
|
|
8dd1d3 |
+# a) the GNU General Public License as published by the Free
|
|
|
8dd1d3 |
+# Software Foundation; either version 2, or (at your option) any
|
|
|
8dd1d3 |
+# later version,
|
|
|
8dd1d3 |
+#
|
|
|
8dd1d3 |
+# or
|
|
|
8dd1d3 |
+#
|
|
|
8dd1d3 |
+# b) the "Artistic License"
|
|
|
8dd1d3 |
+#
|
|
|
8dd1d3 |
+# The file "LICENSE" distributed along with this file provides full
|
|
|
8dd1d3 |
+# details of the terms and conditions of the two licenses.
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=pod
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=head1 NAME
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+Sys::Virt::NWFilterBinding - Represent & manage a network filter binding
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=head1 DESCRIPTION
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+The C<Sys::Virt::NWFilterBinding> module represents a binding between a
|
|
|
8dd1d3 |
+network filter and a network port device.
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=head1 METHODS
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=over 4
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=cut
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+package Sys::Virt::NWFilterBinding;
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+use strict;
|
|
|
8dd1d3 |
+use warnings;
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+sub _new {
|
|
|
8dd1d3 |
+ my $proto = shift;
|
|
|
8dd1d3 |
+ my $class = ref($proto) || $proto;
|
|
|
8dd1d3 |
+ my %params = @_;
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+ my $con = exists $params{connection} ? $params{connection} : die "connection parameter is required";
|
|
|
8dd1d3 |
+ my $self;
|
|
|
8dd1d3 |
+ if (exists $params{portdev}) {
|
|
|
8dd1d3 |
+ $self = Sys::Virt::NWFilterBinding::_lookup_by_port_dev($con, $params{portdev});
|
|
|
8dd1d3 |
+ } elsif (exists $params{xml}) {
|
|
|
8dd1d3 |
+ $self = Sys::Virt::NWFilterBinding::_create_xml($con, $params{xml});
|
|
|
8dd1d3 |
+ } else {
|
|
|
8dd1d3 |
+ die "portdev or xml parameters are required";
|
|
|
8dd1d3 |
+ }
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+ bless $self, $class;
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+ return $self;
|
|
|
8dd1d3 |
+}
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=item my $name = $binding->get_port_dev()
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+Returns a string with the name of the network port device that is bound to
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=item my $name = $binding->get_filter_name()
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+Returns a string with the name of the network filter that is bound to
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=item my $xml = $binding->get_xml_description()
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+Returns an XML document containing a complete description of
|
|
|
8dd1d3 |
+the network's configuration
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=item $binding->delete()
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+Unbind the network port device from the filter
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=cut
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+1;
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=back
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=head1 AUTHORS
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+Daniel P. Berrange <berrange@redhat.com>
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=head1 COPYRIGHT
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+Copyright (C) 2018 Red Hat
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=head1 LICENSE
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+This program is free software; you can redistribute it and/or modify
|
|
|
8dd1d3 |
+it under the terms of either the GNU General Public License as published
|
|
|
8dd1d3 |
+by the Free Software Foundation (either version 2 of the License, or at
|
|
|
8dd1d3 |
+your option any later version), or, the Artistic License, as specified
|
|
|
8dd1d3 |
+in the Perl README file.
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=head1 SEE ALSO
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+L<Sys::Virt>, L<Sys::Virt::Error>, C<http://libvirt.org>
|
|
|
8dd1d3 |
+
|
|
|
8dd1d3 |
+=cut
|
|
|
8dd1d3 |
--
|
|
|
8dd1d3 |
2.17.1
|
|
|
8dd1d3 |
|