7#include "bridgeportsetting.h"
8#include "bridgeportsetting_p.h"
12NetworkManager::BridgePortSettingPrivate::BridgePortSettingPrivate()
13 : name(NM_SETTING_BRIDGE_PORT_SETTING_NAME)
20NetworkManager::BridgePortSetting::BridgePortSetting()
21 : Setting(Setting::BridgePort)
22 , d_ptr(new BridgePortSettingPrivate())
28 , d_ptr(new BridgePortSettingPrivate())
30 setPriority(other->priority());
31 setPathCost(other->pathCost());
32 setHairpinMode(other->hairpinMode());
35NetworkManager::BridgePortSetting::~BridgePortSetting()
47void NetworkManager::BridgePortSetting::setPriority(quint32 priority)
51 d->priority = priority;
54quint32 NetworkManager::BridgePortSetting::priority()
const
56 Q_D(
const BridgePortSetting);
61void NetworkManager::BridgePortSetting::setPathCost(quint32 cost)
63 Q_D(BridgePortSetting);
68quint32 NetworkManager::BridgePortSetting::pathCost()
const
70 Q_D(
const BridgePortSetting);
75void NetworkManager::BridgePortSetting::setHairpinMode(
bool enable)
77 Q_D(BridgePortSetting);
79 d->hairpinMode = enable;
82bool NetworkManager::BridgePortSetting::hairpinMode()
const
84 Q_D(
const BridgePortSetting);
86 return d->hairpinMode;
91 if (setting.contains(
QLatin1String(NM_SETTING_BRIDGE_PORT_PRIORITY))) {
92 setPriority(setting.value(
QLatin1String(NM_SETTING_BRIDGE_PORT_PRIORITY)).toUInt());
95 if (setting.contains(
QLatin1String(NM_SETTING_BRIDGE_PORT_PATH_COST))) {
96 setPathCost(setting.value(
QLatin1String(NM_SETTING_BRIDGE_PORT_PATH_COST)).toUInt());
99 if (setting.contains(
QLatin1String(NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE))) {
100 setHairpinMode(setting.value(
QLatin1String(NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE)).toBool());
108 if (priority() != 32) {
109 setting.insert(
QLatin1String(NM_SETTING_BRIDGE_PORT_PRIORITY), priority());
112 if (pathCost() != 100) {
113 setting.insert(
QLatin1String(NM_SETTING_BRIDGE_PORT_PATH_COST), pathCost());
117 setting.insert(
QLatin1String(NM_SETTING_BRIDGE_PORT_PATH_COST), hairpinMode());
125 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
126 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
128 dbg.
nospace() << NM_SETTING_BRIDGE_PORT_PRIORITY <<
": " << setting.priority() <<
'\n';
129 dbg.
nospace() << NM_SETTING_BRIDGE_PORT_PATH_COST <<
": " << setting.pathCost() <<
'\n';
130 dbg.
nospace() << NM_SETTING_BRIDGE_PORT_PATH_COST <<
": " << setting.hairpinMode() <<
'\n';
Represents bridge port setting.
QString name() const override
Must be reimplemented, default implementationd does nothing.
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.