libteam  1.28
Functions
Libteamdctl

Functions

void teamdctl_log (struct teamdctl *tdc, int priority, const char *file, int line, const char *fn, const char *format,...)
 
TEAMDCTL_EXPORT struct teamdctl * teamdctl_alloc (void)
 
TEAMDCTL_EXPORT void teamdctl_free (struct teamdctl *tdc)
 
TEAMDCTL_EXPORT void teamdctl_set_log_fn (struct teamdctl *tdc, void(*log_fn)(struct teamdctl *tdc, int priority, const char *file, int line, const char *fn, const char *format, va_list args))
 
TEAMDCTL_EXPORT int teamdctl_get_log_priority (struct teamdctl *tdc)
 
TEAMDCTL_EXPORT void teamdctl_set_log_priority (struct teamdctl *tdc, int priority)
 
TEAMDCTL_EXPORT int teamdctl_connect (struct teamdctl *tdc, const char *team_name, const char *addr, const char *cli_type)
 
TEAMDCTL_EXPORT void teamdctl_disconnect (struct teamdctl *tdc)
 
TEAMDCTL_EXPORT int teamdctl_refresh (struct teamdctl *tdc)
 
TEAMDCTL_EXPORT int teamdctl_port_add (struct teamdctl *tdc, const char *port_devname)
 
TEAMDCTL_EXPORT int teamdctl_port_remove (struct teamdctl *tdc, const char *port_devname)
 
TEAMDCTL_EXPORT int teamdctl_port_config_update_raw (struct teamdctl *tdc, const char *port_devname, const char *port_config_raw)
 
TEAMDCTL_EXPORT int teamdctl_port_config_get_raw_direct (struct teamdctl *tdc, const char *port_devname, char **p_cfg)
 
TEAMDCTL_EXPORT char * teamdctl_config_get_raw (struct teamdctl *tdc)
 
TEAMDCTL_EXPORT int teamdctl_config_get_raw_direct (struct teamdctl *tdc, char **p_cfg)
 
TEAMDCTL_EXPORT char * teamdctl_config_actual_get_raw (struct teamdctl *tdc)
 
TEAMDCTL_EXPORT int teamdctl_config_actual_get_raw_direct (struct teamdctl *tdc, char **p_cfg)
 
TEAMDCTL_EXPORT char * teamdctl_state_get_raw (struct teamdctl *tdc)
 
TEAMDCTL_EXPORT int teamdctl_state_get_raw_direct (struct teamdctl *tdc, char **p_cfg)
 
TEAMDCTL_EXPORT int teamdctl_state_item_value_get (struct teamdctl *tdc, const char *item_path, char **p_value)
 
TEAMDCTL_EXPORT int teamdctl_state_item_value_set (struct teamdctl *tdc, const char *item_path, const char *value)
 

Detailed Description

Teamd daemon control library

Header

#include <teamdctl.h>

Function Documentation

◆ teamdctl_alloc()

TEAMDCTL_EXPORT struct teamdctl* teamdctl_alloc ( void  )

Allocates library context and does initial setup.

Returns
New libteam library context.

◆ teamdctl_config_actual_get_raw()

TEAMDCTL_EXPORT char* teamdctl_config_actual_get_raw ( struct teamdctl *  tdc)
Parameters
tdclibteamdctl library context

Gets raw actual config string. Using reply cache. Return value is never NULL. To refresh the cache, use teamdctl_refresh function. Note: the obtained string should not be modified or freed by caller.

Returns
Pointer to cached actual config string.

◆ teamdctl_config_actual_get_raw_direct()

TEAMDCTL_EXPORT int teamdctl_config_actual_get_raw_direct ( struct teamdctl *  tdc,
char **  p_cfg 
)
Parameters
tdclibteamdctl library context
p_cfgpointer to string which will be set

Gets raw actual config string. Does direct method call avoiding possible stale data in the cache. Note: the obtained string should not be modified or freed by caller.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_config_get_raw()

TEAMDCTL_EXPORT char* teamdctl_config_get_raw ( struct teamdctl *  tdc)
Parameters
tdclibteamdctl library context

Gets raw config string. Using reply cache. Return value is never NULL. To refresh the cache, use teamdctl_refresh function. Note: the obtained string should not be modified or freed by caller.

Return Pointer to cached config string.

◆ teamdctl_config_get_raw_direct()

TEAMDCTL_EXPORT int teamdctl_config_get_raw_direct ( struct teamdctl *  tdc,
char **  p_cfg 
)
Parameters
tdclibteamdctl library context
p_cfgpointer to string which will be set

Gets raw config string. Does direct method call avoiding possible stale data in the cache. Note: the obtained string should not be modified or freed by caller.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_connect()

