NetworkManagerQt

tundevice.h
1 /*
2  SPDX-FileCopyrightText: 2013 Lukáš Tinkl <[email protected]>
3  SPDX-FileCopyrightText: 2014 Jan Grulich <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7 
8 #ifndef NETWORKMANAGERQT_TUN_DEVICE_H
9 #define NETWORKMANAGERQT_TUN_DEVICE_H
10 
11 #include "device.h"
12 #include <networkmanagerqt/networkmanagerqt_export.h>
13 
14 namespace NetworkManager
15 {
16 class TunDevicePrivate;
17 
18 /**
19  * A tun device interface
20  */
21 class NETWORKMANAGERQT_EXPORT TunDevice : public Device
22 {
23  Q_OBJECT
24  Q_PROPERTY(qlonglong owner READ owner NOTIFY ownerChanged)
25  Q_PROPERTY(qlonglong group READ group NOTIFY groupChanged)
26  Q_PROPERTY(QString mode READ mode NOTIFY modeChanged)
27  Q_PROPERTY(bool multiQueue READ multiQueue NOTIFY multiQueueChanged)
28  Q_PROPERTY(bool noPi READ noPi NOTIFY noPiChanged)
29  Q_PROPERTY(bool vnetHdr READ vnetHdr NOTIFY vnetHdrChanged)
30  Q_PROPERTY(QString hwAddress READ hwAddress NOTIFY hwAddressChanged)
31 
32 public:
34  typedef QList<Ptr> List;
35  explicit TunDevice(const QString &path, QObject *parent = nullptr);
36  ~TunDevice() override;
37 
38  Type type() const override;
39 
40  /**
41  * The uid of the tunnel owner, or -1 if it has no owner.
42  */
43  qlonglong owner() const;
44  /**
45  * The gid of the tunnel group, or -1 if it has no owner.
46  */
47  qlonglong group() const;
48  /**
49  * The tunnel mode, either "tun" or "tap".
50  */
51  QString mode() const;
52  /**
53  * The tunnel's "TUN_TAP_MQ" flag; true if callers can connect to the tap device multiple times, for multiple send/receive queues.
54  */
55  bool multiQueue() const;
56  /**
57  * The tunnel's "TUN_NO_PI" flag; true if no protocol info is prepended to the tunnel packets.
58  */
59  bool noPi() const;
60  /**
61  * The tunnel's "TUN_VNET_HDR" flag; true if the tunnel packets include a virtio network header.
62  */
63  bool vnetHdr() const;
64  /**
65  * Hardware address of the device.
66  */
67  QString hwAddress() const;
68 
69 Q_SIGNALS:
70  /**
71  * Emitted when the uid of the tunnel owner has changed
72  */
73  void ownerChanged(qlonglong owner);
74  /**
75  * Emitted when the gid of the tunnel group has changed
76  */
77  void groupChanged(qlonglong group);
78  /**
79  * Emitted when the tunnel mode has changed
80  */
81  void modeChanged(const QString &mode);
82  /**
83  * Emitted when the tunnel's "TUN_TAP_MQ" flag has changed
84  */
85  void multiQueueChanged(bool multiQueue);
86  /**
87  * Emitted when the tunnel's "TUN_NO_PI" flag has changed
88  */
89  void noPiChanged(bool noPi);
90  /**
91  * Emitted when the tunnel's "TUN_VNET_HDR" flag has changed
92  */
93  void vnetHdrChanged(bool vnetHdr);
94  /**
95  * Emitted when the hardware address of the device has changed
96  */
97  void hwAddressChanged(const QString &hwAddress);
98 
99 private:
100  Q_DECLARE_PRIVATE(TunDevice)
101 };
102 
103 }
104 
105 #endif
This class represents a common device interface.
Definition: device.h:33
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition: accesspoint.h:20
A tun device interface.
Definition: tundevice.h:21
Type
Device type.
Definition: device.h:177
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Oct 3 2023 03:57:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.