| 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 | |
| 15 | G_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 | */ |
| 29 | typedef 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 | |
| 40 | typedef struct NMTeamLinkWatcher NMTeamLinkWatcher; |
| 41 | |
| 42 | GType nm_team_link_watcher_get_type(void); |
| 43 | |
| 44 | NM_AVAILABLE_IN_1_12 |
| 45 | NMTeamLinkWatcher *nm_team_link_watcher_new_ethtool(int delay_up, int delay_down, GError **error); |
| 46 | NM_AVAILABLE_IN_1_12 |
| 47 | NMTeamLinkWatcher *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); |
| 52 | NM_AVAILABLE_IN_1_12 |
| 53 | NMTeamLinkWatcher *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); |
| 60 | NM_AVAILABLE_IN_1_16 |
| 61 | NMTeamLinkWatcher *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); |
| 69 | NM_AVAILABLE_IN_1_12 |
| 70 | void nm_team_link_watcher_ref(NMTeamLinkWatcher *watcher); |
| 71 | NM_AVAILABLE_IN_1_12 |
| 72 | void nm_team_link_watcher_unref(NMTeamLinkWatcher *watcher); |
| 73 | NM_AVAILABLE_IN_1_12 |
| 74 | gboolean nm_team_link_watcher_equal(const NMTeamLinkWatcher *watcher, |
| 75 | const NMTeamLinkWatcher *other); |
| 76 | NM_AVAILABLE_IN_1_12 |
| 77 | NMTeamLinkWatcher *nm_team_link_watcher_dup(const NMTeamLinkWatcher *watcher); |
| 78 | NM_AVAILABLE_IN_1_12 |
| 79 | const char *nm_team_link_watcher_get_name(const NMTeamLinkWatcher *watcher); |
| 80 | NM_AVAILABLE_IN_1_12 |
| 81 | int nm_team_link_watcher_get_delay_up(const NMTeamLinkWatcher *watcher); |
| 82 | NM_AVAILABLE_IN_1_12 |
| 83 | int nm_team_link_watcher_get_delay_down(const NMTeamLinkWatcher *watcher); |
| 84 | NM_AVAILABLE_IN_1_12 |
| 85 | int nm_team_link_watcher_get_init_wait(const NMTeamLinkWatcher *watcher); |
| 86 | NM_AVAILABLE_IN_1_12 |
| 87 | int nm_team_link_watcher_get_interval(const NMTeamLinkWatcher *watcher); |
| 88 | NM_AVAILABLE_IN_1_12 |
| 89 | int nm_team_link_watcher_get_missed_max(const NMTeamLinkWatcher *watcher); |
| 90 | NM_AVAILABLE_IN_1_12 |
| 91 | const char *nm_team_link_watcher_get_target_host(const NMTeamLinkWatcher *watcher); |
| 92 | NM_AVAILABLE_IN_1_12 |
| 93 | const char *nm_team_link_watcher_get_source_host(const NMTeamLinkWatcher *watcher); |
| 94 | NM_AVAILABLE_IN_1_12 |
| 95 | NMTeamLinkWatcherArpPingFlags nm_team_link_watcher_get_flags(const NMTeamLinkWatcher *watcher); |
| 96 | NM_AVAILABLE_IN_1_16 |
| 97 | int 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 | |
| 154 | typedef struct _NMSettingTeamClass NMSettingTeamClass; |
| 155 | |
| 156 | GType nm_setting_team_get_type(void); |
| 157 | |
| 158 | NMSetting *nm_setting_team_new(void); |
| 159 | |
| 160 | const char *nm_setting_team_get_config(NMSettingTeam *setting); |
| 161 | NM_AVAILABLE_IN_1_12 |
| 162 | int nm_setting_team_get_notify_peers_count(NMSettingTeam *setting); |
| 163 | NM_AVAILABLE_IN_1_12 |
| 164 | int nm_setting_team_get_notify_peers_interval(NMSettingTeam *setting); |
| 165 | NM_AVAILABLE_IN_1_12 |
| 166 | int nm_setting_team_get_mcast_rejoin_count(NMSettingTeam *setting); |
| 167 | NM_AVAILABLE_IN_1_12 |
| 168 | int nm_setting_team_get_mcast_rejoin_interval(NMSettingTeam *setting); |
| 169 | NM_AVAILABLE_IN_1_12 |
| 170 | const char *nm_setting_team_get_runner(NMSettingTeam *setting); |
| 171 | NM_AVAILABLE_IN_1_12 |
| 172 | const char *nm_setting_team_get_runner_hwaddr_policy(NMSettingTeam *setting); |
| 173 | NM_AVAILABLE_IN_1_12 |
| 174 | const char *nm_setting_team_get_runner_tx_balancer(NMSettingTeam *setting); |
| 175 | NM_AVAILABLE_IN_1_12 |
| 176 | int nm_setting_team_get_runner_tx_balancer_interval(NMSettingTeam *setting); |
| 177 | NM_AVAILABLE_IN_1_12 |
| 178 | gboolean nm_setting_team_get_runner_active(NMSettingTeam *setting); |
| 179 | NM_AVAILABLE_IN_1_12 |
| 180 | gboolean nm_setting_team_get_runner_fast_rate(NMSettingTeam *setting); |
| 181 | NM_AVAILABLE_IN_1_12 |
| 182 | int nm_setting_team_get_runner_sys_prio(NMSettingTeam *setting); |
| 183 | NM_AVAILABLE_IN_1_12 |
| 184 | int nm_setting_team_get_runner_min_ports(NMSettingTeam *setting); |
| 185 | NM_AVAILABLE_IN_1_12 |
| 186 | const char *nm_setting_team_get_runner_agg_select_policy(NMSettingTeam *setting); |
| 187 | NM_AVAILABLE_IN_1_12 |
| 188 | gboolean nm_setting_team_remove_runner_tx_hash_by_value(NMSettingTeam *setting, const char *txhash); |
| 189 | NM_AVAILABLE_IN_1_12 |
| 190 | guint nm_setting_team_get_num_runner_tx_hash(NMSettingTeam *setting); |
| 191 | NM_AVAILABLE_IN_1_12 |
| 192 | const char *nm_setting_team_get_runner_tx_hash(NMSettingTeam *setting, guint idx); |
| 193 | NM_AVAILABLE_IN_1_12 |
| 194 | void nm_setting_team_remove_runner_tx_hash(NMSettingTeam *setting, guint idx); |
| 195 | NM_AVAILABLE_IN_1_12 |
| 196 | gboolean nm_setting_team_add_runner_tx_hash(NMSettingTeam *setting, const char *txhash); |
| 197 | NM_AVAILABLE_IN_1_12 |
| 198 | guint nm_setting_team_get_num_link_watchers(NMSettingTeam *setting); |
| 199 | NM_AVAILABLE_IN_1_12 |
| 200 | NMTeamLinkWatcher *nm_setting_team_get_link_watcher(NMSettingTeam *setting, guint idx); |
| 201 | NM_AVAILABLE_IN_1_12 |
| 202 | gboolean nm_setting_team_add_link_watcher(NMSettingTeam *setting, NMTeamLinkWatcher *link_watcher); |
| 203 | NM_AVAILABLE_IN_1_12 |
| 204 | void nm_setting_team_remove_link_watcher(NMSettingTeam *setting, guint idx); |
| 205 | NM_AVAILABLE_IN_1_12 |
| 206 | gboolean nm_setting_team_remove_link_watcher_by_value(NMSettingTeam *setting, |
| 207 | NMTeamLinkWatcher *link_watcher); |
| 208 | NM_AVAILABLE_IN_1_12 |
| 209 | void nm_setting_team_clear_link_watchers(NMSettingTeam *setting); |
| 210 | G_END_DECLS |
| 211 | |
| 212 | #endif /* __NM_SETTING_TEAM_H__ */ |
| 213 | |