:orphan: .. index:: pair: group; Queuing Discipline configuration .. _doxid-group__tapi__conf__qdisc: Queuing Discipline configuration ================================ .. toctree:: :hidden: group_tapi_conf_tbf.rst enum_tapi_cfg_qdisc_kind_t.rst Overview ~~~~~~~~ Copyright (C) 2004-2022 OKTET Labs Ltd. :ref:`More...` | :ref:`tc qdisc TBF configuration` .. ref-code-block:: cpp :class: doxyrest-overview-code-block // typedefs typedef enum :ref:`tapi_cfg_qdisc_kind_t` :ref:`tapi_cfg_qdisc_kind_t`; // enums enum :ref:`tapi_cfg_qdisc_kind_t`; // global functions :ref:`te_errno` :ref:`tapi_cfg_qdisc_get_enabled`(const char* ta, const char* if_name, bool* enabled); :ref:`te_errno` :ref:`tapi_cfg_qdisc_set_enabled`(const char* ta, const char* if_name, bool enabled); static :ref:`te_errno` :ref:`tapi_cfg_qdisc_enable`(const char* ta, const char* if_name); static :ref:`te_errno` :ref:`tapi_cfg_qdisc_disable`(const char* ta, const char* if_name); :ref:`te_errno` :ref:`tapi_cfg_qdisc_set_kind`(const char* ta, const char* if_name, :ref:`tapi_cfg_qdisc_kind_t` kind); :ref:`te_errno` :ref:`tapi_cfg_qdisc_get_kind`(const char* ta, const char* if_name, :ref:`tapi_cfg_qdisc_kind_t`* kind); const char* :ref:`tapi_cfg_qdisc_kind2str`(:ref:`tapi_cfg_qdisc_kind_t` kind); :ref:`tapi_cfg_qdisc_kind_t` :ref:`tapi_cfg_qdisc_str2kind`(const char* string); :ref:`te_errno` :ref:`tapi_cfg_qdisc_get_param`(const char* ta, const char* if_name, const char* param, char** value); :ref:`te_errno` :ref:`tapi_cfg_qdisc_set_param`(const char* ta, const char* if_name, const char* param, const char* value); // macros #define :target:`TAPI_CFG_QDISC_PARAM_FMT` .. _details-group__tapi__conf__qdisc: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved. .. _doxid-group__tapi__conf__qdisc_1tapi_cfg_qdisc_example: 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`` .. ref-code-block:: cpp #include "tapi_cfg_netem.h" #include "tapi_cfg_qdisc.h" ... const char *agent = "Agt_A"; const char *ifname = "eth1"; :ref:`CHECK_RC `(:ref:`tapi_cfg_qdisc_set_kind `(agent, ifname, :ref:`TAPI_CFG_QDISC_KIND_NETEM `)); :ref:`CHECK_RC `(:ref:`tapi_cfg_netem_set_delay `(agent, ifname, :ref:`TE_MS2US `(200))); :ref:`CHECK_RC `(:ref:`tapi_cfg_qdisc_enable `(agent, ifname)); ``tc qdisc change dev eth1 root netem delay 100ms 10ms 25%`` .. ref-code-block:: cpp :ref:`CHECK_RC `(:ref:`tapi_cfg_qdisc_set_kind `(agent, ifname, :ref:`TAPI_CFG_QDISC_KIND_NETEM `)); :ref:`CHECK_RC `(:ref:`tapi_cfg_netem_set_delay `(agent, ifname, :ref:`TE_MS2US `(100))); :ref:`CHECK_RC `(:ref:`tapi_cfg_netem_set_jitter `(agent, ifname, :ref:`TE_MS2US `(10))); :ref:`CHECK_RC `(:ref:`tapi_cfg_netem_set_delay_correlation `(agent, ifname, 25.0)); :ref:`CHECK_RC `(:ref:`tapi_cfg_qdisc_enable `(agent, ifname)); ``tc qdisc add dev eth1 root netem loss 10%`` .. ref-code-block:: cpp :ref:`CHECK_RC `(:ref:`tapi_cfg_qdisc_set_kind `(agent, ifname, :ref:`TAPI_CFG_QDISC_KIND_NETEM `)); :ref:`CHECK_RC `(:ref:`tapi_cfg_netem_set_loss `(agent, ifname, :ref:`TE_MS2US `(100))); :ref:`CHECK_RC `(:ref:`tapi_cfg_qdisc_enable `(agent, ifname)); Typedefs -------- .. index:: pair: typedef; tapi_cfg_qdisc_kind_t .. _doxid-group__tapi__conf__qdisc_1ga79b3294b26de4c5f191307587695624f: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef enum :ref:`tapi_cfg_qdisc_kind_t` tapi_cfg_qdisc_kind_t Qdisc kind support Global Functions ---------------- .. index:: pair: function; tapi_cfg_qdisc_get_enabled .. _doxid-group__tapi__conf__qdisc_1ga2062a8ca9191074e79e178bb680b8875: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`te_errno` tapi_cfg_qdisc_get_enabled(const char* ta, const char* if_name, bool* enabled) Get status of qdisc .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ta - Test Agent * - if_name - Interface Name * - enabled - Activated or deactivated .. rubric:: Returns: Status Code .. index:: pair: function; tapi_cfg_qdisc_set_enabled .. _doxid-group__tapi__conf__qdisc_1gaf1d89540b63210144d51ee632327f11c: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`te_errno` tapi_cfg_qdisc_set_enabled(const char* ta, const char* if_name, bool enabled) Set status: activated or deactivated .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ta - Test Agent * - if_name - Interface Name * - enabled - Activate or deactivate .. rubric:: Returns: Status Code .. index:: pair: function; tapi_cfg_qdisc_enable .. _doxid-group__tapi__conf__qdisc_1ga40715d7ae1c32c6fa513bf2d46f4dbed: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`te_errno` tapi_cfg_qdisc_enable(const char* ta, const char* if_name) Activate qdisc for interface .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ta - Test Agent * - if_name - Interface Name .. rubric:: Returns: Status Code .. index:: pair: function; tapi_cfg_qdisc_disable .. _doxid-group__tapi__conf__qdisc_1ga5e9f642fb5ca81db82f6645b5cf09add: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`te_errno` tapi_cfg_qdisc_disable(const char* ta, const char* if_name) Deactivate qdisc for interface .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ta - Test Agent * - if_name - Interface Name .. rubric:: Returns: Status Code .. index:: pair: function; tapi_cfg_qdisc_set_kind .. _doxid-group__tapi__conf__qdisc_1ga9be98d72b9cf0cd56c3f711da4f18b54: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`te_errno` tapi_cfg_qdisc_set_kind(const char* ta, const char* if_name, :ref:`tapi_cfg_qdisc_kind_t` kind) Set NetEm kind .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ta - Test Agent * - if_name - Interface Name * - kind - NetEm kind .. rubric:: Returns: Status Code .. index:: pair: function; tapi_cfg_qdisc_get_kind .. _doxid-group__tapi__conf__qdisc_1gae672c63a74e74685375479a44da295da: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`te_errno` tapi_cfg_qdisc_get_kind(const char* ta, const char* if_name, :ref:`tapi_cfg_qdisc_kind_t`* kind) Get NetEm kind .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ta - Test Agent * - if_name - Interface Name * - kind - NetEm kind .. rubric:: Returns: Status Code .. index:: pair: function; tapi_cfg_qdisc_kind2str .. _doxid-group__tapi__conf__qdisc_1ga5fb63eb1eae2d36dbc9e2b38b451927d: .. ref-code-block:: cpp :class: doxyrest-title-code-block const char* tapi_cfg_qdisc_kind2str(:ref:`tapi_cfg_qdisc_kind_t` kind) Convert qdisc kind enum to string .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - kind - Qdisc kind .. rubric:: Returns: kind string .. index:: pair: function; tapi_cfg_qdisc_str2kind .. _doxid-group__tapi__conf__qdisc_1ga00d0a23f193af92884b966a5e28c7a82: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`tapi_cfg_qdisc_kind_t` tapi_cfg_qdisc_str2kind(const char* string) Convert qdisc kind string to kind enum .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - string - Qdisc kind .. rubric:: Returns: kind enum .. index:: pair: function; tapi_cfg_qdisc_get_param .. _doxid-group__tapi__conf__qdisc_1ga93f351e667237f712710b1c196bbe54e: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`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 .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ta - Test Agent * - if_name - Interface name * - param - qdisc parameter name * - value - Parameter value .. rubric:: Returns: Status code .. index:: pair: function; tapi_cfg_qdisc_set_param .. _doxid-group__tapi__conf__qdisc_1ga77bd3e04129deb30ef0ed0d1bcc9c7d6: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`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 .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ta - Test Agent * - if_name - Interface name * - param - qdisc parameter name * - value - Parameter value .. rubric:: Returns: Status code