mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 02:35:25 +00:00
platform/wifi: rename wifi-utils to nm-wifi-utils
This commit is contained in:
parent
d18d532c15
commit
91c82cc465
14
Makefile.am
14
Makefile.am
|
@ -1477,11 +1477,11 @@ src_libNetworkManagerBase_la_SOURCES = \
|
|||
src/platform/nm-platform-private.h \
|
||||
src/platform/nm-linux-platform.c \
|
||||
src/platform/nm-linux-platform.h \
|
||||
src/platform/wifi/wifi-utils-nl80211.c \
|
||||
src/platform/wifi/wifi-utils-nl80211.h \
|
||||
src/platform/wifi/wifi-utils-private.h \
|
||||
src/platform/wifi/wifi-utils.c \
|
||||
src/platform/wifi/wifi-utils.h \
|
||||
src/platform/wifi/nm-wifi-utils-nl80211.c \
|
||||
src/platform/wifi/nm-wifi-utils-nl80211.h \
|
||||
src/platform/wifi/nm-wifi-utils-private.h \
|
||||
src/platform/wifi/nm-wifi-utils.c \
|
||||
src/platform/wifi/nm-wifi-utils.h \
|
||||
\
|
||||
src/ndisc/nm-lndp-ndisc.c \
|
||||
src/ndisc/nm-lndp-ndisc.h \
|
||||
|
@ -1514,8 +1514,8 @@ src_libNetworkManagerBase_la_SOURCES = \
|
|||
|
||||
if WITH_WEXT
|
||||
src_libNetworkManagerBase_la_SOURCES += \
|
||||
src/platform/wifi/wifi-utils-wext.c \
|
||||
src/platform/wifi/wifi-utils-wext.h
|
||||
src/platform/wifi/nm-wifi-utils-wext.c \
|
||||
src/platform/wifi/nm-wifi-utils-wext.h
|
||||
endif
|
||||
|
||||
src_libNetworkManagerBase_la_LIBADD = \
|
||||
|
|
|
@ -55,8 +55,8 @@ sources = files(
|
|||
'ndisc/nm-lndp-ndisc.c',
|
||||
'ndisc/nm-ndisc.c',
|
||||
'platform/nm-netlink.c',
|
||||
'platform/wifi/wifi-utils-nl80211.c',
|
||||
'platform/wifi/wifi-utils.c',
|
||||
'platform/wifi/nm-wifi-utils-nl80211.c',
|
||||
'platform/wifi/nm-wifi-utils.c',
|
||||
'platform/nm-linux-platform.c',
|
||||
'platform/nm-platform.c',
|
||||
'platform/nm-platform-utils.c',
|
||||
|
@ -79,7 +79,7 @@ deps = [
|
|||
]
|
||||
|
||||
if enable_wext
|
||||
sources += files('platform/wifi/wifi-utils-wext.c')
|
||||
sources += files('platform/wifi/nm-wifi-utils-wext.c')
|
||||
endif
|
||||
|
||||
libnetwork_manager_base = static_library(
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2012 - 2017 Red Hat, Inc.
|
||||
* Copyright (C) 2012 - 2018 Red Hat, Inc.
|
||||
*/
|
||||
#include "nm-default.h"
|
||||
|
||||
|
@ -50,8 +50,8 @@
|
|||
#include "nmp-netns.h"
|
||||
#include "nm-platform-utils.h"
|
||||
#include "nm-platform-private.h"
|
||||
#include "wifi/wifi-utils.h"
|
||||
#include "wifi/wifi-utils-wext.h"
|
||||
#include "wifi/nm-wifi-utils.h"
|
||||
#include "wifi/nm-wifi-utils-wext.h"
|
||||
#include "nm-utils/unaligned.h"
|
||||
#include "nm-utils/nm-udev-utils.h"
|
||||
|
||||
|
@ -885,7 +885,7 @@ _linktype_get_type (NMPlatform *platform,
|
|||
}
|
||||
|
||||
/* Fallback for drivers that don't call SET_NETDEV_DEVTYPE() */
|
||||
if (wifi_utils_is_wifi (dirfd, ifname_verified))
|
||||
if (nm_wifi_utils_is_wifi (dirfd, ifname_verified))
|
||||
return NM_LINK_TYPE_WIFI;
|
||||
}
|
||||
|
||||
|
@ -5980,12 +5980,12 @@ infiniband_partition_delete (NMPlatform *platform, int parent, int p_key)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static WifiData *
|
||||
static NMWifiUtils *
|
||||
wifi_get_wifi_data (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
||||
const NMPlatformLink *pllink;
|
||||
WifiData *wifi_data;
|
||||
NMWifiUtils *wifi_data;
|
||||
|
||||
wifi_data = g_hash_table_lookup (priv->wifi_data, GINT_TO_POINTER (ifindex));
|
||||
pllink = nm_platform_link_get (platform, ifindex);
|
||||
|
@ -5993,14 +5993,14 @@ wifi_get_wifi_data (NMPlatform *platform, int ifindex)
|
|||
if (!wifi_data) {
|
||||
if (pllink) {
|
||||
if (pllink->type == NM_LINK_TYPE_WIFI)
|
||||
wifi_data = wifi_utils_init (ifindex, TRUE);
|
||||
wifi_data = nm_wifi_utils_init (ifindex, TRUE);
|
||||
else if (pllink->type == NM_LINK_TYPE_OLPC_MESH) {
|
||||
/* The kernel driver now uses nl80211, but we force use of WEXT because
|
||||
* the cfg80211 interactions are not quite ready to support access to
|
||||
* mesh control through nl80211 just yet.
|
||||
*/
|
||||
#if HAVE_WEXT
|
||||
wifi_data = wifi_wext_init (ifindex, FALSE);
|
||||
wifi_data = nm_wifi_utils_wext_init (ifindex, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -6013,7 +6013,7 @@ wifi_get_wifi_data (NMPlatform *platform, int ifindex)
|
|||
}
|
||||
#define WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, retval) \
|
||||
nm_auto_pop_netns NMPNetns *netns = NULL; \
|
||||
WifiData *wifi_data; \
|
||||
NMWifiUtils *wifi_data; \
|
||||
if (!nm_platform_netns_push (platform, &netns)) \
|
||||
return retval; \
|
||||
wifi_data = wifi_get_wifi_data (platform, ifindex); \
|
||||
|
@ -6025,7 +6025,7 @@ wifi_get_capabilities (NMPlatform *platform, int ifindex, NMDeviceWifiCapabiliti
|
|||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, FALSE);
|
||||
if (caps)
|
||||
*caps = wifi_utils_get_caps (wifi_data);
|
||||
*caps = nm_wifi_utils_get_caps (wifi_data);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -6033,63 +6033,63 @@ static gboolean
|
|||
wifi_get_bssid (NMPlatform *platform, int ifindex, guint8 *bssid)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, FALSE);
|
||||
return wifi_utils_get_bssid (wifi_data, bssid);
|
||||
return nm_wifi_utils_get_bssid (wifi_data, bssid);
|
||||
}
|
||||
|
||||
static guint32
|
||||
wifi_get_frequency (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, 0);
|
||||
return wifi_utils_get_freq (wifi_data);
|
||||
return nm_wifi_utils_get_freq (wifi_data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wifi_get_quality (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, FALSE);
|
||||
return wifi_utils_get_qual (wifi_data);
|
||||
return nm_wifi_utils_get_qual (wifi_data);
|
||||
}
|
||||
|
||||
static guint32
|
||||
wifi_get_rate (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, FALSE);
|
||||
return wifi_utils_get_rate (wifi_data);
|
||||
return nm_wifi_utils_get_rate (wifi_data);
|
||||
}
|
||||
|
||||
static NM80211Mode
|
||||
wifi_get_mode (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, NM_802_11_MODE_UNKNOWN);
|
||||
return wifi_utils_get_mode (wifi_data);
|
||||
return nm_wifi_utils_get_mode (wifi_data);
|
||||
}
|
||||
|
||||
static void
|
||||
wifi_set_mode (NMPlatform *platform, int ifindex, NM80211Mode mode)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, );
|
||||
wifi_utils_set_mode (wifi_data, mode);
|
||||
nm_wifi_utils_set_mode (wifi_data, mode);
|
||||
}
|
||||
|
||||
static void
|
||||
wifi_set_powersave (NMPlatform *platform, int ifindex, guint32 powersave)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, );
|
||||
wifi_utils_set_powersave (wifi_data, powersave);
|
||||
nm_wifi_utils_set_powersave (wifi_data, powersave);
|
||||
}
|
||||
|
||||
static guint32
|
||||
wifi_find_frequency (NMPlatform *platform, int ifindex, const guint32 *freqs)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, 0);
|
||||
return wifi_utils_find_freq (wifi_data, freqs);
|
||||
return nm_wifi_utils_find_freq (wifi_data, freqs);
|
||||
}
|
||||
|
||||
static void
|
||||
wifi_indicate_addressing_running (NMPlatform *platform, int ifindex, gboolean running)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, );
|
||||
wifi_utils_indicate_addressing_running (wifi_data, running);
|
||||
nm_wifi_utils_indicate_addressing_running (wifi_data, running);
|
||||
}
|
||||
|
||||
static NMSettingWirelessWakeOnWLan
|
||||
|
@ -6155,21 +6155,21 @@ static guint32
|
|||
mesh_get_channel (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, 0);
|
||||
return wifi_utils_get_mesh_channel (wifi_data);
|
||||
return nm_wifi_utils_get_mesh_channel (wifi_data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mesh_set_channel (NMPlatform *platform, int ifindex, guint32 channel)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, FALSE);
|
||||
return wifi_utils_set_mesh_channel (wifi_data, channel);
|
||||
return nm_wifi_utils_set_mesh_channel (wifi_data, channel);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mesh_set_ssid (NMPlatform *platform, int ifindex, const guint8 *ssid, gsize len)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS (wifi_data, platform, ifindex, FALSE);
|
||||
return wifi_utils_set_mesh_ssid (wifi_data, ssid, len);
|
||||
return nm_wifi_utils_set_mesh_ssid (wifi_data, ssid, len);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -6186,12 +6186,12 @@ link_get_wake_on_lan (NMPlatform *platform, int ifindex)
|
|||
if (type == NM_LINK_TYPE_ETHERNET)
|
||||
return nmp_utils_ethtool_get_wake_on_lan (ifindex);
|
||||
else if (type == NM_LINK_TYPE_WIFI) {
|
||||
WifiData *wifi_data = wifi_get_wifi_data (platform, ifindex);
|
||||
NMWifiUtils *wifi_data = wifi_get_wifi_data (platform, ifindex);
|
||||
|
||||
if (!wifi_data)
|
||||
return FALSE;
|
||||
|
||||
return wifi_utils_get_wake_on_wlan (wifi_data) != NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE;
|
||||
return nm_wifi_utils_get_wake_on_wlan (wifi_data) != NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE;
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -7013,7 +7013,7 @@ nm_linux_platform_init (NMLinuxPlatform *self)
|
|||
priv->delayed_action.list_master_connected = g_ptr_array_new ();
|
||||
priv->delayed_action.list_refresh_link = g_ptr_array_new ();
|
||||
priv->delayed_action.list_wait_for_nl_response = g_array_new (FALSE, TRUE, sizeof (DelayedActionWaitForNlResponseData));
|
||||
priv->wifi_data = g_hash_table_new_full (nm_direct_hash, NULL, NULL, (GDestroyNotify) wifi_utils_unref);
|
||||
priv->wifi_data = g_hash_table_new_full (nm_direct_hash, NULL, NULL, (GDestroyNotify) nm_wifi_utils_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2005 - 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2005 - 2018 Red Hat, Inc.
|
||||
* Copyright (C) 2006 - 2008 Novell, Inc.
|
||||
* Copyright (C) 2011 Intel Corporation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "wifi-utils-nl80211.h"
|
||||
#include "nm-wifi-utils-nl80211.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
@ -32,7 +32,7 @@
|
|||
#include <linux/nl80211.h>
|
||||
|
||||
#include "platform/nm-netlink.h"
|
||||
#include "wifi-utils-private.h"
|
||||
#include "nm-wifi-utils-private.h"
|
||||
#include "platform/nm-platform.h"
|
||||
#include "platform/nm-platform-utils.h"
|
||||
#include "nm-utils.h"
|
||||
|
@ -47,14 +47,14 @@
|
|||
} G_STMT_END
|
||||
|
||||
typedef struct {
|
||||
WifiData parent;
|
||||
NMWifiUtils parent;
|
||||
struct nl_sock *nl_sock;
|
||||
guint32 *freqs;
|
||||
int id;
|
||||
int num_freqs;
|
||||
int phy;
|
||||
bool can_wowlan:1;
|
||||
} WifiDataNl80211;
|
||||
} NMWifiUtilsNl80211;
|
||||
|
||||
static int
|
||||
ack_handler (struct nl_msg *msg, void *arg)
|
||||
|
@ -97,7 +97,7 @@ nla_put_failure:
|
|||
}
|
||||
|
||||
static struct nl_msg *
|
||||
nl80211_alloc_msg (WifiDataNl80211 *nl80211, guint32 cmd, guint32 flags)
|
||||
nl80211_alloc_msg (NMWifiUtilsNl80211 *nl80211, guint32 cmd, guint32 flags)
|
||||
{
|
||||
return _nl80211_alloc_msg (nl80211->id, nl80211->parent.ifindex, nl80211->phy, cmd, flags);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ _nl80211_send_and_recv (struct nl_sock *nl_sock,
|
|||
}
|
||||
|
||||
static int
|
||||
nl80211_send_and_recv (WifiDataNl80211 *nl80211,
|
||||
nl80211_send_and_recv (NMWifiUtilsNl80211 *nl80211,
|
||||
struct nl_msg *msg,
|
||||
int (*valid_handler) (struct nl_msg *, void *),
|
||||
void *valid_data)
|
||||
|
@ -164,9 +164,9 @@ nl80211_send_and_recv (WifiDataNl80211 *nl80211,
|
|||
}
|
||||
|
||||
static void
|
||||
wifi_nl80211_deinit (WifiData *parent)
|
||||
wifi_nl80211_deinit (NMWifiUtils *parent)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) parent;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) parent;
|
||||
|
||||
if (nl80211->nl_sock)
|
||||
nl_socket_free (nl80211->nl_sock);
|
||||
|
@ -207,9 +207,9 @@ nl80211_iface_info_handler (struct nl_msg *msg, void *arg)
|
|||
}
|
||||
|
||||
static NM80211Mode
|
||||
wifi_nl80211_get_mode (WifiData *data)
|
||||
wifi_nl80211_get_mode (NMWifiUtils *data)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) data;
|
||||
struct nl80211_iface_info iface_info = {
|
||||
.mode = NM_802_11_MODE_UNKNOWN,
|
||||
};
|
||||
|
@ -225,9 +225,9 @@ wifi_nl80211_get_mode (WifiData *data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_nl80211_set_mode (WifiData *data, const NM80211Mode mode)
|
||||
wifi_nl80211_set_mode (NMWifiUtils *data, const NM80211Mode mode)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) data;
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
int err;
|
||||
|
||||
|
@ -255,9 +255,9 @@ nla_put_failure:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_nl80211_set_powersave (WifiData *data, guint32 powersave)
|
||||
wifi_nl80211_set_powersave (NMWifiUtils *data, guint32 powersave)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) data;
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
int err;
|
||||
|
||||
|
@ -487,7 +487,7 @@ nl80211_bss_dump_handler (struct nl_msg *msg, void *arg)
|
|||
}
|
||||
|
||||
static void
|
||||
nl80211_get_bss_info (WifiDataNl80211 *nl80211,
|
||||
nl80211_get_bss_info (NMWifiUtilsNl80211 *nl80211,
|
||||
struct nl80211_bss_info *bss_info)
|
||||
{
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
|
@ -500,9 +500,9 @@ nl80211_get_bss_info (WifiDataNl80211 *nl80211,
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_nl80211_get_freq (WifiData *data)
|
||||
wifi_nl80211_get_freq (NMWifiUtils *data)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) data;
|
||||
struct nl80211_bss_info bss_info;
|
||||
|
||||
nl80211_get_bss_info (nl80211, &bss_info);
|
||||
|
@ -511,9 +511,9 @@ wifi_nl80211_get_freq (WifiData *data)
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_nl80211_find_freq (WifiData *data, const guint32 *freqs)
|
||||
wifi_nl80211_find_freq (NMWifiUtils *data, const guint32 *freqs)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nl80211->num_freqs; i++) {
|
||||
|
@ -527,9 +527,9 @@ wifi_nl80211_find_freq (WifiData *data, const guint32 *freqs)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_nl80211_get_bssid (WifiData *data, guint8 *out_bssid)
|
||||
wifi_nl80211_get_bssid (NMWifiUtils *data, guint8 *out_bssid)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) data;
|
||||
struct nl80211_bss_info bss_info;
|
||||
|
||||
nl80211_get_bss_info (nl80211, &bss_info);
|
||||
|
@ -611,7 +611,7 @@ nl80211_station_handler (struct nl_msg *msg, void *arg)
|
|||
}
|
||||
|
||||
static void
|
||||
nl80211_get_ap_info (WifiDataNl80211 *nl80211,
|
||||
nl80211_get_ap_info (NMWifiUtilsNl80211 *nl80211,
|
||||
struct nl80211_station_info *sta_info)
|
||||
{
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
|
@ -641,9 +641,9 @@ nla_put_failure:
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_nl80211_get_rate (WifiData *data)
|
||||
wifi_nl80211_get_rate (NMWifiUtils *data)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) data;
|
||||
struct nl80211_station_info sta_info;
|
||||
|
||||
nl80211_get_ap_info (nl80211, &sta_info);
|
||||
|
@ -652,9 +652,9 @@ wifi_nl80211_get_rate (WifiData *data)
|
|||
}
|
||||
|
||||
static int
|
||||
wifi_nl80211_get_qual (WifiData *data)
|
||||
wifi_nl80211_get_qual (NMWifiUtils *data)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) data;
|
||||
struct nl80211_station_info sta_info;
|
||||
|
||||
nl80211_get_ap_info (nl80211, &sta_info);
|
||||
|
@ -662,9 +662,9 @@ wifi_nl80211_get_qual (WifiData *data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_nl80211_indicate_addressing_running (WifiData *data, gboolean running)
|
||||
wifi_nl80211_indicate_addressing_running (NMWifiUtils *data, gboolean running)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
NMWifiUtilsNl80211 *nl80211 = (NMWifiUtilsNl80211 *) data;
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
int err;
|
||||
|
||||
|
@ -896,11 +896,11 @@ static int nl80211_wiphy_info_handler (struct nl_msg *msg, void *arg)
|
|||
return NL_SKIP;
|
||||
}
|
||||
|
||||
WifiData *
|
||||
wifi_nl80211_init (int ifindex)
|
||||
NMWifiUtils *
|
||||
nm_wifi_utils_nl80211_init (int ifindex)
|
||||
{
|
||||
static const WifiDataClass klass = {
|
||||
.struct_size = sizeof (WifiDataNl80211),
|
||||
static const NMWifiUtilsClass klass = {
|
||||
.struct_size = sizeof (NMWifiUtilsNl80211),
|
||||
.get_mode = wifi_nl80211_get_mode,
|
||||
.set_mode = wifi_nl80211_set_mode,
|
||||
.set_powersave = wifi_nl80211_set_powersave,
|
||||
|
@ -914,7 +914,7 @@ wifi_nl80211_init (int ifindex)
|
|||
.indicate_addressing_running = wifi_nl80211_indicate_addressing_running,
|
||||
.deinit = wifi_nl80211_deinit,
|
||||
};
|
||||
WifiDataNl80211 *nl80211;
|
||||
NMWifiUtilsNl80211 *nl80211;
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
struct nl80211_device_info device_info = {};
|
||||
char ifname[IFNAMSIZ];
|
||||
|
@ -925,7 +925,7 @@ wifi_nl80211_init (int ifindex)
|
|||
nm_sprintf_buf (ifname, "if %d", ifindex);
|
||||
}
|
||||
|
||||
nl80211 = wifi_data_new (&klass, ifindex);
|
||||
nl80211 = nm_wifi_utils_new (&klass, ifindex);
|
||||
|
||||
nl80211->nl_sock = nl_socket_alloc ();
|
||||
if (nl80211->nl_sock == NULL)
|
||||
|
@ -996,10 +996,10 @@ wifi_nl80211_init (int ifindex)
|
|||
_LOGI (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): using nl80211 for WiFi device control",
|
||||
ifname);
|
||||
return (WifiData *) nl80211;
|
||||
return (NMWifiUtils *) nl80211;
|
||||
|
||||
error:
|
||||
wifi_utils_unref ((WifiData *) nl80211);
|
||||
nm_wifi_utils_unref ((NMWifiUtils *) nl80211);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -16,13 +16,14 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2011 Intel Corporation. All rights reserved.
|
||||
* Copyright (C) 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __WIFI_UTILS_NL80211_H__
|
||||
#define __WIFI_UTILS_NL80211_H__
|
||||
|
||||
#include "wifi-utils.h"
|
||||
#include "nm-wifi-utils.h"
|
||||
|
||||
WifiData *wifi_nl80211_init (int ifindex);
|
||||
NMWifiUtils *nm_wifi_utils_nl80211_init (int ifindex);
|
||||
|
||||
#endif /* __WIFI_UTILS_NL80211_H__ */
|
|
@ -15,24 +15,24 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2011 - 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __WIFI_UTILS_PRIVATE_H__
|
||||
#define __WIFI_UTILS_PRIVATE_H__
|
||||
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "wifi-utils.h"
|
||||
#include "nm-wifi-utils.h"
|
||||
|
||||
typedef struct {
|
||||
gsize struct_size;
|
||||
|
||||
NM80211Mode (*get_mode) (WifiData *data);
|
||||
NM80211Mode (*get_mode) (NMWifiUtils *data);
|
||||
|
||||
gboolean (*set_mode) (WifiData *data, const NM80211Mode mode);
|
||||
gboolean (*set_mode) (NMWifiUtils *data, const NM80211Mode mode);
|
||||
|
||||
/* Set power saving mode on an interface */
|
||||
gboolean (*set_powersave) (WifiData *data, guint32 powersave);
|
||||
gboolean (*set_powersave) (NMWifiUtils *data, guint32 powersave);
|
||||
|
||||
/* Get WakeOnWLAN configuration on an interface */
|
||||
NMSettingWirelessWakeOnWLan (*get_wake_on_wlan) (WifiData *data);
|
||||
|
@ -41,42 +41,42 @@ typedef struct {
|
|||
gboolean (*set_wake_on_wlan) (WifiData *data, NMSettingWirelessWakeOnWLan wowl);
|
||||
|
||||
/* Return current frequency in MHz (really associated BSS frequency) */
|
||||
guint32 (*get_freq) (WifiData *data);
|
||||
guint32 (*get_freq) (NMWifiUtils *data);
|
||||
|
||||
/* Return first supported frequency in the zero-terminated list */
|
||||
guint32 (*find_freq) (WifiData *data, const guint32 *freqs);
|
||||
guint32 (*find_freq) (NMWifiUtils *data, const guint32 *freqs);
|
||||
|
||||
/* Return current bitrate in Kbps */
|
||||
guint32 (*get_rate) (WifiData *data);
|
||||
guint32 (*get_rate) (NMWifiUtils *data);
|
||||
|
||||
gboolean (*get_bssid) (WifiData *data, guint8 *out_bssid);
|
||||
gboolean (*get_bssid) (NMWifiUtils *data, guint8 *out_bssid);
|
||||
|
||||
/* Return a signal strength percentage 0 - 100% for the current BSSID;
|
||||
* return -1 on errors or if not associated.
|
||||
*/
|
||||
int (*get_qual) (WifiData *data);
|
||||
int (*get_qual) (NMWifiUtils *data);
|
||||
|
||||
void (*deinit) (WifiData *data);
|
||||
void (*deinit) (NMWifiUtils *data);
|
||||
|
||||
/* OLPC Mesh-only functions */
|
||||
|
||||
guint32 (*get_mesh_channel) (WifiData *data);
|
||||
guint32 (*get_mesh_channel) (NMWifiUtils *data);
|
||||
|
||||
/* channel == 0 means "auto channel" */
|
||||
gboolean (*set_mesh_channel) (WifiData *data, guint32 channel);
|
||||
gboolean (*set_mesh_channel) (NMWifiUtils *data, guint32 channel);
|
||||
|
||||
/* ssid == NULL means "auto SSID" */
|
||||
gboolean (*set_mesh_ssid) (WifiData *data, const guint8 *ssid, gsize len);
|
||||
gboolean (*set_mesh_ssid) (NMWifiUtils *data, const guint8 *ssid, gsize len);
|
||||
|
||||
gboolean (*indicate_addressing_running) (WifiData *data, gboolean running);
|
||||
} WifiDataClass;
|
||||
gboolean (*indicate_addressing_running) (NMWifiUtils *data, gboolean running);
|
||||
} NMWifiUtilsClass;
|
||||
|
||||
struct WifiData {
|
||||
const WifiDataClass *klass;
|
||||
struct NMWifiUtils {
|
||||
const NMWifiUtilsClass *klass;
|
||||
int ifindex;
|
||||
NMDeviceWifiCapabilities caps;
|
||||
};
|
||||
|
||||
gpointer wifi_data_new (const WifiDataClass *klass, int ifindex);
|
||||
gpointer nm_wifi_utils_new (const NMWifiUtilsClass *klass, int ifindex);
|
||||
|
||||
#endif /* __WIFI_UTILS_PRIVATE_H__ */
|
|
@ -15,13 +15,13 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2005 - 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2005 - 2018 Red Hat, Inc.
|
||||
* Copyright (C) 2006 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "wifi-utils-wext.h"
|
||||
#include "nm-wifi-utils-wext.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
@ -38,17 +38,17 @@
|
|||
#include <sys/socket.h>
|
||||
#include <linux/wireless.h>
|
||||
|
||||
#include "wifi-utils-private.h"
|
||||
#include "nm-wifi-utils-private.h"
|
||||
#include "nm-utils.h"
|
||||
#include "platform/nm-platform-utils.h"
|
||||
|
||||
typedef struct {
|
||||
WifiData parent;
|
||||
NMWifiUtils parent;
|
||||
int fd;
|
||||
struct iw_quality max_qual;
|
||||
gint8 num_freqs;
|
||||
guint32 freqs[IW_MAX_FREQUENCIES];
|
||||
} WifiDataWext;
|
||||
} NMWifiUtilsWext;
|
||||
|
||||
/* Until a new wireless-tools comes out that has the defs and the structure,
|
||||
* need to copy them here.
|
||||
|
@ -94,9 +94,9 @@ iw_freq_to_uint32 (const struct iw_freq *freq)
|
|||
}
|
||||
|
||||
static void
|
||||
wifi_wext_deinit (WifiData *parent)
|
||||
wifi_wext_deinit (NMWifiUtils *parent)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) parent;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) parent;
|
||||
|
||||
nm_close (wext->fd);
|
||||
}
|
||||
|
@ -118,9 +118,9 @@ get_ifname (int ifindex, char *buffer, const char *op)
|
|||
}
|
||||
|
||||
static NM80211Mode
|
||||
wifi_wext_get_mode_ifname (WifiData *data, const char *ifname)
|
||||
wifi_wext_get_mode_ifname (NMWifiUtils *data, const char *ifname)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
|
||||
memset (&wrq, 0, sizeof (struct iwreq));
|
||||
|
@ -150,7 +150,7 @@ wifi_wext_get_mode_ifname (WifiData *data, const char *ifname)
|
|||
}
|
||||
|
||||
static NM80211Mode
|
||||
wifi_wext_get_mode (WifiData *data)
|
||||
wifi_wext_get_mode (NMWifiUtils *data)
|
||||
{
|
||||
char ifname[IFNAMSIZ];
|
||||
|
||||
|
@ -161,9 +161,9 @@ wifi_wext_get_mode (WifiData *data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_wext_set_mode (WifiData *data, const NM80211Mode mode)
|
||||
wifi_wext_set_mode (NMWifiUtils *data, const NM80211Mode mode)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
char ifname[IFNAMSIZ];
|
||||
|
||||
|
@ -203,9 +203,9 @@ wifi_wext_set_mode (WifiData *data, const NM80211Mode mode)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_wext_set_powersave (WifiData *data, guint32 powersave)
|
||||
wifi_wext_set_powersave (NMWifiUtils *data, guint32 powersave)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
char ifname[IFNAMSIZ];
|
||||
|
||||
|
@ -232,9 +232,9 @@ wifi_wext_set_powersave (WifiData *data, guint32 powersave)
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_wext_get_freq (WifiData *data)
|
||||
wifi_wext_get_freq (NMWifiUtils *data)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
char ifname[IFNAMSIZ];
|
||||
|
||||
|
@ -254,9 +254,9 @@ wifi_wext_get_freq (WifiData *data)
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_wext_find_freq (WifiData *data, const guint32 *freqs)
|
||||
wifi_wext_find_freq (NMWifiUtils *data, const guint32 *freqs)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < wext->num_freqs; i++) {
|
||||
|
@ -270,9 +270,9 @@ wifi_wext_find_freq (WifiData *data, const guint32 *freqs)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_wext_get_bssid (WifiData *data, guint8 *out_bssid)
|
||||
wifi_wext_get_bssid (NMWifiUtils *data, guint8 *out_bssid)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
char ifname[IFNAMSIZ];
|
||||
|
||||
|
@ -292,9 +292,9 @@ wifi_wext_get_bssid (WifiData *data, guint8 *out_bssid)
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_wext_get_rate (WifiData *data)
|
||||
wifi_wext_get_rate (NMWifiUtils *data)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
int err;
|
||||
char ifname[IFNAMSIZ];
|
||||
|
@ -403,9 +403,9 @@ wext_qual_to_percent (const struct iw_quality *qual,
|
|||
}
|
||||
|
||||
static int
|
||||
wifi_wext_get_qual (WifiData *data)
|
||||
wifi_wext_get_qual (NMWifiUtils *data)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
struct iw_statistics stats;
|
||||
char ifname[IFNAMSIZ];
|
||||
|
@ -433,13 +433,13 @@ wifi_wext_get_qual (WifiData *data)
|
|||
/* OLPC Mesh-only functions */
|
||||
|
||||
static guint32
|
||||
wifi_wext_get_mesh_channel (WifiData *data)
|
||||
wifi_wext_get_mesh_channel (NMWifiUtils *data)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
guint32 freq;
|
||||
int i;
|
||||
|
||||
freq = wifi_utils_get_freq (data);
|
||||
freq = nm_wifi_utils_get_freq (data);
|
||||
for (i = 0; i < wext->num_freqs; i++) {
|
||||
if (freq == wext->freqs[i])
|
||||
return i + 1;
|
||||
|
@ -448,9 +448,9 @@ wifi_wext_get_mesh_channel (WifiData *data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_wext_set_mesh_channel (WifiData *data, guint32 channel)
|
||||
wifi_wext_set_mesh_channel (NMWifiUtils *data, guint32 channel)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
char ifname[IFNAMSIZ];
|
||||
|
||||
|
@ -477,9 +477,9 @@ wifi_wext_set_mesh_channel (WifiData *data, guint32 channel)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_wext_set_mesh_ssid (WifiData *data, const guint8 *ssid, gsize len)
|
||||
wifi_wext_set_mesh_ssid (NMWifiUtils *data, const guint8 *ssid, gsize len)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
char buf[IW_ESSID_MAX_SIZE + 1];
|
||||
char ifname[IFNAMSIZ];
|
||||
|
@ -514,7 +514,7 @@ wifi_wext_set_mesh_ssid (WifiData *data, const guint8 *ssid, gsize len)
|
|||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
wext_can_scan_ifname (WifiDataWext *wext, const char *ifname)
|
||||
wext_can_scan_ifname (NMWifiUtilsWext *wext, const char *ifname)
|
||||
{
|
||||
struct iwreq wrq;
|
||||
|
||||
|
@ -528,7 +528,7 @@ wext_can_scan_ifname (WifiDataWext *wext, const char *ifname)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wext_get_range_ifname (WifiDataWext *wext,
|
||||
wext_get_range_ifname (NMWifiUtilsWext *wext,
|
||||
const char *ifname,
|
||||
struct iw_range *range,
|
||||
guint32 *response_len)
|
||||
|
@ -577,7 +577,7 @@ wext_get_range_ifname (WifiDataWext *wext,
|
|||
NM_WIFI_DEVICE_CAP_RSN)
|
||||
|
||||
static guint32
|
||||
wext_get_caps (WifiDataWext *wext, const char *ifname, struct iw_range *range)
|
||||
wext_get_caps (NMWifiUtilsWext *wext, const char *ifname, struct iw_range *range)
|
||||
{
|
||||
guint32 caps = NM_WIFI_DEVICE_CAP_NONE;
|
||||
|
||||
|
@ -626,11 +626,11 @@ wext_get_caps (WifiDataWext *wext, const char *ifname, struct iw_range *range)
|
|||
return caps;
|
||||
}
|
||||
|
||||
WifiData *
|
||||
wifi_wext_init (int ifindex, gboolean check_scan)
|
||||
NMWifiUtils *
|
||||
nm_wifi_utils_wext_init (int ifindex, gboolean check_scan)
|
||||
{
|
||||
static const WifiDataClass klass = {
|
||||
.struct_size = sizeof (WifiDataWext),
|
||||
static const NMWifiUtilsClass klass = {
|
||||
.struct_size = sizeof (NMWifiUtilsWext),
|
||||
.get_mode = wifi_wext_get_mode,
|
||||
.set_mode = wifi_wext_set_mode,
|
||||
.set_powersave = wifi_wext_set_powersave,
|
||||
|
@ -644,7 +644,7 @@ wifi_wext_init (int ifindex, gboolean check_scan)
|
|||
.set_mesh_channel = wifi_wext_set_mesh_channel,
|
||||
.set_mesh_ssid = wifi_wext_set_mesh_ssid,
|
||||
};
|
||||
WifiDataWext *wext;
|
||||
NMWifiUtilsWext *wext;
|
||||
struct iw_range range;
|
||||
guint32 response_len = 0;
|
||||
struct iw_range_with_scan_capa *scan_capa_range;
|
||||
|
@ -658,7 +658,7 @@ wifi_wext_init (int ifindex, gboolean check_scan)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
wext = wifi_data_new (&klass, ifindex);
|
||||
wext = nm_wifi_utils_new (&klass, ifindex);
|
||||
|
||||
wext->fd = socket (PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||
if (wext->fd < 0)
|
||||
|
@ -731,15 +731,15 @@ wifi_wext_init (int ifindex, gboolean check_scan)
|
|||
"(%s): using WEXT for WiFi device control",
|
||||
ifname);
|
||||
|
||||
return (WifiData *) wext;
|
||||
return (NMWifiUtils *) wext;
|
||||
|
||||
error:
|
||||
wifi_utils_unref ((WifiData *) wext);
|
||||
nm_wifi_utils_unref ((NMWifiUtils *) wext);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wifi_wext_is_wifi (const char *iface)
|
||||
nm_wifi_utils_wext_is_wifi (const char *iface)
|
||||
{
|
||||
int fd;
|
||||
struct iwreq iwr;
|
|
@ -15,16 +15,16 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2011 - 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __WIFI_UTILS_WEXT_H__
|
||||
#define __WIFI_UTILS_WEXT_H__
|
||||
|
||||
#include "wifi-utils.h"
|
||||
#include "nm-wifi-utils.h"
|
||||
|
||||
WifiData *wifi_wext_init (int ifindex, gboolean check_scan);
|
||||
NMWifiUtils *nm_wifi_utils_wext_init (int ifindex, gboolean check_scan);
|
||||
|
||||
gboolean wifi_wext_is_wifi (const char *iface);
|
||||
gboolean nm_wifi_utils_wext_is_wifi (const char *iface);
|
||||
|
||||
#endif /* __WIFI_UTILS_WEXT_H__ */
|
|
@ -21,29 +21,29 @@
|
|||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "wifi-utils.h"
|
||||
#include "nm-wifi-utils.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "wifi-utils-private.h"
|
||||
#include "wifi-utils-nl80211.h"
|
||||
#include "nm-wifi-utils-private.h"
|
||||
#include "nm-wifi-utils-nl80211.h"
|
||||
#if HAVE_WEXT
|
||||
#include "wifi-utils-wext.h"
|
||||
#include "nm-wifi-utils-wext.h"
|
||||
#endif
|
||||
#include "nm-core-utils.h"
|
||||
|
||||
#include "platform/nm-platform-utils.h"
|
||||
|
||||
gpointer
|
||||
wifi_data_new (const WifiDataClass *klass, int ifindex)
|
||||
nm_wifi_utils_new (const NMWifiUtilsClass *klass, int ifindex)
|
||||
{
|
||||
WifiData *data;
|
||||
NMWifiUtils *data;
|
||||
|
||||
nm_assert (klass);
|
||||
nm_assert (klass->struct_size > sizeof (WifiData));
|
||||
nm_assert (klass->struct_size > sizeof (NMWifiUtils));
|
||||
|
||||
data = g_malloc0 (klass->struct_size);
|
||||
data->klass = klass;
|
||||
|
@ -53,24 +53,24 @@ wifi_data_new (const WifiDataClass *klass, int ifindex)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
WifiData *
|
||||
wifi_utils_init (int ifindex, gboolean check_scan)
|
||||
NMWifiUtils *
|
||||
nm_wifi_utils_init (int ifindex, gboolean check_scan)
|
||||
{
|
||||
WifiData *ret;
|
||||
NMWifiUtils *ret;
|
||||
|
||||
g_return_val_if_fail (ifindex > 0, NULL);
|
||||
|
||||
ret = wifi_nl80211_init (ifindex);
|
||||
ret = nm_wifi_utils_nl80211_init (ifindex);
|
||||
if (ret == NULL) {
|
||||
#if HAVE_WEXT
|
||||
ret = wifi_wext_init (ifindex, check_scan);
|
||||
ret = nm_wifi_utils_wext_init (ifindex, check_scan);
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
NMDeviceWifiCapabilities
|
||||
wifi_utils_get_caps (WifiData *data)
|
||||
nm_wifi_utils_get_caps (NMWifiUtils *data)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, NM_WIFI_DEVICE_CAP_NONE);
|
||||
|
||||
|
@ -78,14 +78,14 @@ wifi_utils_get_caps (WifiData *data)
|
|||
}
|
||||
|
||||
NM80211Mode
|
||||
wifi_utils_get_mode (WifiData *data)
|
||||
nm_wifi_utils_get_mode (NMWifiUtils *data)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, NM_802_11_MODE_UNKNOWN);
|
||||
return data->klass->get_mode (data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
wifi_utils_set_mode (WifiData *data, const NM80211Mode mode)
|
||||
nm_wifi_utils_set_mode (NMWifiUtils *data, const NM80211Mode mode)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
g_return_val_if_fail ( (mode == NM_802_11_MODE_INFRA)
|
||||
|
@ -97,7 +97,7 @@ wifi_utils_set_mode (WifiData *data, const NM80211Mode mode)
|
|||
}
|
||||
|
||||
gboolean
|
||||
wifi_utils_set_powersave (WifiData *data, guint32 powersave)
|
||||
nm_wifi_utils_set_powersave (NMWifiUtils *data, guint32 powersave)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
|
||||
|
@ -124,14 +124,14 @@ wifi_utils_set_wake_on_wlan (WifiData *data, NMSettingWirelessWakeOnWLan wowl)
|
|||
}
|
||||
|
||||
guint32
|
||||
wifi_utils_get_freq (WifiData *data)
|
||||
nm_wifi_utils_get_freq (NMWifiUtils *data)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, 0);
|
||||
return data->klass->get_freq (data);
|
||||
}
|
||||
|
||||
guint32
|
||||
wifi_utils_find_freq (WifiData *data, const guint32 *freqs)
|
||||
nm_wifi_utils_find_freq (NMWifiUtils *data, const guint32 *freqs)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, 0);
|
||||
g_return_val_if_fail (freqs != NULL, 0);
|
||||
|
@ -139,7 +139,7 @@ wifi_utils_find_freq (WifiData *data, const guint32 *freqs)
|
|||
}
|
||||
|
||||
gboolean
|
||||
wifi_utils_get_bssid (WifiData *data, guint8 *out_bssid)
|
||||
nm_wifi_utils_get_bssid (NMWifiUtils *data, guint8 *out_bssid)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
g_return_val_if_fail (out_bssid != NULL, FALSE);
|
||||
|
@ -149,21 +149,21 @@ wifi_utils_get_bssid (WifiData *data, guint8 *out_bssid)
|
|||
}
|
||||
|
||||
guint32
|
||||
wifi_utils_get_rate (WifiData *data)
|
||||
nm_wifi_utils_get_rate (NMWifiUtils *data)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, 0);
|
||||
return data->klass->get_rate (data);
|
||||
}
|
||||
|
||||
int
|
||||
wifi_utils_get_qual (WifiData *data)
|
||||
nm_wifi_utils_get_qual (NMWifiUtils *data)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, 0);
|
||||
return data->klass->get_qual (data);
|
||||
}
|
||||
|
||||
void
|
||||
wifi_utils_unref (WifiData *data)
|
||||
nm_wifi_utils_unref (NMWifiUtils *data)
|
||||
{
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
|
@ -172,14 +172,14 @@ wifi_utils_unref (WifiData *data)
|
|||
}
|
||||
|
||||
gboolean
|
||||
wifi_utils_is_wifi (int dirfd, const char *ifname)
|
||||
nm_wifi_utils_is_wifi (int dirfd, const char *ifname)
|
||||
{
|
||||
g_return_val_if_fail (dirfd >= 0, FALSE);
|
||||
|
||||
if (faccessat (dirfd, "phy80211", F_OK, 0) == 0)
|
||||
return TRUE;
|
||||
#if HAVE_WEXT
|
||||
if (wifi_wext_is_wifi (ifname))
|
||||
if (nm_wifi_utils_wext_is_wifi (ifname))
|
||||
return TRUE;
|
||||
#endif
|
||||
return FALSE;
|
||||
|
@ -188,7 +188,7 @@ wifi_utils_is_wifi (int dirfd, const char *ifname)
|
|||
/* OLPC Mesh-only functions */
|
||||
|
||||
guint32
|
||||
wifi_utils_get_mesh_channel (WifiData *data)
|
||||
nm_wifi_utils_get_mesh_channel (NMWifiUtils *data)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
g_return_val_if_fail (data->klass->get_mesh_channel != NULL, FALSE);
|
||||
|
@ -196,7 +196,7 @@ wifi_utils_get_mesh_channel (WifiData *data)
|
|||
}
|
||||
|
||||
gboolean
|
||||
wifi_utils_set_mesh_channel (WifiData *data, guint32 channel)
|
||||
nm_wifi_utils_set_mesh_channel (NMWifiUtils *data, guint32 channel)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
g_return_val_if_fail (channel <= 13, FALSE);
|
||||
|
@ -205,7 +205,7 @@ wifi_utils_set_mesh_channel (WifiData *data, guint32 channel)
|
|||
}
|
||||
|
||||
gboolean
|
||||
wifi_utils_set_mesh_ssid (WifiData *data, const guint8 *ssid, gsize len)
|
||||
nm_wifi_utils_set_mesh_ssid (NMWifiUtils *data, const guint8 *ssid, gsize len)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
g_return_val_if_fail (data->klass->set_mesh_ssid != NULL, FALSE);
|
||||
|
@ -213,7 +213,7 @@ wifi_utils_set_mesh_ssid (WifiData *data, const guint8 *ssid, gsize len)
|
|||
}
|
||||
|
||||
gboolean
|
||||
wifi_utils_indicate_addressing_running (WifiData *data, gboolean running)
|
||||
nm_wifi_utils_indicate_addressing_running (NMWifiUtils *data, gboolean running)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
if (data->klass->indicate_addressing_running)
|
|
@ -27,50 +27,50 @@
|
|||
#include "nm-dbus-interface.h"
|
||||
#include "nm-setting-wireless.h"
|
||||
|
||||
typedef struct WifiData WifiData;
|
||||
typedef struct NMWifiUtils NMWifiUtils;
|
||||
|
||||
gboolean wifi_utils_is_wifi (int dirfd, const char *ifname);
|
||||
gboolean nm_wifi_utils_is_wifi (int dirfd, const char *ifname);
|
||||
|
||||
WifiData *wifi_utils_init (int ifindex, gboolean check_scan);
|
||||
NMWifiUtils *nm_wifi_utils_init (int ifindex, gboolean check_scan);
|
||||
|
||||
void wifi_utils_unref (WifiData *data);
|
||||
void nm_wifi_utils_unref (NMWifiUtils *data);
|
||||
|
||||
NMDeviceWifiCapabilities wifi_utils_get_caps (WifiData *data);
|
||||
NMDeviceWifiCapabilities nm_wifi_utils_get_caps (NMWifiUtils *data);
|
||||
|
||||
NM80211Mode wifi_utils_get_mode (WifiData *data);
|
||||
NM80211Mode nm_wifi_utils_get_mode (NMWifiUtils *data);
|
||||
|
||||
gboolean wifi_utils_set_mode (WifiData *data, const NM80211Mode mode);
|
||||
gboolean nm_wifi_utils_set_mode (NMWifiUtils *data, const NM80211Mode mode);
|
||||
|
||||
/* Returns frequency in MHz */
|
||||
guint32 wifi_utils_get_freq (WifiData *data);
|
||||
guint32 nm_wifi_utils_get_freq (NMWifiUtils *data);
|
||||
|
||||
/* Return the first supported frequency in the zero-terminated list.
|
||||
* Frequencies are specified in MHz. */
|
||||
guint32 wifi_utils_find_freq (WifiData *data, const guint32 *freqs);
|
||||
guint32 nm_wifi_utils_find_freq (NMWifiUtils *data, const guint32 *freqs);
|
||||
|
||||
/* out_bssid must be ETH_ALEN bytes */
|
||||
gboolean wifi_utils_get_bssid (WifiData *data, guint8 *out_bssid);
|
||||
gboolean nm_wifi_utils_get_bssid (NMWifiUtils *data, guint8 *out_bssid);
|
||||
|
||||
/* Returns current bitrate in Kbps */
|
||||
guint32 wifi_utils_get_rate (WifiData *data);
|
||||
guint32 nm_wifi_utils_get_rate (NMWifiUtils *data);
|
||||
|
||||
/* Returns quality 0 - 100% on succes, or -1 on error */
|
||||
int wifi_utils_get_qual (WifiData *data);
|
||||
int nm_wifi_utils_get_qual (NMWifiUtils *data);
|
||||
|
||||
/* Tells the driver DHCP or SLAAC is running */
|
||||
gboolean wifi_utils_indicate_addressing_running (WifiData *data, gboolean running);
|
||||
gboolean nm_wifi_utils_indicate_addressing_running (NMWifiUtils *data, gboolean running);
|
||||
|
||||
gboolean wifi_utils_set_powersave (WifiData *data, guint32 powersave);
|
||||
gboolean nm_wifi_utils_set_powersave (NMWifiUtils *data, guint32 powersave);
|
||||
|
||||
NMSettingWirelessWakeOnWLan wifi_utils_get_wake_on_wlan (WifiData *data);
|
||||
|
||||
gboolean wifi_utils_set_wake_on_wlan (WifiData *data, NMSettingWirelessWakeOnWLan wowl);
|
||||
|
||||
/* OLPC Mesh-only functions */
|
||||
guint32 wifi_utils_get_mesh_channel (WifiData *data);
|
||||
guint32 nm_wifi_utils_get_mesh_channel (NMWifiUtils *data);
|
||||
|
||||
gboolean wifi_utils_set_mesh_channel (WifiData *data, guint32 channel);
|
||||
gboolean nm_wifi_utils_set_mesh_channel (NMWifiUtils *data, guint32 channel);
|
||||
|
||||
gboolean wifi_utils_set_mesh_ssid (WifiData *data, const guint8 *ssid, gsize len);
|
||||
gboolean nm_wifi_utils_set_mesh_ssid (NMWifiUtils *data, const guint8 *ssid, gsize len);
|
||||
|
||||
#endif /* __WIFI_UTILS_H__ */
|
Loading…
Reference in a new issue