8#include "tcsetting_p.h"
12#if !NM_CHECK_VERSION(1, 10, 0)
13#define NM_SETTING_TC_CONFIG_SETTING_NAME "tc"
15#define NM_SETTING_TC_CONFIG_QDISCS "qdiscs"
16#define NM_SETTING_TC_CONFIG_TFILTERS "tfilters"
19NetworkManager::TcSettingPrivate::TcSettingPrivate()
20 : name(NM_SETTING_TC_CONFIG_SETTING_NAME)
24NetworkManager::TcSetting::TcSetting()
25 : Setting(Setting::Tc)
26 , d_ptr(new TcSettingPrivate())
30NetworkManager::TcSetting::TcSetting(
const Ptr &other)
32 , d_ptr(new TcSettingPrivate())
34 setQdiscs(other->qdiscs());
35 setTfilters(other->tfilters());
38NetworkManager::TcSetting::~TcSetting()
50void NetworkManager::TcSetting::setQdiscs(
const NMVariantMapList &qdiscs)
57NMVariantMapList NetworkManager::TcSetting::qdiscs()
const
64void NetworkManager::TcSetting::setTfilters(
const NMVariantMapList &tfilters)
68 d->tfilters = tfilters;
71NMVariantMapList NetworkManager::TcSetting::tfilters()
const
80 if (setting.contains(
QLatin1String(NM_SETTING_TC_CONFIG_QDISCS))) {
81 setQdiscs(qdbus_cast<NMVariantMapList>(setting.value(
QLatin1String(NM_SETTING_TC_CONFIG_QDISCS))));
84 if (setting.contains(
QLatin1String(NM_SETTING_TC_CONFIG_TFILTERS))) {
85 setTfilters(qdbus_cast<NMVariantMapList>(setting.value(
QLatin1String(NM_SETTING_TC_CONFIG_TFILTERS))));
93 if (!qdiscs().empty()) {
97 if (!tfilters().empty()) {
106 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
107 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
109 dbg.
nospace() << NM_SETTING_TC_CONFIG_QDISCS <<
": " <<
'\n';
110 const NMVariantMapList qdiscList = setting.qdiscs();
111 for (
const QVariantMap &qdisc : qdiscList) {
112 QVariantMap::const_iterator i = qdisc.constBegin();
113 while (i != qdisc.constEnd()) {
114 dbg.
nospace() << i.key() <<
": " << i.value() <<
'\n';
117 dbg.
nospace() << NM_SETTING_TC_CONFIG_TFILTERS <<
": " <<
'\n';
118 const NMVariantMapList tfiltersList = setting.tfilters();
119 for (
const QVariantMap &tfilter : tfiltersList) {
120 QVariantMap::const_iterator i = tfilter.constBegin();
121 while (i != tfilter.constEnd()) {
122 dbg.
nospace() << i.key() <<
": " << i.value() <<
'\n';
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
QVariant fromValue(T &&value)