File: NWFilterBinding.pm

package info (click to toggle)
libsys-virt-perl 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 932 kB
  • sloc: perl: 2,035; sh: 12; makefile: 3
file content (107 lines) | stat: -rw-r--r-- 2,310 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# -*- perl -*-
#
# Copyright (C) 2018 Red Hat
#
# This program is free software; You can redistribute it and/or modify
# it under either:
#
# a) the GNU General Public License as published by the Free
#   Software Foundation; either version 2, or (at your option) any
#   later version,
#
# or
#
# b) the "Artistic License"
#
# The file "LICENSE" distributed along with this file provides full
# details of the terms and conditions of the two licenses.

=pod

=head1 NAME

Sys::Virt::NWFilterBinding - Represent & manage a network filter binding

=head1 DESCRIPTION

The C<Sys::Virt::NWFilterBinding> module represents a binding between a
network filter and a network port device.

=head1 METHODS

=over 4

=cut

package Sys::Virt::NWFilterBinding;

use strict;
use warnings;


sub _new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my %params = @_;

    my $con = exists $params{connection} ? $params{connection} : die "connection parameter is required";
    my $self;
    if (exists $params{portdev}) {
	$self = Sys::Virt::NWFilterBinding::_lookup_by_port_dev($con,  $params{portdev});
    } elsif (exists $params{xml}) {
	$self = Sys::Virt::NWFilterBinding::_create_xml($con,  $params{xml});
    } else {
	die "portdev or xml parameters are required";
    }

    bless $self, $class;

    return $self;
}


=item my $name = $binding->get_port_dev()

Returns a string with the name of the network port device that is bound to

=item my $name = $binding->get_filter_name()

Returns a string with the name of the network filter that is bound to

=item my $xml = $binding->get_xml_description()

Returns an XML document containing a complete description of
the network's configuration

=item $binding->delete()

Unbind the network port device from the filter

=cut


1;

=back

=head1 AUTHORS

Daniel P. Berrange <berrange@redhat.com>

=head1 COPYRIGHT

Copyright (C) 2018 Red Hat

=head1 LICENSE

This program is free software; you can redistribute it and/or modify
it under the terms of either the GNU General Public License as published
by the Free Software Foundation (either version 2 of the License, or at
your option any later version), or, the Artistic License, as specified
in the Perl README file.

=head1 SEE ALSO

L<Sys::Virt>, L<Sys::Virt::Error>, C<http://libvirt.org>

=cut