7#include "vlansetting.h"
8#include "vlansetting_p.h"
11#define NM_SETTING_VLAN_INTERFACE_NAME "interface-name"
15NetworkManager::VlanSettingPrivate::VlanSettingPrivate()
16 : name(NM_SETTING_VLAN_SETTING_NAME)
18 , flags(VlanSetting::
None)
22NetworkManager::VlanSetting::VlanSetting()
23 : Setting(Setting::Vlan)
24 , d_ptr(new VlanSettingPrivate())
28NetworkManager::VlanSetting::VlanSetting(
const Ptr &other)
30 , d_ptr(new VlanSettingPrivate())
32 setInterfaceName(other->interfaceName());
33 setParent(other->parent());
36 setIngressPriorityMap(other->ingressPriorityMap());
37 setEgressPriorityMap(other->egressPriorityMap());
40NetworkManager::VlanSetting::~VlanSetting()
56 d->interfaceName = name;
59QString NetworkManager::VlanSetting::interfaceName()
const
63 return d->interfaceName;
66void NetworkManager::VlanSetting::setParent(
const QString &parent)
73QString NetworkManager::VlanSetting::parent()
const
75 Q_D(
const VlanSetting);
80void NetworkManager::VlanSetting::setId(quint32
id)
87quint32 NetworkManager::VlanSetting::id()
const
89 Q_D(
const VlanSetting);
103 Q_D(
const VlanSetting);
108void NetworkManager::VlanSetting::setIngressPriorityMap(
const QStringList &map)
112 d->ingressPriorityMap =
map;
115QStringList NetworkManager::VlanSetting::ingressPriorityMap()
const
117 Q_D(
const VlanSetting);
119 return d->ingressPriorityMap;
122void NetworkManager::VlanSetting::setEgressPriorityMap(
const QStringList &map)
126 d->egressPriorityMap =
map;
129QStringList NetworkManager::VlanSetting::egressPriorityMap()
const
131 Q_D(
const VlanSetting);
133 return d->egressPriorityMap;
138 if (setting.contains(
QLatin1String(NM_SETTING_VLAN_INTERFACE_NAME))) {
139 setInterfaceName(setting.value(
QLatin1String(NM_SETTING_VLAN_INTERFACE_NAME)).toString());
142 if (setting.contains(
QLatin1String(NM_SETTING_VLAN_PARENT))) {
143 setParent(setting.value(
QLatin1String(NM_SETTING_VLAN_PARENT)).toString());
147 setId(setting.value(
QLatin1String(NM_SETTING_VLAN_ID)).toUInt());
150 if (setting.contains(
QLatin1String(NM_SETTING_VLAN_FLAGS))) {
151 setFlags((Flag)setting.value(
QLatin1String(NM_SETTING_VLAN_FLAGS)).toUInt());
154 if (setting.contains(
QLatin1String(NM_SETTING_VLAN_INGRESS_PRIORITY_MAP))) {
155 setIngressPriorityMap(setting.value(
QLatin1String(NM_SETTING_VLAN_INGRESS_PRIORITY_MAP)).toStringList());
158 if (setting.contains(
QLatin1String(NM_SETTING_VLAN_EGRESS_PRIORITY_MAP))) {
159 setEgressPriorityMap(setting.value(
QLatin1String(NM_SETTING_VLAN_EGRESS_PRIORITY_MAP)).toStringList());
167 if (!interfaceName().isEmpty()) {
168 setting.insert(
QLatin1String(NM_SETTING_VLAN_INTERFACE_NAME), interfaceName());
171 if (!parent().isEmpty()) {
172 setting.insert(
QLatin1String(NM_SETTING_VLAN_PARENT), parent());
179 if (flags() != None) {
180 setting.insert(
QLatin1String(NM_SETTING_VLAN_FLAGS), (
int)flags());
183 if (!ingressPriorityMap().isEmpty()) {
184 setting.insert(
QLatin1String(NM_SETTING_VLAN_INGRESS_PRIORITY_MAP), ingressPriorityMap());
187 if (!egressPriorityMap().isEmpty()) {
188 setting.insert(
QLatin1String(NM_SETTING_VLAN_EGRESS_PRIORITY_MAP), egressPriorityMap());
196 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
197 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
199 dbg.
nospace() << NM_SETTING_VLAN_INTERFACE_NAME <<
": " << setting.interfaceName() <<
'\n';
200 dbg.
nospace() << NM_SETTING_VLAN_PARENT <<
": " << setting.parent() <<
'\n';
201 dbg.
nospace() << NM_SETTING_VLAN_ID <<
": " << setting.id() <<
'\n';
202 dbg.
nospace() << NM_SETTING_VLAN_FLAGS <<
": " << setting.flags() <<
'\n';
203 dbg.
nospace() << NM_SETTING_VLAN_INGRESS_PRIORITY_MAP <<
": " << setting.ingressPriorityMap() <<
'\n';
204 dbg.
nospace() << NM_SETTING_VLAN_EGRESS_PRIORITY_MAP <<
": " << setting.egressPriorityMap() <<
'\n';
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
void setInterfaceName(const QString &name)
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
KCRASH_EXPORT void setFlags(KCrash::CrashFlags flags)
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)