libteam
1.27
|
Macros | |
#define | NETLINK_RCVBUF 98304 |
Functions | |
TEAM_EXPORT int | team_change_handler_register (struct team_handle *th, const struct team_change_handler *handler, void *priv) |
TEAM_EXPORT int | team_change_handler_register_head (struct team_handle *th, const struct team_change_handler *handler, void *priv) |
TEAM_EXPORT void | team_change_handler_unregister (struct team_handle *th, const struct team_change_handler *handler, void *priv) |
TEAM_EXPORT struct team_handle * | team_alloc (void) |
TEAM_EXPORT int | team_create (struct team_handle *th, const char *team_name) |
TEAM_EXPORT int | team_recreate (struct team_handle *th, const char *team_name) |
TEAM_EXPORT int | team_destroy (struct team_handle *th) |
TEAM_EXPORT int | team_init (struct team_handle *th, uint32_t ifindex) |
TEAM_EXPORT void | team_free (struct team_handle *th) |
TEAM_EXPORT int | team_refresh (struct team_handle *th) |
TEAM_EXPORT void | team_set_log_fn (struct team_handle *th, void(*log_fn)(struct team_handle *th, int priority, const char *file, int line, const char *fn, const char *format, va_list args)) |
TEAM_EXPORT int | team_get_log_priority (struct team_handle *th) |
TEAM_EXPORT void | team_set_log_priority (struct team_handle *th, int priority) |
TEAM_EXPORT const struct team_eventfd * | team_get_next_eventfd (struct team_handle *th, const struct team_eventfd *eventfd) |
TEAM_EXPORT int | team_get_eventfd_fd (struct team_handle *th, const struct team_eventfd *eventfd) |
TEAM_EXPORT int | team_call_eventfd_handler (struct team_handle *th, const struct team_eventfd *eventfd) |
TEAM_EXPORT int | team_get_event_fd (struct team_handle *th) |
TEAM_EXPORT int | team_handle_events (struct team_handle *th) |
TEAM_EXPORT int | team_check_events (struct team_handle *th) |
TEAM_EXPORT int | team_get_mode_name (struct team_handle *th, char **mode_name) |
TEAM_EXPORT int | team_set_mode_name (struct team_handle *th, const char *mode_name) |
TEAM_EXPORT int | team_get_notify_peers_count (struct team_handle *th, uint32_t *count) |
TEAM_EXPORT int | team_set_notify_peers_count (struct team_handle *th, uint32_t count) |
TEAM_EXPORT int | team_get_notify_peers_interval (struct team_handle *th, uint32_t *interval) |
TEAM_EXPORT int | team_set_notify_peers_interval (struct team_handle *th, uint32_t interval) |
TEAM_EXPORT int | team_get_mcast_rejoin_count (struct team_handle *th, uint32_t *count) |
TEAM_EXPORT int | team_set_mcast_rejoin_count (struct team_handle *th, uint32_t count) |
TEAM_EXPORT int | team_get_mcast_rejoin_interval (struct team_handle *th, uint32_t *interval) |
TEAM_EXPORT int | team_set_mcast_rejoin_interval (struct team_handle *th, uint32_t interval) |
TEAM_EXPORT int | team_get_active_port (struct team_handle *th, uint32_t *ifindex) |
TEAM_EXPORT int | team_set_active_port (struct team_handle *th, uint32_t ifindex) |
TEAM_EXPORT int | team_get_bpf_hash_func (struct team_handle *th, struct sock_fprog *fp) |
TEAM_EXPORT int | team_set_bpf_hash_func (struct team_handle *th, const struct sock_fprog *fp) |
TEAM_EXPORT int | team_set_port_enabled (struct team_handle *th, uint32_t port_ifindex, bool val) |
TEAM_EXPORT int | team_get_port_enabled (struct team_handle *th, uint32_t port_ifindex, bool *enabled) |
TEAM_EXPORT int | team_set_port_user_linkup_enabled (struct team_handle *th, uint32_t port_ifindex, bool val) |
TEAM_EXPORT int | team_get_port_user_linkup (struct team_handle *th, uint32_t port_ifindex, bool *linkup) |
TEAM_EXPORT int | team_set_port_user_linkup (struct team_handle *th, uint32_t port_ifindex, bool linkup) |
TEAM_EXPORT int | team_set_port_queue_id (struct team_handle *th, uint32_t port_ifindex, uint32_t queue_id) |
TEAM_EXPORT int | team_get_port_priority (struct team_handle *th, uint32_t port_ifindex, int32_t *priority) |
TEAM_EXPORT int | team_set_port_priority (struct team_handle *th, uint32_t port_ifindex, int32_t priority) |
TEAM_EXPORT uint32_t | team_ifname2ifindex (struct team_handle *th, const char *ifname) |
TEAM_EXPORT char * | team_ifindex2ifname (struct team_handle *th, uint32_t ifindex, char *ifname, unsigned int maxlen) |
TEAM_EXPORT int | team_port_add (struct team_handle *th, uint32_t port_ifindex) |
TEAM_EXPORT bool | team_is_our_port (struct team_handle *th, uint32_t port_ifindex) |
TEAM_EXPORT int | team_port_remove (struct team_handle *th, uint32_t port_ifindex) |
TEAM_EXPORT int | team_carrier_set (struct team_handle *th, bool carrier_up) |
TEAM_EXPORT int | team_carrier_get (struct team_handle *th, bool *carrier_up) |
TEAM_EXPORT int | team_hwaddr_set (struct team_handle *th, uint32_t ifindex, const char *addr, unsigned int addr_len) |
TEAM_EXPORT int | team_hwaddr_get (struct team_handle *th, uint32_t ifindex, char *addr, unsigned int addr_len) |
TEAM_EXPORT int | team_hwaddr_len_get (struct team_handle *th, uint32_t ifindex) |
TEAM_EXPORT struct team_ifinfo * | team_get_ifinfo (struct team_handle *th) |
Libteam core funtions
TEAM_EXPORT struct team_handle* team_alloc | ( | void | ) |
Allocates library context, sockets, initializes rtnl netlink connection.
TEAM_EXPORT int team_call_eventfd_handler | ( | struct team_handle * | th, |
const struct team_eventfd * | eventfd | ||
) |
th | libteam library context |
eventfd | eventfd structure |
Call eventfd handler.
TEAM_EXPORT int team_carrier_get | ( | struct team_handle * | th, |
bool * | carrier_up | ||
) |
th | libteam library context |
carrier_up | where the carrier state will be stored |
Gets carrier status of the master network interface
TEAM_EXPORT int team_carrier_set | ( | struct team_handle * | th, |
bool | carrier_up | ||
) |
th | libteam library context |
carrier_up | carrier state to be set |
Sets carrier status for the master network interface
TEAM_EXPORT int team_change_handler_register | ( | struct team_handle * | th, |
const struct team_change_handler * | handler, | ||
void * | priv | ||
) |
th | libteam library context |
handler | event handler structure |
priv | event handler func private data |
Registers custom handler structure which defines a function which going to be called on defined events. The handler will be added at the end of the list.
TEAM_EXPORT int team_change_handler_register_head | ( | struct team_handle * | th, |
const struct team_change_handler * | handler, | ||
void * | priv | ||
) |
th | libteam library context |
handler | event handler structure |
priv | event handler func private data |
Registers custom handler structure which defines a function which going to be called on defined events. The handler will be added at the start of the list.
TEAM_EXPORT void team_change_handler_unregister | ( | struct team_handle * | th, |
const struct team_change_handler * | handler, | ||
void * | priv | ||
) |
th | libteam library context |
handler | event handler structure |
priv | event handler func private data |
Unregisters custom handler structure.
TEAM_EXPORT int team_check_events | ( | struct team_handle * | th | ) |
th | libteam library context |
Check for events pending to be processed on event socket and process them one by one. This is safe to be called even if no data present on event socket file descriptor.
TEAM_EXPORT int team_create | ( | struct team_handle * | th, |
const char * | team_name | ||
) |
th | libteam library context |
team_name | new team device name |
Create new team device by given name. If NULL is passed, name will be allocated automatically.
TEAM_EXPORT int team_destroy | ( | struct team_handle * | th | ) |
th | libteam library context |
Destroy current initialized team device.
TEAM_EXPORT void team_free | ( | struct team_handle * | th | ) |
th | libteam library context |
Do library context cleanup.
TEAM_EXPORT int team_get_active_port | ( | struct team_handle * | th, |
uint32_t * | ifindex | ||
) |
th | libteam library context |
ifindex | where the port interface index will be stored |
Get interface index of active port. Note this is possible only if team is in "activebackup" mode.
TEAM_EXPORT int team_get_bpf_hash_func | ( | struct team_handle * | th, |
struct sock_fprog * | fp | ||
) |
th | libteam library context |
fp | where current BPF instruction set will be stored |
Get tx port selecting hash function. Note this is possible only if team is in "loadbalance" mode.
TEAM_EXPORT int team_get_event_fd | ( | struct team_handle * | th | ) |
th | libteam library context |
Get event filedesctiptor.
TEAM_EXPORT int team_get_eventfd_fd | ( | struct team_handle * | th, |
const struct team_eventfd * | eventfd | ||
) |
th | libteam library context |
eventfd | eventfd structure |
Get eventfd filedesctiptor.
TEAM_EXPORT struct team_ifinfo* team_get_ifinfo | ( | struct team_handle * | th | ) |
th | libteam library context |
Get team device rtnetlink interface info.
TEAM_EXPORT int team_get_log_priority | ( | struct team_handle * | th | ) |
th | libteam library context |
TEAM_EXPORT int team_get_mcast_rejoin_count | ( | struct team_handle * | th, |
uint32_t * | count | ||
) |
th | libteam library context |
count | where the count will be stored |
Get number of bursts of multicast group rejoins to be sent.
TEAM_EXPORT int team_get_mcast_rejoin_interval | ( | struct team_handle * | th, |
uint32_t * | interval | ||
) |
th | libteam library context |
interval | where the interval will be stored |
Get interval (in milliseconds) in which bursts of rejoins are sent.
TEAM_EXPORT int team_get_mode_name | ( | struct team_handle * | th, |
char ** | mode_name | ||
) |
th | libteam library context |
mode_name | where the mode name will be stored |
Get name of currect mode.
TEAM_EXPORT const struct team_eventfd* team_get_next_eventfd | ( | struct team_handle * | th, |
const struct team_eventfd * | eventfd | ||
) |
th | libteam library context |
eventfd | eventfd structure |
Get next eventfd in list.
TEAM_EXPORT int team_get_notify_peers_count | ( | struct team_handle * | th, |
uint32_t * | count | ||
) |
th | libteam library context |
count | where the count will be stored |
Get number of bursts of NAs and ARPs notifications sent to peers.
TEAM_EXPORT int team_get_notify_peers_interval | ( | struct team_handle * | th, |
uint32_t * | interval | ||
) |
th | libteam library context |
interval | where the interval will be stored |
Get interval (in milliseconds) in which bursts of NAs and ARPs notifications are sent to peers.
TEAM_EXPORT int team_get_port_enabled | ( | struct team_handle * | th, |
uint32_t | port_ifindex, | ||
bool * | enabled | ||
) |
th | libteam library context |
port_ifindex | port interface index |
enabled | where the enabled state will be stored |
Gets enabled state for port identified by port_ifindex
TEAM_EXPORT int team_get_port_priority | ( | struct team_handle * | th, |
uint32_t | port_ifindex, | ||
int32_t * | priority | ||
) |
th | libteam library context |
port_ifindex | port interface index |
priority | where the port priority will be stored |
Gets priority for port identified by port_ifindex
TEAM_EXPORT int team_get_port_user_linkup | ( | struct team_handle * | th, |
uint32_t | port_ifindex, | ||
bool * | linkup | ||
) |
th | libteam library context |
port_ifindex | port interface index |
linkup | where the port user link state will be stored |
Gets user linkup for port identified by port_ifindex
TEAM_EXPORT int team_handle_events | ( | struct team_handle * | th | ) |
th | libteam library context |
Handler events which happened on event filedescriptor.
TEAM_EXPORT int team_hwaddr_get | ( | struct team_handle * | th, |
uint32_t | ifindex, | ||
char * | addr, | ||
unsigned int | addr_len | ||
) |
th | libteam library context |
ifindex | interface index |
addr | address will be written here |
addr_len | length of addr buffer |
Gets hardware address (MAC) of network interface by given interface index.
TEAM_EXPORT int team_hwaddr_len_get | ( | struct team_handle * | th, |
uint32_t | ifindex | ||
) |
th | libteam library context |
ifindex | interface index |
Gets length of hardware address (MAC) of network interface by given interface index.
TEAM_EXPORT int team_hwaddr_set | ( | struct team_handle * | th, |
uint32_t | ifindex, | ||
const char * | addr, | ||
unsigned int | addr_len | ||
) |
th | libteam library context |
ifindex | interface index |
addr | address to be set |
addr_len | length of addr |
Sets given hardware address (MAC) for network interface by given interface index.
TEAM_EXPORT char* team_ifindex2ifname | ( | struct team_handle * | th, |
uint32_t | ifindex, | ||
char * | ifname, | ||
unsigned int | maxlen | ||
) |
th | libteam library context |
ifindex | interface index |
ifname | where the interface name will be stored |
maxlen | length of ifname buffer |
Looks up for interface of given index and gets its name.
TEAM_EXPORT uint32_t team_ifname2ifindex | ( | struct team_handle * | th, |
const char * | ifname | ||
) |
SECTION: RTNL helpers
th | libteam library context |
ifname | interface name |
Looks up for interface of given name and gets its index.
TEAM_EXPORT int team_init | ( | struct team_handle * | th, |
uint32_t | ifindex | ||
) |
th | libteam library context |
ifindex | team device interface index |
Do library context initialization. Sets up team generic netlink connection.
TEAM_EXPORT bool team_is_our_port | ( | struct team_handle * | th, |
uint32_t | port_ifindex | ||
) |
th | libteam library context |
port_ifindex | port interface index |
Find out if interface is port of this team.
TEAM_EXPORT int team_port_add | ( | struct team_handle * | th, |
uint32_t | port_ifindex | ||
) |
th | libteam library context |
port_ifindex | port interface index |
Adds port into team.
TEAM_EXPORT int team_port_remove | ( | struct team_handle * | th, |
uint32_t | port_ifindex | ||
) |
th | libteam library context |
port_ifindex | port interface index |
Removes port from team.
TEAM_EXPORT int team_recreate | ( | struct team_handle * | th, |
const char * | team_name | ||
) |
th | libteam library context |
team_name | new team device name |
Does the same as team_create only if device with team_name already exists it will be deleted first.
TEAM_EXPORT int team_refresh | ( | struct team_handle * | th | ) |
th | libteam library context |
This is used for user to refresh internal lists and call event handlers.
TEAM_EXPORT int team_set_active_port | ( | struct team_handle * | th, |
uint32_t | ifindex | ||
) |
th | libteam library context |
ifindex | interface index of new active port |
Set new active port by given ifindex. Note this is possible only if team is in "activebackup" mode.
TEAM_EXPORT int team_set_bpf_hash_func | ( | struct team_handle * | th, |
const struct sock_fprog * | fp | ||
) |
th | libteam library context |
fp | prepared BPF instruction set |
Set tx port selecting hash function. Note this is possible only if team is in "loadbalance" mode. Passing NULL clears current function.
TEAM_EXPORT void team_set_log_fn | ( | struct team_handle * | th, |
void(*)(struct team_handle *th, int priority, const char *file, int line, const char *fn, const char *format, va_list args) | log_fn | ||
) |
th | libteam library context |
log_fn | function to be called for logging messages |
The built-in logging writes to stderr. It can be overridden by a custom function, to plug log messages into the user's logging functionality.
TEAM_EXPORT void team_set_log_priority | ( | struct team_handle * | th, |
int | priority | ||
) |
th | libteam library context |
priority | the new logging priority |
Set the current logging priority. The value controls which messages are logged.
TEAM_EXPORT int team_set_mcast_rejoin_count | ( | struct team_handle * | th, |
uint32_t | count | ||
) |
th | libteam library context |
count | number of bursts |
Set number of bursts of multicast group rejoins to be sent.
TEAM_EXPORT int team_set_mcast_rejoin_interval | ( | struct team_handle * | th, |
uint32_t | interval | ||
) |
th | libteam library context |
interval | interval of bursts |
Set interval (in milliseconds) in which bursts of rejoins are sent.
TEAM_EXPORT int team_set_mode_name | ( | struct team_handle * | th, |
const char * | mode_name | ||
) |
th | libteam library context |
mode_name | name of mode to be set |
Set team mode.
TEAM_EXPORT int team_set_notify_peers_count | ( | struct team_handle * | th, |
uint32_t | count | ||
) |
th | libteam library context |
count | number of bursts |
Set number of bursts of NAs and ARPs notifications sent to peers.
TEAM_EXPORT int team_set_notify_peers_interval | ( | struct team_handle * | th, |
uint32_t | interval | ||
) |
th | libteam library context |
interval | interval of bursts |
Set interval (in milliseconds) in which bursts of NAs and ARPs notifications will be sent to peers.
TEAM_EXPORT int team_set_port_enabled | ( | struct team_handle * | th, |
uint32_t | port_ifindex, | ||
bool | val | ||
) |
th | libteam library context |
port_ifindex | port interface index |
val | boolean value |
Enables or disable port identified by port_ifindex
TEAM_EXPORT int team_set_port_priority | ( | struct team_handle * | th, |
uint32_t | port_ifindex, | ||
int32_t | priority | ||
) |
th | libteam library context |
port_ifindex | port interface index |
priority | desired priority |
Sets priority for port identified by port_ifindex
TEAM_EXPORT int team_set_port_queue_id | ( | struct team_handle * | th, |
uint32_t | port_ifindex, | ||
uint32_t | queue_id | ||
) |
th | libteam library context |
port_ifindex | port interface index |
queue_id | desired queue id |
Sets queue id for port identified by port_ifindex
TEAM_EXPORT int team_set_port_user_linkup | ( | struct team_handle * | th, |
uint32_t | port_ifindex, | ||
bool | linkup | ||
) |
th | libteam library context |
port_ifindex | port interface index |
linkup | desired link state |
Sets user linkup for port identified by port_ifindex
TEAM_EXPORT int team_set_port_user_linkup_enabled | ( | struct team_handle * | th, |
uint32_t | port_ifindex, | ||
bool | val | ||
) |
th | libteam library context |
port_ifindex | port interface index |
val | boolean value |
Enables or disable user linkup for port identified by port_ifindex