1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us>
4 */
5
6#ifndef __NM_SETTING_TEAM_H__
7#define __NM_SETTING_TEAM_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/**
18 * NMTeamLinkWatcherArpPingFlags:
19 * @NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE: no one among the arp_ping link watcher
20 * boolean options ('validate_active', 'validate_inactive', 'send_always') is
21 * enabled (set to true).
22 * @NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE: the arp_ping link watcher
23 * option 'validate_active' is enabled (set to true).
24 * @NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_INACTIVE: the arp_ping link watcher
25 * option 'validate_inactive' is enabled (set to true).
26 * @NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_SEND_ALWAYS: the arp_ping link watcher option
27 * 'send_always' is enabled (set to true).
28 */
29typedef enum { /*< flags >*/
30 NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE = 0, /*< skip >*/
31 NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE = 0x2,
32 NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_INACTIVE = 0x4,
33 NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_SEND_ALWAYS = 0x8,
34} NMTeamLinkWatcherArpPingFlags;
35
36#define NM_TEAM_LINK_WATCHER_ETHTOOL "ethtool"
37#define NM_TEAM_LINK_WATCHER_ARP_PING "arp_ping"
38#define NM_TEAM_LINK_WATCHER_NSNA_PING "nsna_ping"
39
40typedef struct NMTeamLinkWatcher NMTeamLinkWatcher;
41
42GType nm_team_link_watcher_get_type(void);
43
44NM_AVAILABLE_IN_1_12
45NMTeamLinkWatcher *nm_team_link_watcher_new_ethtool(int delay_up, int delay_down, GError **error);
46NM_AVAILABLE_IN_1_12
47NMTeamLinkWatcher *nm_team_link_watcher_new_nsna_ping(int init_wait,
48 int interval,
49 int missed_max,
50 const char *target_host,
51 GError **error);
52NM_AVAILABLE_IN_1_12
53NMTeamLinkWatcher *nm_team_link_watcher_new_arp_ping(int init_wait,
54 int interval,
55 int missed_max,
56 const char *target_host,
57 const char *source_host,
58 NMTeamLinkWatcherArpPingFlags flags,
59 GError **error);
60NM_AVAILABLE_IN_1_16
61NMTeamLinkWatcher *nm_team_link_watcher_new_arp_ping2(int init_wait,
62 int interval,
63 int missed_max,
64 int vlanid,
65 const char *target_host,
66 const char *source_host,
67 NMTeamLinkWatcherArpPingFlags flags,
68 GError **error);
69NM_AVAILABLE_IN_1_12
70void nm_team_link_watcher_ref(NMTeamLinkWatcher *watcher);
71NM_AVAILABLE_IN_1_12
72void nm_team_link_watcher_unref(NMTeamLinkWatcher *watcher);
73NM_AVAILABLE_IN_1_12
74gboolean nm_team_link_watcher_equal(const NMTeamLinkWatcher *watcher,
75 const NMTeamLinkWatcher *other);
76NM_AVAILABLE_IN_1_12
77NMTeamLinkWatcher *nm_team_link_watcher_dup(const NMTeamLinkWatcher *watcher);
78NM_AVAILABLE_IN_1_12
79const char *nm_team_link_watcher_get_name(const NMTeamLinkWatcher *watcher);
80NM_AVAILABLE_IN_1_12
81int nm_team_link_watcher_get_delay_up(const NMTeamLinkWatcher *watcher);
82NM_AVAILABLE_IN_1_12
83int nm_team_link_watcher_get_delay_down(const NMTeamLinkWatcher *watcher);
84NM_AVAILABLE_IN_1_12
85int nm_team_link_watcher_get_init_wait(const NMTeamLinkWatcher *watcher);
86NM_AVAILABLE_IN_1_12
87int nm_team_link_watcher_get_interval(const NMTeamLinkWatcher *watcher);
88NM_AVAILABLE_IN_1_12
89int nm_team_link_watcher_get_missed_max(const NMTeamLinkWatcher *watcher);
90NM_AVAILABLE_IN_1_12
91const char *nm_team_link_watcher_get_target_host(const NMTeamLinkWatcher *watcher);
92NM_AVAILABLE_IN_1_12
93const char *nm_team_link_watcher_get_source_host(const NMTeamLinkWatcher *watcher);
94NM_AVAILABLE_IN_1_12
95NMTeamLinkWatcherArpPingFlags nm_team_link_watcher_get_flags(const NMTeamLinkWatcher *watcher);
96NM_AVAILABLE_IN_1_16
97int nm_team_link_watcher_get_vlanid(const NMTeamLinkWatcher *watcher);
98
99#define NM_TYPE_SETTING_TEAM (nm_setting_team_get_type())
100#define NM_SETTING_TEAM(obj) \
101 (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_TEAM, NMSettingTeam))
102#define NM_SETTING_TEAM_CLASS(klass) \
103 (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_TEAM, NMSettingTeamClass))
104#define NM_IS_SETTING_TEAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_TEAM))
105#define NM_IS_SETTING_TEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_TEAM))
106#define NM_SETTING_TEAM_GET_CLASS(obj) \
107 (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_TEAM, NMSettingTeamClass))
108
109#define NM_SETTING_TEAM_SETTING_NAME "team"
110
111#define NM_SETTING_TEAM_CONFIG "config"
112#define NM_SETTING_TEAM_NOTIFY_PEERS_COUNT "notify-peers-count"
113#define NM_SETTING_TEAM_NOTIFY_PEERS_INTERVAL "notify-peers-interval"
114#define NM_SETTING_TEAM_MCAST_REJOIN_COUNT "mcast-rejoin-count"
115#define NM_SETTING_TEAM_MCAST_REJOIN_INTERVAL "mcast-rejoin-interval"
116#define NM_SETTING_TEAM_RUNNER "runner"
117#define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY "runner-hwaddr-policy"
118#define NM_SETTING_TEAM_RUNNER_TX_HASH "runner-tx-hash"
119#define NM_SETTING_TEAM_RUNNER_TX_BALANCER "runner-tx-balancer"
120#define NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL "runner-tx-balancer-interval"
121#define NM_SETTING_TEAM_RUNNER_ACTIVE "runner-active"
122#define NM_SETTING_TEAM_RUNNER_FAST_RATE "runner-fast-rate"
123#define NM_SETTING_TEAM_RUNNER_SYS_PRIO "runner-sys-prio"
124#define NM_SETTING_TEAM_RUNNER_MIN_PORTS "runner-min-ports"
125#define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY "runner-agg-select-policy"
126#define NM_SETTING_TEAM_LINK_WATCHERS "link-watchers"
127
128#define NM_SETTING_TEAM_RUNNER_BROADCAST "broadcast"
129#define NM_SETTING_TEAM_RUNNER_ROUNDROBIN "roundrobin"
130#define NM_SETTING_TEAM_RUNNER_RANDOM "random"
131#define NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP "activebackup"
132#define NM_SETTING_TEAM_RUNNER_LOADBALANCE "loadbalance"
133#define NM_SETTING_TEAM_RUNNER_LACP "lacp"
134
135#define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_SAME_ALL "same_all"
136#define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_BY_ACTIVE "by_active"
137#define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_ONLY_ACTIVE "only_active"
138
139#define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO "lacp_prio"
140#define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO_STABLE "lacp_prio_stable"
141#define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_BANDWIDTH "bandwidth"
142#define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_COUNT "count"
143#define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_PORT_CONFIG "port_config"
144
145#define NM_SETTING_TEAM_NOTIFY_PEERS_COUNT_ACTIVEBACKUP_DEFAULT 1
146#define NM_SETTING_TEAM_NOTIFY_MCAST_COUNT_ACTIVEBACKUP_DEFAULT 1
147#define NM_SETTING_TEAM_RUNNER_DEFAULT NM_SETTING_TEAM_RUNNER_ROUNDROBIN
148#define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_DEFAULT NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_SAME_ALL
149#define NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL_DEFAULT 50
150#define NM_SETTING_TEAM_RUNNER_SYS_PRIO_DEFAULT 65535
151#define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_DEFAULT \
152 NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO
153
154typedef struct _NMSettingTeamClass NMSettingTeamClass;
155
156GType nm_setting_team_get_type(void);
157
158NMSetting *nm_setting_team_new(void);
159
160const char *nm_setting_team_get_config(NMSettingTeam *setting);
161NM_AVAILABLE_IN_1_12
162int nm_setting_team_get_notify_peers_count(NMSettingTeam *setting);
163NM_AVAILABLE_IN_1_12
164int nm_setting_team_get_notify_peers_interval(NMSettingTeam *setting);
165NM_AVAILABLE_IN_1_12
166int nm_setting_team_get_mcast_rejoin_count(NMSettingTeam *setting);
167NM_AVAILABLE_IN_1_12
168int nm_setting_team_get_mcast_rejoin_interval(NMSettingTeam *setting);
169NM_AVAILABLE_IN_1_12
170const char *nm_setting_team_get_runner(NMSettingTeam *setting);
171NM_AVAILABLE_IN_1_12
172const char *nm_setting_team_get_runner_hwaddr_policy(NMSettingTeam *setting);
173NM_AVAILABLE_IN_1_12
174const char *nm_setting_team_get_runner_tx_balancer(NMSettingTeam *setting);
175NM_AVAILABLE_IN_1_12
176int nm_setting_team_get_runner_tx_balancer_interval(NMSettingTeam *setting);
177NM_AVAILABLE_IN_1_12
178gboolean nm_setting_team_get_runner_active(NMSettingTeam *setting);
179NM_AVAILABLE_IN_1_12
180gboolean nm_setting_team_get_runner_fast_rate(NMSettingTeam *setting);
181NM_AVAILABLE_IN_1_12
182int nm_setting_team_get_runner_sys_prio(NMSettingTeam *setting);
183NM_AVAILABLE_IN_1_12
184int nm_setting_team_get_runner_min_ports(NMSettingTeam *setting);
185NM_AVAILABLE_IN_1_12
186const char *nm_setting_team_get_runner_agg_select_policy(NMSettingTeam *setting);
187NM_AVAILABLE_IN_1_12
188gboolean nm_setting_team_remove_runner_tx_hash_by_value(NMSettingTeam *setting, const char *txhash);
189NM_AVAILABLE_IN_1_12
190guint nm_setting_team_get_num_runner_tx_hash(NMSettingTeam *setting);
191NM_AVAILABLE_IN_1_12
192const char *nm_setting_team_get_runner_tx_hash(NMSettingTeam *setting, guint idx);
193NM_AVAILABLE_IN_1_12
194void nm_setting_team_remove_runner_tx_hash(NMSettingTeam *setting, guint idx);
195NM_AVAILABLE_IN_1_12
196gboolean nm_setting_team_add_runner_tx_hash(NMSettingTeam *setting, const char *txhash);
197NM_AVAILABLE_IN_1_12
198guint nm_setting_team_get_num_link_watchers(NMSettingTeam *setting);
199NM_AVAILABLE_IN_1_12
200NMTeamLinkWatcher *nm_setting_team_get_link_watcher(NMSettingTeam *setting, guint idx);
201NM_AVAILABLE_IN_1_12
202gboolean nm_setting_team_add_link_watcher(NMSettingTeam *setting, NMTeamLinkWatcher *link_watcher);
203NM_AVAILABLE_IN_1_12
204void nm_setting_team_remove_link_watcher(NMSettingTeam *setting, guint idx);
205NM_AVAILABLE_IN_1_12
206gboolean nm_setting_team_remove_link_watcher_by_value(NMSettingTeam *setting,
207 NMTeamLinkWatcher *link_watcher);
208NM_AVAILABLE_IN_1_12
209void nm_setting_team_clear_link_watchers(NMSettingTeam *setting);
210G_END_DECLS
211
212#endif /* __NM_SETTING_TEAM_H__ */
213

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