Add initial wifi medium code.

This commit is contained in:
Vibhav Pant
2023-08-16 02:00:09 +05:30
parent c8af59666d
commit 9b742d920a
13 changed files with 2027 additions and 0 deletions
@@ -0,0 +1,29 @@
#ifndef PLATFORM_IMPL_LINUX_DBUS_H_
#define PLATFORM_IMPL_LINUX_DBUS_H_
#include "internal/platform/logging.h"
#define DBUS_LOG_METHOD_CALL_ERROR(p, m, e) \
do { \
NEARBY_LOGS(ERROR) << __func__ << ": Got error '" << (e).getName() \
<< "' with message '" << (e).getMessage() \
<< "' while calling " << (m) << " on object " \
<< (p)->getObjectPath(); \
} while (false)
#define DBUS_LOG_PROPERTY_GET_ERROR(p, prop, e) \
do { \
NEARBY_LOGS(ERROR) << __func__ << ": Got error '" << (e).getName() \
<< "' with message '" << (e).getMessage() \
<< "' while getting property " << (prop) \
<< " on object " << (p)->getObjectPath(); \
} while (false)
#define DBUS_LOG_PROPERTY_SET_ERROR(p, prop, e) \
do { \
NEARBY_LOGS(ERROR) << __func__ << ": Got error '" << (e).getName() \
<< "' with message '" << (e).getMessage() \
<< "' while setting property " << (prop) \
<< " on object " << (p)->getObjectPath(); \
} while (false)
#endif
@@ -0,0 +1,87 @@
/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp__networkmanager_accesspoint_client_glue_h__proxy__H__
#define __sdbuscpp__networkmanager_accesspoint_client_glue_h__proxy__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace freedesktop {
namespace NetworkManager {
class AccessPoint_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.AccessPoint";
protected:
AccessPoint_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~AccessPoint_proxy() = default;
public:
uint32_t Flags()
{
return proxy_.getProperty("Flags").onInterface(INTERFACE_NAME);
}
uint32_t WpaFlags()
{
return proxy_.getProperty("WpaFlags").onInterface(INTERFACE_NAME);
}
uint32_t RsnFlags()
{
return proxy_.getProperty("RsnFlags").onInterface(INTERFACE_NAME);
}
std::vector<uint8_t> Ssid()
{
return proxy_.getProperty("Ssid").onInterface(INTERFACE_NAME);
}
uint32_t Frequency()
{
return proxy_.getProperty("Frequency").onInterface(INTERFACE_NAME);
}
std::string HwAddress()
{
return proxy_.getProperty("HwAddress").onInterface(INTERFACE_NAME);
}
uint32_t Mode()
{
return proxy_.getProperty("Mode").onInterface(INTERFACE_NAME);
}
uint32_t MaxBitrate()
{
return proxy_.getProperty("MaxBitrate").onInterface(INTERFACE_NAME);
}
uint8_t Strength()
{
return proxy_.getProperty("Strength").onInterface(INTERFACE_NAME);
}
int32_t LastSeen()
{
return proxy_.getProperty("LastSeen").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}}} // namespaces
#endif
@@ -0,0 +1,320 @@
/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp__networkmanager_client_glue_h__proxy__H__
#define __sdbuscpp__networkmanager_client_glue_h__proxy__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace freedesktop {
class NetworkManager_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager";
protected:
NetworkManager_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
proxy_.uponSignal("CheckPermissions").onInterface(INTERFACE_NAME).call([this](){ this->onCheckPermissions(); });
proxy_.uponSignal("StateChanged").onInterface(INTERFACE_NAME).call([this](const uint32_t& state){ this->onStateChanged(state); });
proxy_.uponSignal("DeviceAdded").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& device_path){ this->onDeviceAdded(device_path); });
proxy_.uponSignal("DeviceRemoved").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& device_path){ this->onDeviceRemoved(device_path); });
}
~NetworkManager_proxy() = default;
virtual void onCheckPermissions() = 0;
virtual void onStateChanged(const uint32_t& state) = 0;
virtual void onDeviceAdded(const sdbus::ObjectPath& device_path) = 0;
virtual void onDeviceRemoved(const sdbus::ObjectPath& device_path) = 0;
public:
void Reload(const uint32_t& flags)
{
proxy_.callMethod("Reload").onInterface(INTERFACE_NAME).withArguments(flags);
}
std::vector<sdbus::ObjectPath> GetDevices()
{
std::vector<sdbus::ObjectPath> result;
proxy_.callMethod("GetDevices").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
std::vector<sdbus::ObjectPath> GetAllDevices()
{
std::vector<sdbus::ObjectPath> result;
proxy_.callMethod("GetAllDevices").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
sdbus::ObjectPath GetDeviceByIpIface(const std::string& iface)
{
sdbus::ObjectPath result;
proxy_.callMethod("GetDeviceByIpIface").onInterface(INTERFACE_NAME).withArguments(iface).storeResultsTo(result);
return result;
}
sdbus::ObjectPath ActivateConnection(const sdbus::ObjectPath& connection, const sdbus::ObjectPath& device, const sdbus::ObjectPath& specific_object)
{
sdbus::ObjectPath result;
proxy_.callMethod("ActivateConnection").onInterface(INTERFACE_NAME).withArguments(connection, device, specific_object).storeResultsTo(result);
return result;
}
std::tuple<sdbus::ObjectPath, sdbus::ObjectPath> AddAndActivateConnection(const std::map<std::string, std::map<std::string, sdbus::Variant>>& connection, const sdbus::ObjectPath& device, const sdbus::ObjectPath& specific_object)
{
std::tuple<sdbus::ObjectPath, sdbus::ObjectPath> result;
proxy_.callMethod("AddAndActivateConnection").onInterface(INTERFACE_NAME).withArguments(connection, device, specific_object).storeResultsTo(result);
return result;
}
std::tuple<sdbus::ObjectPath, sdbus::ObjectPath, std::map<std::string, sdbus::Variant>> AddAndActivateConnection2(const std::map<std::string, std::map<std::string, sdbus::Variant>>& connection, const sdbus::ObjectPath& device, const sdbus::ObjectPath& specific_object, const std::map<std::string, sdbus::Variant>& options)
{
std::tuple<sdbus::ObjectPath, sdbus::ObjectPath, std::map<std::string, sdbus::Variant>> result;
proxy_.callMethod("AddAndActivateConnection2").onInterface(INTERFACE_NAME).withArguments(connection, device, specific_object, options).storeResultsTo(result);
return result;
}
void DeactivateConnection(const sdbus::ObjectPath& active_connection)
{
proxy_.callMethod("DeactivateConnection").onInterface(INTERFACE_NAME).withArguments(active_connection);
}
void Sleep(const bool& sleep)
{
proxy_.callMethod("Sleep").onInterface(INTERFACE_NAME).withArguments(sleep);
}
void Enable(const bool& enable)
{
proxy_.callMethod("Enable").onInterface(INTERFACE_NAME).withArguments(enable);
}
std::map<std::string, std::string> GetPermissions()
{
std::map<std::string, std::string> result;
proxy_.callMethod("GetPermissions").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
void SetLogging(const std::string& level, const std::string& domains)
{
proxy_.callMethod("SetLogging").onInterface(INTERFACE_NAME).withArguments(level, domains);
}
std::tuple<std::string, std::string> GetLogging()
{
std::tuple<std::string, std::string> result;
proxy_.callMethod("GetLogging").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
uint32_t CheckConnectivity()
{
uint32_t result;
proxy_.callMethod("CheckConnectivity").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
uint32_t state()
{
uint32_t result;
proxy_.callMethod("state").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
sdbus::ObjectPath CheckpointCreate(const std::vector<sdbus::ObjectPath>& devices, const uint32_t& rollback_timeout, const uint32_t& flags)
{
sdbus::ObjectPath result;
proxy_.callMethod("CheckpointCreate").onInterface(INTERFACE_NAME).withArguments(devices, rollback_timeout, flags).storeResultsTo(result);
return result;
}
void CheckpointDestroy(const sdbus::ObjectPath& checkpoint)
{
proxy_.callMethod("CheckpointDestroy").onInterface(INTERFACE_NAME).withArguments(checkpoint);
}
std::map<std::string, uint32_t> CheckpointRollback(const sdbus::ObjectPath& checkpoint)
{
std::map<std::string, uint32_t> result;
proxy_.callMethod("CheckpointRollback").onInterface(INTERFACE_NAME).withArguments(checkpoint).storeResultsTo(result);
return result;
}
void CheckpointAdjustRollbackTimeout(const sdbus::ObjectPath& checkpoint, const uint32_t& add_timeout)
{
proxy_.callMethod("CheckpointAdjustRollbackTimeout").onInterface(INTERFACE_NAME).withArguments(checkpoint, add_timeout);
}
public:
std::vector<sdbus::ObjectPath> Devices()
{
return proxy_.getProperty("Devices").onInterface(INTERFACE_NAME);
}
std::vector<sdbus::ObjectPath> AllDevices()
{
return proxy_.getProperty("AllDevices").onInterface(INTERFACE_NAME);
}
std::vector<sdbus::ObjectPath> Checkpoints()
{
return proxy_.getProperty("Checkpoints").onInterface(INTERFACE_NAME);
}
bool NetworkingEnabled()
{
return proxy_.getProperty("NetworkingEnabled").onInterface(INTERFACE_NAME);
}
bool WirelessEnabled()
{
return proxy_.getProperty("WirelessEnabled").onInterface(INTERFACE_NAME);
}
void WirelessEnabled(const bool& value)
{
proxy_.setProperty("WirelessEnabled").onInterface(INTERFACE_NAME).toValue(value);
}
bool WirelessHardwareEnabled()
{
return proxy_.getProperty("WirelessHardwareEnabled").onInterface(INTERFACE_NAME);
}
bool WwanEnabled()
{
return proxy_.getProperty("WwanEnabled").onInterface(INTERFACE_NAME);
}
void WwanEnabled(const bool& value)
{
proxy_.setProperty("WwanEnabled").onInterface(INTERFACE_NAME).toValue(value);
}
bool WwanHardwareEnabled()
{
return proxy_.getProperty("WwanHardwareEnabled").onInterface(INTERFACE_NAME);
}
bool WimaxEnabled()
{
return proxy_.getProperty("WimaxEnabled").onInterface(INTERFACE_NAME);
}
void WimaxEnabled(const bool& value)
{
proxy_.setProperty("WimaxEnabled").onInterface(INTERFACE_NAME).toValue(value);
}
bool WimaxHardwareEnabled()
{
return proxy_.getProperty("WimaxHardwareEnabled").onInterface(INTERFACE_NAME);
}
uint32_t RadioFlags()
{
return proxy_.getProperty("RadioFlags").onInterface(INTERFACE_NAME);
}
std::vector<sdbus::ObjectPath> ActiveConnections()
{
return proxy_.getProperty("ActiveConnections").onInterface(INTERFACE_NAME);
}
sdbus::ObjectPath PrimaryConnection()
{
return proxy_.getProperty("PrimaryConnection").onInterface(INTERFACE_NAME);
}
std::string PrimaryConnectionType()
{
return proxy_.getProperty("PrimaryConnectionType").onInterface(INTERFACE_NAME);
}
uint32_t Metered()
{
return proxy_.getProperty("Metered").onInterface(INTERFACE_NAME);
}
sdbus::ObjectPath ActivatingConnection()
{
return proxy_.getProperty("ActivatingConnection").onInterface(INTERFACE_NAME);
}
bool Startup()
{
return proxy_.getProperty("Startup").onInterface(INTERFACE_NAME);
}
std::string Version()
{
return proxy_.getProperty("Version").onInterface(INTERFACE_NAME);
}
std::vector<uint32_t> VersionInfo()
{
return proxy_.getProperty("VersionInfo").onInterface(INTERFACE_NAME);
}
std::vector<uint32_t> Capabilities()
{
return proxy_.getProperty("Capabilities").onInterface(INTERFACE_NAME);
}
uint32_t State()
{
return proxy_.getProperty("State").onInterface(INTERFACE_NAME);
}
uint32_t Connectivity()
{
return proxy_.getProperty("Connectivity").onInterface(INTERFACE_NAME);
}
bool ConnectivityCheckAvailable()
{
return proxy_.getProperty("ConnectivityCheckAvailable").onInterface(INTERFACE_NAME);
}
bool ConnectivityCheckEnabled()
{
return proxy_.getProperty("ConnectivityCheckEnabled").onInterface(INTERFACE_NAME);
}
void ConnectivityCheckEnabled(const bool& value)
{
proxy_.setProperty("ConnectivityCheckEnabled").onInterface(INTERFACE_NAME).toValue(value);
}
std::string ConnectivityCheckUri()
{
return proxy_.getProperty("ConnectivityCheckUri").onInterface(INTERFACE_NAME);
}
std::map<std::string, sdbus::Variant> GlobalDnsConfiguration()
{
return proxy_.getProperty("GlobalDnsConfiguration").onInterface(INTERFACE_NAME);
}
void GlobalDnsConfiguration(const std::map<std::string, sdbus::Variant>& value)
{
proxy_.setProperty("GlobalDnsConfiguration").onInterface(INTERFACE_NAME).toValue(value);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
#endif
@@ -0,0 +1,64 @@
/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp__networkmanager_device_wifip2p_client_glue_h__proxy__H__
#define __sdbuscpp__networkmanager_device_wifip2p_client_glue_h__proxy__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace freedesktop {
namespace NetworkManager {
namespace Device {
class WifiP2P_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.Device.WifiP2P";
protected:
WifiP2P_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
proxy_.uponSignal("PeerAdded").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& peer){ this->onPeerAdded(peer); });
proxy_.uponSignal("PeerRemoved").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& peer){ this->onPeerRemoved(peer); });
}
~WifiP2P_proxy() = default;
virtual void onPeerAdded(const sdbus::ObjectPath& peer) = 0;
virtual void onPeerRemoved(const sdbus::ObjectPath& peer) = 0;
public:
void StartFind(const std::map<std::string, sdbus::Variant>& options)
{
proxy_.callMethod("StartFind").onInterface(INTERFACE_NAME).withArguments(options);
}
void StopFind()
{
proxy_.callMethod("StopFind").onInterface(INTERFACE_NAME);
}
public:
std::string HwAddress()
{
return proxy_.getProperty("HwAddress").onInterface(INTERFACE_NAME);
}
std::vector<sdbus::ObjectPath> Peers()
{
return proxy_.getProperty("Peers").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}}}} // namespaces
#endif
@@ -0,0 +1,103 @@
/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp__networkmanager_device_wireless_client_glue_h__proxy__H__
#define __sdbuscpp__networkmanager_device_wireless_client_glue_h__proxy__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace freedesktop {
namespace NetworkManager {
namespace Device {
class Wireless_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.Device.Wireless";
protected:
Wireless_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
proxy_.uponSignal("AccessPointAdded").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& access_point){ this->onAccessPointAdded(access_point); });
proxy_.uponSignal("AccessPointRemoved").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& access_point){ this->onAccessPointRemoved(access_point); });
}
~Wireless_proxy() = default;
virtual void onAccessPointAdded(const sdbus::ObjectPath& access_point) = 0;
virtual void onAccessPointRemoved(const sdbus::ObjectPath& access_point) = 0;
public:
std::vector<sdbus::ObjectPath> GetAccessPoints()
{
std::vector<sdbus::ObjectPath> result;
proxy_.callMethod("GetAccessPoints").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
std::vector<sdbus::ObjectPath> GetAllAccessPoints()
{
std::vector<sdbus::ObjectPath> result;
proxy_.callMethod("GetAllAccessPoints").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
void RequestScan(const std::map<std::string, sdbus::Variant>& options)
{
proxy_.callMethod("RequestScan").onInterface(INTERFACE_NAME).withArguments(options);
}
public:
std::string HwAddress()
{
return proxy_.getProperty("HwAddress").onInterface(INTERFACE_NAME);
}
std::string PermHwAddress()
{
return proxy_.getProperty("PermHwAddress").onInterface(INTERFACE_NAME);
}
uint32_t Mode()
{
return proxy_.getProperty("Mode").onInterface(INTERFACE_NAME);
}
uint32_t Bitrate()
{
return proxy_.getProperty("Bitrate").onInterface(INTERFACE_NAME);
}
std::vector<sdbus::ObjectPath> AccessPoints()
{
return proxy_.getProperty("AccessPoints").onInterface(INTERFACE_NAME);
}
sdbus::ObjectPath ActiveAccessPoint()
{
return proxy_.getProperty("ActiveAccessPoint").onInterface(INTERFACE_NAME);
}
uint32_t WirelessCapabilities()
{
return proxy_.getProperty("WirelessCapabilities").onInterface(INTERFACE_NAME);
}
int64_t LastScan()
{
return proxy_.getProperty("LastScan").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}}}} // namespaces
#endif
@@ -0,0 +1,102 @@
/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp__networkmanager_ip4config_client_glue_h__proxy__H__
#define __sdbuscpp__networkmanager_ip4config_client_glue_h__proxy__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace freedesktop {
namespace NetworkManager {
class IP4Config_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.IP4Config";
protected:
IP4Config_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~IP4Config_proxy() = default;
public:
std::vector<std::vector<uint32_t>> Addresses()
{
return proxy_.getProperty("Addresses").onInterface(INTERFACE_NAME);
}
std::vector<std::map<std::string, sdbus::Variant>> AddressData()
{
return proxy_.getProperty("AddressData").onInterface(INTERFACE_NAME);
}
std::string Gateway()
{
return proxy_.getProperty("Gateway").onInterface(INTERFACE_NAME);
}
std::vector<std::vector<uint32_t>> Routes()
{
return proxy_.getProperty("Routes").onInterface(INTERFACE_NAME);
}
std::vector<std::map<std::string, sdbus::Variant>> RouteData()
{
return proxy_.getProperty("RouteData").onInterface(INTERFACE_NAME);
}
std::vector<uint32_t> Nameservers()
{
return proxy_.getProperty("Nameservers").onInterface(INTERFACE_NAME);
}
std::vector<std::map<std::string, sdbus::Variant>> NameserverData()
{
return proxy_.getProperty("NameserverData").onInterface(INTERFACE_NAME);
}
std::vector<std::string> Domains()
{
return proxy_.getProperty("Domains").onInterface(INTERFACE_NAME);
}
std::vector<std::string> Searches()
{
return proxy_.getProperty("Searches").onInterface(INTERFACE_NAME);
}
std::vector<std::string> DnsOptions()
{
return proxy_.getProperty("DnsOptions").onInterface(INTERFACE_NAME);
}
int32_t DnsPriority()
{
return proxy_.getProperty("DnsPriority").onInterface(INTERFACE_NAME);
}
std::vector<uint32_t> WinsServers()
{
return proxy_.getProperty("WinsServers").onInterface(INTERFACE_NAME);
}
std::vector<std::string> WinsServerData()
{
return proxy_.getProperty("WinsServerData").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}}} // namespaces
#endif
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<node name="/">
<!--
org.freedesktop.NetworkManager.AccessPoint:
@short_description: Wi-Fi Access Point.
-->
<interface name="org.freedesktop.NetworkManager.AccessPoint">
<!--
Flags:
Flags describing the capabilities of the access point.
Returns: <link linkend="NM80211ApFlags">NM80211ApFlags</link>
-->
<property name="Flags" type="u" access="read"/>
<!--
WpaFlags:
Flags describing the access point's capabilities according to WPA (Wifi
Protected Access).
Returns: <link linkend="NM80211ApSecurityFlags">NM80211ApSecurityFlags</link>
-->
<property name="WpaFlags" type="u" access="read"/>
<!--
RsnFlags:
Flags describing the access point's capabilities according to the RSN
(Robust Secure Network) protocol.
Returns: <link linkend="NM80211ApSecurityFlags">NM80211ApSecurityFlags</link>
-->
<property name="RsnFlags" type="u" access="read"/>
<!--
Ssid:
The Service Set Identifier identifying the access point.
-->
<property name="Ssid" type="ay" access="read">
<!-- gdbus-codegen assumes that "ay" means "non-UTF-8 string" and
won't deal with '\0' bytes correctly.
-->
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="1"/>
</property>
<!--
Frequency:
The radio channel frequency in use by the access point, in MHz.
-->
<property name="Frequency" type="u" access="read"/>
<!--
HwAddress:
The hardware address (BSSID) of the access point.
-->
<property name="HwAddress" type="s" access="read"/>
<!--
Mode:
Describes the operating mode of the access point.
Returns: <link linkend="NM80211Mode">NM80211Mode</link>
-->
<property name="Mode" type="u" access="read"/>
<!--
MaxBitrate:
The maximum bitrate this access point is capable of, in kilobits/second
(Kb/s).
-->
<property name="MaxBitrate" type="u" access="read"/>
<!--
Strength:
The current signal quality of the access point, in percent.
-->
<property name="Strength" type="y" access="read"/>
<!--
LastSeen:
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.
-->
<property name="LastSeen" type="i" access="read"/>
</interface>
</node>
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<node name="/">
<!--
org.freedesktop.NetworkManager.Device.WifiP2P:
@short_description: Wi-Fi P2P Device.
@since: 1.16
-->
<interface name="org.freedesktop.NetworkManager.Device.WifiP2P">
<annotation name="org.gtk.GDBus.C.Name" value="Device_Wifi_P2P"/>
<!--
HwAddress:
The active hardware address of the device.
DEPRECATED. Use the "HwAddress" property in "org.freedesktop.NetworkManager.Device" instead which exists since version NetworkManager 1.24.0.
-->
<property name="HwAddress" type="s" access="read"/>
<!--
Peers:
List of object paths of peers visible to this Wi-Fi P2P device.
-->
<property name="Peers" type="ao" access="read"/>
<!--
StartFind:
@options: Options of find.
Start a find operation for Wi-Fi P2P peers.
The %options argument accepts the following keys:
<variablelist>
<varlistentry>
<term><literal>i timeout</literal>:</term>
<listitem><para>Timeout value in the range of 1-600 seconds.</para>
<para>The default is 30 seconds.</para></listitem>
</varlistentry>
</variablelist>
-->
<method name="StartFind">
<arg name="options" type="a{sv}" direction="in"/>
</method>
<!--
StopFind:
Stop an ongoing find operation again.
-->
<method name="StopFind">
</method>
<!--
PeerAdded:
@peer: The object path of the newly found access point.
Emitted when a new Wi-Fi P2P peer is found by the device.
-->
<signal name="PeerAdded">
<arg name="peer" type="o"/>
</signal>
<!--
PeerRemoved:
@peer: The object path of the Wi-Fi P2P peer that has disappeared.
Emitted when a Wi-Fi P2P peer disappears from view of the device.
-->
<signal name="PeerRemoved">
<arg name="peer" type="o"/>
</signal>
</interface>
</node>
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<node name="/">
<!--
org.freedesktop.NetworkManager.Device.Wireless:
@short_description: Wi-Fi Device.
-->
<interface name="org.freedesktop.NetworkManager.Device.Wireless">
<annotation name="org.gtk.GDBus.C.Name" value="DeviceWifi"/>
<!--
GetAccessPoints:
@access_points: List of access point object paths.
DEPRECATED. Get the list of access points visible to this device. Note
that this list does not include access points which hide their SSID. To
retrieve a list of all access points (including hidden ones) use the
GetAllAccessPoints() method.
-->
<method name="GetAccessPoints">
<arg name="access_points" type="ao" direction="out"/>
</method>
<!--
GetAllAccessPoints:
@access_points: List of access point object paths.
Get the list of all access points visible to this device, including hidden
ones for which the SSID is not yet known.
-->
<method name="GetAllAccessPoints">
<arg name="access_points" type="ao" direction="out"/>
</method>
<!--
RequestScan:
@options: Options of scan. Currently, 'ssids' option with value of "aay" type is supported.
Request the device to scan. To know when the scan is finished, use the "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" to listen to changes to the "LastScan" property.
-->
<method name="RequestScan">
<arg name="options" type="a{sv}" direction="in"/>
</method>
<!--
HwAddress:
The active hardware address of the device.
DEPRECATED. Use the "HwAddress" property in "org.freedesktop.NetworkManager.Device" instead which exists since version NetworkManager 1.24.0.
-->
<property name="HwAddress" type="s" access="read"/>
<!--
PermHwAddress:
The permanent hardware address of the device.
-->
<property name="PermHwAddress" type="s" access="read"/>
<!--
Mode:
The operating mode of the wireless device.
Returns: <link linkend="NM80211Mode">NM80211Mode</link>
-->
<property name="Mode" type="u" access="read"/>
<!--
Bitrate:
The bit rate currently used by the wireless device, in kilobits/second
(Kb/s).
-->
<property name="Bitrate" type="u" access="read"/>
<!--
AccessPoints:
List of object paths of access point visible to this wireless device.
-->
<property name="AccessPoints" type="ao" access="read"/>
<!--
ActiveAccessPoint:
Object path of the access point currently used by the wireless device.
-->
<property name="ActiveAccessPoint" type="o" access="read"/>
<!--
WirelessCapabilities:
The capabilities of the wireless device.
Returns: <link linkend="NMDeviceWifiCapabilities">NMDeviceWifiCapabilities</link>
-->
<property name="WirelessCapabilities" type="u" access="read"/>
<!--
LastScan:
@since: 1.12
The timestamp (in CLOCK_BOOTTIME milliseconds) for the last finished network scan.
A value of -1 means the device never scanned for access points.
-->
<property name="LastScan" type="x" access="read"/>
<!--
AccessPointAdded:
@access_point: The object path of the newly found access point.
Emitted when a new access point is found by the device.
-->
<signal name="AccessPointAdded">
<arg name="access_point" type="o"/>
</signal>
<!--
AccessPointRemoved:
@access_point: The object path of the access point that has disappeared.
Emitted when an access point disappears from view of the device.
-->
<signal name="AccessPointRemoved">
<arg name="access_point" type="o"/>
</signal>
</interface>
</node>
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<node name="/">
<!--
org.freedesktop.NetworkManager.IP4Config:
@short_description: IPv4 Configuration Set.
-->
<interface name="org.freedesktop.NetworkManager.IP4Config">
<!--
Addresses:
Array of arrays of IPv4 address/prefix/gateway. All 3 elements of each
array are in network byte order. Essentially: [(addr, prefix, gateway),
(addr, prefix, gateway), ...] Deprecated: use AddressData and Gateway
-->
<property name="Addresses" type="aau" access="read"/>
<!--
AddressData:
Array of IP address data objects. All addresses will include "address" (an
IP address string), and "prefix" (a uint). Some addresses may include
additional attributes.
-->
<property name="AddressData" type="aa{sv}" access="read"/>
<!--
Gateway:
The gateway in use.
-->
<property name="Gateway" type="s" access="read"/>
<!--
Routes:
Arrays of IPv4 route/prefix/next-hop/metric. All 4 elements of each tuple
are in network byte order. 'route' and 'next hop' are IPv4 addresses,
while prefix and metric are simple unsigned integers. Essentially:
[(route, prefix, next-hop, metric), (route, prefix, next-hop, metric),
...] Deprecated: use RouteData
-->
<property name="Routes" type="aau" access="read"/>
<!--
RouteData:
Array of IP route data objects. All routes will include "dest" (an IP
address string) and "prefix" (a uint). Some routes may include "next-hop"
(an IP address string), "metric" (a uint), and additional attributes.
-->
<property name="RouteData" type="aa{sv}" access="read"/>
<!--
Nameservers:
The nameservers in use. Deprecated: use NameserverData
-->
<property name="Nameservers" type="au" access="read"/>
<!--
NameserverData:
@since: 1.14
The nameservers in use. Currently, only the value "address"
is recognized (with an IP address string).
-->
<property name="NameserverData" type="aa{sv}" access="read"/>
<!--
Domains:
A list of domains this address belongs to.
-->
<property name="Domains" type="as" access="read"/>
<!--
Searches:
A list of dns searches.
-->
<property name="Searches" type="as" access="read"/>
<!--
DnsOptions:
A list of DNS options that modify the behavior of the DNS resolver. See
resolv.conf(5) manual page for the list of supported options.
-->
<property name="DnsOptions" type="as" access="read"/>
<!--
DnsPriority:
The relative priority of DNS servers.
-->
<property name="DnsPriority" type="i" access="read"/>
<!--
WinsServers:
The Windows Internet Name Service servers associated with the connection.
Each address is in network byte order. Deprecated: use WinsServerData
-->
<property name="WinsServers" type="au" access="read"/>
<!--
WinsServerData:
@since: 1.14
The Windows Internet Name Service servers associated with the connection.
-->
<property name="WinsServerData" type="as" access="read"/>
</interface>
</node>
@@ -0,0 +1,598 @@
<?xml version="1.0" encoding="UTF-8"?>
<node name="/org/freedesktop/NetworkManager">
<!--
org.freedesktop.NetworkManager:
@short_description: Connection Manager.
-->
<interface name="org.freedesktop.NetworkManager">
<annotation name="org.gtk.GDBus.C.Name" value="Manager"/>
<!--
Reload:
@flags: Optional flags to specify which parts shall be reloaded.
Reload NetworkManager's configuration and perform certain updates, like flushing a cache or
rewriting external state to disk. This is similar to sending SIGHUP to NetworkManager but it
allows for more fine-grained control over what to reload (see @flags). It also allows
non-root access via PolicyKit and contrary to signals it is synchronous.
No flags (0x00) means to reload everything that is supported which is identical to
sending a SIGHUP.
(0x01) means to reload the NetworkManager.conf configuration from disk. Note that this
does not include connections, which can be reloaded via Setting's ReloadConnections.
(0x02) means to update DNS configuration, which usually involves writing /etc/resolv.conf
anew.
(0x04) means to restart the DNS plugin. This is for example useful when using
dnsmasq plugin, which uses additional configuration in /etc/NetworkManager/dnsmasq.d.
If you edit those files, you can restart the DNS plugin. This action shortly interrupts
name resolution.
Note that flags may affect each other. For example, restarting the DNS plugin (0x04)
implicitly updates DNS too (0x02). Or when reloading the configuration (0x01), changes
to DNS setting also cause a DNS update (0x02). However, (0x01) does not involve restarting
the DNS plugin (0x04) or update resolv.conf (0x02), unless the DNS related configuration
changes in NetworkManager.conf.
-->
<method name="Reload">
<arg name="flags" type="u" direction="in"/>
</method>
<!--
GetDevices:
@devices: List of object paths of network devices known to the system. This list does not include device placeholders (see GetAllDevices()).
Get the list of realized network devices.
-->
<method name="GetDevices">
<arg name="devices" type="ao" direction="out"/>
</method>
<!--
GetAllDevices:
@devices: List of object paths of network devices and device placeholders (eg, devices that do not yet exist but which can be automatically created by NetworkManager if one of their AvailableConnections was activated).
Get the list of all network devices.
-->
<method name="GetAllDevices">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_all_devices"/>
<arg name="devices" type="ao" direction="out"/>
</method>
<!--
GetDeviceByIpIface:
@iface: Interface name of the device to find.
@device: Object path of the network device.
Return the object path of the network device referenced by its IP
interface name. Note that some devices (usually modems) only have an IP
interface name when they are connected.
-->
<method name="GetDeviceByIpIface">
<arg name="iface" type="s" direction="in"/>
<arg name="device" type="o" direction="out"/>
</method>
<!--
ActivateConnection:
@connection: The connection to activate. If "/" is given, a valid device path must be given, and NetworkManager picks the best connection to activate for the given device. VPN connections must always pass a valid connection path.
@device: The object path of device to be activated for physical connections. This parameter is ignored for VPN connections, because the specific_object (if provided) specifies the device to use.
@specific_object: The path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of "/" should be used (ie, no specific object). For Wi-Fi connections, pass the object path of a specific AP from the card's scan list, or "/" to pick an AP automatically. For VPN connections, pass the object path of an ActiveConnection object that should serve as the "base" connection (to which the VPN connections lifetime will be tied), or pass "/" and NM will automatically use the current default device.
@active_connection: The path of the active connection object representing this active connection.
Activate a connection using the supplied device.
-->
<method name="ActivateConnection">
<arg name="connection" type="o" direction="in"/>
<arg name="device" type="o" direction="in"/>
<arg name="specific_object" type="o" direction="in"/>
<arg name="active_connection" type="o" direction="out"/>
</method>
<!--
AddAndActivateConnection:
@connection: Connection settings and properties; if incomplete missing settings will be automatically completed using the given device and specific object.
@device: The object path of device to be activated using the given connection.
@specific_object: The path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of "/" should be used (ie, no specific object). For Wi-Fi connections, pass the object path of a specific AP from the card's scan list, which will be used to complete the details of the newly added connection.
@path: Object path of the new connection that was just added.
@active_connection: The path of the active connection object representing this active connection.
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.
See also AddAndActivateConnection2.
-->
<method name="AddAndActivateConnection">
<arg name="connection" type="a{sa{sv}}" direction="in"/>
<arg name="device" type="o" direction="in"/>
<arg name="specific_object" type="o" direction="in"/>
<arg name="path" type="o" direction="out"/>
<arg name="active_connection" type="o" direction="out"/>
</method>
<!--
AddAndActivateConnection2:
@connection: Connection settings and properties; if incomplete missing settings will be automatically completed using the given device and specific object.
@device: The object path of device to be activated using the given connection.
@specific_object: The path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of "/" should be used (ie, no specific object). For Wi-Fi connections, pass the object path of a specific AP from the card's scan list, which will be used to complete the details of the newly added connection.
@options: Further options for the method call.
@path: Object path of the new connection that was just added.
@active_connection: The path of the active connection object representing this active connection.
@result: A dictionary of additional output arguments for future extension. Currently, not additional output arguments are supported.
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.
This method extends AddAndActivateConnection to allow passing further
parameters. At this time the following options are supported:
* persist: A string value of either "disk" (default), "memory" or "volatile". If "memory" is passed, the connection will not be saved to disk. If "volatile" is passed, the connection will not be saved to disk and will be destroyed when disconnected.
* bind-activation: Bind the activation lifetime. Set to "dbus-client" to automatically disconnect when the requesting process disappears from the bus. The default of "none" means the connection is kept activated normally.
-->
<method name="AddAndActivateConnection2">
<arg name="connection" type="a{sa{sv}}" direction="in"/>
<arg name="device" type="o" direction="in"/>
<arg name="specific_object" type="o" direction="in"/>
<arg name="options" type="a{sv}" direction="in"/>
<arg name="path" type="o" direction="out"/>
<arg name="active_connection" type="o" direction="out"/>
<arg name="result" type="a{sv}" direction="out"/>
</method>
<!--
DeactivateConnection:
@active_connection: The currently active connection to deactivate.
Deactivate an active connection.
-->
<method name="DeactivateConnection">
<arg name="active_connection" type="o" direction="in"/>
</method>
<!--
Sleep:
@sleep: Indicates whether the NetworkManager daemon should sleep or wake.
Control the NetworkManager daemon's sleep state. When asleep, all
interfaces that it manages are deactivated. When awake, devices are
available to be activated. This command should not be called directly by
users or clients; it is intended for system suspend/resume tracking.
-->
<method name="Sleep">
<arg name="sleep" type="b" direction="in"/>
</method>
<!--
Enable:
@enable: If FALSE, indicates that all networking should be disabled. If TRUE, indicates that NetworkManager should begin managing network devices.
Control whether overall networking is enabled or disabled. When disabled,
all interfaces that NM manages are deactivated. When enabled, all managed
interfaces are re-enabled and available to be activated. This command
should be used by clients that provide to users the ability to
enable/disable all networking.
-->
<method name="Enable">
<arg name="enable" type="b" direction="in"/>
</method>
<!--
GetPermissions:
@permissions: Dictionary of available permissions and results. Each permission is represented by a name (ie "org.freedesktop.NetworkManager.Foobar") and each result is one of the following values: "yes" (the permission is available), "auth" (the permission is available after a successful authentication), or "no" (the permission is denied). Clients may use these values in the UI to indicate the ability to perform certain operations.
Returns the permissions a caller has for various authenticated operations
that NetworkManager provides, like Enable/Disable networking, changing
Wi-Fi, WWAN, and WiMAX state, etc.
-->
<method name="GetPermissions">
<arg name="permissions" type="a{ss}" direction="out"/>
</method>
<!--
CheckPermissions:
Emitted when system authorization details change, indicating that clients
may wish to recheck permissions with GetPermissions.
-->
<signal name="CheckPermissions"/>
<!--
SetLogging:
@level: One of [ERR, WARN, INFO, DEBUG, TRACE, OFF, KEEP]. This level is applied to the domains as specified in the domains argument. Except for the special level "KEEP", all unmentioned domains are disabled entirely. "KEEP" is special and allows not to change the current setting except for the specified domains. E.g. level=KEEP and domains=PLATFORM:DEBUG will only touch the platform domain.
@domains: A combination of logging domains separated by commas (','), or "NONE" to disable logging. Each domain enables logging for operations related to that domain. Available domains are: [PLATFORM, RFKILL, ETHER, WIFI, BT, MB, DHCP4, DHCP6, PPP, WIFI_SCAN, IP4, IP6, AUTOIP4, DNS, VPN, SHARING, SUPPLICANT, AGENTS, SETTINGS, SUSPEND, CORE, DEVICE, OLPC, WIMAX, INFINIBAND, FIREWALL, ADSL, BOND, VLAN, BRIDGE, DBUS_PROPS, TEAM, CONCHECK, DCB, DISPATCH, AUDIT]. In addition to these domains, the following special domains can be used: [NONE, ALL, DEFAULT, DHCP, IP]. You can also specify that some domains should log at a different level from the default by appending a colon (':') and a log level (eg, 'WIFI:DEBUG'). If an empty string is given, the log level is changed but the current set of log domains remains unchanged.
Set logging verbosity and which operations are logged.
-->
<method name="SetLogging">
<arg name="level" type="s" direction="in"/>
<arg name="domains" type="s" direction="in"/>
</method>
<!--
GetLogging:
@level: One of [ERR, WARN, INFO, DEBUG, TRACE].
@domains: For available domains see SetLogging() call.
Get current logging verbosity level and operations domains.
-->
<method name="GetLogging">
<arg name="level" type="s" direction="out"/>
<arg name="domains" type="s" direction="out"/>
</method>
<!--
CheckConnectivity:
@connectivity: (<link linkend="NMConnectivityState">NMConnectivityState</link>) The current connectivity state.
Re-check the network connectivity state.
-->
<method name="CheckConnectivity">
<arg name="connectivity" type="u" direction="out"/>
</method>
<!--
state:
@state: <link linkend="NMState">NMState</link>
The overall networking state as determined by the NetworkManager daemon,
based on the state of network devices under its management.
-->
<method name="state">
<arg name="state" type="u" direction="out"/>
</method>
<!--
CheckpointCreate:
@devices: A list of device paths for which a checkpoint should be created. An empty list means all devices.
@rollback_timeout: The time in seconds until NetworkManager will automatically rollback to the checkpoint. Set to zero for infinite.
@flags: (<link linkend="NMCheckpointCreateFlags">NMCheckpointCreateFlags</link>) Flags for the creation.
@checkpoint: On success, the path of the new checkpoint.
Create a checkpoint of the current networking configuration
for given interfaces. If @rollback_timeout is not zero, a
rollback is automatically performed after the given timeout.
-->
<method name="CheckpointCreate">
<arg name="devices" type="ao" direction="in"/>
<arg name="rollback_timeout" type="u" direction="in"/>
<arg name="flags" type="u" direction="in"/>
<arg name="checkpoint" type="o" direction="out"/>
</method>
<!--
CheckpointDestroy:
@checkpoint: The checkpoint to be destroyed. Set to empty to cancel all pending checkpoints.
Destroy a previously created checkpoint.
-->
<method name="CheckpointDestroy">
<arg name="checkpoint" type="o" direction="in"/>
</method>
<!--
CheckpointRollback:
@checkpoint: The checkpoint to be rolled back.
@result: On return, a dictionary of devices and results. Devices are represented by their original D-Bus path; each result is a <link linkend="NMRollbackResult">RollbackResult</link>.
Rollback a checkpoint before the timeout is reached.
-->
<method name="CheckpointRollback">
<arg name="checkpoint" type="o" direction="in"/>
<arg name="result" type="a{su}" direction="out" />
</method>
<!--
CheckpointAdjustRollbackTimeout:
@checkpoint: The checkpoint to be rolled back.
@add_timeout: Number of seconds from <emphasis>now</emphasis> in which the timeout will expire. Set to 0 to disable the timeout.
@since: 1.12
Reset the timeout for rollback for the checkpoint.
Note that the added seconds start counting from now,
not "Created" timestamp or the previous expiration
time. Note that the "Created" property of the checkpoint
will stay unchanged by this call. However, the "RollbackTimeout"
will be recalculated to give the approximate new expiration time.
The new "RollbackTimeout" property will be approximate up to
one second precision, which is the accuracy of the property.
-->
<method name="CheckpointAdjustRollbackTimeout">
<arg name="checkpoint" type="o" direction="in"/>
<arg name="add_timeout" type="u" direction="in"/>
</method>
<!--
Devices:
The list of realized network devices. Realized devices are those which
have backing resources (eg from the kernel or a management daemon like
ModemManager, teamd, etc).
-->
<property name="Devices" type="ao" access="read"/>
<!--
AllDevices:
The list of both realized and un-realized network devices. Un-realized
devices are software devices which do not yet have backing resources, but
for which backing resources can be created if the device is activated.
-->
<property name="AllDevices" type="ao" access="read"/>
<!--
Checkpoints:
The list of active checkpoints.
-->
<property name="Checkpoints" type="ao" access="read"/>
<!--
NetworkingEnabled:
Indicates if overall networking is currently enabled or not. See the
Enable() method.
-->
<property name="NetworkingEnabled" type="b" access="read"/>
<!--
WirelessEnabled:
Indicates if wireless is currently enabled or not.
-->
<property name="WirelessEnabled" type="b" access="readwrite"/>
<!--
WirelessHardwareEnabled:
Indicates if the wireless hardware is currently enabled, i.e. the state of
the RF kill switch.
-->
<property name="WirelessHardwareEnabled" type="b" access="read"/>
<!--
WwanEnabled:
Indicates if mobile broadband devices are currently enabled or not.
-->
<property name="WwanEnabled" type="b" access="readwrite"/>
<!--
WwanHardwareEnabled:
Indicates if the mobile broadband hardware is currently enabled, i.e. the
state of the RF kill switch.
-->
<property name="WwanHardwareEnabled" type="b" access="read"/>
<!--
WimaxEnabled:
DEPRECATED. Doesn't have any meaning and is around only for
compatibility reasons.
-->
<property name="WimaxEnabled" type="b" access="readwrite"/>
<!--
WimaxHardwareEnabled:
DEPRECATED. Doesn't have any meaning and is around only for
compatibility reasons.
-->
<property name="WimaxHardwareEnabled" type="b" access="read"/>
<!--
RadioFlags:
@since: 1.38
Flags related to radio devices. See <link
linkend="NMRadioFlags">NMRadioFlags</link> for the list of flags
supported.
-->
<property name="RadioFlags" type="u" access="read"/>
<!--
ActiveConnections:
List of active connection object paths.
-->
<property name="ActiveConnections" type="ao" access="read"/>
<!--
PrimaryConnection:
The object path of 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.
-->
<property name="PrimaryConnection" type="o" access="read"/>
<!--
PrimaryConnectionType:
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.
-->
<property name="PrimaryConnectionType" type="s" access="read"/>
<!--
Metered:
Indicates whether the connectivity is metered. This is equivalent to the
metered property of the device associated with the primary connection.
Returns: <link linkend="NMMetered">NMMetered</link>
-->
<property name="Metered" type="u" access="read"/>
<!--
ActivatingConnection:
The object path of an active connection that is currently being activated
and which is expected to become the new PrimaryConnection when it finishes
activating.
-->
<property name="ActivatingConnection" type="o" access="read"/>
<!--
Startup:
Indicates whether NM is still starting up; this becomes FALSE when NM has
finished attempting to activate every connection that it might be able to
activate at startup.
-->
<property name="Startup" type="b" access="read"/>
<!--
Version:
NetworkManager version.
-->
<property name="Version" type="s" access="read"/>
<!--
VersionInfo:
NetworkManager version and capabilities.
The first element in the array is the NM_VERSION of the daemon. It is a binary representation
of the "Version" and can be compared numerically. The version is encoded as
"(major &lt;&lt; 16 | minor &lt;&lt; 8 | micro)".
The following elements are a bitfield of static capabilities of the daemon. See
#NMVersionInfoCapability for the available capability numbers.
Since: 1.42
-->
<property name="VersionInfo" type="au" access="read"/>
<!--
Capabilities:
The current set of capabilities. See <link
linkend="NMCapability">NMCapability</link> for currently
defined capability numbers. The array is guaranteed to
be sorted in ascending order without duplicates.
-->
<property name="Capabilities" type="au" access="read"/>
<!--
State:
The overall state of the NetworkManager daemon.
This takes state of all active connections and the connectivity state into account
to produce a single indicator of the network accessibility status.
The graphical shells may use this property to provide network connection status
indication and applications may use this to check if Internet connection is
accessible. Shell that is able to cope with captive portals should use the
"Connectivity" property to decide whether to present a captive portal authentication
dialog.
Returns: <link linkend="NMState">NMState</link>
-->
<property name="State" type="u" access="read"/>
<!--
StateChanged:
@state: (<link linkend="NMState">NMState</link>) The new state of NetworkManager.
NetworkManager's state changed.
-->
<signal name="StateChanged">
<arg name="state" type="u"/>
</signal>
<!--
Connectivity:
The result of the last connectivity check. The connectivity check is triggered
automatically when a default connection becomes available, periodically and by
calling a CheckConnectivity() method.
This property is in general useful for the graphical shell to determine whether
the Internet access is being hijacked by an authentication gateway (a "captive
portal"). In such case it would typically present a web browser window to give
the user a chance to authenticate and call CheckConnectivity() when the user
submits a form or dismisses the window.
To determine the whether the user is able to access the Internet without dealing
with captive portals (e.g. to provide a network connection indicator or disable
controls that require Internet access), the "State" property is more suitable.
Returns: <link linkend="NMConnectivityState">NMConnectivityState</link>
-->
<property name="Connectivity" type="u" access="read"/>
<!--
ConnectivityCheckAvailable:
Indicates whether connectivity checking service has been
configured. This may return true even if the service is not
currently enabled.
This is primarily intended for use in a privacy control panel,
as a way to determine whether to show an option to
enable/disable the feature.
-->
<property name="ConnectivityCheckAvailable" type="b" access="read"/>
<!--
ConnectivityCheckEnabled:
Indicates whether connectivity checking is enabled. This
property can also be written to disable connectivity
checking (as a privacy control panel might want to do).
-->
<property name="ConnectivityCheckEnabled" type="b" access="readwrite"/>
<!--
ConnectivityCheckUri:
The URI that NetworkManager will hit to check if there is internet connectivity.
-->
<property name="ConnectivityCheckUri" type="s" access="read"/>
<!--
GlobalDnsConfiguration:
Dictionary of global DNS settings where the key is one of "searches",
"options" and "domains". The values for the "searches" and "options" keys
are string arrays describing the list of search domains and resolver
options, respectively. The value of the "domains" key is a second-level
dictionary, where each key is a domain name, and each key's value is a
third-level dictionary with the keys "servers" and "options". "servers" is
a string array of DNS servers, "options" is a string array of
domain-specific options.
-->
<property name="GlobalDnsConfiguration" type="a{sv}" access="readwrite"/>
<!--
DeviceAdded:
@device_path: The object path of the newly added device.
A device was added to the system
-->
<signal name="DeviceAdded">
<arg name="device_path" type="o"/>
</signal>
<!--
DeviceRemoved:
@device_path: The object path of the device that was just removed.
A device was removed from the system, and is no longer available.
-->
<signal name="DeviceRemoved">
<arg name="device_path" type="o"/>
</signal>
</interface>
</node>
@@ -0,0 +1,171 @@
#include <arpa/inet.h>
#include <cstdint>
#include <memory>
#include <netinet/in.h>
#include <type_traits>
#include <sdbus-c++/Error.h>
#include <sdbus-c++/IProxy.h>
#include <sdbus-c++/Types.h>
#include "absl/synchronization/mutex.h"
#include "internal/platform/implementation/linux/dbus.h"
#include "internal/platform/implementation/linux/networkmanager_device_wireless_client_glue.h"
#include "internal/platform/implementation/linux/wifi_medium.h"
#include "internal/platform/implementation/wifi.h"
namespace nearby {
namespace linux {
std::unique_ptr<NetworkManagerIP4Config>
NetworkManagerObjectManager::GetIp4Config(
const sdbus::ObjectPath &access_point) {
auto objects = GetManagedObjects();
for (auto &[object_path, interfaces] : objects) {
if (object_path.find("/org/freedesktop/NetworkManager/ActiveConnection/",
0) == 0) {
if (interfaces.count(
"org.freedesktop.NetworkManager.Connection.Active") == 1) {
auto props =
interfaces["org.freedesktop.NetworkManager.Connection.Active"];
sdbus::ObjectPath specific_object = props["SpecificObject"];
sdbus::ObjectPath ip4config = props["Ip4Config"];
if (specific_object == access_point)
return std::make_unique<NetworkManagerIP4Config>(
getProxy().getConnection(), ip4config);
}
}
}
return nullptr;
}
api::WifiCapability &NetworkManagerWifiMedium::GetCapability() {
try {
auto cap_mask = WirelessCapabilities();
// https://networkmanager.dev/docs/api/latest/nm-dbus-types.html#NMDeviceWifiCapabilities
capability_.supports_5_ghz = (cap_mask & 0x00000400);
capability_.supports_6_ghz = false;
capability_.support_wifi_direct = true;
} catch (const sdbus::Error &e) {
DBUS_LOG_PROPERTY_GET_ERROR(&getProxy(), "WirelessCapabilities", e);
}
return capability_;
}
api::WifiInformation &NetworkManagerWifiMedium::GetInformation() {
{
absl::ReaderMutexLock l(&active_access_point_lock_);
if (!active_access_point_.has_value()) {
information_ = api::WifiInformation{false};
return information_;
}
}
try {
absl::MutexLock l(&active_access_point_lock_);
auto ssid_vec = active_access_point_->Ssid();
std::string ssid{ssid_vec.begin(), ssid_vec.end()};
information_ =
api::WifiInformation{true, ssid, active_access_point_->HwAddress(),
(int32_t)(active_access_point_->Frequency())};
NetworkManagerObjectManager manager(getProxy().getConnection());
auto ip4config =
manager.GetIp4Config(active_access_point_->getObjectPath());
if (ip4config != nullptr) {
auto address_data = ip4config->AddressData();
if (address_data.size() > 0) {
std::string address = address_data[0]["address"];
information_.ip_address_dot_decimal = address;
struct in_addr addr;
inet_aton(address.c_str(), &addr);
char addr_bytes[4];
memcpy(addr_bytes, &addr.s_addr, sizeof(addr_bytes));
information_.ip_address_4_bytes = std::string(addr_bytes, 4);
}
} else {
NEARBY_LOGS(ERROR) << __func__
<< ": Could not find the Ip4Config object for "
<< active_access_point_->getObjectPath();
}
} catch (const sdbus::Error &e) {
absl::ReaderMutexLock l(&active_access_point_lock_);
NEARBY_LOGS(ERROR)
<< __func__ << ": Got error '" << e.getName() << "' with message '"
<< e.getMessage()
<< "' while populating network information for access point "
<< active_access_point_->getObjectPath();
}
return information_;
}
void NetworkManagerWifiMedium::onPropertiesChanged(
const std::string &interfaceName,
const std::map<std::string, sdbus::Variant> &changedProperties,
const std::vector<std::string> &invalidatedProperties) {
if (interfaceName != org::freedesktop::NetworkManager::Device::
Wireless_proxy::INTERFACE_NAME) {
return;
}
for (auto &[property, _val] : changedProperties) {
if (property == "LastScan") {
absl::ReaderMutexLock l(&scan_result_callback_lock_);
if (scan_result_callback_.has_value()) {
// scan_result_callback_->get().OnScanResults()
}
}
}
}
bool NetworkManagerWifiMedium::Scan(
const api::WifiMedium::ScanResultCallback &scan_result_callback) {
absl::MutexLock l(&scan_result_callback_lock_);
scan_result_callback_ = scan_result_callback;
try {
RequestScan(std::map<std::string, sdbus::Variant>());
} catch (const sdbus::Error &e) {
scan_result_callback_ = std::nullopt;
DBUS_LOG_METHOD_CALL_ERROR(&getProxy(), "RequestScan", e);
return false;
}
return true;
}
api::WifiConnectionStatus
NetworkManagerWifiMedium::ConnectToNetwork(absl::string_view ssid,
absl::string_view password,
api::WifiAuthType auth_type) {}
bool NetworkManagerWifiMedium::VerifyInternetConnectivity() {
auto network_manager_proxy_ = sdbus::createProxy(
"org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager");
network_manager_proxy_->finishRegistration();
try {
std::uint32_t connectivity;
network_manager_proxy_->callMethod("CheckConnectivity")
.onInterface("org.freedesktop.NetworkManager")
.storeResultsTo(connectivity);
return connectivity == 4; // NM_CONNECTIVITY_FULL
} catch (const sdbus::Error &e) {
DBUS_LOG_METHOD_CALL_ERROR(network_manager_proxy_, "CheckConnectivity", e);
return false;
}
}
std::string NetworkManagerWifiMedium::GetIpAddress() {
GetInformation();
return information_.ip_address_dot_decimal;
}
} // namespace linux
} // namespace nearby
@@ -0,0 +1,130 @@
#ifndef PLATFORM_IMPL_LINUX_WIFI_MEDIUM_H_
#define PLATFORM_IMPL_LINUX_WIFI_MEDIUM_H_
#include <functional>
#include <memory>
#include <optional>
#include <sdbus-c++/IConnection.h>
#include <sdbus-c++/ProxyInterfaces.h>
#include <sdbus-c++/StandardInterfaces.h>
#include <sdbus-c++/Types.h>
#include "absl/synchronization/mutex.h"
#include "internal/platform/implementation/linux/networkmanager_accesspoint_client_glue.h"
#include "internal/platform/implementation/linux/networkmanager_device_wireless_client_glue.h"
#include "internal/platform/implementation/linux/networkmanager_ip4config_client_glue.h"
#include "internal/platform/implementation/wifi.h"
namespace nearby {
namespace linux {
class NetworkManagerIP4Config
: public sdbus::ProxyInterfaces<
org::freedesktop::NetworkManager::IP4Config_proxy> {
public:
NetworkManagerIP4Config(sdbus::IConnection &system_bus,
const sdbus::ObjectPath &config_object_path)
: ProxyInterfaces(system_bus, "org.freedesktop.NetworkManager",
config_object_path) {
registerProxy();
}
~NetworkManagerIP4Config() { unregisterProxy(); }
};
class NetworkManagerObjectManager
: public sdbus::ProxyInterfaces<sdbus::ObjectManager_proxy> {
public:
NetworkManagerObjectManager(sdbus::IConnection &system_bus)
: ProxyInterfaces(system_bus, "org.freedesktop.NetworkManager",
"/org/freedesktop") {
registerProxy();
}
~NetworkManagerObjectManager() { unregisterProxy(); }
std::unique_ptr<NetworkManagerIP4Config>
GetIp4Config(const sdbus::ObjectPath &access_point);
protected:
void onInterfacesAdded(
const sdbus::ObjectPath &objectPath,
const std::map<std::string, std::map<std::string, sdbus::Variant>>
&interfacesAndProperties) override {}
void
onInterfacesRemoved(const sdbus::ObjectPath &objectPath,
const std::vector<std::string> &interfaces) override {}
};
class NetworkManagerAccessPoint
: public sdbus::ProxyInterfaces<
org::freedesktop::NetworkManager::AccessPoint_proxy> {
public:
NetworkManagerAccessPoint(sdbus::IConnection &system_bus,
const sdbus::ObjectPath &access_point_object_path)
: ProxyInterfaces(system_bus, "org.freedesktop.NetworkManager",
access_point_object_path) {
registerProxy();
}
~NetworkManagerAccessPoint() { unregisterProxy(); }
};
class NetworkManagerWifiMedium
: public api::WifiMedium,
sdbus::ProxyInterfaces<
org::freedesktop::NetworkManager::Device::Wireless_proxy,
sdbus::Properties_proxy> {
public:
NetworkManagerWifiMedium(sdbus::IConnection &system_bus,
const sdbus::ObjectPath &wireless_device_object_path)
: ProxyInterfaces(system_bus, "org.freedesktop.NetworkManager",
wireless_device_object_path) {
active_access_point_ = std::nullopt;
registerProxy();
}
~NetworkManagerWifiMedium() override { unregisterProxy(); }
class ScanResultCallback : public api::WifiMedium::ScanResultCallback {
public:
~ScanResultCallback() override = default;
void OnScanResults(
const std::vector<api::WifiScanResult> &scan_results) override {
// TODO: Add implementation at some point
}
};
bool IsInterfaceValid() const override { return true; };
api::WifiCapability &GetCapability() override;
api::WifiInformation &GetInformation() override;
bool Scan(const api::WifiMedium::ScanResultCallback &scan_result_callback) override;
api::WifiConnectionStatus
ConnectToNetwork(absl::string_view ssid, absl::string_view password,
api::WifiAuthType auth_type) override;
bool VerifyInternetConnectivity() override;
std::string GetIpAddress() override;
protected:
void onPropertiesChanged(
const std::string &interfaceName,
const std::map<std::string, sdbus::Variant> &changedProperties,
const std::vector<std::string> &invalidatedProperties) override;
private:
api::WifiCapability capability_;
api::WifiInformation information_{false};
absl::Mutex active_access_point_lock_;
std::optional<NetworkManagerAccessPoint> active_access_point_;
absl::Mutex scan_result_callback_lock_;
std::optional<
std::reference_wrapper<const api::WifiMedium::ScanResultCallback>>
scan_result_callback_;
};
} // namespace linux
} // namespace nearby
#endif