eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 61d0abe910cd25c07f0eee75dc29dc3ca3e8c413
parent 6096d8895d970713fde76d0a34afa434a3cad4bd
Author: Denis Kenzior <denkenz@gmail.com>
Date:   Fri, 16 Apr 2021 15:16:33 -0500

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

Diffstat:
Msrc/dbus.c | 24------------------------
Msrc/dbus.h | 2--
Msrc/device.c | 2+-
Msrc/netdev.c | 22++++++++++++++++++++++
Msrc/netdev.h | 2++
Msrc/wiphy.c | 2+-
6 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/src/dbus.c b/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", diff --git a/src/dbus.h b/src/dbus.h @@ -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); diff --git a/src/device.c b/src/device.c @@ -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"; diff --git a/src/netdev.c b/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 = diff --git a/src/netdev.h b/src/netdev.h @@ -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); diff --git a/src/wiphy.c b/src/wiphy.c @@ -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); }