TEAMDCTL_EXPORT int teamdctl_connect ( struct teamdctl *  tdc,
const char *  team_name,
const char *  addr,
const char *  cli_type 
)
Parameters
tdclibteamdctl library context
team_nameteam device name
addraddress (for zeromq only)
cli_typeclient type

Connect to teamd instance controlling team driver instance with interface name team_name. Use client type cli_type to connect. That can be either "dbus" for connection over D-Bus, "usock" which will use unix domain socket or NULL to select the type automatically.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_disconnect()

TEAMDCTL_EXPORT void teamdctl_disconnect ( struct teamdctl *  tdc)
Parameters
tdclibteamdctl library context

Disconnect from teamd instance.

◆ teamdctl_free()

TEAMDCTL_EXPORT void teamdctl_free ( struct teamdctl *  tdc)
Parameters
tdclibteam library context

Do library context cleanup.

◆ teamdctl_get_log_priority()

TEAMDCTL_EXPORT int teamdctl_get_log_priority ( struct teamdctl *  tdc)
Parameters
tdclibteamdctl library context
Returns
The current logging priority.

◆ teamdctl_log()

void teamdctl_log ( struct teamdctl *  tdc,
int  priority,
const char *  file,
int  line,
const char *  fn,
const char *  format,
  ... 
)

SECTION: logging

◆ teamdctl_port_add()

TEAMDCTL_EXPORT int teamdctl_port_add ( struct teamdctl *  tdc,
const char *  port_devname 
)
Parameters
tdclibteamdctl library context
port_devnameport device name

Adds specified port to team.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_port_config_get_raw_direct()

TEAMDCTL_EXPORT int teamdctl_port_config_get_raw_direct ( struct teamdctl *  tdc,
const char *  port_devname,
char **  p_cfg 
)
Parameters
tdclibteamdctl library context
port_devnameport device name
p_cfgpointer to string which will be set

Gets raw port config string. Does direct method call avoiding possible stale data in the cache. Note: the obtained string should not be modified or freed by caller.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_port_config_update_raw()

TEAMDCTL_EXPORT int teamdctl_port_config_update_raw ( struct teamdctl *  tdc,
const char *  port_devname,
const char *  port_config_raw 
)
Parameters
tdclibteamdctl library context
port_devnameport device name
port_config_rawport config

Update config for specified port.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_port_remove()

TEAMDCTL_EXPORT int teamdctl_port_remove ( struct teamdctl *  tdc,
const char *  port_devname 
)
Parameters
tdclibteamdctl library context
port_devnameport device name

Removes specified port from team.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_refresh()

TEAMDCTL_EXPORT int teamdctl_refresh ( struct teamdctl *  tdc)
Parameters
tdclibteamdctl library context

Refresh cache.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_set_log_fn()

TEAMDCTL_EXPORT void teamdctl_set_log_fn ( struct teamdctl *  tdc,
void(*)(struct teamdctl *tdc, int priority, const char *file, int line, const char *fn, const char *format, va_list args)  log_fn 
)
Parameters
tdclibteamdctl library context
log_fnfunction 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.

◆ teamdctl_set_log_priority()

TEAMDCTL_EXPORT void teamdctl_set_log_priority ( struct teamdctl *  tdc,
int  priority 
)
Parameters
tdclibteamdctl library context
prioritythe new logging priority

Set the current logging priority. The value controls which messages are logged.

◆ teamdctl_state_get_raw()

TEAMDCTL_EXPORT char* teamdctl_state_get_raw ( struct teamdctl *  tdc)
Parameters
tdclibteamdctl library context

Gets raw state string. Using reply cache. Return value is never NULL. To refresh the cache, use teamdctl_refresh function. Note: the obtained string should not be modified or freed by caller.

Returns
Pointer to cached state string.

◆ teamdctl_state_get_raw_direct()

TEAMDCTL_EXPORT int teamdctl_state_get_raw_direct ( struct teamdctl *  tdc,
char **  p_cfg 
)
Parameters
tdclibteamdctl library context
p_cfgpointer to string which will be set

Gets raw state string. Does direct method call avoiding possible stale data in the cache. Note: the obtained string should not be modified or freed by caller.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_state_item_value_get()

TEAMDCTL_EXPORT int teamdctl_state_item_value_get ( struct teamdctl *  tdc,
const char *  item_path,
char **  p_value 
)
Parameters
tdclibteamdctl library context
item_pathpath to item
p_valuepointer where reply string will be stored

Get state item value. Note that caller is responsible to free *p_value.

Returns
Zero on success or negative number in case of an error.

◆ teamdctl_state_item_value_set()

TEAMDCTL_EXPORT int teamdctl_state_item_value_set ( struct teamdctl *  tdc,
const char *  item_path,
const char *  value 
)
Parameters
tdclibteamdctl library context
item_pathpath to item
valuenew value to be set

Set state item value.

Returns
Zero on success or negative number in case of an error.