Debian Codegraph @

lib/Sys/Virt/NWFilterBinding.pm

raw
1 # -*- perl -*-
2 #
3 # Copyright (C) 2018 Red Hat
4 #
5 # This program is free software; You can redistribute it and/or modify
6 # it under either:
7 #
8 # a) the GNU General Public License as published by the Free
9 # Software Foundation; either version 2, or (at your option) any
10 # later version,
11 #
12 # or
13 #
14 # b) the "Artistic License"
15 #
16 # The file "LICENSE" distributed along with this file provides full
17 # details of the terms and conditions of the two licenses.
18
19 =pod
20
21 =head1 NAME
22
23 Sys::Virt::NWFilterBinding - Represent & manage a network filter binding
24
25 =head1 DESCRIPTION
26
27 The C<Sys::Virt::NWFilterBinding> module represents a binding between a
28 network filter and a network port device.
29
30 =head1 METHODS
31
32 =over 4
33
34 =cut
35
36 package Sys::Virt::NWFilterBinding;
37
38 use strict;
39 use warnings;
40
41
42 sub _new {
43 my $proto = shift;
44 my $class = ref($proto) || $proto;
45 my %params = @_;
46
47 my $con = exists $params{connection} ? $params{connection} : die "connection parameter is required";
48 my $self;
49 if (exists $params{portdev}) {
50 $self = Sys::Virt::NWFilterBinding::_lookup_by_port_dev($con, $params{portdev});
51 } elsif (exists $params{xml}) {
52 $self = Sys::Virt::NWFilterBinding::_create_xml($con, $params{xml}, $params{flags});
53 } else {
54 die "portdev or xml parameters are required";
55 }
56
57 bless $self, $class;
58
59 return $self;
60 }
61
62
63 =item my $name = $binding->get_port_dev()
64
65 Returns a string with the name of the network port device that is bound to
66
67 =item my $name = $binding->get_filter_name()
68
69 Returns a string with the name of the network filter that is bound to
70
71 =item my $xml = $binding->get_xml_description()
72
73 Returns an XML document containing a complete description of
74 the network's configuration
75
76 =item $binding->delete()
77
78 Unbind the network port device from the filter
79
80 =cut
81
82
83 1;
84
85 =back
86
87 =head2 NETWORK FILTER BINDING CREATION CONSTANTS
88
89 When creating network filter bindings zero or more of the following
90 constants may be used
91
92 =over 4
93
94 =item Sys::Virt::NWFilterBinding::CREATE_VALIDATE
95
96 Validate the XML document against the XML schema
97
98 =back
99
100 =head1 AUTHORS
101
102 Daniel P. Berrange <[email protected]>
103
104 =head1 COPYRIGHT
105
106 Copyright (C) 2018 Red Hat
107
108 =head1 LICENSE
109
110 This program is free software; you can redistribute it and/or modify
111 it under the terms of either the GNU General Public License as published
112 by the Free Software Foundation (either version 2 of the License, or at
113 your option any later version), or, the Artistic License, as specified
114 in the Perl README file.
115
116 =head1 SEE ALSO
117
118 L<Sys::Virt>, L<Sys::Virt::Error>, C<http://libvirt.org>
119
120 =cut