| 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 | |
| 15 | namespace NetworkManager |
| 16 | { |
| 17 | class WiredSettingPrivate; |
| 18 | |
| 19 | /*! |
| 20 | * \class NetworkManager::WiredSetting |
| 21 | * \inheaderfile NetworkManagerQt/WiredSetting |
| 22 | * \inmodule NetworkManagerQt |
| 23 | * |
| 24 | * \brief Represents wired setting. |
| 25 | */ |
| 26 | class NETWORKMANAGERQT_EXPORT WiredSetting : public Setting |
| 27 | { |
| 28 | public: |
| 29 | /*! |
| 30 | * \typedef NetworkManager::WiredSetting::Ptr |
| 31 | */ |
| 32 | typedef QSharedPointer<WiredSetting> Ptr; |
| 33 | /*! |
| 34 | * \typedef NetworkManager::WiredSetting::List |
| 35 | */ |
| 36 | typedef QList<Ptr> List; |
| 37 | /*! |
| 38 | * |
| 39 | * \value UnknownPort |
| 40 | * \value Tp |
| 41 | * \value Aui |
| 42 | * \value Bnc |
| 43 | * \value Mii |
| 44 | */ |
| 45 | enum PortType { |
| 46 | UnknownPort = 0, |
| 47 | Tp, |
| 48 | Aui, |
| 49 | Bnc, |
| 50 | Mii, |
| 51 | }; |
| 52 | |
| 53 | /*! |
| 54 | * |
| 55 | * \value UnknownDuplexType |
| 56 | * \value Half |
| 57 | * \value Full |
| 58 | */ |
| 59 | enum DuplexType { |
| 60 | UnknownDuplexType = 0, |
| 61 | Half, |
| 62 | Full, |
| 63 | }; |
| 64 | |
| 65 | /*! |
| 66 | * |
| 67 | * \value Undefined |
| 68 | * \value Qeth |
| 69 | * \value Lcs |
| 70 | * \value Ctc |
| 71 | */ |
| 72 | enum S390Nettype { |
| 73 | Undefined = 0, |
| 74 | Qeth, |
| 75 | Lcs, |
| 76 | Ctc, |
| 77 | }; |
| 78 | |
| 79 | /*! |
| 80 | * |
| 81 | * \value WakeOnLanPhy |
| 82 | * \value WakeOnLanUnicast |
| 83 | * \value WakeOnLanMulticast |
| 84 | * \value WakeOnLanBroadcast |
| 85 | * \value WakeOnLanArp |
| 86 | * \value WakeOnLanMagic |
| 87 | * |
| 88 | * Special values |
| 89 | * |
| 90 | * \value WakeOnLanDefault |
| 91 | * \value WakeOnLanIgnore |
| 92 | */ |
| 93 | enum WakeOnLanFlag { |
| 94 | WakeOnLanPhy = 1 << 1, |
| 95 | WakeOnLanUnicast = 1 << 2, |
| 96 | WakeOnLanMulticast = 1 << 3, |
| 97 | WakeOnLanBroadcast = 1 << 4, |
| 98 | WakeOnLanArp = 1 << 5, |
| 99 | WakeOnLanMagic = 1 << 6, |
| 100 | WakeOnLanDefault = 1 << 0, |
| 101 | WakeOnLanIgnore = 1 << 15, |
| 102 | }; |
| 103 | Q_DECLARE_FLAGS(WakeOnLanFlags, WakeOnLanFlag) |
| 104 | Q_FLAGS(WakeOnLanFlag) |
| 105 | |
| 106 | /*! |
| 107 | */ |
| 108 | WiredSetting(); |
| 109 | /*! |
| 110 | */ |
| 111 | explicit WiredSetting(const Ptr &other); |
| 112 | ~WiredSetting() override; |
| 113 | |
| 114 | QString name() const override; |
| 115 | |
| 116 | /*! |
| 117 | */ |
| 118 | void setPort(PortType port); |
| 119 | /*! |
| 120 | */ |
| 121 | PortType port() const; |
| 122 | |
| 123 | /*! |
| 124 | */ |
| 125 | void setSpeed(quint32 speed); |
| 126 | /*! |
| 127 | */ |
| 128 | quint32 speed() const; |
| 129 | |
| 130 | /*! |
| 131 | */ |
| 132 | void setDuplexType(DuplexType type); |
| 133 | /*! |
| 134 | */ |
| 135 | DuplexType duplexType() const; |
| 136 | |
| 137 | /*! |
| 138 | */ |
| 139 | void setAutoNegotiate(bool autoNegotiate); |
| 140 | /*! |
| 141 | */ |
| 142 | bool autoNegotiate() const; |
| 143 | |
| 144 | /*! |
| 145 | */ |
| 146 | QString generateMacAddressMask() const; |
| 147 | /*! |
| 148 | */ |
| 149 | void setGenerateMacAddressMask(const QString &mask); |
| 150 | |
| 151 | /*! |
| 152 | */ |
| 153 | void setMacAddress(const QByteArray &address); |
| 154 | /*! |
| 155 | */ |
| 156 | QByteArray macAddress() const; |
| 157 | |
| 158 | /*! |
| 159 | */ |
| 160 | void setClonedMacAddress(const QByteArray &address); |
| 161 | /*! |
| 162 | */ |
| 163 | QByteArray clonedMacAddress() const; |
| 164 | |
| 165 | /*! |
| 166 | */ |
| 167 | void setMacAddressBlacklist(const QStringList &list); |
| 168 | /*! |
| 169 | */ |
| 170 | QStringList macAddressBlacklist() const; |
| 171 | |
| 172 | /*! |
| 173 | */ |
| 174 | void setMtu(quint32 mtu); |
| 175 | /*! |
| 176 | */ |
| 177 | quint32 mtu() const; |
| 178 | |
| 179 | /*! |
| 180 | */ |
| 181 | void setS390Subchannels(const QStringList &channels); |
| 182 | /*! |
| 183 | */ |
| 184 | QStringList s390Subchannels() const; |
| 185 | |
| 186 | /*! |
| 187 | */ |
| 188 | void setS390NetType(S390Nettype type); |
| 189 | /*! |
| 190 | */ |
| 191 | S390Nettype s390NetType() const; |
| 192 | |
| 193 | /*! |
| 194 | */ |
| 195 | void setS390Options(const QMap<QString, QString> &options); |
| 196 | /*! |
| 197 | */ |
| 198 | QMap<QString, QString> s390Options() const; |
| 199 | |
| 200 | /*! |
| 201 | */ |
| 202 | WakeOnLanFlags wakeOnLan() const; |
| 203 | /*! |
| 204 | */ |
| 205 | void setWakeOnLan(WakeOnLanFlags wol); |
| 206 | |
| 207 | /*! |
| 208 | */ |
| 209 | QString wakeOnLanPassword() const; |
| 210 | /*! |
| 211 | */ |
| 212 | void setWakeOnLanPassword(const QString &password); |
| 213 | |
| 214 | /*! |
| 215 | */ |
| 216 | QString assignedMacAddress() const; |
| 217 | /*! |
| 218 | */ |
| 219 | void setAssignedMacAddress(const QString &assignedMacAddress); |
| 220 | |
| 221 | void fromMap(const QVariantMap &setting) override; |
| 222 | |
| 223 | QVariantMap toMap() const override; |
| 224 | |
| 225 | protected: |
| 226 | WiredSettingPrivate *d_ptr; |
| 227 | |
| 228 | private: |
| 229 | Q_DECLARE_PRIVATE(WiredSetting) |
| 230 | }; |
| 231 | |
| 232 | NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const WiredSetting &setting); |
| 233 | |
| 234 | Q_DECLARE_OPERATORS_FOR_FLAGS(WiredSetting::WakeOnLanFlags) |
| 235 | |
| 236 | } |
| 237 | |
| 238 | #endif // NETWORKMANAGERQT_WIRED_SETTING_H |
| 239 | |