1/*
2 SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef NETWORKMANAGERQT_WIRED_SETTING_H
8#define NETWORKMANAGERQT_WIRED_SETTING_H
9
10#include "setting.h"
11#include <networkmanagerqt/networkmanagerqt_export.h>
12
13#include <QStringList>
14
15namespace NetworkManager
16{
17class WiredSettingPrivate;
18
19/**
20 * Represents wired setting
21 */
22class NETWORKMANAGERQT_EXPORT WiredSetting : public Setting
23{
24public:
25 typedef QSharedPointer<WiredSetting> Ptr;
26 typedef QList<Ptr> List;
27 enum PortType {
28 UnknownPort = 0,
29 Tp,
30 Aui,
31 Bnc,
32 Mii,
33 };
34
35 enum DuplexType {
36 UnknownDuplexType = 0,
37 Half,
38 Full,
39 };
40
41 enum S390Nettype {
42 Undefined = 0,
43 Qeth,
44 Lcs,
45 Ctc,
46 };
47
48 enum WakeOnLanFlag {
49 WakeOnLanPhy = 1 << 1,
50 WakeOnLanUnicast = 1 << 2,
51 WakeOnLanMulticast = 1 << 3,
52 WakeOnLanBroadcast = 1 << 4,
53 WakeOnLanArp = 1 << 5,
54 WakeOnLanMagic = 1 << 6,
55 /* Special values */
56 WakeOnLanDefault = 1 << 0,
57 WakeOnLanIgnore = 1 << 15,
58 };
59 Q_DECLARE_FLAGS(WakeOnLanFlags, WakeOnLanFlag)
60 Q_FLAGS(WakeOnLanFlag)
61
62 WiredSetting();
63 explicit WiredSetting(const Ptr &other);
64 ~WiredSetting() override;
65
66 QString name() const override;
67
68 void setPort(PortType port);
69 PortType port() const;
70
71 void setSpeed(quint32 speed);
72 quint32 speed() const;
73
74 void setDuplexType(DuplexType type);
75 DuplexType duplexType() const;
76
77 void setAutoNegotiate(bool autoNegotiate);
78 bool autoNegotiate() const;
79
80 QString generateMacAddressMask() const;
81 void setGenerateMacAddressMask(const QString &mask);
82
83 void setMacAddress(const QByteArray &address);
84 QByteArray macAddress() const;
85
86 void setClonedMacAddress(const QByteArray &address);
87 QByteArray clonedMacAddress() const;
88
89 void setMacAddressBlacklist(const QStringList &list);
90 QStringList macAddressBlacklist() const;
91
92 void setMtu(quint32 mtu);
93 quint32 mtu() const;
94
95 void setS390Subchannels(const QStringList &channels);
96 QStringList s390Subchannels() const;
97
98 void setS390NetType(S390Nettype type);
99 S390Nettype s390NetType() const;
100
101 void setS390Options(const QMap<QString, QString> &options);
102 QMap<QString, QString> s390Options() const;
103
104 WakeOnLanFlags wakeOnLan() const;
105 void setWakeOnLan(WakeOnLanFlags wol);
106
107 QString wakeOnLanPassword() const;
108 void setWakeOnLanPassword(const QString &password);
109
110 QString assignedMacAddress() const;
111 void setAssignedMacAddress(const QString &assignedMacAddress);
112
113 void fromMap(const QVariantMap &setting) override;
114
115 QVariantMap toMap() const override;
116
117protected:
118 WiredSettingPrivate *d_ptr;
119
120private:
121 Q_DECLARE_PRIVATE(WiredSetting)
122};
123
124NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const WiredSetting &setting);
125
126Q_DECLARE_OPERATORS_FOR_FLAGS(WiredSetting::WakeOnLanFlags)
127
128}
129
130#endif // NETWORKMANAGERQT_WIRED_SETTING_H
131

source code of networkmanager-qt/src/settings/wiredsetting.h