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};
33
34/**
35 * @return QHostAddress representation of an ipv6 address
36 * @param address byte array containing the binary representation of the address
37 */
38NETWORKMANAGERQT_EXPORT QHostAddress ipv6AddressAsHostAddress(const QByteArray &address);
39
40/**
41 * @return binary representation of an ipv6 address
42 * @param address qhostaddress containing the address
43 */
44NETWORKMANAGERQT_EXPORT QByteArray ipv6AddressFromHostAddress(const QHostAddress &address);
45
46/**
47 * @return String representation of a mac address.
48 * @param ba byte array containing the binary repesentation of the address
49 */
50NETWORKMANAGERQT_EXPORT QString macAddressAsString(const QByteArray &ba);
51
52/**
53 * @return binary repesentation of a mac address.
54 * @param s string representation of the address
55 */
56NETWORKMANAGERQT_EXPORT QByteArray macAddressFromString(const QString &s);
57
58NETWORKMANAGERQT_EXPORT bool macAddressIsValid(const QString &macAddress);
59NETWORKMANAGERQT_EXPORT bool macAddressIsValid(const QByteArray &macAddress);
60
61/**
62 * @param freq frequency of a wireless network
63 * @return The frequency channel.
64 */
65NETWORKMANAGERQT_EXPORT int findChannel(int freq);
66
67NETWORKMANAGERQT_EXPORT NetworkManager::WirelessSetting::FrequencyBand findFrequencyBand(int freq);
68
69NETWORKMANAGERQT_EXPORT bool
70deviceSupportsApCiphers(NetworkManager::WirelessDevice::Capabilities, NetworkManager::AccessPoint::WpaFlags ciphers, WirelessSecurityType type);
71
72NETWORKMANAGERQT_EXPORT bool securityIsValid(WirelessSecurityType type,
74 bool haveAp,
75 bool adHoc,
79
80NETWORKMANAGERQT_EXPORT WirelessSecurityType findBestWirelessSecurity(NetworkManager::WirelessDevice::Capabilities,
81 bool haveAp,
82 bool adHoc,
86
87NETWORKMANAGERQT_EXPORT bool wepKeyIsValid(const QString &key, NetworkManager::WirelessSecuritySetting::WepKeyType type);
88
89NETWORKMANAGERQT_EXPORT bool wpaPskIsValid(const QString &psk);
90
91NETWORKMANAGERQT_EXPORT WirelessSecurityType securityTypeFromConnectionSetting(const NetworkManager::ConnectionSettings::Ptr &settings);
92
93NETWORKMANAGERQT_EXPORT QList<QPair<int, int>> getBFreqs();
94NETWORKMANAGERQT_EXPORT QList<QPair<int, int>> getAFreqs();
95
96NETWORKMANAGERQT_EXPORT QDateTime clockBootTimeToDateTime(qlonglong clockBootime);
97}
98
99#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:78
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 Tue Mar 26 2024 11:13:24 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.