diff --git a/src/accesspoint.h b/src/accesspoint.h index 8660246..dff0e40 100644 --- a/src/accesspoint.h +++ b/src/accesspoint.h @@ -1,207 +1,205 @@ /* Copyright 2008 Will Stephenson Copyright 2011-2013 Lamarque V. Souza Copyright 2013 Jan Grulich This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_ACCESSPOINT_H #define NETWORKMANAGERQT_ACCESSPOINT_H #include #include #include #include #include namespace NetworkManager { class AccessPointPrivate; /** * Represents an access point */ class NETWORKMANAGERQT_EXPORT AccessPoint : public QObject { Q_OBJECT public: typedef QSharedPointer Ptr; typedef QList List; /** * The access point's current operating mode */ enum OperationMode { Unknown = 0, /**< not associated with a network */ Adhoc, /**< part of an adhoc network */ Infra, /**< a station in an infrastructure wireless network */ ApMode /**< access point in an infrastructure network */ }; /** * General capabilities of an access point */ enum Capability { None = 0x0, /**< Null capability - says nothing about the access point */ Privacy = 0x1 /**< Access point supports privacy measures */ }; /** * Flags describing the access point's capabilities according to WPA (Wifi Protected Access) */ enum WpaFlag { PairWep40 = 0x1, PairWep104 = 0x2, PairTkip = 0x4, PairCcmp = 0x8, GroupWep40 = 0x10, GroupWep104 = 0x20, GroupTkip = 0x40, GroupCcmp = 0x80, KeyMgmtPsk = 0x100, KeyMgmt8021x = 0x200 }; Q_DECLARE_FLAGS(Capabilities, Capability) Q_FLAG(Capabilities) Q_DECLARE_FLAGS(WpaFlags, WpaFlag) Q_FLAG(WpaFlags) explicit AccessPoint(const QString &path, QObject *parent = nullptr); virtual ~AccessPoint(); /** * @return path of the access point */ QString uni() const; /** * @return capabilities of an access point */ Capabilities capabilities() const; /** * @return flags describing the access point's capabilities according to WPA (Wifi Protected Access). * @see WpaFlag */ AccessPoint::WpaFlags wpaFlags() const; /** * @return Flags describing the access point's capabilities according to the RSN (Robust Secure Network) protocol. * @see WpaFlag */ AccessPoint::WpaFlags rsnFlags() const; /** * @return The Service Set Identifier identifying the access point. */ QString ssid() const; /** * @return raw SSID, encoded as a byte array */ QByteArray rawSsid() const; /** * @return The radio channel frequency in use by the access point, in MHz. */ uint frequency() const; /** * @return The hardware address (BSSID) of the access point. */ QString hardwareAddress() const; /** * @return The maximum bitrate this access point is capable of, in kilobits/second (Kb/s). */ uint maxBitRate() const; /** * @return Describes the operating mode of the access point. */ OperationMode mode() const; /** * @return The current signal quality of the access point, in percent. */ int signalStrength() const; /** * @return The timestamp (in CLOCK_BOOTTIME seconds) for the last time the access point * was found in scan results. A value of -1 means the access point has never been found in scan results. * @since 5.14.0 - * @note always returns -1 in runtime NM < 1.0.6 */ int lastSeen() const; /** * Helper method to convert wire representation of operation @p mode to enum */ static OperationMode convertOperationMode(uint mode); Q_SIGNALS: /** * This signal is emitted when the signal strength of this network has changed. * * @param strength the new signal strength value for this network */ void signalStrengthChanged(int strength); /** * This signal is emitted when the bitrate of this network has changed. * * @param bitrate the new bitrate value for this network */ void bitRateChanged(int bitrate); /** * This signal is emitted when the capabilities of this network have changed. * * @param caps the new capabilities */ void capabilitiesChanged(AccessPoint::Capabilities caps); /** * This signal is emitted when the WPA flags in use by this access point change * * @param flags the new flags */ void wpaFlagsChanged(AccessPoint::WpaFlags flags); /** * This signal is emitted when the RSN(WPA2) flags in use by this access point change * * @param flags the new flags */ void rsnFlagsChanged(AccessPoint::WpaFlags flags); /** * This signal is emitted when the ssid of this Access Point changes * * @param ssid the new SSID */ void ssidChanged(const QString &ssid); /** * This signal is emitted when the frequency used by this Access Point changes * * @param frequency the new frequency */ void frequencyChanged(uint frequency); /** * This signal is emitted when the timestamp for the last time the access point was found * in scan results changes * * @param lastSeen the timestamp for the last time the access point was found in scan results. * @since 5.14.0 * @see lastSeen - * @note never emitted in runtime NM < 1.0.6 */ void lastSeenChanged(int lastSeen); private: Q_DECLARE_PRIVATE(AccessPoint) AccessPointPrivate *const d_ptr; }; Q_DECLARE_OPERATORS_FOR_FLAGS(AccessPoint::WpaFlags) } #endif diff --git a/src/connection.h b/src/connection.h index 1509597..525d6dd 100644 --- a/src/connection.h +++ b/src/connection.h @@ -1,166 +1,165 @@ /* Copyright 2008,2009 Will Stephenson Copyright 2011-2013 Lamarque V. Souza Copyright 2013 Jan Grulich This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_SETTINGS_CONNECTION_H #define NETWORKMANAGERQT_SETTINGS_CONNECTION_H #include #include "generictypes.h" #include "connectionsettings.h" #include #include #include class QDBusPendingCallWatcher; namespace NetworkManager { class ConnectionPrivate; /** * This class represents a single network connection configuration. */ class NETWORKMANAGERQT_EXPORT Connection : public QObject { Q_OBJECT public: typedef QSharedPointer Ptr; typedef QList List; /** * Constructs a connection object for the given path */ explicit Connection(const QString &path, QObject *parent = nullptr); ~Connection(); /** * Returns if this connection is valid */ bool isValid() const; /** * Returns the unique identifier of this connection */ QString uuid() const; /** * Returns the path (DBus) of this connection */ QString path() const; /** * Returns the name of this connection */ QString name() const; /** * If set, indicates that the in-memory state of the * connection does not match the on-disk state. This flag * will be set when updateUnsaved() is called or when any * connection details change, and cleared when the connection * is saved to disk via save() or from internal operations. * * @since 0.9.9.0 */ bool isUnsaved() const; /** * Returns the settings of this connection */ ConnectionSettings::Ptr settings(); /** * Retrieves this connections's secrets (passwords and / or encryption keys). * * @param setting the setting identifier. */ QDBusPendingReply secrets(const QString &setting); /** * Update the connection with new @p settings and properties, replacing all previous settings and properties. * Secrets may be part of the update request, and will be either stored in persistent storage or given to a Secret Agent for storage, * depending on the request. */ QDBusPendingReply<> update(const NMVariantMapMap &settings); /** * Update the connection with new @p settings and properties (replacing * all previous settings and properties) but do not immediately save * the connection to disk. Secrets may be part of the update request * and may sent to a Secret Agent for storage, depending on the the * flags associated with each secret. * * Use the save() method to save these changes to disk. Note * that unsaved changes will be lost if the connection is * reloaded from disk (either automatically on file change or * due to an explicit reloadConnections() call). * * @since 0.9.9.0 */ QDBusPendingReply<> updateUnsaved(const NMVariantMapMap &settings); /** * Saves a "dirty" connection (that had previously been * updated with updateUnsaved()) to persistent storage. * * @since 0.9.9.0 */ QDBusPendingReply<> save(); /** * Clear the secrets belonging to this network connection profile. * @since 5.8.0 - * @note this is a noop in runtime NM < 1.0.0 */ QDBusPendingReply<> clearSecrets(); /** * Removes the connection from NetworkManager database, * this operation does not ask for confirmation but * a policykit rule might prevent it from being removed * without the proper password. */ QDBusPendingReply<> remove(); Q_SIGNALS: /** * Emitted when the connection settings changes */ void updated(); /** * Emitted when the connection was removed * @param path connections's path. */ void removed(const QString &path); /** * Emitted when the connection unsaved state changes */ void unsavedChanged(bool unsaved); private: Q_DECLARE_PRIVATE(Connection) ConnectionPrivate *const d_ptr; }; } #endif // CONNECTION_H diff --git a/src/device.h b/src/device.h index e6bdafb..b530156 100644 --- a/src/device.h +++ b/src/device.h @@ -1,588 +1,581 @@ /* Copyright 2008,2011 Will Stephenson Copyright 2011-2013 Lamarque V. Souza Copyright 2013 Daniel Nicoletti Copyright 2013 Jan Grulich This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_DEVICE_H #define NETWORKMANAGERQT_DEVICE_H #include #include #include #include #include "generictypes.h" #include "ipconfig.h" #include "dhcp4config.h" #include "dhcp6config.h" #include "activeconnection.h" #include "devicestatistics.h" namespace NetworkManager { class DevicePrivate; class DeviceStateReason; class DeviceStateReasonPrivate; /** * This class represents a common device interface */ class NETWORKMANAGERQT_EXPORT Device : public QObject { Q_OBJECT Q_PROPERTY(QString uni READ uni) Q_PROPERTY(QString interfaceName READ interfaceName) Q_PROPERTY(QString ipInterfaceName READ ipInterfaceName) Q_PROPERTY(QString driver READ driver) Q_PROPERTY(QString driverVersion READ driverVersion) Q_PROPERTY(QString firmwareVersion READ firmwareVersion) Q_PROPERTY(QVariant genericCapabilities READ capabilitiesV) Q_PROPERTY(QHostAddress ipV4Address READ ipV4Address) Q_PROPERTY(bool managed READ managed) Q_PROPERTY(uint mtu READ mtu) Q_PROPERTY(bool nmPluginMissing READ nmPluginMissing) Q_PROPERTY(MeteredStatus metered READ metered) Q_PROPERTY(QString udi READ udi) Q_PROPERTY(bool firmwareMissing READ firmwareMissing) Q_PROPERTY(bool autoconnect READ autoconnect WRITE setAutoconnect) Q_PROPERTY(DeviceStateReason stateReason READ stateReason) Q_PROPERTY(State state READ state) Q_PROPERTY(NetworkManager::DeviceStatistics::Ptr deviceStatistics READ deviceStatistics) public: typedef QSharedPointer Ptr; typedef QList List; /** * Device connection states describe the possible states of a * network connection from the user's point of view. For * simplicity, states from several different layers are present - * this is a high level view */ enum State { UnknownState = 0, /**< The device is in an unknown state */ Unmanaged = 10, /**< The device is recognized but not managed by NetworkManager */ Unavailable = 20, /**< The device cannot be used (carrier off, rfkill, etc) */ Disconnected = 30, /**< The device is not connected */ Preparing = 40, /**< The device is preparing to connect */ ConfiguringHardware = 50, /**< The device is being configured */ NeedAuth = 60, /**< The device is awaiting secrets necessary to continue connection */ ConfiguringIp = 70, /**< The IP settings of the device are being requested and configured */ CheckingIp = 80, /**< The device's IP connectivity ability is being determined */ WaitingForSecondaries = 90, /**< The device is waiting for secondary connections to be activated */ Activated = 100, /**< The device is active */ Deactivating = 110, /**< The device's network connection is being torn down */ Failed = 120 /**< The device is in a failure state following an attempt to activate it */ }; Q_ENUM(State) /** * Enums describing the reason for a connection state change * @note StateChangeReasons NewActivation, ParentChanged, ParentManagedChanged are available in runtime NM >= 1.0.4 */ enum StateChangeReason { UnknownReason = 0, NoReason = 1 , NowManagedReason = 2, NowUnmanagedReason = 3, ConfigFailedReason = 4, ConfigUnavailableReason = 5, ConfigExpiredReason = 6, NoSecretsReason = 7, AuthSupplicantDisconnectReason = 8, AuthSupplicantConfigFailedReason = 9, AuthSupplicantFailedReason = 10, AuthSupplicantTimeoutReason = 11, PppStartFailedReason = 12, PppDisconnectReason = 13, PppFailedReason = 14, DhcpStartFailedReason = 15, DhcpErrorReason = 16, DhcpFailedReason = 17, SharedStartFailedReason = 18, SharedFailedReason = 19, AutoIpStartFailedReason = 20, AutoIpErrorReason = 21, AutoIpFailedReason = 22, ModemBusyReason = 23, ModemNoDialToneReason = 24, ModemNoCarrierReason = 25, ModemDialTimeoutReason = 26, ModemDialFailedReason = 27, ModemInitFailedReason = 28, GsmApnSelectFailedReason = 29, GsmNotSearchingReason = 30, GsmRegistrationDeniedReason = 31, GsmRegistrationTimeoutReason = 32, GsmRegistrationFailedReason = 33, GsmPinCheckFailedReason = 34, FirmwareMissingReason = 35, DeviceRemovedReason = 36, SleepingReason = 37, ConnectionRemovedReason = 38, UserRequestedReason = 39, CarrierReason = 40, ConnectionAssumedReason = 41, SupplicantAvailableReason = 42, ModemNotFoundReason = 43, BluetoothFailedReason = 44, GsmSimNotInserted = 45, GsmSimPinRequired = 46, GsmSimPukRequired = 47, GsmSimWrong = 48 , InfiniBandMode = 49, DependencyFailed = 50, Br2684Failed = 51, ModemManagerUnavailable = 52, SsidNotFound = 53, SecondaryConnectionFailed = 54, DcbFcoeFailed = 55, TeamdControlFailed = 56, ModemFailed = 57, ModemAvailable = 58, SimPinIncorrect = 59, NewActivation = 60, ParentChanged = 61, ParentManagedChanged = 62, Reserved = 65536 }; Q_ENUM(StateChangeReason) enum MeteredStatus { UnknownStatus = 0, /**< The device metered status is unknown. */ Yes = 1, /**< The device is metered and the value was statically set. */ No = 2, /**< The device is not metered and the value was statically set. */ GuessYes = 3, /**< The device is metered and the value was guessed. */ GuessNo = 4 /**< The device is not metered and the value was guessed. */ }; Q_ENUM(MeteredStatus) /** * Possible device capabilities */ enum Capability { IsManageable = 0x1, /**< denotes that the device can be controlled by this API */ SupportsCarrierDetect = 0x2 /**< the device informs us when it is plugged in to the medium */ }; Q_ENUM(Capability) Q_DECLARE_FLAGS(Capabilities, Capability) Q_FLAG(Capabilities) /** * Device type */ enum Type { UnknownType = NM_DEVICE_TYPE_UNKNOWN, /**< Unknown device type */ Ethernet = NM_DEVICE_TYPE_ETHERNET, /**< Ieee8023 wired ethernet */ Wifi = NM_DEVICE_TYPE_WIFI, /**< the Ieee80211 family of wireless networks */ Unused1 = NM_DEVICE_TYPE_UNUSED1, /**< Currently unused */ Unused2 = NM_DEVICE_TYPE_UNUSED2, /**< Currently unused */ Bluetooth = NM_DEVICE_TYPE_BT, /**< network bluetooth device (usually a cell phone) */ OlpcMesh = NM_DEVICE_TYPE_OLPC_MESH, /**< OLPC Mesh networking device */ Wimax = NM_DEVICE_TYPE_WIMAX, /**< WiMax WWAN technology */ Modem = NM_DEVICE_TYPE_MODEM, /**< POTS, GSM, CDMA or LTE modems */ InfiniBand = NM_DEVICE_TYPE_INFINIBAND, /**< Infiniband network device */ Bond = NM_DEVICE_TYPE_BOND, /**< Bond virtual device */ Vlan = NM_DEVICE_TYPE_VLAN, /**< Vlan virtual device */ Adsl = NM_DEVICE_TYPE_ADSL, /**< ADSL modem device */ Bridge = NM_DEVICE_TYPE_BRIDGE, /**< Bridge virtual device */ Generic = NM_DEVICE_TYPE_GENERIC, /**< Generic device @since 1.0.0 */ Team = NM_DEVICE_TYPE_TEAM, /**< Team master device @since 1.0.0 */ Gre, /**< Gre virtual device @since 1.2.0, @deprecated use IpTunnel instead*/ MacVlan, /**< MacVlan virtual device @since 1.2.0 */ Tun, /**< Tun virtual device @since 1.2.0 */ Veth, /**< Veth virtual device @since 1.2.0 */ IpTunnel, /**< IP Tunneling Device @since 1.2.0 */ VxLan, /**< Vxlan Device @since 1.2.0 */ MacSec, /**< MacSec Device @since 1.6.0 */ Dummy /**< Dummy Device @since 1.8.0 */ }; Q_ENUM(Type) Q_DECLARE_FLAGS(Types, Type) Q_FLAG(Types) /** * Creates a new device object. * * @param path UNI of the device */ explicit Device(const QString &path, QObject *parent = nullptr); Device(DevicePrivate &dd, QObject *parent); /** * Destroys a device object. */ virtual ~Device(); /** * Retrieves the interface type. This is a virtual function that will return the * proper type of all sub-classes. * * @returns the NetworkManager::Device::Type that corresponds to this device. */ virtual Type type() const; /** * Retrieves the Unique Network Identifier (UNI) of the device. * This identifier is unique for each network and network interface in the system. * * @returns the Unique Network Identifier of the current device */ QString uni() const; /** * The current active connection for this device * * @returns A valid ActiveConnection object or NULL if no active connection was found */ NetworkManager::ActiveConnection::Ptr activeConnection() const; /** * Returns available connections for this device * * @returns List of availables connection */ Connection::List availableConnections(); /** * The system name for the network device */ QString interfaceName() const; /** * The name of the device's data interface when available. This property * may not refer to the actual data interface until the device has * successfully established a data connection, indicated by the device's * state() becoming ACTIVATED. */ QString ipInterfaceName() const; /** * Handle for the system driver controlling this network interface */ QString driver() const; /** * The driver version. */ QString driverVersion() const; /** * The firmware version. */ QString firmwareVersion() const; /** * Disconnects a device and prevents the device from automatically * activating further connections without user intervention. */ QDBusPendingReply<> disconnectInterface(); /** * Deletes a software device from NetworkManager and removes the interface from the system. * The method returns an error when called for a hardware device. * * @since 5.8.0 * - * @note this is a noop in runtime NM < 1.0.0 */ QDBusPendingReply<> deleteInterface(); /** * returns the current IPv4 address without the prefix * \sa ipV4Config() * \sa ipV6Config() * @deprecated */ QHostAddress ipV4Address() const; /** * Get the current IPv4 configuration of this device. * Only valid when device is Activated. */ IpConfig ipV4Config() const; /** * Get the current IPv6 configuration of this device. * Only valid when device is Activated. */ IpConfig ipV6Config() const; /** * Get the DHCP options returned by the DHCP server * or a null pointer if the device is not Activated or does not * use DHCP configuration. */ Dhcp4Config::Ptr dhcp4Config() const; /** * Get the DHCP options returned by the DHCP server * or a null pointer if the device is not Activated or does not * use DHCP configuration. */ Dhcp6Config::Ptr dhcp6Config() const; /** * Retrieves the activation status of this network interface. * * @return true if this network interface is active, false otherwise */ bool isActive() const; /** * Retrieves the device is valid. * * @return true if this device interface is valid, false otherwise */ bool isValid() const; /** * Retrieves the current state of the device. * This is a high level view of the device. It is user oriented, so * actually it provides state coming from different layers. * * @return the current connection state * @see Device::State */ State state() const; /** * Retrieves the maximum speed as reported by the device. * Note that this is only a design related piece of information, and that * the device might not reach this maximum. * * @return the device's maximum speed */ int designSpeed() const; /** * Retrieves the capabilities supported by this device. * * @return the capabilities of the device */ Capabilities capabilities() const; QVariant capabilitiesV() const; /** * Is the device currently being managed by NetworkManager? */ bool managed() const; /** * Is the firmware needed by the device missing? */ bool firmwareMissing() const; /** * If the device is allowed to autoconnect. */ bool autoconnect() const; /** * The current state and reason for changing to that state. */ DeviceStateReason stateReason() const; /** * Retrieves the Unique Device Identifier (UDI) of the device. * This identifier is unique for each device in the system. */ QString udi() const; /** * @return If non-empty, an (opaque) indicator of the physical network * port associated with the device. This can be used to recognize * when two seemingly-separate hardware devices are actually just * different virtual interfaces to the same physical port. * * @since 0.9.9.0 */ QString physicalPortId() const; /** * The device MTU (maximum transmission unit) * @since 0.9.9.0 * - * @note always returns 0 in runtime NM < 1.0.6 */ uint mtu() const; /** * @return If TRUE, indicates the NetworkManager plugin for the device is likely * missing or misconfigured. * @since 5.14.0 - * @note always returns false in runtime NM < 1.2.0 */ bool nmPluginMissing() const; /** * @return Whether the amount of traffic flowing through the device is * subject to limitations, for example set by service providers. * @since 5.14.0 - * @note always returns UnknownStatus in runtime NM < 1.0.6 */ MeteredStatus metered() const; /** * If true, indicates the device is allowed to autoconnect. * If false, manual intervention is required before the device * will automatically connect to a known network, such as activating * a connection using the device, or setting this property to @p true. */ void setAutoconnect(bool autoconnect); /** * Returns Device Statistics interface - * @note always returns empty pointer in runtime NM < 1.4.0 */ DeviceStatistics::Ptr deviceStatistics() const; /** * Retrieves a specialized interface to interact with the device corresponding * to a given device interface. * * @returns a pointer to the device interface if it exists, @p 0 otherwise */ template DevIface *as() { return qobject_cast(this); } /** * Retrieves a specialized interface to interact with the device corresponding * to a given device interface. * * @returns a pointer to the device interface if it exists, 0 otherwise */ template const DevIface *as() const { return qobject_cast(this); } Q_SIGNALS: /** * This signal is emitted when the device's link status changed. * * @param newstate the new state of the connection * @param oldstate the previous state of the connection * @param reason the reason for the state change, if any. ReasonNone where the backend * provides no reason. * @see Device::State * @see Device::StateChangeReason */ void stateChanged(NetworkManager::Device::State newstate, NetworkManager::Device::State oldstate, NetworkManager::Device::StateChangeReason reason); /** * Emitted when the autoconnect of this network has changed. */ void activeConnectionChanged(); /** * Emitted when the autoconnect of this network has changed. */ void autoconnectChanged(); /** * Emitted when the list of avaiable connections of this network has changed. */ void availableConnectionChanged(); /** * Emitted when a new connection is available */ void availableConnectionAppeared(const QString &connection); /** * Emitted when the connection is no longer available */ void availableConnectionDisappeared(const QString &connection); /** * Emitted when the capabilities of this network has changed. */ void capabilitiesChanged(); /** * Emitted when the DHCP configuration for IPv4 of this network has changed. */ void dhcp4ConfigChanged(); /** * Emitted when the DHCP configuration for IPv6 of this network has changed. */ void dhcp6ConfigChanged(); /** * Emitted when the driver of this network has changed. */ void driverChanged(); /** * Emitted when the driver version of this network has changed. */ void driverVersionChanged(); /** * Emitted when the firmware missing state of this network has changed. */ void firmwareMissingChanged(); /** * Emitted when the firmware version of this network has changed. */ void firmwareVersionChanged(); /** * Emitted when the interface name of this network has changed. */ void interfaceNameChanged(); /** * Emitted when the IPv4 address of this network has changed. */ void ipV4AddressChanged(); /** * Emitted when the IPv4 configuration of this network has changed. */ void ipV4ConfigChanged(); /** * Emitted when the IPv6 configuration of this network has changed. */ void ipV6ConfigChanged(); /** * Emitted when the ip interface name of this network has changed. */ void ipInterfaceChanged(); /** * Emitted when the managed state of this network has changed. */ void managedChanged(); /** * Emitted when the physical port ID changes. * @see physicalPortId() * @since 0.9.9.0 */ void physicalPortIdChanged(); /** * Emitted when the maximum transmission unit has changed * @since 0.9.9.0 */ void mtuChanged(); /** * Emitted when NmPluginMissing property has changed * @since 5.14.0 * @see nmPluginMissing - * @note never Emitted in runtime NM < 1.2.0 */ void nmPluginMissingChanged(bool nmPluginMissing); /** * Emitted when metered property has changed * @since 5.14.0 * @see metered - * @note never Emitted in runtime NM < 1.0.6 */ void meteredChanged(MeteredStatus metered); /** * Emitted when the connection state of this network has changed. */ void connectionStateChanged(); /** * Emitted when the state reason of this network has changed. */ void stateReasonChanged(); /** * Emitted when the Unique Device Identifier of this device has changed. */ void udiChanged(); protected: DevicePrivate *const d_ptr; private: Q_DECLARE_PRIVATE(Device) }; Q_DECLARE_OPERATORS_FOR_FLAGS(Device::Capabilities) Q_DECLARE_OPERATORS_FOR_FLAGS(Device::Types) class NETWORKMANAGERQT_EXPORT DeviceStateReason { public: DeviceStateReason(Device::State state, Device::StateChangeReason reason); DeviceStateReason(const DeviceStateReason &); ~DeviceStateReason(); Device::State state() const; Device::StateChangeReason reason() const; DeviceStateReason &operator=(const DeviceStateReason &); private: Q_DECLARE_PRIVATE(DeviceStateReason) DeviceStateReasonPrivate *const d_ptr; }; } #endif diff --git a/src/dnsconfiguration.h b/src/dnsconfiguration.h index d826302..f0e813d 100644 --- a/src/dnsconfiguration.h +++ b/src/dnsconfiguration.h @@ -1,124 +1,120 @@ /* Copyright 2018 Aleksander Morgado This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_DNSCONFIGURATION_H #define NETWORKMANAGERQT_DNSCONFIGURATION_H #include #include "dnsdomain.h" // To prevent signals in glib2 be defined by QT #undef signals #include -#if NM_CHECK_VERSION(1, 0, 0) #include -#else -#include -#endif #define signals Q_SIGNALS #include #include namespace NetworkManager { /** * This class represents IP configuration */ class NETWORKMANAGERQT_EXPORT DnsConfiguration { public: /** * Constructs an initialized DnsConfiguration object */ DnsConfiguration(const QStringList &searches, const QStringList &options, const QList domains); /** * Constructs an empty DnsConfiguration object */ DnsConfiguration(); /** * Destroys this DnsConfiguration object. */ ~DnsConfiguration(); /** * Constructs a DnsConfiguration object that is a copy of the object @p other. */ DnsConfiguration(const DnsConfiguration &other); /** * Returns the list of search domains */ QStringList searches() const; /** * Sets the list of search domains */ void setSearches(const QStringList &list); /** * Returns the list of resolver options */ QStringList options() const; /** * Sets the list of resolver options */ void setOptions(const QStringList &list); /** * Returns the list of domains */ QList domains() const; /** * Sets the list of domains */ void setDomains(const QList &domains); /** * Marshall into a map */ QVariantMap toMap() const; /** * De-marshall from a map */ void fromMap (const QVariantMap &map); /** * Makes a copy of the DnsConfiguration object @p other. */ DnsConfiguration &operator=(const DnsConfiguration &other); private: class Private; Private *const d; }; } // namespace NetworkManager #endif // NETWORKMANAGERQT_DNSCONFIGURATION_H diff --git a/src/dnsdomain.h b/src/dnsdomain.h index 87bc569..6847fa0 100644 --- a/src/dnsdomain.h +++ b/src/dnsdomain.h @@ -1,115 +1,111 @@ /* Copyright 2018 Aleksander Morgado This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_DNSDOMAIN_H #define NETWORKMANAGERQT_DNSDOMAIN_H #include #include "ipaddress.h" #include "iproute.h" // To prevent signals in glib2 be defined by QT #undef signals #include -#if NM_CHECK_VERSION(1, 0, 0) #include -#else -#include -#endif #define signals Q_SIGNALS #include #include namespace NetworkManager { /** * This class represents the configuration for a DNS domain */ class NETWORKMANAGERQT_EXPORT DnsDomain { public: /** * Constructs a DnsDomain object with a list of */ DnsDomain(const QString &name, const QList &servers, const QStringList &options); /** * Constructs a DnsDomain object */ DnsDomain(); /** * Destroys this DnsDomain object. */ ~DnsDomain(); /** * Constructs a DnsDomain object that is a copy of the object @p other. */ DnsDomain(const DnsDomain &other); /** * Returns the domain name */ QString name() const; /** * Sets the domain name */ void setName(const QString &name); /** * Returns the list of servers */ QList servers() const; /** * Sets the list of servers */ void setServers(const QList &list); /** * Returns the list of resolver options */ QStringList options() const; /** * Sets the list of resolver options */ void setOptions(const QStringList &list); /** * Makes a copy of the DnsDomain object @p other. */ DnsDomain &operator=(const DnsDomain &other); private: class Private; Private *const d; }; } // namespace NetworkManager #endif // NETWORKMANAGERQT_DNSDOMAIN_H diff --git a/src/ipconfig.h b/src/ipconfig.h index de54ae2..83450cd 100644 --- a/src/ipconfig.h +++ b/src/ipconfig.h @@ -1,140 +1,139 @@ /* * Copyright 2008,2011 Will Stephenson * Copyright 2013 Daniel Nicoletti This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_IPCONFIG_H #define NETWORKMANAGERQT_IPCONFIG_H #include #include "ipaddress.h" #include "iproute.h" // To prevent signals in glib2 be defined by QT #undef signals #include #define signals Q_SIGNALS #include #include namespace NetworkManager { /** * This class represents IP configuration */ class NETWORKMANAGERQT_EXPORT IpConfig { public: /** * Constructs an IP config object with a list of @p addresses, @p nameservers, @p domains and @p routes. */ IpConfig(const IpAddresses &addresses, const QList &nameservers, const QStringList &domains, const IpRoutes &routes); /** * Constructs an empty IpConfig object. */ IpConfig(); /** * Destroys this IpConfig object. */ ~IpConfig(); /** * Constructs an IpConfig object that is a copy of the object @p other. */ IpConfig(const IpConfig &other); /** * Configure this class using the information on the following @p path */ void setIPv4Path(const QString &path); /** * Configure this class using the information on the following @p path */ void setIPv6Path(const QString &path); /** * Returns a list of IP addresses and gateway related to this configuration. * Use IpAddress::ip() to access the IP address and IpAddress::gateway() * to access the gateway address. */ NetworkManager::IpAddresses addresses() const; /** * Returns a list of domains related to this configuration. */ QStringList domains() const; /** * Returns the gateway in use * * @since 0.9.9.0 */ QString gateway() const; /** * Returns a list of nameservers related to this configuration. */ QList nameservers() const; /** * Returns a list of static routes (not the default gateway) related to this configuration. * Use @ref addresses() to retrieve the default gateway. */ IpRoutes routes() const; /** * Returns a list of DNS searches. * * @since 0.9.9.0 */ QStringList searches() const; /** * Returns a list of DNS options that modify the behaviour of the DNS resolver. * @since 5.14.0 - * @note always returns default constructed QStringList in runtime NM < 1.2.0 */ QStringList dnsOptions() const; /** * Makes a copy of the IpConfig object @p other. */ IpConfig &operator=(const IpConfig &other); /** * Returns false if the list of IP addresses is empty */ bool isValid() const; private: class Private; Private *const d; }; } // namespace NetworkManager #endif // NETWORKMANAGERQT_IPCONFIG_H diff --git a/src/manager.h b/src/manager.h index 3d87247..02afed1 100644 --- a/src/manager.h +++ b/src/manager.h @@ -1,455 +1,443 @@ /* Copyright 2008,2010,2011 Will Stephenson Copyright 2011-2013 Lamarque Souza Copyright 2013 Jan Grulich This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_NETWORKMANAGER_H #define NETWORKMANAGERQT_NETWORKMANAGER_H #include #include #include #include "device.h" #include "activeconnection.h" #include "dnsconfiguration.h" /** * This class allows querying the underlying system to discover the available * network interfaces and reachable networks. It has also the * responsibility to notify when a network interface appears or disappears. * * It is the unique entry point for network management. Applications should use * it to find network interfaces, or to be notified about network related changes. * * Note that it is implemented as a singleton */ namespace NetworkManager { Q_NAMESPACE enum Status { Unknown, /**< the networking system is not active or unable to report its status - proceed with caution */ Asleep, /**< networking is inactive and all devices are disabled */ Disconnected,/**< the system is not connected to any network */ Disconnecting, /**< the system is breaking the connection */ Connecting, /**< the system is not connected to any network */ ConnectedLinkLocal, /**< a network device is connected, but there is only link-local connectivity */ ConnectedSiteOnly, /**< a network device is connected, but there is only site-local connectivity */ Connected /**< the system is currently connected to a network */ }; enum LogLevel { Error, Warning, Info, Debug, Trace/**< = Debug in runtime NM < 0.9.10*/ }; -/** - * @note flags Agents, Settings, Bridge, DbusProps, Team, ConCheck, Dcb, Dispatch are not - * usabel in runtime NM < 0.9.10 - */ enum LogDomain {NoChange, None, Hardware, RFKill, Ethernet, WiFi, Bluetooth, MobileBroadBand, DHCP4, DHCP6, PPP, WiFiScan, IPv4, IPv6, AutoIPv4, DNS, VPN, Sharing, Supplicant, UserSet, SysSet, Suspend, Core, Devices, OLPC, Wimax/*TODO: mark it deprecated somehow?*/, Infiniband, Firewall, Adsl, Bond, Vlan , Agents, Settings, Bridge, DbusProps, Team, ConCheck, Dcb, Dispatch }; Q_DECLARE_FLAGS(LogDomains, LogDomain) Q_FLAGS(LogDomain) /** * Describes the network connectivity state. * @since 0.9.9.0 */ enum Connectivity { UnknownConnectivity = 0, /**< Network connectivity is unknown. */ NoConnectivity = 1, /**< The host is not connected to any network. */ Portal = 2, /**< The host is behind a captive portal and cannot reach the full Internet. */ Limited = 3, /**< The host is connected to a network, but does not appear to be able to reach the full Internet. */ Full = 4 /**< The host is connected to a network, and appears to be able to reach the full Internet. */ }; class NETWORKMANAGERQT_EXPORT Notifier : public QObject { Q_OBJECT Q_SIGNALS: /** * This signal is emitted when the system's connection state changes */ void statusChanged(NetworkManager::Status status); /** * This signal is emitted when a new network interface is available. * * @param uni the network interface identifier */ void deviceAdded(const QString &uni); /** * This signal is emitted when a network interface is not available anymore. * * @param uni the network interface identifier */ void deviceRemoved(const QString &uni); /** * This signal is emitted when the status of the wireless changed */ void wirelessEnabledChanged(bool); /** * This signal is emitted when the status of the wireless changed */ void wwanEnabledChanged(bool); /** * This signal is emitted when the status of the wimax changed * * @deprecated Wimax support was removed from NetworkManager 1.2 * (never emitted in runtime NM >= 1.2.0). */ void wimaxEnabledChanged(bool); /** * This signal is emitted when the status of the wireless changed */ void wirelessHardwareEnabledChanged(bool); /** * This signal is emitted when the status of the wireless changed */ void wwanHardwareEnabledChanged(bool); /** * This signal is emitted when the status of the wimax hardware changed * * @deprecated Wimax support was removed from NetworkManager 1.2 * (never emitted in runtime NM >= 1.2.0). */ void wimaxHardwareEnabledChanged(bool); /** * This signal is emitted when the status of overall networking changed */ void networkingEnabledChanged(bool); /** * This signal is emitted when a new connection was made active * * @param path the path of the new connection */ void activeConnectionAdded(const QString &path); /** * This signal is emitted when an active connection is no longer active * * @param path the path of the removed connection */ void activeConnectionRemoved(const QString &path); /** * This signal is emitted when the set of active connections changes */ void activeConnectionsChanged(); /** * This signal is emitted when the NetworkManager DBus service goes away */ void serviceDisappeared(); /** * This signal is emitted when the NetworkManager DBus service appears */ void serviceAppeared(); /** * Emitted when the global connectivity changes. * @since 0.9.9.0 */ void connectivityChanged(NetworkManager::Connectivity connectivity); /** * Emitted when the primary connection changes. * @param uni path of the new primary connection * @since 0.9.9.0 */ void primaryConnectionChanged(const QString &uni); /** * Emitted when the activating connection changes. * @param uni path of the new activating connection * @since 0.9.9.0 */ void activatingConnectionChanged(const QString &uni); /** * Emitted when the primary connection type changes. * @param connection type of the new primary connection * @since 5.8.0 - * @note never emitted in runtime NM < 1.0.0 */ void primaryConnectionTypeChanged(NetworkManager::ConnectionSettings::ConnectionType type); /** * Emitted when NM has started/finished its startup sequence * @since 0.9.9.0 - * @note never emitted in runtime NM < 0.9.10 */ void isStartingUpChanged(); /** * Emitted when metered property has changed * @since 5.14.0 * @see metered - * @note never emitted in runtime NM < 1.0.6 */ void meteredChanged(NetworkManager::Device::MeteredStatus metered); /** * Emitted when the global DNS configuration has changed * @since 5.45.0 * @see globalDnsConfiguration - * @note never emitted in runtime NM < 1.2.0 */ void globalDnsConfigurationChanged(const NetworkManager::DnsConfiguration &configuration); }; /** * Get the NetworkManager version */ NETWORKMANAGERQT_EXPORT QString version(); /** * Compares NetworkManager's version to the parameter version. * returns 1, -1 or 0 if NetworkManager's version is greater, less or equal to parameter. */ NETWORKMANAGERQT_EXPORT int compareVersion(const QString &version); /** * Compares NetworkManager version to x.y.z. * returns 1, -1 or 0 if NetworkManager's version is greater, less or equal to x.y.z. */ NETWORKMANAGERQT_EXPORT int compareVersion(const int x, const int y, const int z); /** * Checks if NetworkManager version is at least x.y.z * @return true if NetworkManager's version is greater or equal, false otherwise **/ NETWORKMANAGERQT_EXPORT bool checkVersion(const int x, const int y, const int z); /** * Get the manager connection state */ NETWORKMANAGERQT_EXPORT NetworkManager::Status status(); /** * Retrieves the list of all the network interfaces in the system. * It includes both hardware and virtual devices. * * @return the list of network interfaces available in this system */ NETWORKMANAGERQT_EXPORT Device::List networkInterfaces(); /** * Find a new NetworkInterface object given its UNI. This pointer is owned by the Solid * infrastructure. * * @param uni the identifier of the network interface to find * @return a valid NetworkInterface object if there's a device having the given UNI, an invalid one otherwise */ NETWORKMANAGERQT_EXPORT Device::Ptr findNetworkInterface(const QString &uni); /** * Return the network device referenced by its IP interface name. * This is not system independent so programs that will use this method will not be portable. */ NETWORKMANAGERQT_EXPORT Device::Ptr findDeviceByIpFace(const QString &iface); /** * Retrieves the status of networking (as a whole) in the system. * This is distinct from whether the system's networking is online or offline. * To check that, see @ref status(). * * @return true if this networking is enabled, false otherwise */ NETWORKMANAGERQT_EXPORT bool isNetworkingEnabled(); /** * Retrieves the activation status of wireless networking in the system. * * @return true if this wireless networking is enabled, false otherwise */ NETWORKMANAGERQT_EXPORT bool isWirelessEnabled(); /** * Retrieves the status of wireless hardware in the system. This is typically * controlled by a physical switch so there is no way to set this in software. * * @return true if this wireless networking is enabled, false otherwise */ NETWORKMANAGERQT_EXPORT bool isWirelessHardwareEnabled(); /** * Retrieves the status of wireless broadband (Wireless WAN) in the system. * * @return true if this type of wireless networking is enabled, false otherwise */ NETWORKMANAGERQT_EXPORT bool isWwanEnabled(); /** * Retrieves the status of wireless broadband (Wireless WAN) hardware in the system. This is typically * controlled by a physical switch so there is no way to set this in software. * * @return true if this broddband hardware is enabled, false otherwise */ NETWORKMANAGERQT_EXPORT bool isWwanHardwareEnabled(); /** * Retrieves the activation status of wimax networking in the system. * * @return true if this wimax networking is enabled, false otherwise * * @deprecated Wimax support was removed from NetworkManager 1.2 * (always returns false in runtime NM >= 1.2.0). */ NETWORKMANAGERQT_EXPORT bool isWimaxEnabled(); /** * Retrieves the status of wimax hardware in the system. This is typically * controlled by a physical switch so there is no way to set this in software. * * @return true if wimax HW networking is enabled, false otherwise * * @deprecated Wimax support was removed from NetworkManager 1.2 * (always returns false in runtime NM >= 1.2.0). */ NETWORKMANAGERQT_EXPORT bool isWimaxHardwareEnabled(); /** * Activate a connection using the supplied device. * * @param connectionUni unique identifier for the connection to be activated * @param interfaceUni unique identifier of the network interface to be activated * @param connectionParameter can be used to specify extra parameters not specific to the NetworkInterface or the connection, eg which AP to use when several present with same ESSID in range (because ESSID does not guarantee that the AP is part of the network you want to join!) */ NETWORKMANAGERQT_EXPORT QDBusPendingReply activateConnection(const QString &connectionUni, const QString &interfaceUni, const QString &connectionParameter); /** * Adds a new connection using the given details (if any) as a template (automatically filling in missing settings with the capabilities of the given device and specific object), then activate the new connection. * Cannot be used for VPN connections at this time. * * @param connection connection definition to be added and activated * @param interfaceUni unique identifier of the network interface to be activated * @param connectionParameter can be used to specify extra parameters not specific to the NetworkInterface or the connection, eg which AP to use when several present with same ESSID in range (because ESSID does not guarantee that the AP is part of the network you want to join!) */ NETWORKMANAGERQT_EXPORT QDBusPendingReply addAndActivateConnection(const NMVariantMapMap &connection, const QString &interfaceUni, const QString &connectionParameter); /** * Deactivate this network interface, if active * * @param activeConnection identifier of the connection to deactivate */ NETWORKMANAGERQT_EXPORT QDBusPendingReply<> deactivateConnection(const QString &activeConnection); /** * Access the list of any active connections * * @return a list of valid ActiveConnection objects */ NETWORKMANAGERQT_EXPORT ActiveConnection::List activeConnections(); /** * Access the list of any active connections paths * * @return a list of valid ActiveConnection paths */ NETWORKMANAGERQT_EXPORT QStringList activeConnectionsPaths(); /** * Get current logging verbosity level and operations domains */ NETWORKMANAGERQT_EXPORT QDBusPendingReply getLogging(); /** * @return the network connectivity state * @since 0.9.9.0 */ NETWORKMANAGERQT_EXPORT Connectivity connectivity(); /** * Re-check the network connectivity state. * @see connectivity() * @since 0.9.9.0 */ NETWORKMANAGERQT_EXPORT QDBusPendingReply checkConnectivity(); /** * @return the "primary" active connection being used * to access the network. In particular, if there is no VPN * active, or the VPN does not have the default route, then this * indicates the connection that has the default route. If there * is a VPN active with the default route, then this indicates * the connection that contains the route to the VPN endpoint. * @since 0.9.9.0 */ NETWORKMANAGERQT_EXPORT ActiveConnection::Ptr primaryConnection(); /** * @return an active connection that is currently * being activated and which is expected to become the new * primaryConnection() when it finishes activating. * @since 0.9.9.0 */ NETWORKMANAGERQT_EXPORT ActiveConnection::Ptr activatingConnection(); /** * @return The connection type of the "primary" active connection being * used to access the network. This is the same as the Type * property on the object indicated by PrimaryConnection. * @since 5.8.0 - * @note always returns NetworkManager::ConnectionSettings::Unknown in runtime NM < 1.0.0 */ NETWORKMANAGERQT_EXPORT NetworkManager::ConnectionSettings::ConnectionType primaryConnectionType(); /** * Indicates whether NM is still starting up; this becomes @p false * when NM has finished attempting to activate every connection * that it might be able to activate at startup. * @since 0.9.9.0 - * @note always returns false in runtime NM < 0.9.10 */ NETWORKMANAGERQT_EXPORT bool isStartingUp(); /** * @return Indicates whether the connectivity is metered. * @since 5.14.0 - * @note always returns NetworkManager::Device::UnknownStatus in runtime NM < 1.0.6 */ NETWORKMANAGERQT_EXPORT NetworkManager::Device::MeteredStatus metered(); /** * @return Gets the global DNS configuration. * @since 5.45.0 - * @note always returns an empty configuration in runtime NM < 1.2.0 */ NETWORKMANAGERQT_EXPORT NetworkManager::DnsConfiguration globalDnsConfiguration(); /** * @return Sets the global DNS configuration. * @since 5.45.0 */ NETWORKMANAGERQT_EXPORT void setGlobalDnsConfiguration(const NetworkManager::DnsConfiguration &configuration); /** * Find an ActiveConnection object for an active connection id * * @param uni the id of the ActiveConnection * @return a valid ActiveConnection object */ NETWORKMANAGERQT_EXPORT ActiveConnection::Ptr findActiveConnection(const QString &uni); /** * Retrieves the interface types supported by this network manager. * * @return the interface types supported by the network manager */ NETWORKMANAGERQT_EXPORT Device::Types supportedInterfaceTypes(); NETWORKMANAGERQT_EXPORT void setNetworkingEnabled(bool enabled); // implemented in Notifier NETWORKMANAGERQT_EXPORT void setWirelessEnabled(bool enabled); NETWORKMANAGERQT_EXPORT void setWwanEnabled(bool enabled); /** * @deprecated Wimax support was removed from NetworkManager 1.2 * (it is a noop in runtime NM >= 1.2.0). */ NETWORKMANAGERQT_EXPORT void setWimaxEnabled(bool enabled); NETWORKMANAGERQT_EXPORT void sleep(bool sleep); NETWORKMANAGERQT_EXPORT void setLogging(LogLevel, LogDomains); NETWORKMANAGERQT_EXPORT NMStringMap permissions(); NETWORKMANAGERQT_EXPORT Notifier *notifier(); } #endif diff --git a/src/teamdevice.h b/src/teamdevice.h index d755a16..98f6af6 100644 --- a/src/teamdevice.h +++ b/src/teamdevice.h @@ -1,99 +1,97 @@ /* Copyright 2013 Lukáš Tinkl This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_TEAM_DEVICE_H #define NETWORKMANAGERQT_TEAM_DEVICE_H #include "device.h" #include namespace NetworkManager { class TeamDevicePrivate; /** * A team device interface */ class NETWORKMANAGERQT_EXPORT TeamDevice : public Device { Q_OBJECT Q_PROPERTY(bool carrier READ carrier NOTIFY carrierChanged) Q_PROPERTY(QString hwAddress READ hwAddress NOTIFY hwAddressChanged) Q_PROPERTY(QStringList slaves READ slaves NOTIFY slavesChanged) Q_PROPERTY(QString config READ config NOTIFY configChanged) public: typedef QSharedPointer Ptr; typedef QList List; explicit TeamDevice(const QString &path, QObject *parent = nullptr); ~TeamDevice() override; Type type() const override; /** * Indicates whether the physical carrier is found */ bool carrier() const; /** * Hardware address of the device */ QString hwAddress() const; /** * Devices which are currently slaved to this device */ QStringList slaves() const; /** * The JSON configuration currently applied on the device. - * @note always returns empty configuration in runtime NM < 1.4.0 */ QString config() const; Q_SIGNALS: /** * Emitted when the carrier of this device has changed */ void carrierChanged(bool plugged); /** * Emitted when the hardware address of this device has changed */ void hwAddressChanged(const QString &address); /** * Emitted when the list of devices slaved to this device has changed */ void slavesChanged(const QStringList &slaves); /** * Emitted when the JSON confugration which is currently applied has changed - * @note never emitted in runtime NM < 1.4.0 */ void configChanged(const QString &config); private: Q_DECLARE_PRIVATE(TeamDevice) }; } #endif diff --git a/src/tundevice.h b/src/tundevice.h index bfe0220..474bb7a 100644 --- a/src/tundevice.h +++ b/src/tundevice.h @@ -1,122 +1,120 @@ /* Copyright 2013 Lukáš Tinkl Copyright 2014 Jan Grulich This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_TUN_DEVICE_H #define NETWORKMANAGERQT_TUN_DEVICE_H #include "device.h" #include namespace NetworkManager { class TunDevicePrivate; /** * A tun device interface */ class NETWORKMANAGERQT_EXPORT TunDevice : public Device { Q_OBJECT Q_PROPERTY(qlonglong owner READ owner NOTIFY ownerChanged) Q_PROPERTY(qlonglong group READ group NOTIFY groupChanged) Q_PROPERTY(QString mode READ mode NOTIFY modeChanged) Q_PROPERTY(bool multiQueue READ multiQueue NOTIFY multiQueueChanged) Q_PROPERTY(bool noPi READ noPi NOTIFY noPiChanged) Q_PROPERTY(bool vnetHdr READ vnetHdr NOTIFY vnetHdrChanged) Q_PROPERTY(QString hwAddress READ hwAddress NOTIFY hwAddressChanged) public: typedef QSharedPointer Ptr; typedef QList List; explicit TunDevice(const QString &path, QObject *parent = nullptr); ~TunDevice() override; Type type() const override; /** * The uid of the tunnel owner, or -1 if it has no owner. */ qlonglong owner() const; /** * The gid of the tunnel group, or -1 if it has no owner. */ qlonglong group() const; /** * The tunnel mode, either "tun" or "tap". */ QString mode() const; /** * The tunnel's "TUN_TAP_MQ" flag; true if callers can connect to the tap device multiple times, for multiple send/receive queues. */ bool multiQueue() const; /** * The tunnel's "TUN_NO_PI" flag; true if no protocol info is prepended to the tunnel packets. */ bool noPi() const; /** * The tunnel's "TUN_VNET_HDR" flag; true if the tunnel packets include a virtio network header. */ bool vnetHdr() const; /** * Hardware address of the device. - * @note returns empty address in runtime NM < 1.2.0 */ QString hwAddress() const; Q_SIGNALS: /** * Emitted when the uid of the tunnel owner has changed */ void ownerChanged(qlonglong owner); /** * Emitted when the gid of the tunnel group has changed */ void groupChanged(qlonglong group); /** * Emitted when the tunnel mode has changed */ void modeChanged(const QString &mode); /** * Emitted when the tunnel's "TUN_TAP_MQ" flag has changed */ void multiQueueChanged(bool multiQueue); /** * Emitted when the tunnel's "TUN_NO_PI" flag has changed */ void noPiChanged(bool noPi); /** * Emitted when the tunnel's "TUN_VNET_HDR" flag has changed */ void vnetHdrChanged(bool vnetHdr); /** * Emitted when the hardware address of the device has changed - * @note never emitted in runtime NM < 1.2.0 */ void hwAddressChanged(const QString &hwAddress); private: Q_DECLARE_PRIVATE(TunDevice) }; } #endif diff --git a/src/vlandevice.h b/src/vlandevice.h index 8720dc7..a089fd5 100644 --- a/src/vlandevice.h +++ b/src/vlandevice.h @@ -1,96 +1,94 @@ /* Copyright 2013 Jan Grulich This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_VLAN_DEVICE_H #define NETWORKMANAGERQT_VLAN_DEVICE_H #include "device.h" #include namespace NetworkManager { class VlanDevicePrivate; /** * A vlan device interface */ class NETWORKMANAGERQT_EXPORT VlanDevice : public Device { Q_OBJECT Q_PROPERTY(bool carrier READ carrier NOTIFY carrierChanged) Q_PROPERTY(QString hwAddress READ hwAddress NOTIFY hwAddressChanged) Q_PROPERTY(uint vlanId READ vlanId NOTIFY vlanIdChanged) Q_PROPERTY(NetworkManager::Device::Ptr parent READ parent NOTIFY parentChanged) public: typedef QSharedPointer Ptr; typedef QList List; explicit VlanDevice(const QString &path, QObject *parent = nullptr); ~VlanDevice() override; Type type() const override; /** * Indicates whether the physical carrier is found */ bool carrier() const; /** * Hardware address of the device */ QString hwAddress() const; /** * The parent device of this VLAN device * @since 5.8.0 - * @note always returns nullptr in runtime NM < 1.0.0 */ NetworkManager::Device::Ptr parent() const; /** * The VLAN ID of this VLAN interface */ uint vlanId() const; Q_SIGNALS: /** * Emitted when the carrier of this device has changed */ void carrierChanged(bool plugged); /** * Emitted when the hardware address of this device has changed */ void hwAddressChanged(const QString &address); /** * Emitted when the parent device of this device has changed - * @note never emitted in runtime NM < 1.0.0 */ void parentChanged(const QString &path); /** * Emitted when the VLAN ID of this device has changed */ void vlanIdChanged(uint id); private: Q_DECLARE_PRIVATE(VlanDevice) }; } #endif diff --git a/src/wireddevice.h b/src/wireddevice.h index 3ec6872..c21bb13 100644 --- a/src/wireddevice.h +++ b/src/wireddevice.h @@ -1,108 +1,106 @@ /* Copyright 2008,2011 Will Stephenson Copyright 2011-2013 Lamarque V. Souza Copyright 2013 Jan Grulich This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NETWORKMANAGERQT_WIREDDEVICE_H #define NETWORKMANAGERQT_WIREDDEVICE_H #include #include "device.h" namespace NetworkManager { class WiredDevicePrivate; /** * A wired device interface */ class NETWORKMANAGERQT_EXPORT WiredDevice : public Device { Q_OBJECT Q_PROPERTY(QString hardwareAddress READ hardwareAddress) Q_PROPERTY(QString permanentHardwareAddress READ permanentHardwareAddress) Q_PROPERTY(bool carrier READ carrier NOTIFY carrierChanged) Q_PROPERTY(int bitRate READ bitRate NOTIFY bitRateChanged) Q_PROPERTY(QStringList s390SubChannels READ s390SubChannels NOTIFY s390SubChannelsChanged) public: typedef QSharedPointer Ptr; typedef QList List; explicit WiredDevice(const QString &path, QObject *parent = nullptr); ~WiredDevice() override; /** * Return the type */ Type type() const override; /** * Active hardware address of the device */ QString hardwareAddress() const; /** * Permanent hardware address of the device */ QString permanentHardwareAddress() const; /** * Design speed of the device, in megabits/second (Mb/s) */ int bitRate() const; /** * Indicates whether the physical carrier is found (e.g. whether a cable is plugged in or not) */ bool carrier() const; /** * Array of S/390 subchannels for S/390 or z/Architecture devices - * @note always returns empty array in runtime NM < 1.2.0 */ QStringList s390SubChannels() const; Q_SIGNALS: /** * Emitted when the design speed of the device has changed */ void bitRateChanged(int bitRate); /** * Emitted when the carrier of this device has changed */ void carrierChanged(bool plugged); /** * Emitted when the hardware address of this device has changed */ void hardwareAddressChanged(const QString &hwAddress); /** * Emitted when the permanent hardware address of this device has changed */ void permanentHardwareAddressChanged(const QString &permHwAddress); /* * Emitted when the array of s390SubChannels has changed - * @note never emitted in runtime NM < 1.2.0 */ void s390SubChannelsChanged(const QStringList &channels); private: Q_DECLARE_PRIVATE(WiredDevice) }; } #endif // NETWORKMANAGERQT_WIREDDEVICE_H