8#include "tunsetting_p.h"
12NetworkManager::TunSettingPrivate::TunSettingPrivate()
13 : name(NM_SETTING_TUN_SETTING_NAME)
14 , mode(TunSetting::Tun)
21NetworkManager::TunSetting::TunSetting()
22 : Setting(Setting::Tun)
23 , d_ptr(new TunSettingPrivate())
27NetworkManager::TunSetting::TunSetting(
const Ptr &other)
29 , d_ptr(new TunSettingPrivate())
31 setGroup(other->group());
32 setMode(other->mode());
33 setMultiQueue(other->multiQueue());
34 setOwner(other->owner());
36 setVnetHdr(other->vnetHdr());
39NetworkManager::TunSetting::~TunSetting()
51void NetworkManager::TunSetting::setGroup(
const QString &group)
58QString NetworkManager::TunSetting::group()
const
60 Q_D(
const TunSetting);
65void NetworkManager::TunSetting::setMode(NetworkManager::TunSetting::Mode mode)
72NetworkManager::TunSetting::Mode NetworkManager::TunSetting::mode()
const
74 Q_D(
const TunSetting);
79void NetworkManager::TunSetting::setMultiQueue(
bool multiQueue)
83 d->multiQueue = multiQueue;
86bool NetworkManager::TunSetting::multiQueue()
const
88 Q_D(
const TunSetting);
93void NetworkManager::TunSetting::setOwner(
const QString &owner)
100QString NetworkManager::TunSetting::owner()
const
102 Q_D(
const TunSetting);
107void NetworkManager::TunSetting::setPi(
bool pi)
114bool NetworkManager::TunSetting::pi()
const
116 Q_D(
const TunSetting);
121void NetworkManager::TunSetting::setVnetHdr(
bool vnetHdr)
125 d->vnetHdr = vnetHdr;
128bool NetworkManager::TunSetting::vnetHdr()
const
130 Q_D(
const TunSetting);
138 setGroup(setting.value(
QLatin1String(NM_SETTING_TUN_GROUP)).toString());
142 setMode((Mode)setting.value(
QLatin1String(NM_SETTING_TUN_MODE)).toUInt());
145 if (setting.contains(
QLatin1String(NM_SETTING_TUN_MULTI_QUEUE))) {
146 setMultiQueue(setting.value(
QLatin1String(NM_SETTING_TUN_MULTI_QUEUE)).toBool());
150 setOwner(setting.value(
QLatin1String(NM_SETTING_TUN_OWNER)).toString());
154 setPi(setting.value(
QLatin1String(NM_SETTING_TUN_PI)).toBool());
157 if (setting.contains(
QLatin1String(NM_SETTING_TUN_VNET_HDR))) {
158 setVnetHdr(setting.value(
QLatin1String(NM_SETTING_TUN_VNET_HDR)).toBool());
166 if (!group().isEmpty()) {
167 setting.insert(
QLatin1String(NM_SETTING_TUN_GROUP), group());
170 setting.insert(
QLatin1String(NM_SETTING_TUN_MODE), (
int)mode());
171 setting.insert(
QLatin1String(NM_SETTING_TUN_MULTI_QUEUE), multiQueue());
173 if (!owner().isEmpty()) {
174 setting.insert(
QLatin1String(NM_SETTING_TUN_OWNER), owner());
178 setting.insert(
QLatin1String(NM_SETTING_TUN_VNET_HDR), vnetHdr());
185 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
186 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
188 dbg.
nospace() << NM_SETTING_TUN_GROUP <<
": " << setting.group() <<
'\n';
189 dbg.
nospace() << NM_SETTING_TUN_MODE <<
": " << setting.mode() <<
'\n';
190 dbg.
nospace() << NM_SETTING_TUN_MULTI_QUEUE <<
": " << setting.multiQueue() <<
'\n';
191 dbg.
nospace() << NM_SETTING_TUN_OWNER <<
": " << setting.owner() <<
'\n';
192 dbg.
nospace() << NM_SETTING_TUN_PI <<
": " << setting.pi() <<
'\n';
193 dbg.
nospace() << NM_SETTING_TUN_VNET_HDR <<
": " << setting.vnetHdr() <<
'\n';
Represents generic setting.
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.