nm-setting-team.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
  2. /*
  3. * This library is free software; you can redistribute it and/or
  4. * modify it under the terms of the GNU Lesser General Public
  5. * License as published by the Free Software Foundation; either
  6. * version 2 of the License, or (at your option) any later version.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * Lesser General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Lesser General Public
  14. * License along with this library; if not, write to the
  15. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. * Boston, MA 02110-1301 USA.
  17. *
  18. * Copyright 2013 Jiri Pirko <jiri@resnulli.us>
  19. */
  20. #ifndef __NM_SETTING_TEAM_H__
  21. #define __NM_SETTING_TEAM_H__
  22. #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
  23. #error "Only <NetworkManager.h> can be included directly."
  24. #endif
  25. #include "nm-setting.h"
  26. G_BEGIN_DECLS
  27. /**
  28. * NMTeamLinkWatcherArpPingFlags:
  29. * @NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE: no one among the arp_ping link watcher
  30. * boolean options ('validate_active', 'validate_inactive', 'send_always') is
  31. * enabled (set to true).
  32. * @NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE: the arp_ping link watcher
  33. * option 'validate_active' is enabled (set to true).
  34. * @NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_INACTIVE: the arp_ping link watcher
  35. * option 'validate_inactive' is enabled (set to true).
  36. * @NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_SEND_ALWAYS: the arp_ping link watcher option
  37. * 'send_always' is enabled (set to true).
  38. */
  39. typedef enum { /*< flags >*/
  40. NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE = 0, /*< skip >*/
  41. NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE = (1 << 1),
  42. NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_INACTIVE = (1 << 2),
  43. NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_SEND_ALWAYS = (1 << 3)
  44. } NMTeamLinkWatcherArpPingFlags;
  45. #define NM_TEAM_LINK_WATCHER_ETHTOOL "ethtool"
  46. #define NM_TEAM_LINK_WATCHER_ARP_PING "arp_ping"
  47. #define NM_TEAM_LINK_WATCHER_NSNA_PING "nsna_ping"
  48. typedef struct NMTeamLinkWatcher NMTeamLinkWatcher;
  49. GType nm_team_link_watcher_get_type (void);
  50. NM_AVAILABLE_IN_1_12
  51. NMTeamLinkWatcher *nm_team_link_watcher_new_ethtool (int delay_up,
  52. int delay_down,
  53. GError **error);
  54. NM_AVAILABLE_IN_1_12
  55. NMTeamLinkWatcher *nm_team_link_watcher_new_nsna_ping (int init_wait,
  56. int interval,
  57. int missed_max,
  58. const char *target_host,
  59. GError **error);
  60. NM_AVAILABLE_IN_1_12
  61. NMTeamLinkWatcher *nm_team_link_watcher_new_arp_ping (int init_wait,
  62. int interval,
  63. int missed_max,
  64. const char *target_host,
  65. const char *source_host,
  66. NMTeamLinkWatcherArpPingFlags flags,
  67. GError **error);
  68. NM_AVAILABLE_IN_1_12
  69. void nm_team_link_watcher_ref (NMTeamLinkWatcher *watcher);
  70. NM_AVAILABLE_IN_1_12
  71. void nm_team_link_watcher_unref (NMTeamLinkWatcher *watcher);
  72. NM_AVAILABLE_IN_1_12
  73. gboolean nm_team_link_watcher_equal (NMTeamLinkWatcher *watcher, NMTeamLinkWatcher *other);
  74. NM_AVAILABLE_IN_1_12
  75. NMTeamLinkWatcher *nm_team_link_watcher_dup (NMTeamLinkWatcher *watcher);
  76. NM_AVAILABLE_IN_1_12
  77. const char *nm_team_link_watcher_get_name (NMTeamLinkWatcher *watcher);
  78. NM_AVAILABLE_IN_1_12
  79. int nm_team_link_watcher_get_delay_up (NMTeamLinkWatcher *watcher);
  80. NM_AVAILABLE_IN_1_12
  81. int nm_team_link_watcher_get_delay_down (NMTeamLinkWatcher *watcher);
  82. NM_AVAILABLE_IN_1_12
  83. int nm_team_link_watcher_get_init_wait (NMTeamLinkWatcher *watcher);
  84. NM_AVAILABLE_IN_1_12
  85. int nm_team_link_watcher_get_interval (NMTeamLinkWatcher *watcher);
  86. NM_AVAILABLE_IN_1_12
  87. int nm_team_link_watcher_get_missed_max (NMTeamLinkWatcher *watcher);
  88. NM_AVAILABLE_IN_1_12
  89. const char *nm_team_link_watcher_get_target_host (NMTeamLinkWatcher *watcher);
  90. NM_AVAILABLE_IN_1_12
  91. const char *nm_team_link_watcher_get_source_host (NMTeamLinkWatcher *watcher);
  92. NM_AVAILABLE_IN_1_12
  93. NMTeamLinkWatcherArpPingFlags nm_team_link_watcher_get_flags (NMTeamLinkWatcher *watcher);
  94. #define NM_TYPE_SETTING_TEAM (nm_setting_team_get_type ())
  95. #define NM_SETTING_TEAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_TEAM, NMSettingTeam))
  96. #define NM_SETTING_TEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_TEAM, NMSettingTeamClass))
  97. #define NM_IS_SETTING_TEAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_TEAM))
  98. #define NM_IS_SETTING_TEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_TEAM))
  99. #define NM_SETTING_TEAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_TEAM, NMSettingTeamClass))
  100. #define NM_SETTING_TEAM_SETTING_NAME "team"
  101. #define NM_SETTING_TEAM_CONFIG "config"
  102. #define NM_SETTING_TEAM_NOTIFY_PEERS_COUNT "notify-peers-count"
  103. #define NM_SETTING_TEAM_NOTIFY_PEERS_INTERVAL "notify-peers-interval"
  104. #define NM_SETTING_TEAM_MCAST_REJOIN_COUNT "mcast-rejoin-count"
  105. #define NM_SETTING_TEAM_MCAST_REJOIN_INTERVAL "mcast-rejoin-interval"
  106. #define NM_SETTING_TEAM_RUNNER "runner"
  107. #define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY "runner-hwaddr-policy"
  108. #define NM_SETTING_TEAM_RUNNER_TX_HASH "runner-tx-hash"
  109. #define NM_SETTING_TEAM_RUNNER_TX_BALANCER "runner-tx-balancer"
  110. #define NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL "runner-tx-balancer-interval"
  111. #define NM_SETTING_TEAM_RUNNER_ACTIVE "runner-active"
  112. #define NM_SETTING_TEAM_RUNNER_FAST_RATE "runner-fast-rate"
  113. #define NM_SETTING_TEAM_RUNNER_SYS_PRIO "runner-sys-prio"
  114. #define NM_SETTING_TEAM_RUNNER_MIN_PORTS "runner-min-ports"
  115. #define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY "runner-agg-select-policy"
  116. #define NM_SETTING_TEAM_LINK_WATCHERS "link-watchers"
  117. #define NM_SETTING_TEAM_RUNNER_BROADCAST "broadcast"
  118. #define NM_SETTING_TEAM_RUNNER_ROUNDROBIN "roundrobin"
  119. #define NM_SETTING_TEAM_RUNNER_RANDOM "random"
  120. #define NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP "activebackup"
  121. #define NM_SETTING_TEAM_RUNNER_LOADBALANCE "loadbalance"
  122. #define NM_SETTING_TEAM_RUNNER_LACP "lacp"
  123. #define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_SAME_ALL "same_all"
  124. #define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_BY_ACTIVE "by_active"
  125. #define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_ONLY_ACTIVE "only_active"
  126. #define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO "lacp_prio"
  127. #define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO_STABLE "lacp_prio_stable"
  128. #define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_BANDWIDTH "bandwidth"
  129. #define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_COUNT "count"
  130. #define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_PORT_CONFIG "port_config"
  131. #define NM_SETTING_TEAM_NOTIFY_PEERS_COUNT_ACTIVEBACKUP_DEFAULT 1
  132. #define NM_SETTING_TEAM_NOTIFY_MCAST_COUNT_ACTIVEBACKUP_DEFAULT 1
  133. #define NM_SETTING_TEAM_RUNNER_DEFAULT NM_SETTING_TEAM_RUNNER_ROUNDROBIN
  134. #define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_DEFAULT NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_SAME_ALL
  135. #define NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL_DEFAULT 50
  136. #define NM_SETTING_TEAM_RUNNER_SYS_PRIO_DEFAULT 65535
  137. #define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_DEFAULT NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO
  138. /**
  139. * NMSettingTeam:
  140. *
  141. * Teaming Settings
  142. */
  143. struct _NMSettingTeam {
  144. NMSetting parent;
  145. };
  146. typedef struct {
  147. NMSettingClass parent;
  148. /*< private >*/
  149. gpointer padding[4];
  150. } NMSettingTeamClass;
  151. GType nm_setting_team_get_type (void);
  152. NMSetting * nm_setting_team_new (void);
  153. const char * nm_setting_team_get_config (NMSettingTeam *setting);
  154. NM_AVAILABLE_IN_1_12
  155. int nm_setting_team_get_notify_peers_count (NMSettingTeam *setting);
  156. NM_AVAILABLE_IN_1_12
  157. int nm_setting_team_get_notify_peers_interval (NMSettingTeam *setting);
  158. NM_AVAILABLE_IN_1_12
  159. int nm_setting_team_get_mcast_rejoin_count (NMSettingTeam *setting);
  160. NM_AVAILABLE_IN_1_12
  161. int nm_setting_team_get_mcast_rejoin_interval (NMSettingTeam *setting);
  162. NM_AVAILABLE_IN_1_12
  163. const char * nm_setting_team_get_runner (NMSettingTeam *setting);
  164. NM_AVAILABLE_IN_1_12
  165. const char * nm_setting_team_get_runner_hwaddr_policy (NMSettingTeam *setting);
  166. NM_AVAILABLE_IN_1_12
  167. const char * nm_setting_team_get_runner_tx_balancer (NMSettingTeam *setting);
  168. NM_AVAILABLE_IN_1_12
  169. int nm_setting_team_get_runner_tx_balancer_interval (NMSettingTeam *setting);
  170. NM_AVAILABLE_IN_1_12
  171. gboolean nm_setting_team_get_runner_active (NMSettingTeam *setting);
  172. NM_AVAILABLE_IN_1_12
  173. gboolean nm_setting_team_get_runner_fast_rate (NMSettingTeam *setting);
  174. NM_AVAILABLE_IN_1_12
  175. int nm_setting_team_get_runner_sys_prio (NMSettingTeam *setting);
  176. NM_AVAILABLE_IN_1_12
  177. int nm_setting_team_get_runner_min_ports (NMSettingTeam *setting);
  178. NM_AVAILABLE_IN_1_12
  179. const char * nm_setting_team_get_runner_agg_select_policy (NMSettingTeam *setting);
  180. NM_AVAILABLE_IN_1_12
  181. gboolean nm_setting_team_remove_runner_tx_hash_by_value (NMSettingTeam *setting, const char *txhash);
  182. NM_AVAILABLE_IN_1_12
  183. guint nm_setting_team_get_num_runner_tx_hash (NMSettingTeam *setting);
  184. NM_AVAILABLE_IN_1_12
  185. const char *nm_setting_team_get_runner_tx_hash (NMSettingTeam *setting, guint idx);
  186. NM_AVAILABLE_IN_1_12
  187. void nm_setting_team_remove_runner_tx_hash (NMSettingTeam *setting, guint idx);
  188. NM_AVAILABLE_IN_1_12
  189. gboolean nm_setting_team_add_runner_tx_hash (NMSettingTeam *setting, const char *txhash);
  190. NM_AVAILABLE_IN_1_12
  191. guint nm_setting_team_get_num_link_watchers (NMSettingTeam *setting);
  192. NM_AVAILABLE_IN_1_12
  193. NMTeamLinkWatcher * nm_setting_team_get_link_watcher (NMSettingTeam *setting, guint idx);
  194. NM_AVAILABLE_IN_1_12
  195. gboolean nm_setting_team_add_link_watcher (NMSettingTeam *setting,
  196. NMTeamLinkWatcher *link_watcher);
  197. NM_AVAILABLE_IN_1_12
  198. void nm_setting_team_remove_link_watcher (NMSettingTeam *setting, guint idx);
  199. NM_AVAILABLE_IN_1_12
  200. gboolean nm_setting_team_remove_link_watcher_by_value (NMSettingTeam *setting,
  201. NMTeamLinkWatcher *link_watcher);
  202. NM_AVAILABLE_IN_1_12
  203. void nm_setting_team_clear_link_watchers (NMSettingTeam *setting);
  204. G_END_DECLS
  205. #endif /* __NM_SETTING_TEAM_H__ */