Queuing Discipline configuration
Overview
Copyright (C) 2004-2022 OKTET Labs Ltd. More…
// typedefs typedef enum tapi_cfg_qdisc_kind_t tapi_cfg_qdisc_kind_t; // enums enum tapi_cfg_qdisc_kind_t; // global functions te_errno tapi_cfg_qdisc_get_enabled(const char* ta, const char* if_name, bool* enabled); te_errno tapi_cfg_qdisc_set_enabled(const char* ta, const char* if_name, bool enabled); static te_errno tapi_cfg_qdisc_enable(const char* ta, const char* if_name); static te_errno tapi_cfg_qdisc_disable(const char* ta, const char* if_name); te_errno tapi_cfg_qdisc_set_kind(const char* ta, const char* if_name, tapi_cfg_qdisc_kind_t kind); te_errno tapi_cfg_qdisc_get_kind(const char* ta, const char* if_name, tapi_cfg_qdisc_kind_t* kind); const char* tapi_cfg_qdisc_kind2str(tapi_cfg_qdisc_kind_t kind); tapi_cfg_qdisc_kind_t tapi_cfg_qdisc_str2kind(const char* string); te_errno tapi_cfg_qdisc_get_param(const char* ta, const char* if_name, const char* param, char** value); te_errno tapi_cfg_qdisc_set_param(const char* ta, const char* if_name, const char* param, const char* value); // macros #define TAPI_CFG_QDISC_PARAM_FMT
Detailed Documentation
Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.
Example of usage
Usage of TAPI for control NetEm
At first add ./cs.conf.inc.qdisc from ts_conf in your cs.conf
Setup Agent Agt_A analog of command line:
tc qdisc add dev eth1 root netem delay 200ms
#include "tapi_cfg_netem.h" #include "tapi_cfg_qdisc.h" ... const char *agent = "Agt_A"; const char *ifname = "eth1"; CHECK_RC(tapi_cfg_qdisc_set_kind(agent, ifname, TAPI_CFG_QDISC_KIND_NETEM)); CHECK_RC(tapi_cfg_netem_set_delay(agent, ifname, TE_MS2US(200))); CHECK_RC(tapi_cfg_qdisc_enable(agent, ifname));
tc qdisc change dev eth1 root netem delay 100ms 10ms 25%
CHECK_RC(tapi_cfg_qdisc_set_kind(agent, ifname, TAPI_CFG_QDISC_KIND_NETEM)); CHECK_RC(tapi_cfg_netem_set_delay(agent, ifname, TE_MS2US(100))); CHECK_RC(tapi_cfg_netem_set_jitter(agent, ifname, TE_MS2US(10))); CHECK_RC(tapi_cfg_netem_set_delay_correlation(agent, ifname, 25.0)); CHECK_RC(tapi_cfg_qdisc_enable(agent, ifname));
tc qdisc add dev eth1 root netem loss 10%
CHECK_RC(tapi_cfg_qdisc_set_kind(agent, ifname, TAPI_CFG_QDISC_KIND_NETEM)); CHECK_RC(tapi_cfg_netem_set_loss(agent, ifname, TE_MS2US(100))); CHECK_RC(tapi_cfg_qdisc_enable(agent, ifname));
Typedefs
typedef enum tapi_cfg_qdisc_kind_t tapi_cfg_qdisc_kind_t
Qdisc kind support
Global Functions
te_errno tapi_cfg_qdisc_get_enabled(const char* ta, const char* if_name, bool* enabled)
Get status of qdisc
Parameters:
ta |
Test Agent |
if_name |
Interface Name |
enabled |
Activated or deactivated |
Returns:
Status Code
te_errno tapi_cfg_qdisc_set_enabled(const char* ta, const char* if_name, bool enabled)
Set status: activated or deactivated
Parameters:
ta |
Test Agent |
if_name |
Interface Name |
enabled |
Activate or deactivate |
Returns:
Status Code
static te_errno tapi_cfg_qdisc_enable(const char* ta, const char* if_name)
Activate qdisc for interface
Parameters:
ta |
Test Agent |
if_name |
Interface Name |
Returns:
Status Code
static te_errno tapi_cfg_qdisc_disable(const char* ta, const char* if_name)
Deactivate qdisc for interface
Parameters:
ta |
Test Agent |
if_name |
Interface Name |
Returns:
Status Code
te_errno tapi_cfg_qdisc_set_kind(const char* ta, const char* if_name, tapi_cfg_qdisc_kind_t kind)
Set NetEm kind
Parameters:
ta |
Test Agent |
if_name |
Interface Name |
kind |
NetEm kind |
Returns:
Status Code
te_errno tapi_cfg_qdisc_get_kind(const char* ta, const char* if_name, tapi_cfg_qdisc_kind_t* kind)
Get NetEm kind
Parameters:
ta |
Test Agent |
if_name |
Interface Name |
kind |
NetEm kind |
Returns:
Status Code
const char* tapi_cfg_qdisc_kind2str(tapi_cfg_qdisc_kind_t kind)
Convert qdisc kind enum to string
Parameters:
kind |
Qdisc kind |
Returns:
kind string
tapi_cfg_qdisc_kind_t tapi_cfg_qdisc_str2kind(const char* string)
Convert qdisc kind string to kind enum
Parameters:
string |
Qdisc kind |
Returns:
kind enum
te_errno tapi_cfg_qdisc_get_param(const char* ta, const char* if_name, const char* param, char** value)
Get value of qdisc parameter as string value should be free() after use
Parameters:
ta |
Test Agent |
if_name |
Interface name |
param |
qdisc parameter name |
value |
Parameter value |
Returns:
Status code
te_errno tapi_cfg_qdisc_set_param(const char* ta, const char* if_name, const char* param, const char* value)
Set value of qdisc parameter as string
Parameters:
ta |
Test Agent |
if_name |
Interface name |
param |
qdisc parameter name |
value |
Parameter value |
Returns:
Status code