NetworkManagerQt

utils.h
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_UTILS_H
8#define NETWORKMANAGERQT_UTILS_H
9
10#include <QHostAddress>
11#include <QPair>
12
13#include "wirelessdevice.h"
14#include "wirelesssecuritysetting.h"
15#include "wirelesssetting.h"
16#include <networkmanagerqt/networkmanagerqt_export.h>
17
18namespace NetworkManager
19{
20enum WirelessSecurityType {
21 UnknownSecurity = -1,
22 NoneSecurity,
23 StaticWep,
24 DynamicWep,
25 Leap,
26 WpaPsk,
27 WpaEap,
28 Wpa2Psk,
29 Wpa2Eap,
30 SAE,
31 Wpa3SuiteB192,
32 OWE,
33};
34
35/**
36 * @return QHostAddress representation of an ipv6 address
37 * @param address byte array containing the binary representation of the address
38 */
39NETWORKMANAGERQT_EXPORT QHostAddress ipv6AddressAsHostAddress(const QByteArray &address);
40
41/**
42 * @return binary representation of an ipv6 address
43 * @param address qhostaddress containing the address
44 */
45NETWORKMANAGERQT_EXPORT QByteArray ipv6AddressFromHostAddress(const QHostAddress &address);
46
47/**
48 * @return String representation of a mac address.
49 * @param ba byte array containing the binary repesentation of the address
50 */
51NETWORKMANAGERQT_EXPORT QString macAddressAsString(const QByteArray &ba);
52
53/**
54 * @return binary repesentation of a mac address.
55 * @param s string representation of the address
56 */
57NETWORKMANAGERQT_EXPORT QByteArray macAddressFromString(const QString &s);
58
59NETWORKMANAGERQT_EXPORT bool macAddressIsValid(const QString &macAddress);
60NETWORKMANAGERQT_EXPORT bool macAddressIsValid(const QByteArray &macAddress);
61
62/**
63 * @param freq frequency of a wireless network
64 * @return The frequency channel.
65 */
66NETWORKMANAGERQT_EXPORT int findChannel(int freq);
67
68NETWORKMANAGERQT_EXPORT NetworkManager::WirelessSetting::FrequencyBand findFrequencyBand(int freq);
69
70NETWORKMANAGERQT_EXPORT bool
71deviceSupportsApCiphers(NetworkManager::WirelessDevice::Capabilities, NetworkManager::AccessPoint::WpaFlags ciphers, WirelessSecurityType type);
72
73NETWORKMANAGERQT_EXPORT bool securityIsValid(WirelessSecurityType type,
75 bool haveAp,
76 bool adHoc,
80
81NETWORKMANAGERQT_EXPORT WirelessSecurityType findBestWirelessSecurity(NetworkManager::WirelessDevice::Capabilities,
82 bool haveAp,
83 bool adHoc,
87
88NETWORKMANAGERQT_EXPORT bool wepKeyIsValid(const QString &key, NetworkManager::WirelessSecuritySetting::WepKeyType type);
89
90NETWORKMANAGERQT_EXPORT bool wpaPskIsValid(const QString &psk);
91
92NETWORKMANAGERQT_EXPORT WirelessSecurityType securityTypeFromConnectionSetting(const NetworkManager::ConnectionSettings::Ptr &settings);
93
94NETWORKMANAGERQT_EXPORT QList<QPair<int, int>> getBFreqs();
95NETWORKMANAGERQT_EXPORT QList<QPair<int, int>> getAFreqs();
96
97NETWORKMANAGERQT_EXPORT QDateTime clockBootTimeToDateTime(qlonglong clockBootime);
98}
99
100#endif // NETWORKMANAGERQT_UTILS_H
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition accesspoint.h:21
NETWORKMANAGERQT_EXPORT int findChannel(int freq)
Definition utils.cpp:77
NETWORKMANAGERQT_EXPORT QByteArray ipv6AddressFromHostAddress(const QHostAddress &address)
Definition utils.cpp:26
NETWORKMANAGERQT_EXPORT QByteArray macAddressFromString(const QString &s)
Definition utils.cpp:50
NETWORKMANAGERQT_EXPORT QString macAddressAsString(const QByteArray &ba)
Definition utils.cpp:39
NETWORKMANAGERQT_EXPORT QHostAddress ipv6AddressAsHostAddress(const QByteArray &address)
Definition utils.cpp:13
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:19:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.