1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2011 - 2015 Red Hat, Inc.
4 */
5
6#ifndef __NM_SETTING_BRIDGE_H__
7#define __NM_SETTING_BRIDGE_H__
8
9#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
10#error "Only <NetworkManager.h> can be included directly."
11#endif
12
13#include "nm-setting.h"
14
15G_BEGIN_DECLS
16
17#define NM_TYPE_SETTING_BRIDGE (nm_setting_bridge_get_type())
18#define NM_SETTING_BRIDGE(obj) \
19 (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_BRIDGE, NMSettingBridge))
20#define NM_SETTING_BRIDGE_CLASS(klass) \
21 (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_BRIDGE, NMSettingBridgeClass))
22#define NM_IS_SETTING_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_BRIDGE))
23#define NM_IS_SETTING_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_BRIDGE))
24#define NM_SETTING_BRIDGE_GET_CLASS(obj) \
25 (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_BRIDGE, NMSettingBridgeClass))
26
27#define NM_SETTING_BRIDGE_SETTING_NAME "bridge"
28
29#define NM_SETTING_BRIDGE_MAC_ADDRESS "mac-address"
30#define NM_SETTING_BRIDGE_STP "stp"
31#define NM_SETTING_BRIDGE_PRIORITY "priority"
32#define NM_SETTING_BRIDGE_FORWARD_DELAY "forward-delay"
33#define NM_SETTING_BRIDGE_HELLO_TIME "hello-time"
34#define NM_SETTING_BRIDGE_MAX_AGE "max-age"
35#define NM_SETTING_BRIDGE_AGEING_TIME "ageing-time"
36#define NM_SETTING_BRIDGE_GROUP_FORWARD_MASK "group-forward-mask"
37#define NM_SETTING_BRIDGE_MULTICAST_HASH_MAX "multicast-hash-max"
38#define NM_SETTING_BRIDGE_MULTICAST_LAST_MEMBER_COUNT "multicast-last-member-count"
39#define NM_SETTING_BRIDGE_MULTICAST_LAST_MEMBER_INTERVAL "multicast-last-member-interval"
40#define NM_SETTING_BRIDGE_MULTICAST_MEMBERSHIP_INTERVAL "multicast-membership-interval"
41#define NM_SETTING_BRIDGE_MULTICAST_SNOOPING "multicast-snooping"
42#define NM_SETTING_BRIDGE_MULTICAST_ROUTER "multicast-router"
43#define NM_SETTING_BRIDGE_MULTICAST_QUERIER "multicast-querier"
44#define NM_SETTING_BRIDGE_MULTICAST_QUERIER_INTERVAL "multicast-querier-interval"
45#define NM_SETTING_BRIDGE_MULTICAST_QUERY_INTERVAL "multicast-query-interval"
46#define NM_SETTING_BRIDGE_MULTICAST_QUERY_RESPONSE_INTERVAL "multicast-query-response-interval"
47#define NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR "multicast-query-use-ifaddr"
48#define NM_SETTING_BRIDGE_MULTICAST_STARTUP_QUERY_COUNT "multicast-startup-query-count"
49#define NM_SETTING_BRIDGE_MULTICAST_STARTUP_QUERY_INTERVAL "multicast-startup-query-interval"
50#define NM_SETTING_BRIDGE_VLAN_FILTERING "vlan-filtering"
51#define NM_SETTING_BRIDGE_VLAN_DEFAULT_PVID "vlan-default-pvid"
52#define NM_SETTING_BRIDGE_VLANS "vlans"
53#define NM_SETTING_BRIDGE_GROUP_ADDRESS "group-address"
54#define NM_SETTING_BRIDGE_VLAN_PROTOCOL "vlan-protocol"
55#define NM_SETTING_BRIDGE_VLAN_STATS_ENABLED "vlan-stats-enabled"
56
57#define NM_BRIDGE_VLAN_VID_MIN 1
58#define NM_BRIDGE_VLAN_VID_MAX 4094
59
60typedef struct _NMSettingBridgeClass NMSettingBridgeClass;
61
62typedef struct _NMBridgeVlan NMBridgeVlan;
63
64GType nm_setting_bridge_get_type(void);
65
66NMSetting *nm_setting_bridge_new(void);
67
68const char *nm_setting_bridge_get_mac_address(NMSettingBridge *setting);
69
70gboolean nm_setting_bridge_get_stp(NMSettingBridge *setting);
71
72guint16 nm_setting_bridge_get_priority(NMSettingBridge *setting);
73
74guint16 nm_setting_bridge_get_forward_delay(NMSettingBridge *setting);
75
76guint16 nm_setting_bridge_get_hello_time(NMSettingBridge *setting);
77
78guint16 nm_setting_bridge_get_max_age(NMSettingBridge *setting);
79
80guint32 nm_setting_bridge_get_ageing_time(NMSettingBridge *setting);
81NM_AVAILABLE_IN_1_10
82guint16 nm_setting_bridge_get_group_forward_mask(NMSettingBridge *setting);
83
84gboolean nm_setting_bridge_get_multicast_snooping(NMSettingBridge *setting);
85NM_AVAILABLE_IN_1_18
86gboolean nm_setting_bridge_get_vlan_filtering(NMSettingBridge *setting);
87NM_AVAILABLE_IN_1_18
88guint16 nm_setting_bridge_get_vlan_default_pvid(NMSettingBridge *setting);
89NM_AVAILABLE_IN_1_18
90void nm_setting_bridge_add_vlan(NMSettingBridge *setting, NMBridgeVlan *vlan);
91NM_AVAILABLE_IN_1_18
92guint nm_setting_bridge_get_num_vlans(NMSettingBridge *setting);
93NM_AVAILABLE_IN_1_18
94NMBridgeVlan *nm_setting_bridge_get_vlan(NMSettingBridge *setting, guint idx);
95NM_AVAILABLE_IN_1_18
96void nm_setting_bridge_remove_vlan(NMSettingBridge *setting, guint idx);
97NM_AVAILABLE_IN_1_18
98gboolean
99nm_setting_bridge_remove_vlan_by_vid(NMSettingBridge *setting, guint16 vid_start, guint16 vid_end);
100NM_AVAILABLE_IN_1_18
101void nm_setting_bridge_clear_vlans(NMSettingBridge *setting);
102
103NM_AVAILABLE_IN_1_18
104GType nm_bridge_vlan_get_type(void);
105NM_AVAILABLE_IN_1_18
106NMBridgeVlan *nm_bridge_vlan_new(guint16 vid_start, guint16 vid_end);
107NM_AVAILABLE_IN_1_18
108NMBridgeVlan *nm_bridge_vlan_ref(NMBridgeVlan *vlan);
109NM_AVAILABLE_IN_1_18
110void nm_bridge_vlan_unref(NMBridgeVlan *vlan);
111NM_AVAILABLE_IN_1_18
112NMBridgeVlan *nm_bridge_vlan_new_clone(const NMBridgeVlan *vlan);
113NM_AVAILABLE_IN_1_18
114int nm_bridge_vlan_cmp(const NMBridgeVlan *a, const NMBridgeVlan *b);
115NM_AVAILABLE_IN_1_18
116void nm_bridge_vlan_seal(NMBridgeVlan *vlan);
117NM_AVAILABLE_IN_1_18
118gboolean nm_bridge_vlan_is_sealed(const NMBridgeVlan *vlan);
119NM_AVAILABLE_IN_1_18
120void nm_bridge_vlan_set_untagged(NMBridgeVlan *vlan, gboolean value);
121NM_AVAILABLE_IN_1_18
122void nm_bridge_vlan_set_pvid(NMBridgeVlan *vlan, gboolean value);
123NM_AVAILABLE_IN_1_18
124gboolean
125nm_bridge_vlan_get_vid_range(const NMBridgeVlan *vlan, guint16 *vid_start, guint16 *vid_end);
126NM_AVAILABLE_IN_1_18
127gboolean nm_bridge_vlan_is_untagged(const NMBridgeVlan *vlan);
128NM_AVAILABLE_IN_1_18
129gboolean nm_bridge_vlan_is_pvid(const NMBridgeVlan *vlan);
130
131NM_AVAILABLE_IN_1_18
132char *nm_bridge_vlan_to_str(const NMBridgeVlan *vlan, GError **error);
133NM_AVAILABLE_IN_1_18
134NMBridgeVlan *nm_bridge_vlan_from_str(const char *str, GError **error);
135
136NM_AVAILABLE_IN_1_24
137const char *nm_setting_bridge_get_group_address(const NMSettingBridge *setting);
138
139NM_AVAILABLE_IN_1_24
140const char *nm_setting_bridge_get_vlan_protocol(const NMSettingBridge *setting);
141
142NM_AVAILABLE_IN_1_24
143gboolean nm_setting_bridge_get_vlan_stats_enabled(const NMSettingBridge *setting);
144
145NM_AVAILABLE_IN_1_24
146const char *nm_setting_bridge_get_multicast_router(const NMSettingBridge *setting);
147
148NM_AVAILABLE_IN_1_24
149gboolean nm_setting_bridge_get_multicast_query_use_ifaddr(const NMSettingBridge *setting);
150
151NM_AVAILABLE_IN_1_24
152gboolean nm_setting_bridge_get_multicast_querier(const NMSettingBridge *setting);
153
154NM_AVAILABLE_IN_1_26
155guint32 nm_setting_bridge_get_multicast_hash_max(const NMSettingBridge *setting);
156
157NM_AVAILABLE_IN_1_26
158guint32 nm_setting_bridge_get_multicast_last_member_count(const NMSettingBridge *setting);
159
160NM_AVAILABLE_IN_1_26
161guint64 nm_setting_bridge_get_multicast_last_member_interval(const NMSettingBridge *setting);
162
163NM_AVAILABLE_IN_1_26
164guint64 nm_setting_bridge_get_multicast_membership_interval(const NMSettingBridge *setting);
165
166NM_AVAILABLE_IN_1_26
167guint64 nm_setting_bridge_get_multicast_querier_interval(const NMSettingBridge *setting);
168
169NM_AVAILABLE_IN_1_26
170guint64 nm_setting_bridge_get_multicast_query_interval(const NMSettingBridge *setting);
171
172NM_AVAILABLE_IN_1_26
173guint64 nm_setting_bridge_get_multicast_query_response_interval(const NMSettingBridge *setting);
174
175NM_AVAILABLE_IN_1_26
176guint32 nm_setting_bridge_get_multicast_startup_query_count(const NMSettingBridge *setting);
177
178NM_AVAILABLE_IN_1_26
179guint64 nm_setting_bridge_get_multicast_startup_query_interval(const NMSettingBridge *setting);
180
181G_END_DECLS
182
183#endif /* __NM_SETTING_BRIDGE_H__ */
184

source code of include/libnm/nm-setting-bridge.h