1 /*
2  * Copyright (C) 2007-2012, 2014 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library.  If not, see
16  * <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 #include "internal.h"
22 #include "virmacaddr.h"
23 
24 int virNetDevBridgeCreate(const char *brname,
25                           const virMacAddr *mac)
26     ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
27 int virNetDevBridgeDelete(const char *brname)
28     ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
29 
30 int virNetDevBridgeAddPort(const char *brname,
31                            const char *ifname)
32     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
33 
34 int virNetDevBridgeRemovePort(const char *brname,
35                               const char *ifname)
36     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
37 
38 int virNetDevBridgeSetSTPDelay(const char *brname,
39                                int delay)
40     ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
41 int virNetDevBridgeGetSTPDelay(const char *brname,
42                                int *delay)
43     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
44 int virNetDevBridgeSetSTP(const char *brname,
45                           bool enable)
46     ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
47 int virNetDevBridgeGetSTP(const char *brname,
48                           bool *enable)
49     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
50 
51 int virNetDevBridgeSetVlanFiltering(const char *brname,
52                                     bool enable)
53     ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
54 int virNetDevBridgeGetVlanFiltering(const char *brname,
55                                     bool *enable)
56     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
57 
58 int virNetDevBridgePortGetLearning(const char *brname,
59                                    const char *ifname,
60                                    bool *enable)
61     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
62     G_GNUC_WARN_UNUSED_RESULT;
63 int virNetDevBridgePortSetLearning(const char *brname,
64                                    const char *ifname,
65                                    bool enable)
66     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
67 int virNetDevBridgePortGetUnicastFlood(const char *brname,
68                                        const char *ifname,
69                                        bool *enable)
70     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
71     G_GNUC_WARN_UNUSED_RESULT;
72 int virNetDevBridgePortSetUnicastFlood(const char *brname,
73                                        const char *ifname,
74                                        bool enable)
75     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
76 int virNetDevBridgePortGetIsolated(const char *brname,
77                                    const char *ifname,
78                                    bool *enable)
79     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
80     G_GNUC_WARN_UNUSED_RESULT;
81 int virNetDevBridgePortSetIsolated(const char *brname,
82                                    const char *ifname,
83                                    bool enable)
84     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
85 
86 typedef enum {
87     VIR_NETDEVBRIDGE_FDB_FLAG_ROUTER    = (1 << 0),
88     VIR_NETDEVBRIDGE_FDB_FLAG_SELF      = (1 << 1),
89     VIR_NETDEVBRIDGE_FDB_FLAG_MASTER    = (1 << 2),
90 
91     VIR_NETDEVBRIDGE_FDB_FLAG_PERMANENT = (1 << 3),
92     VIR_NETDEVBRIDGE_FDB_FLAG_TEMP      = (1 << 4),
93 } virNetDevBridgeFDBFlags;
94 
95 int virNetDevBridgeFDBAdd(const virMacAddr *mac, const char *ifname,
96                           unsigned int flags)
97     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
98 int virNetDevBridgeFDBDel(const virMacAddr *mac, const char *ifname,
99                           unsigned int flags)
100     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
101