mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
netdev: Move iftype_to_string utility
Move and rename this utility into netdev_iftype_to_string away from dbus.c. This also allows us to drop including nl80211.h in dbus.c
This commit is contained in:
parent
6096d8895d
commit
61d0abe910
24
src/dbus.c
24
src/dbus.c
@ -30,36 +30,12 @@
|
||||
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include "linux/nl80211.h"
|
||||
|
||||
#include "src/agent.h"
|
||||
#include "src/iwd.h"
|
||||
#include "src/dbus.h"
|
||||
|
||||
static struct l_dbus *g_dbus = NULL;
|
||||
|
||||
const char *dbus_iftype_to_string(uint32_t iftype)
|
||||
{
|
||||
switch (iftype) {
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
return "ad-hoc";
|
||||
case NL80211_IFTYPE_STATION:
|
||||
return "station";
|
||||
case NL80211_IFTYPE_AP:
|
||||
return "ap";
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
return "p2p-client";
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
return "p2p-go";
|
||||
case NL80211_IFTYPE_P2P_DEVICE:
|
||||
return "p2p-device";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct l_dbus_message *dbus_error_busy(struct l_dbus_message *msg)
|
||||
{
|
||||
return l_dbus_message_new_error(msg, IWD_SERVICE ".InProgress",
|
||||
|
@ -56,8 +56,6 @@ bool dbus_append_dict_basic(struct l_dbus_message_builder *builder,
|
||||
const char *name, char type,
|
||||
const void *data);
|
||||
|
||||
const char *dbus_iftype_to_string(unsigned int iftype);
|
||||
|
||||
struct l_dbus_message *dbus_error_busy(struct l_dbus_message *msg);
|
||||
struct l_dbus_message *dbus_error_failed(struct l_dbus_message *msg);
|
||||
struct l_dbus_message *dbus_error_aborted(struct l_dbus_message *msg);
|
||||
|
@ -194,7 +194,7 @@ static bool device_property_get_mode(struct l_dbus *dbus,
|
||||
{
|
||||
struct device *device = user_data;
|
||||
uint32_t iftype = netdev_get_iftype(device->netdev);
|
||||
const char *modestr = dbus_iftype_to_string(iftype);
|
||||
const char *modestr = netdev_iftype_to_string(iftype);
|
||||
|
||||
if (modestr == NULL)
|
||||
modestr = "unknown";
|
||||
|
22
src/netdev.c
22
src/netdev.c
@ -194,6 +194,28 @@ static struct watchlist netdev_watches;
|
||||
static bool pae_over_nl80211;
|
||||
static bool mac_per_ssid;
|
||||
|
||||
const char *netdev_iftype_to_string(uint32_t iftype)
|
||||
{
|
||||
switch (iftype) {
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
return "ad-hoc";
|
||||
case NL80211_IFTYPE_STATION:
|
||||
return "station";
|
||||
case NL80211_IFTYPE_AP:
|
||||
return "ap";
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
return "p2p-client";
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
return "p2p-go";
|
||||
case NL80211_IFTYPE_P2P_DEVICE:
|
||||
return "p2p-device";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool is_offload(struct handshake_state *hs)
|
||||
{
|
||||
struct netdev_handshake_state *nhs =
|
||||
|
@ -122,6 +122,8 @@ typedef void (*netdev_get_station_cb_t)(
|
||||
const struct diagnostic_station_info *info,
|
||||
void *user_data);
|
||||
|
||||
const char *netdev_iftype_to_string(uint32_t iftype);
|
||||
|
||||
struct wiphy *netdev_get_wiphy(struct netdev *netdev);
|
||||
const uint8_t *netdev_get_address(struct netdev *netdev);
|
||||
uint32_t netdev_get_ifindex(struct netdev *netdev);
|
||||
|
@ -604,7 +604,7 @@ static char **wiphy_get_supported_iftypes(struct wiphy *wiphy, uint16_t mask)
|
||||
if (!(supported_mask & (1 << i)))
|
||||
continue;
|
||||
|
||||
str = dbus_iftype_to_string(i + 1);
|
||||
str = netdev_iftype_to_string(i + 1);
|
||||
if (str)
|
||||
ret[j++] = l_strdup(str);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user