From c5c509634af9e22f73e552fcddf3d2593519a038 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 00:05:32 +0100 Subject: [PATCH 01/16] introspection/docs: add missing "Since" comments to Wi-Fi P2P D-Bus API --- ...ktop.NetworkManager.Device.P2PWireless.xml | 17 +++++++++++++++++ ...org.freedesktop.NetworkManager.P2PPeer.xml | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/introspection/org.freedesktop.NetworkManager.Device.P2PWireless.xml b/introspection/org.freedesktop.NetworkManager.Device.P2PWireless.xml index 6f7bdeaeb6..0e6a1cbca2 100644 --- a/introspection/org.freedesktop.NetworkManager.Device.P2PWireless.xml +++ b/introspection/org.freedesktop.NetworkManager.Device.P2PWireless.xml @@ -4,6 +4,7 @@ org.freedesktop.NetworkManager.Device.P2PWireless: @short_description: P2P Wi-Fi Device + Since: 1.16 --> @@ -12,6 +13,8 @@ HwAddress: The active hardware address of the device. + + Since: 1.16 --> @@ -19,6 +22,8 @@ GroupOwner: Whether this device is currently the group owner. + + Since: 1.16 --> @@ -26,6 +31,8 @@ WFDIEs: The Wi-Fi Display information elements. + + Since: 1.16 --> @@ -48,6 +57,8 @@ 30 seconds. Start a find operation for P2P peers. + + Since: 1.16 --> @@ -57,6 +68,8 @@ StopFind: Stop an ongoing find operation again. + + Since: 1.16 --> @@ -66,6 +79,8 @@ @peer: The object path of the newly found access point. Emitted when a new P2P peer is found by the device. + + Since: 1.16 --> @@ -76,6 +91,8 @@ @peer: The object path of the P2P peer that has disappeared. Emitted when a P2P peer disappears from view of the device. + + Since: 1.16 --> diff --git a/introspection/org.freedesktop.NetworkManager.P2PPeer.xml b/introspection/org.freedesktop.NetworkManager.P2PPeer.xml index 1a1cf71308..4ffba1d14e 100644 --- a/introspection/org.freedesktop.NetworkManager.P2PPeer.xml +++ b/introspection/org.freedesktop.NetworkManager.P2PPeer.xml @@ -4,6 +4,7 @@ org.freedesktop.NetworkManager.P2PPeer: @short_description: P2P Wi-Fi Peer + Since: 1.16 --> @@ -14,6 +15,8 @@ Flags describing the capabilities of the access point. Returns: NM80211ApFlags + + Since: 1.16 --> @@ -21,6 +24,8 @@ Manufacturer: The manufacturer of the P2P peer. + + Since: 1.16 --> @@ -28,6 +33,8 @@ Model: The model of the P2P peer. + + Since: 1.16 --> @@ -35,6 +42,8 @@ ModelNumber: The model number of the P2P peer. + + Since: 1.16 --> @@ -42,6 +51,8 @@ Serial: The serial number of the P2P peer. + + Since: 1.16 --> @@ -49,6 +60,8 @@ Wfdies: The Wi-Fi Display Information Elements of the P2P peer. + + Since: 1.16 --> @@ -56,6 +69,8 @@ HwAddress: The hardware address (BSSID) of the access point. + + Since: 1.16 --> @@ -63,6 +78,8 @@ Strength: The current signal quality of the access point, in percent. + + Since: 1.16 --> @@ -72,6 +89,8 @@ 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. + + Since: 1.16 --> From 2d649305f811ecb0b2ae9cdc2dd18452f4ad3867 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 27 Jan 2019 23:55:06 +0100 Subject: [PATCH 02/16] cli/trivial: order code in "nm-meta-setting-desc.c" alphabetically --- clients/common/nm-meta-setting-desc.c | 58 +++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index e6d1cafba3..41cf35d93e 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -6619,6 +6619,27 @@ static const NMMetaPropertyInfo *const property_infos_OLPC_MESH[] = { NULL }; +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_P2P_WIRELESS +static const NMMetaPropertyInfo *const property_infos_P2P_WIRELESS[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_P2P_WIRELESS_PEER, + .is_cli_option = TRUE, + .property_alias = "peer", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("Peer"), + .property_type = &_pt_gobject_mac, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_wireless_security_wps_method_get_type, + ), + ), + ), + NULL +}; + #undef _CURRENT_NM_META_SETTING_TYPE #define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PPPOE static const NMMetaPropertyInfo *const property_infos_PPPOE[] = { @@ -7843,27 +7864,6 @@ static const NMMetaPropertyInfo *const property_infos_6LOWPAN[] = { NULL }; -#undef _CURRENT_NM_META_SETTING_TYPE -#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_P2P_WIRELESS -static const NMMetaPropertyInfo *const property_infos_P2P_WIRELESS[] = { - PROPERTY_INFO_WITH_DESC (NM_SETTING_P2P_WIRELESS_PEER, - .is_cli_option = TRUE, - .property_alias = "peer", - .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, - .prompt = N_("Peer"), - .property_type = &_pt_gobject_mac, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, - .property_type = &_pt_gobject_enum, - .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( - PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, - .get_gtype = nm_setting_wireless_security_wps_method_get_type, - ), - ), - ), - NULL -}; - /*****************************************************************************/ static void @@ -7985,6 +7985,7 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN) /*****************************************************************************/ +#define SETTING_PRETTY_NAME_6LOWPAN N_("6LOWPAN settings") #define SETTING_PRETTY_NAME_802_1X N_("802-1x settings") #define SETTING_PRETTY_NAME_ADSL N_("ADSL connection") #define SETTING_PRETTY_NAME_BLUETOOTH N_("bluetooth connection") @@ -8010,6 +8011,7 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN) #define SETTING_PRETTY_NAME_OVS_INTERFACE N_("Open vSwitch interface settings") #define SETTING_PRETTY_NAME_OVS_PATCH N_("Open vSwitch patch interface settings") #define SETTING_PRETTY_NAME_OVS_PORT N_("Open vSwitch port settings") +#define SETTING_PRETTY_NAME_P2P_WIRELESS N_("P2P Wi-Fi connection") #define SETTING_PRETTY_NAME_PPP N_("PPP settings") #define SETTING_PRETTY_NAME_PPPOE N_("PPPoE") #define SETTING_PRETTY_NAME_PROXY N_("Proxy") @@ -8028,8 +8030,6 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN) #define SETTING_PRETTY_NAME_WIRELESS N_("Wi-Fi connection") #define SETTING_PRETTY_NAME_WIRELESS_SECURITY N_("Wi-Fi security settings") #define SETTING_PRETTY_NAME_WPAN N_("WPAN settings") -#define SETTING_PRETTY_NAME_6LOWPAN N_("6LOWPAN settings") -#define SETTING_PRETTY_NAME_P2P_WIRELESS N_("P2P Wi-Fi connection") #define NM_META_SETTING_VALID_PARTS(...) \ ((const NMMetaSettingValidPartItem *const[]) { __VA_ARGS__ NULL }) @@ -8205,6 +8205,12 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = { NM_META_SETTING_VALID_PART_ITEM (OVS_PORT, TRUE), ), ), + SETTING_INFO (P2P_WIRELESS, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (P2P_WIRELESS, TRUE), + ), + ), SETTING_INFO (PPPOE, /* PPPoE is a base connection type from historical reasons. * See libnm-core/nm-setting.c:_nm_setting_is_base_type() @@ -8304,12 +8310,6 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = { NM_META_SETTING_VALID_PART_ITEM (WPAN, TRUE), ), ), - SETTING_INFO (P2P_WIRELESS, - .valid_parts = NM_META_SETTING_VALID_PARTS ( - NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), - NM_META_SETTING_VALID_PART_ITEM (P2P_WIRELESS, TRUE), - ), - ), }; /*****************************************************************************/ From 4ac6c7fdf1b7b99fb5199e071f5a9954f3cdb6a6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 00:11:06 +0100 Subject: [PATCH 03/16] all/trivial: whitespace --- libnm-core/nm-setting-p2p-wireless.h | 4 ++-- src/devices/wifi/nm-device-p2p-wifi.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libnm-core/nm-setting-p2p-wireless.h b/libnm-core/nm-setting-p2p-wireless.h index 4880867198..1f89e18f45 100644 --- a/libnm-core/nm-setting-p2p-wireless.h +++ b/libnm-core/nm-setting-p2p-wireless.h @@ -61,10 +61,10 @@ NM_AVAILABLE_IN_1_16 GType nm_setting_p2p_wireless_get_type (void); NM_AVAILABLE_IN_1_16 -NMSetting *nm_setting_p2p_wireless_new (void); +NMSetting *nm_setting_p2p_wireless_new (void); NM_AVAILABLE_IN_1_16 -const char *nm_setting_p2p_wireless_get_peer (NMSettingP2PWireless *setting); +const char *nm_setting_p2p_wireless_get_peer (NMSettingP2PWireless *setting); NM_AVAILABLE_IN_1_16 NMSettingWirelessSecurityWpsMethod nm_setting_p2p_wireless_get_wps_method (NMSettingP2PWireless *setting); diff --git a/src/devices/wifi/nm-device-p2p-wifi.c b/src/devices/wifi/nm-device-p2p-wifi.c index e9b7f68c71..d7d6001dde 100644 --- a/src/devices/wifi/nm-device-p2p-wifi.c +++ b/src/devices/wifi/nm-device-p2p-wifi.c @@ -1131,7 +1131,7 @@ nm_device_p2p_wifi_set_mgmt_iface (NMDeviceP2PWifi *self, void nm_device_p2p_wifi_remove (NMDeviceP2PWifi* self) { - g_signal_emit_by_name (self, NM_DEVICE_REMOVED); + g_signal_emit_by_name (self, NM_DEVICE_REMOVED); } /*****************************************************************************/ From ab5b6f6f8130c809cc5c598e996db3c77b503c1d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 00:18:40 +0100 Subject: [PATCH 04/16] libnm-core: minor cleanup of NMSettingP2PWireless --- libnm-core/nm-setting-p2p-wireless.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/libnm-core/nm-setting-p2p-wireless.c b/libnm-core/nm-setting-p2p-wireless.c index e49ff0d995..32597e1dde 100644 --- a/libnm-core/nm-setting-p2p-wireless.c +++ b/libnm-core/nm-setting-p2p-wireless.c @@ -41,6 +41,8 @@ * NMSettingP2PWireless: * * P2P Wi-Fi Settings + * + * Since: 1.16 */ /*****************************************************************************/ @@ -107,12 +109,23 @@ nm_setting_p2p_wireless_get_wps_method (NMSettingP2PWireless *setting) return NM_SETTING_P2P_WIRELESS_GET_PRIVATE (setting)->wps_method; } +/*****************************************************************************/ + static gboolean verify (NMSetting *setting, NMConnection *connection, GError **error) { NMSettingP2PWirelessPrivate *priv = NM_SETTING_P2P_WIRELESS_GET_PRIVATE (setting); - if (!priv->peer_mac_address || !nm_utils_hwaddr_valid (priv->peer_mac_address, ETH_ALEN)) { + if (!priv->peer_mac_address) { + g_set_error_literal (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_MISSING_PROPERTY, + _("property is missing")); + g_prefix_error (error, "%s.%s: ", NM_SETTING_P2P_WIRELESS_SETTING_NAME, NM_SETTING_P2P_WIRELESS_PEER); + return FALSE; + } + + if (!nm_utils_hwaddr_valid (priv->peer_mac_address, ETH_ALEN)) { g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, @@ -209,7 +222,7 @@ nm_setting_p2p_wireless_init (NMSettingP2PWireless *setting) NMSetting * nm_setting_p2p_wireless_new (void) { - return (NMSetting *) g_object_new (NM_TYPE_SETTING_P2P_WIRELESS, NULL); + return g_object_new (NM_TYPE_SETTING_P2P_WIRELESS, NULL); } static void @@ -228,8 +241,8 @@ nm_setting_p2p_wireless_class_init (NMSettingP2PWirelessClass *setting_p2p_wirel GObjectClass *object_class = G_OBJECT_CLASS (setting_p2p_wireless_class); NMSettingClass *setting_class = NM_SETTING_CLASS (setting_p2p_wireless_class); - object_class->set_property = set_property; object_class->get_property = get_property; + object_class->set_property = set_property; object_class->finalize = finalize; setting_class->verify = verify; From efbcac25b8f087211039874abd9b03afd3f1c5c6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 00:36:08 +0100 Subject: [PATCH 05/16] libnm-core: fix and cleanup validation of WPS-method for Wi-Fi P2P setting The check for Wi-Fi P2P's wps-method was not correct. While at it, move the logic to validate WPS-method flags in an utility function. --- libnm-core/nm-setting-p2p-wireless.c | 27 +++------------ libnm-core/nm-setting-wireless-security.c | 22 +++---------- libnm-core/nm-utils-private.h | 6 ++++ libnm-core/nm-utils.c | 40 +++++++++++++++++++++++ 4 files changed, 56 insertions(+), 39 deletions(-) diff --git a/libnm-core/nm-setting-p2p-wireless.c b/libnm-core/nm-setting-p2p-wireless.c index 32597e1dde..e791749bfd 100644 --- a/libnm-core/nm-setting-p2p-wireless.c +++ b/libnm-core/nm-setting-p2p-wireless.c @@ -134,29 +134,12 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - if (priv->wps_method > NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_PIN) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("property is invalid")); + if (!_nm_utils_wps_method_validate (priv->wps_method, + NM_SETTING_P2P_WIRELESS_SETTING_NAME, + NM_SETTING_P2P_WIRELESS_WPS_METHOD, + TRUE, + error)) return FALSE; - } - - if (priv->wps_method > NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("P2P connections require WPS")); - return FALSE; - } - - if (priv->wps_method > NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("P2P connections require WPS")); - return FALSE; - } return TRUE; } diff --git a/libnm-core/nm-setting-wireless-security.c b/libnm-core/nm-setting-wireless-security.c index fe339d9e36..c38d21ff10 100644 --- a/libnm-core/nm-setting-wireless-security.c +++ b/libnm-core/nm-setting-wireless-security.c @@ -1084,24 +1084,12 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - /* WPS */ - if (priv->wps_method > NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_PIN) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("property is invalid")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_WPS_METHOD); + if (!_nm_utils_wps_method_validate (priv->wps_method, + NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, + NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, + FALSE, + error)) return FALSE; - } - - if (priv->wps_method & NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED && priv->wps_method != NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("can't be simultaneously disabled and enabled")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_WPS_METHOD); - return FALSE; - } return TRUE; } diff --git a/libnm-core/nm-utils-private.h b/libnm-core/nm-utils-private.h index 58822cdeff..b61260cb22 100644 --- a/libnm-core/nm-utils-private.h +++ b/libnm-core/nm-utils-private.h @@ -41,6 +41,12 @@ struct _NMVariantAttributeSpec { gboolean _nm_utils_string_slist_validate (GSList *list, const char **valid_values); +gboolean _nm_utils_wps_method_validate (NMSettingWirelessSecurityWpsMethod wps_method, + const char *setting_name, + const char *property_name, + gboolean wps_required, + GError **error); + /* D-Bus transform funcs */ GVariant *_nm_utils_hwaddr_cloned_get (NMSetting *setting, diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 4709971281..bb43a9aec0 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -4311,6 +4311,46 @@ _nm_utils_hwaddr_from_dbus (GVariant *dbus_value, /*****************************************************************************/ +gboolean +_nm_utils_wps_method_validate (NMSettingWirelessSecurityWpsMethod wps_method, + const char *setting_name, + const char *property_name, + gboolean wps_required, + GError **error) +{ + if (wps_method > NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_PIN) { + g_set_error_literal (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("property is invalid")); + g_prefix_error (error, "%s.%s: ", setting_name, property_name); + return FALSE; + } + + if (NM_FLAGS_HAS (wps_method, NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED)) { + if (wps_method != NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED) { + g_set_error_literal (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("can't be simultaneously disabled and enabled")); + g_prefix_error (error, "%s.%s: ", setting_name, property_name); + return FALSE; + } + if (wps_required) { + g_set_error_literal (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("WPS is required")); + g_prefix_error (error, "%s.%s: ", setting_name, property_name); + return FALSE; + } + } + + return TRUE; +} + +/*****************************************************************************/ + static char * _split_word (char *s) { From 41b2d8c6c996767251d667e36d3a9be2614b9559 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 11:48:09 +0100 Subject: [PATCH 06/16] libnm/device-p2p-wifi: cleanup peers handling Don't reallocate peers-array nor set it to %NULL. Instead, just emit the signal for the peers and take them out one-by-one. I am slightly surprised, that the peers array does not need to hold a reference on the NMP2PPeer instances. But that seems intentional. I think, the libnm code here should be significantly reworked, but that is for another time. Also, delay clearing the pointers until finalize() method. For the most part, it shouldn't make a difference. Still avoid having the instance in a badly defined state during dispose() (which theoretically could be called multiple times). --- libnm/nm-device-p2p-wifi.c | 42 ++++++++++++-------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/libnm/nm-device-p2p-wifi.c b/libnm/nm-device-p2p-wifi.c index 4d740fafec..b91392b7e8 100644 --- a/libnm/nm-device-p2p-wifi.c +++ b/libnm/nm-device-p2p-wifi.c @@ -171,31 +171,18 @@ nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *device, } static void -clean_up_peers (NMDeviceP2PWifi *self, gboolean in_dispose) +clean_up_peers (NMDeviceP2PWifi *self) { - NMDeviceP2PWifiPrivate *priv; - GPtrArray *peers; - int i; + NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); - g_return_if_fail (NM_IS_DEVICE_P2P_WIFI (self)); + while (priv->peers->len > 0) { + NMP2PPeer *peer; - priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + peer = priv->peers->pdata[priv->peers->len - 1]; + g_ptr_array_remove_index (priv->peers, priv->peers->len - 1); - peers = priv->peers; - - if (in_dispose) - priv->peers = NULL; - else { - priv->peers = g_ptr_array_new (); - - for (i = 0; i < peers->len; i++) { - NMP2PPeer *peer = NM_P2P_PEER (g_ptr_array_index (peers, i)); - - g_signal_emit (self, signals[PEER_REMOVED], 0, peer); - } + g_signal_emit (self, signals[PEER_REMOVED], 0, peer); } - - g_ptr_array_unref (peers); } static gboolean @@ -392,15 +379,7 @@ init_dbus (NMObject *object) static void dispose (GObject *object) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (object); - - if (priv->peers) - clean_up_peers (NM_DEVICE_P2P_WIFI (object), TRUE); - - g_clear_object (&priv->proxy); - if (priv->wfd_ies) - g_byte_array_unref (priv->wfd_ies); - priv->wfd_ies = NULL; + clean_up_peers (NM_DEVICE_P2P_WIFI (object)); G_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->dispose (object); } @@ -410,7 +389,12 @@ finalize (GObject *object) { NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (object); + g_clear_object (&priv->proxy); g_free (priv->hw_address); + if (priv->wfd_ies) + g_byte_array_unref (priv->wfd_ies); + if (priv->peers) + g_ptr_array_unref (priv->peers); G_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->finalize (object); } From c6c41eb17a05dbed8913477ce1b94e882bcc4110 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 00:49:40 +0100 Subject: [PATCH 07/16] libnm: various cleanup of NMP2PPeer and NMDeviceP2PWifi - fix leaking hw_address in finalize(). - reorder code. - avoid double tabs in GObject property definitions. - hide struct definitions from header. - don't use signal slots in class structure. - use NM_GOBJECT_PROPERTIES_DEFINE_BASE(). - add missing NM_AVAILABLE_IN_1_16 annotations. --- libnm/nm-device-p2p-wifi.c | 156 +++++++++++----------- libnm/nm-device-p2p-wifi.h | 30 ++--- libnm/nm-p2p-peer.c | 265 +++++++++++++++++++------------------ libnm/nm-p2p-peer.h | 19 +-- 4 files changed, 230 insertions(+), 240 deletions(-) diff --git a/libnm/nm-device-p2p-wifi.c b/libnm/nm-device-p2p-wifi.c index b91392b7e8..d7b68412cd 100644 --- a/libnm/nm-device-p2p-wifi.c +++ b/libnm/nm-device-p2p-wifi.c @@ -14,8 +14,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * Copyright 2007 - 2008 Novell, Inc. - * Copyright 2007 - 2018 Red Hat, Inc. + * Copyright 2018 - 2019 Red Hat, Inc. */ #include "nm-default.h" @@ -35,37 +34,19 @@ #include "introspection/org.freedesktop.NetworkManager.Device.P2PWireless.h" -G_DEFINE_TYPE (NMDeviceP2PWifi, nm_device_p2p_wifi, NM_TYPE_DEVICE) - -#define NM_DEVICE_P2P_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_P2P_WIFI, NMDeviceP2PWifiPrivate)) - -void _nm_device_p2p_wifi_set_p2p_wireless_enabled (NMDeviceP2PWifi *device, gboolean enabled); -static void state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data); +/*****************************************************************************/ typedef struct { NMDeviceP2PWifi *device; GSimpleAsyncResult *simple; } RequestScanInfo; -typedef struct { - NMDBusDeviceP2PWifi *proxy; - - char *hw_address; - - gboolean group_owner; - GByteArray *wfd_ies; - GPtrArray *peers; -} NMDeviceP2PWifiPrivate; - -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_GROUP_OWNER, PROP_WFDIES, PROP_PEERS, - - LAST_PROP -}; +); enum { PEER_ADDED, @@ -73,8 +54,44 @@ enum { LAST_SIGNAL }; + static guint signals[LAST_SIGNAL] = { 0 }; +typedef struct { + NMDBusDeviceP2PWifi *proxy; + + char *hw_address; + + GByteArray *wfd_ies; + GPtrArray *peers; + + gboolean group_owner; +} NMDeviceP2PWifiPrivate; + +/** + * NMDeviceP2PWifi: + * + * Since: 1.16 + */ +struct _NMDeviceP2PWifi { + NMDevice parent; + NMDeviceP2PWifiPrivate _priv; +}; + +struct _NMDeviceP2PWifiClass { + NMDeviceClass parent; +}; + +G_DEFINE_TYPE (NMDeviceP2PWifi, nm_device_p2p_wifi, NM_TYPE_DEVICE) + +#define NM_DEVICE_P2P_WIFI_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceP2PWifi, NM_IS_DEVICE_P2P_WIFI, NMDevice, NMObject) + +/*****************************************************************************/ + +static void state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data); + +/*****************************************************************************/ + /** * nm_device_p2p_wifi_get_hw_address: * @device: a #NMDeviceP2PWifi @@ -406,20 +423,15 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) NMObjectClass *nm_object_class = NM_OBJECT_CLASS (wifi_class); NMDeviceClass *device_class = NM_DEVICE_CLASS (wifi_class); - g_type_class_add_private (wifi_class, sizeof (NMDeviceP2PWifiPrivate)); - - /* virtual methods */ object_class->get_property = get_property; - object_class->dispose = dispose; - object_class->finalize = finalize; - - nm_object_class->init_dbus = init_dbus; + object_class->dispose = dispose; + object_class->finalize = finalize; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; - /* properties */ + nm_object_class->init_dbus = init_dbus; /** * NMDeviceP2PWifi:hw-address: @@ -428,12 +440,11 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_P2P_WIFI_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_P2P_WIFI_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** @@ -443,12 +454,11 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_GROUP_OWNER, - g_param_spec_boolean (NM_DEVICE_P2P_WIFI_GROUP_OWNER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_GROUP_OWNER] = + g_param_spec_boolean (NM_DEVICE_P2P_WIFI_GROUP_OWNER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceP2PWifi:wfd-ies: @@ -457,13 +467,12 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_WFDIES, - g_param_spec_variant (NM_DEVICE_P2P_WIFI_WFDIES, "", "", - G_VARIANT_TYPE ("ay"), - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WFDIES] = + g_param_spec_variant (NM_DEVICE_P2P_WIFI_WFDIES, "", "", + G_VARIANT_TYPE ("ay"), + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceP2PWifi:peers: (type GPtrArray(NMP2PPeer)) @@ -472,14 +481,13 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_PEERS, - g_param_spec_boxed (NM_DEVICE_P2P_WIFI_PEERS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PEERS] = + g_param_spec_boxed (NM_DEVICE_P2P_WIFI_PEERS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); - /* signals */ + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); /** * NMDeviceP2PWifi::peer-added: @@ -491,14 +499,13 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) * Since: 1.16 **/ signals[PEER_ADDED] = - g_signal_new ("peer-added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMDeviceP2PWifiClass, peer_added), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("peer-added", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); /** * NMDeviceP2PWifi::peer-removed: @@ -510,12 +517,11 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) * Since: 1.16 **/ signals[PEER_REMOVED] = - g_signal_new ("peer-removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMDeviceP2PWifiClass, peer_removed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("peer-removed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); } diff --git a/libnm/nm-device-p2p-wifi.h b/libnm/nm-device-p2p-wifi.h index 90a7242489..a5efabc47d 100644 --- a/libnm/nm-device-p2p-wifi.h +++ b/libnm/nm-device-p2p-wifi.h @@ -14,8 +14,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * Copyright 2007 - 2008 Novell, Inc. - * Copyright 2007 - 2018 Red Hat, Inc. + * Copyright 2018 - 2019 Red Hat, Inc. */ #ifndef __NM_DEVICE_P2P_WIFI_H__ @@ -41,41 +40,34 @@ G_BEGIN_DECLS #define NM_DEVICE_P2P_WIFI_PEERS "peers" #define NM_DEVICE_P2P_WIFI_WFDIES "wfdies" -/** - * NMDeviceP2PWifi: - */ -struct _NMDeviceP2PWifi { - NMDevice parent; -}; - -typedef struct { - NMDeviceClass parent; - - /* Signals */ - void (*peer_added) (NMDeviceP2PWifi *device, NMP2PPeer *peer); - void (*peer_removed) (NMDeviceP2PWifi *device, NMP2PPeer *peer); - - /*< private >*/ - gpointer padding[4]; -} NMDeviceP2PWifiClass; +typedef struct _NMDeviceP2PWifiClass NMDeviceP2PWifiClass; +NM_AVAILABLE_IN_1_16 GType nm_device_p2p_wifi_get_type (void); +NM_AVAILABLE_IN_1_16 const char * nm_device_p2p_wifi_get_hw_address (NMDeviceP2PWifi *device); + +NM_AVAILABLE_IN_1_16 gboolean nm_device_p2p_wifi_get_group_owner (NMDeviceP2PWifi *device); #if 0 gboolean nm_device_p2p_wifi_get_wfdies (NMDeviceP2PWifi *device); #endif +NM_AVAILABLE_IN_1_16 NMP2PPeer * nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *device, const char *path); +NM_AVAILABLE_IN_1_16 const GPtrArray * nm_device_p2p_wifi_get_peers (NMDeviceP2PWifi *device); +NM_AVAILABLE_IN_1_16 gboolean nm_device_p2p_wifi_start_find (NMDeviceP2PWifi *device, GCancellable *cancellable, GError **error); + +NM_AVAILABLE_IN_1_16 gboolean nm_device_p2p_wifi_stop_find (NMDeviceP2PWifi *device, GCancellable *cancellable, GError **error); diff --git a/libnm/nm-p2p-peer.c b/libnm/nm-p2p-peer.c index 7919424210..164a758e83 100644 --- a/libnm/nm-p2p-peer.c +++ b/libnm/nm-p2p-peer.c @@ -14,8 +14,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * Copyright 2007 - 2008 Novell, Inc. - * Copyright 2007 - 2018 Red Hat, Inc. + * Copyright 2018 - 2019 Red Hat, Inc. */ #include "nm-default.h" @@ -32,29 +31,9 @@ #include "nm-dbus-interface.h" #include "nm-object-private.h" -G_DEFINE_TYPE (NMP2PPeer, nm_p2p_peer, NM_TYPE_OBJECT) +/*****************************************************************************/ -#define NM_P2P_PEER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_P2P_PEER, NMP2PPeerPrivate)) - -typedef struct { - NM80211ApFlags flags; - - char *name; - char *manufacturer; - char *model; - char *model_number; - char *serial; - - GBytes *wfd_ies; - - char *hw_address; - - guint8 strength; - int last_seen; -} NMP2PPeerPrivate; - -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_FLAGS, PROP_NAME, PROP_MANUFACTURER, @@ -65,10 +44,44 @@ enum { PROP_HW_ADDRESS, PROP_STRENGTH, PROP_LAST_SEEN, +); - LAST_PROP +typedef struct { + char *name; + char *manufacturer; + char *model; + char *model_number; + char *serial; + + GBytes *wfd_ies; + + char *hw_address; + + int last_seen; + + NM80211ApFlags flags; + + guint8 strength; +} NMP2PPeerPrivate; + +/** + * NMP2PPeer: + */ +struct _NMP2PPeer { + NMObject parent; + NMP2PPeerPrivate _priv; }; +struct _NMP2PPeerClass { + NMObjectClass parent; +}; + +G_DEFINE_TYPE (NMP2PPeer, nm_p2p_peer, NM_TYPE_OBJECT) + +#define NM_P2P_PEER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMP2PPeer, NM_IS_P2P_PEER, NMObject) + +/*****************************************************************************/ + /** * nm_p2p_peer_get_flags: * @peer: a #NMP2PPeer @@ -279,25 +292,27 @@ nm_p2p_peer_connection_valid (NMP2PPeer *peer, NMConnection *connection) const char *hw_address; const char *setting_peer; + s_p2p_wifi = (NMSettingP2PWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_P2P_WIRELESS); + if (!s_p2p_wifi) + return FALSE; + s_con = nm_connection_get_setting_connection (connection); if (!s_con) return FALSE; ctype = nm_setting_connection_get_connection_type (s_con); - if (!ctype || !nm_streq (ctype, NM_SETTING_P2P_WIRELESS_SETTING_NAME)) - return FALSE; - - s_p2p_wifi = (NMSettingP2PWireless*) nm_connection_get_setting (connection, NM_TYPE_SETTING_P2P_WIRELESS); - if (!s_p2p_wifi) + if ( !ctype + || !nm_streq (ctype, NM_SETTING_P2P_WIRELESS_SETTING_NAME)) return FALSE; /* HW Address check */ hw_address = nm_p2p_peer_get_hw_address (peer); if (!hw_address) return FALSE; + setting_peer = nm_setting_p2p_wireless_get_peer (s_p2p_wifi); if ( !setting_peer - || g_strcmp0 (hw_address, setting_peer)) + || !nm_streq (hw_address, setting_peer)) return FALSE; return TRUE; @@ -329,7 +344,7 @@ GPtrArray * nm_p2p_peer_filter_connections (NMP2PPeer *peer, const GPtrArray *connections) { GPtrArray *filtered; - int i; + guint i; filtered = g_ptr_array_new_with_free_func (g_object_unref); for (i = 0; i < connections->len; i++) { @@ -344,6 +359,33 @@ nm_p2p_peer_filter_connections (NMP2PPeer *peer, const GPtrArray *connections) /*****************************************************************************/ +static void +init_dbus (NMObject *object) +{ + NMP2PPeerPrivate *priv = NM_P2P_PEER_GET_PRIVATE (object); + const NMPropertiesInfo property_info[] = { + { NM_P2P_PEER_FLAGS, &priv->flags }, + { NM_P2P_PEER_NAME, &priv->name }, + { NM_P2P_PEER_MANUFACTURER, &priv->manufacturer }, + { NM_P2P_PEER_MODEL, &priv->model }, + { NM_P2P_PEER_MODEL_NUMBER, &priv->model_number }, + { NM_P2P_PEER_SERIAL, &priv->serial }, + { NM_P2P_PEER_WFD_IES, &priv->wfd_ies }, + { NM_P2P_PEER_HW_ADDRESS, &priv->hw_address }, + { NM_P2P_PEER_STRENGTH, &priv->strength }, + { NM_P2P_PEER_LAST_SEEN, &priv->last_seen }, + { NULL }, + }; + + NM_OBJECT_CLASS (nm_p2p_peer_parent_class)->init_dbus (object); + + _nm_object_register_properties (object, + NM_DBUS_INTERFACE_P2P_PEER, + property_info); +} + +/*****************************************************************************/ + static void get_property (GObject *object, guint prop_id, @@ -389,6 +431,8 @@ get_property (GObject *object, } } +/*****************************************************************************/ + static void nm_p2p_peer_init (NMP2PPeer *peer) { @@ -406,53 +450,24 @@ finalize (GObject *object) g_free (priv->model_number); g_free (priv->serial); - if (priv->wfd_ies) - g_bytes_unref (priv->wfd_ies); + g_free (priv->hw_address); + + g_bytes_unref (priv->wfd_ies); G_OBJECT_CLASS (nm_p2p_peer_parent_class)->finalize (object); } static void -init_dbus (NMObject *object) +nm_p2p_peer_class_init (NMP2PPeerClass *klass) { - NMP2PPeerPrivate *priv = NM_P2P_PEER_GET_PRIVATE (object); - const NMPropertiesInfo property_info[] = { - { NM_P2P_PEER_FLAGS, &priv->flags }, - { NM_P2P_PEER_NAME, &priv->name }, - { NM_P2P_PEER_MANUFACTURER, &priv->manufacturer }, - { NM_P2P_PEER_MODEL, &priv->model }, - { NM_P2P_PEER_MODEL_NUMBER, &priv->model_number }, - { NM_P2P_PEER_SERIAL, &priv->serial }, - { NM_P2P_PEER_WFD_IES, &priv->wfd_ies }, - { NM_P2P_PEER_HW_ADDRESS, &priv->hw_address }, - { NM_P2P_PEER_STRENGTH, &priv->strength }, - { NM_P2P_PEER_LAST_SEEN, &priv->last_seen }, - { NULL }, - }; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + NMObjectClass *nm_object_class = NM_OBJECT_CLASS (klass); - NM_OBJECT_CLASS (nm_p2p_peer_parent_class)->init_dbus (object); - - _nm_object_register_properties (object, - NM_DBUS_INTERFACE_P2P_PEER, - property_info); -} - -static void -nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (peer_class); - NMObjectClass *nm_object_class = NM_OBJECT_CLASS (peer_class); - - g_type_class_add_private (peer_class, sizeof (NMP2PPeerPrivate)); - - /* virtual methods */ object_class->get_property = get_property; - object_class->finalize = finalize; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - /* properties */ - /** * NMP2PPeer:flags: * @@ -460,13 +475,12 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_FLAGS, - g_param_spec_flags (NM_P2P_PEER_FLAGS, "", "", - NM_TYPE_802_11_AP_FLAGS, - NM_802_11_AP_FLAGS_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FLAGS] = + g_param_spec_flags (NM_P2P_PEER_FLAGS, "", "", + NM_TYPE_802_11_AP_FLAGS, + NM_802_11_AP_FLAGS_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMP2PPeer:name: @@ -475,12 +489,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_NAME, - g_param_spec_string (NM_P2P_PEER_NAME, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NAME] = + g_param_spec_string (NM_P2P_PEER_NAME, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMP2PPeer:manufacturer: @@ -489,12 +502,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_MANUFACTURER, - g_param_spec_string (NM_P2P_PEER_MANUFACTURER, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MANUFACTURER] = + g_param_spec_string (NM_P2P_PEER_MANUFACTURER, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMP2PPeer:model: @@ -503,12 +515,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_MODEL, - g_param_spec_string (NM_P2P_PEER_MODEL, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MODEL] = + g_param_spec_string (NM_P2P_PEER_MODEL, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMP2PPeer:model-number: @@ -517,12 +528,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_MODEL_NUMBER, - g_param_spec_string (NM_P2P_PEER_MODEL_NUMBER, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MODEL_NUMBER] = + g_param_spec_string (NM_P2P_PEER_MODEL_NUMBER, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMP2PPeer:serial: @@ -531,12 +541,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_SERIAL, - g_param_spec_string (NM_P2P_PEER_SERIAL, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SERIAL] = + g_param_spec_string (NM_P2P_PEER_SERIAL, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMP2PPeer:wfd-ies: @@ -545,12 +554,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_WFD_IES, - g_param_spec_boxed (NM_P2P_PEER_WFD_IES, "", "", - G_TYPE_BYTES, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WFD_IES] = + g_param_spec_boxed (NM_P2P_PEER_WFD_IES, "", "", + G_TYPE_BYTES, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMP2PPeer:hw-address: * @@ -558,12 +566,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_P2P_PEER_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_P2P_PEER_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMP2PPeer:strength: @@ -572,12 +579,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_STRENGTH, - g_param_spec_uchar (NM_P2P_PEER_STRENGTH, "", "", - 0, G_MAXUINT8, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_STRENGTH] = + g_param_spec_uchar (NM_P2P_PEER_STRENGTH, "", "", + 0, G_MAXUINT8, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMP2PPeer:last-seen: @@ -587,10 +593,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_LAST_SEEN, - g_param_spec_int (NM_P2P_PEER_LAST_SEEN, "", "", - -1, G_MAXINT, -1, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LAST_SEEN] = + g_param_spec_int (NM_P2P_PEER_LAST_SEEN, "", "", + -1, G_MAXINT, -1, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-p2p-peer.h b/libnm/nm-p2p-peer.h index bb96df4312..0c52ecb3c0 100644 --- a/libnm/nm-p2p-peer.h +++ b/libnm/nm-p2p-peer.h @@ -14,8 +14,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * Copyright 2007 - 2008 Novell, Inc. - * Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2018 - 2019 Red Hat, Inc. */ #ifndef __NM_P2P_PEER_H__ @@ -47,21 +46,7 @@ G_BEGIN_DECLS #define NM_P2P_PEER_STRENGTH "strength" #define NM_P2P_PEER_LAST_SEEN "last-seen" -/** - * NMP2PPeer: - */ -NM_AVAILABLE_IN_1_16 -struct _NMP2PPeer { - NMObject parent; -}; - -NM_AVAILABLE_IN_1_16 -typedef struct { - NMObjectClass parent; - - /*< private >*/ - gpointer padding[4]; -} NMP2PPeerClass; +typedef struct _NMP2PPeerClass NMP2PPeerClass; NM_AVAILABLE_IN_1_16 GType nm_p2p_peer_get_type (void); From 4f8852b2f2c1478c59ad0f655efce27b8170d1dc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 11:54:23 +0100 Subject: [PATCH 08/16] libnm/device-p2p-wifi: drop unused code If this is going to be implemented, revert the patch. --- libnm/nm-device-p2p-wifi.c | 29 ----------------------------- libnm/nm-device-p2p-wifi.h | 4 ---- 2 files changed, 33 deletions(-) diff --git a/libnm/nm-device-p2p-wifi.c b/libnm/nm-device-p2p-wifi.c index d7b68412cd..fad25b58b1 100644 --- a/libnm/nm-device-p2p-wifi.c +++ b/libnm/nm-device-p2p-wifi.c @@ -88,10 +88,6 @@ G_DEFINE_TYPE (NMDeviceP2PWifi, nm_device_p2p_wifi, NM_TYPE_DEVICE) /*****************************************************************************/ -static void state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data); - -/*****************************************************************************/ - /** * nm_device_p2p_wifi_get_hw_address: * @device: a #NMDeviceP2PWifi @@ -345,34 +341,9 @@ nm_device_p2p_wifi_init (NMDeviceP2PWifi *device) { NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (device); - g_signal_connect (device, - "notify::" NM_DEVICE_STATE, - G_CALLBACK (state_changed_cb), - NULL); - priv->peers = g_ptr_array_new (); } -static void -state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data) -{ -#if 0 - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); - - switch (nm_device_get_state (device)) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_UNMANAGED: - case NM_DEVICE_STATE_UNAVAILABLE: - case NM_DEVICE_STATE_DISCONNECTED: - case NM_DEVICE_STATE_FAILED: - /* TODO: Do something? */ - break; - default: - break; - } -#endif -} - static void init_dbus (NMObject *object) { diff --git a/libnm/nm-device-p2p-wifi.h b/libnm/nm-device-p2p-wifi.h index a5efabc47d..e9bfb26a19 100644 --- a/libnm/nm-device-p2p-wifi.h +++ b/libnm/nm-device-p2p-wifi.h @@ -51,10 +51,6 @@ const char * nm_device_p2p_wifi_get_hw_address (NMDeviceP2PWifi *d NM_AVAILABLE_IN_1_16 gboolean nm_device_p2p_wifi_get_group_owner (NMDeviceP2PWifi *device); -#if 0 -gboolean nm_device_p2p_wifi_get_wfdies (NMDeviceP2PWifi *device); -#endif - NM_AVAILABLE_IN_1_16 NMP2PPeer * nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *device, const char *path); From 65c4af50c409efb7256a35867525fe7866559042 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 11:54:23 +0100 Subject: [PATCH 09/16] libnm-core/setting-p2p-wifi: drop unused code If this is going to be implemented, revert the patch. --- libnm-core/nm-setting-p2p-wireless.c | 4 ---- libnm-core/nm-setting-p2p-wireless.h | 9 --------- 2 files changed, 13 deletions(-) diff --git a/libnm-core/nm-setting-p2p-wireless.c b/libnm-core/nm-setting-p2p-wireless.c index e791749bfd..8188cab5d2 100644 --- a/libnm-core/nm-setting-p2p-wireless.c +++ b/libnm-core/nm-setting-p2p-wireless.c @@ -50,10 +50,6 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_PEER, PROP_WPS_METHOD, -#if 0 - PROP_WPS_PIN, - PROP_WPS_PIN_FLAGS, -#endif ); typedef struct { diff --git a/libnm-core/nm-setting-p2p-wireless.h b/libnm-core/nm-setting-p2p-wireless.h index 1f89e18f45..09ac934e31 100644 --- a/libnm-core/nm-setting-p2p-wireless.h +++ b/libnm-core/nm-setting-p2p-wireless.h @@ -45,15 +45,6 @@ G_BEGIN_DECLS */ #define NM_SETTING_P2P_WIRELESS_PEER "peer" #define NM_SETTING_P2P_WIRELESS_WPS_METHOD "wps-method" -#if 0 -#define NM_SETTING_P2P_WIRELESS_WPS_PIN "wps-pin" -#endif - -#if 0 -#define NM_SETTING_P2P_WIRELESS_GO_INTENT "go-intent" -/* Not sure how we could even handle this, i.e. would we need to store more information? */ -#define NM_SETTING_P2P_WIRELESS_PERSISTENT "persistent" -#endif typedef struct _NMSettingP2PWirelessClass NMSettingP2PWirelessClass; From 6e45cd900c6e12e0bf10ec229cc9b190c074fabe Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 11:58:18 +0100 Subject: [PATCH 10/16] libnm/device-p2p-wifi: drop API that still needs consideration Having synchronous API is wrong, or at least questionable. Granted, libnm isn't currently very good about the exact order of things to happen. However synchronous API by design delays events while waiting for the response and hence messes up the ordering. Maybe synchronous API should not be added to libnm. Or at least, if we have synchronous API, we certainly need an asynchrnous variant as well (which is still missing). As synchronous API is not preferred, it should also be named nm_some_thing_sync(), accompanied by nm_some_thing() and nm_some_thing_finish(). The name for the synchronous method should be the odd one and we shouldn't have an nm_some_thing_async(). Yes, libnm is not consistend about that. I am going to drop this API for the moment. --- libnm/libnm.ver | 2 -- libnm/nm-device-p2p-wifi.c | 70 -------------------------------------- libnm/nm-device-p2p-wifi.h | 10 ------ 3 files changed, 82 deletions(-) diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 0267c140a0..21dfb8ee1e 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1454,8 +1454,6 @@ global: nm_device_p2p_wifi_get_hw_address; nm_device_p2p_wifi_get_peers; nm_device_p2p_wifi_get_type; - nm_device_p2p_wifi_start_find; - nm_device_p2p_wifi_stop_find; nm_p2p_peer_connection_valid; nm_p2p_peer_filter_connections; nm_p2p_peer_get_flags; diff --git a/libnm/nm-device-p2p-wifi.c b/libnm/nm-device-p2p-wifi.c index fad25b58b1..c9be88ff1a 100644 --- a/libnm/nm-device-p2p-wifi.c +++ b/libnm/nm-device-p2p-wifi.c @@ -237,76 +237,6 @@ nm_device_p2p_wifi_get_wfdies_as_variant (const NMDeviceP2PWifi *self) return g_variant_new_array (G_VARIANT_TYPE_BYTE, NULL, 0); } -/** - * nm_device_p2p_wifi_start_find: - * @device: a #NMDeviceP2PWifi - * @cancellable: a #GCancellable, or %NULL - * @error: location for a #GError, or %NULL - * - * Request NM to search for P2P peers on @device. Note that the function - * returns immediately after requesting the find, and it may take some time - * after that for peers to be found. - * - * The find operation will run for 30s by default. You can stop it earlier - * using nm_device_p2p_wifi_stop_find(). - * - * Returns: %TRUE on success, %FALSE on error, in which case @error will be - * set. - * - * Since: 1.16 - **/ -gboolean -nm_device_p2p_wifi_start_find (NMDeviceP2PWifi *device, - GCancellable *cancellable, - GError **error) -{ - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (device); - GVariant *options = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0); - gboolean ret; - - g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), FALSE); - - ret = nmdbus_device_p2p_wifi_call_start_find_sync (priv->proxy, - options, - cancellable, error); - - if (error && *error) - g_dbus_error_strip_remote_error (*error); - - return ret; -} - -/** - * nm_device_p2p_wifi_stop_find: - * @device: a #NMDeviceP2PWifi - * @cancellable: a #GCancellable, or %NULL - * @error: location for a #GError, or %NULL - * - * Request NM to stop searching for P2P peers on @device. - * - * Returns: %TRUE on success, %FALSE on error, in which case @error will be - * set. - * - * Since: 1.16 - **/ -gboolean -nm_device_p2p_wifi_stop_find (NMDeviceP2PWifi *device, - GCancellable *cancellable, - GError **error) -{ - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (device); - gboolean ret; - - g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), FALSE); - - ret = nmdbus_device_p2p_wifi_call_stop_find_sync (priv->proxy, - cancellable, error); - if (error && *error) - g_dbus_error_strip_remote_error (*error); - - return ret; -} - /*****************************************************************************/ static void diff --git a/libnm/nm-device-p2p-wifi.h b/libnm/nm-device-p2p-wifi.h index e9bfb26a19..bd5841fde2 100644 --- a/libnm/nm-device-p2p-wifi.h +++ b/libnm/nm-device-p2p-wifi.h @@ -58,16 +58,6 @@ NMP2PPeer * nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *d NM_AVAILABLE_IN_1_16 const GPtrArray * nm_device_p2p_wifi_get_peers (NMDeviceP2PWifi *device); -NM_AVAILABLE_IN_1_16 -gboolean nm_device_p2p_wifi_start_find (NMDeviceP2PWifi *device, - GCancellable *cancellable, - GError **error); - -NM_AVAILABLE_IN_1_16 -gboolean nm_device_p2p_wifi_stop_find (NMDeviceP2PWifi *device, - GCancellable *cancellable, - GError **error); - G_END_DECLS #endif /* __NM_DEVICE_P2P_WIFI_H__ */ From 43aa288fd88e0b6c71a74258332baee29e946ed5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 12:15:39 +0100 Subject: [PATCH 11/16] core/p2p-wifi: various minor cleanups --- src/devices/wifi/nm-device-p2p-wifi.c | 3 +-- src/devices/wifi/nm-device-p2p-wifi.h | 1 - src/devices/wifi/nm-device-wifi.c | 16 ++++++++-------- src/devices/wifi/nm-wifi-p2p-peer.c | 8 ++++---- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/devices/wifi/nm-device-p2p-wifi.c b/src/devices/wifi/nm-device-p2p-wifi.c index d7d6001dde..6400bedcfa 100644 --- a/src/devices/wifi/nm-device-p2p-wifi.c +++ b/src/devices/wifi/nm-device-p2p-wifi.c @@ -309,7 +309,7 @@ complete_connection (NMDevice *device, } setting_peer = nm_wifi_p2p_peer_get_address (peer); - g_assert (setting_peer); + g_return_val_if_fail (setting_peer, FALSE); } /* Add a P2P wifi setting if one doesn't exist yet */ @@ -1248,7 +1248,6 @@ constructed (GObject *object) G_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->constructed (object); - /* Connect to the supplicant manager */ priv->sup_mgr = g_object_ref (nm_supplicant_manager_get ()); nm_device_add_pending_action (NM_DEVICE (self), NM_PENDING_ACTION_WAITING_FOR_SUPPLICANT, FALSE); diff --git a/src/devices/wifi/nm-device-p2p-wifi.h b/src/devices/wifi/nm-device-p2p-wifi.h index 128914e055..b57a3f835b 100644 --- a/src/devices/wifi/nm-device-p2p-wifi.h +++ b/src/devices/wifi/nm-device-p2p-wifi.h @@ -38,7 +38,6 @@ #define NM_DEVICE_P2P_WIFI_MGMT_IFACE "mgmt-iface" - typedef struct _NMDeviceP2PWifi NMDeviceP2PWifi; typedef struct _NMDeviceP2PWifiClass NMDeviceP2PWifiClass; diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 4ba14ac336..cd1b5e6927 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -22,13 +22,13 @@ #include "nm-default.h" #include "nm-device-wifi.h" -#include "nm-device-p2p-wifi.h" #include #include #include #include +#include "nm-device-p2p-wifi.h" #include "nm-wifi-ap.h" #include "nm-common-macros.h" #include "devices/nm-device.h" @@ -2047,8 +2047,8 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, && new_state <= NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) priv->ssid_found = TRUE; - if (old_state < NM_SUPPLICANT_INTERFACE_STATE_READY && - new_state >= NM_SUPPLICANT_INTERFACE_STATE_READY) + if ( old_state < NM_SUPPLICANT_INTERFACE_STATE_READY + && new_state >= NM_SUPPLICANT_INTERFACE_STATE_READY) recheck_p2p_availability (self); switch (new_state) { @@ -2247,7 +2247,8 @@ recheck_p2p_availability (NMDeviceWifi *self) NULL); if (p2p_available && !priv->p2p_device) { - g_autofree char *iface_name = NULL; + gs_free char *iface_name = NULL; + /* Create a P2P device. "p2p-dev-" is the same prefix as chosen by * wpa_supplicant internally. */ @@ -2265,8 +2266,7 @@ recheck_p2p_availability (NMDeviceWifi *self) } else if (!p2p_available && priv->p2p_device) { /* Destroy the P2P device. */ g_object_remove_weak_pointer (G_OBJECT (priv->p2p_device), (gpointer*) &priv->p2p_device); - nm_device_p2p_wifi_remove (priv->p2p_device); - priv->p2p_device = NULL; + nm_device_p2p_wifi_remove (g_steal_pointer (&priv->p2p_device)); } } @@ -3509,7 +3509,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass) g_signal_new (NM_DEVICE_WIFI_P2P_DEVICE_CREATED, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, NULL, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, NM_TYPE_DEVICE); } diff --git a/src/devices/wifi/nm-wifi-p2p-peer.c b/src/devices/wifi/nm-wifi-p2p-peer.c index 417365907c..b34ba7af83 100644 --- a/src/devices/wifi/nm-wifi-p2p-peer.c +++ b/src/devices/wifi/nm-wifi-p2p-peer.c @@ -656,10 +656,10 @@ static const NMDBusInterfaceInfoExtended interface_info_p2p_peer = { }; static void -nm_wifi_p2p_peer_class_init (NMWifiP2PPeerClass *p2p_peer_class) +nm_wifi_p2p_peer_class_init (NMWifiP2PPeerClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (p2p_peer_class); - NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (p2p_peer_class); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); g_type_class_add_private (object_class, sizeof (NMWifiP2PPeerPrivate)); @@ -667,7 +667,7 @@ nm_wifi_p2p_peer_class_init (NMWifiP2PPeerClass *p2p_peer_class) dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_p2p_peer); object_class->get_property = get_property; - object_class->finalize = finalize; + object_class->finalize = finalize; obj_properties[PROP_FLAGS] = g_param_spec_uint (NM_WIFI_P2P_PEER_FLAGS, "", "", From 37da2d8a06f7566ecd90ed1ab2287cee538b5c39 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 11:54:23 +0100 Subject: [PATCH 12/16] core/device-p2p-wifi/trival: move code Have the class_init() function at the bottom. --- src/devices/wifi/nm-wifi-p2p-peer.c | 152 ++++++++++++++-------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/src/devices/wifi/nm-wifi-p2p-peer.c b/src/devices/wifi/nm-wifi-p2p-peer.c index b34ba7af83..57184f8eb0 100644 --- a/src/devices/wifi/nm-wifi-p2p-peer.c +++ b/src/devices/wifi/nm-wifi-p2p-peer.c @@ -97,6 +97,82 @@ G_DEFINE_TYPE (NMWifiP2PPeer, nm_wifi_p2p_peer, NM_TYPE_DBUS_OBJECT) /*****************************************************************************/ +const char ** +nm_wifi_p2p_peers_get_paths (const CList *peers_lst_head) +{ + NMWifiP2PPeer *peer; + const char **list; + const char *path; + gsize i, n; + + n = c_list_length (peers_lst_head); + list = g_new (const char *, n + 1); + + i = 0; + if (n > 0) { + c_list_for_each_entry (peer, peers_lst_head, peers_lst) { + nm_assert (i < n); + path = nm_dbus_object_get_path (NM_DBUS_OBJECT (peer)); + nm_assert (path); + + list[i++] = path; + } + nm_assert (i <= n); + } + list[i] = NULL; + return list; +} + +NMWifiP2PPeer * +nm_wifi_p2p_peers_find_first_compatible (const CList *peers_lst_head, + NMConnection *connection) +{ + NMWifiP2PPeer *peer; + + g_return_val_if_fail (connection, NULL); + + c_list_for_each_entry (peer, peers_lst_head, peers_lst) { + if (nm_wifi_p2p_peer_check_compatible (peer, connection)) + return peer; + } + return NULL; +} + +NMWifiP2PPeer * +nm_wifi_p2p_peers_find_by_supplicant_path (const CList *peers_lst_head, const char *path) +{ + NMWifiP2PPeer *peer; + + g_return_val_if_fail (path != NULL, NULL); + + c_list_for_each_entry (peer, peers_lst_head, peers_lst) { + if (nm_streq0 (path, nm_wifi_p2p_peer_get_supplicant_path (peer))) + return peer; + } + return NULL; +} + +/*****************************************************************************/ + +NMWifiP2PPeer * +nm_wifi_p2p_peer_lookup_for_device (NMDevice *device, const char *exported_path) +{ + NMWifiP2PPeer *peer; + + g_return_val_if_fail (NM_IS_DEVICE (device), NULL); + + peer = (NMWifiP2PPeer *) nm_dbus_manager_lookup_object (nm_dbus_object_get_manager (NM_DBUS_OBJECT (device)), + exported_path); + if ( !peer + || !NM_IS_WIFI_P2P_PEER (peer) + || peer->wifi_device != device) + return NULL; + + return peer; +} + +/*****************************************************************************/ + const char * nm_wifi_p2p_peer_get_supplicant_path (NMWifiP2PPeer *peer) { @@ -730,79 +806,3 @@ nm_wifi_p2p_peer_class_init (NMWifiP2PPeerClass *klass) g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } - -/*****************************************************************************/ - -const char ** -nm_wifi_p2p_peers_get_paths (const CList *peers_lst_head) -{ - NMWifiP2PPeer *peer; - const char **list; - const char *path; - gsize i, n; - - n = c_list_length (peers_lst_head); - list = g_new (const char *, n + 1); - - i = 0; - if (n > 0) { - c_list_for_each_entry (peer, peers_lst_head, peers_lst) { - nm_assert (i < n); - path = nm_dbus_object_get_path (NM_DBUS_OBJECT (peer)); - nm_assert (path); - - list[i++] = path; - } - nm_assert (i <= n); - } - list[i] = NULL; - return list; -} - -NMWifiP2PPeer * -nm_wifi_p2p_peers_find_first_compatible (const CList *peers_lst_head, - NMConnection *connection) -{ - NMWifiP2PPeer *peer; - - g_return_val_if_fail (connection, NULL); - - c_list_for_each_entry (peer, peers_lst_head, peers_lst) { - if (nm_wifi_p2p_peer_check_compatible (peer, connection)) - return peer; - } - return NULL; -} - -NMWifiP2PPeer * -nm_wifi_p2p_peers_find_by_supplicant_path (const CList *peers_lst_head, const char *path) -{ - NMWifiP2PPeer *peer; - - g_return_val_if_fail (path != NULL, NULL); - - c_list_for_each_entry (peer, peers_lst_head, peers_lst) { - if (nm_streq0 (path, nm_wifi_p2p_peer_get_supplicant_path (peer))) - return peer; - } - return NULL; -} - -/*****************************************************************************/ - -NMWifiP2PPeer * -nm_wifi_p2p_peer_lookup_for_device (NMDevice *device, const char *exported_path) -{ - NMWifiP2PPeer *peer; - - g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - - peer = (NMWifiP2PPeer *) nm_dbus_manager_lookup_object (nm_dbus_object_get_manager (NM_DBUS_OBJECT (device)), - exported_path); - if ( !peer - || !NM_IS_WIFI_P2P_PEER (peer) - || peer->wifi_device != device) - return NULL; - - return peer; -} From c8204377d6fce857461b014fc89f51dd427ff45f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 11:54:23 +0100 Subject: [PATCH 13/16] core/device-p2p-wifi: drop unused code If this is going to be implemented, revert the patch. --- src/devices/wifi/nm-device-p2p-wifi.c | 27 --------------------------- src/devices/wifi/nm-wifi-p2p-peer.c | 11 ----------- 2 files changed, 38 deletions(-) diff --git a/src/devices/wifi/nm-device-p2p-wifi.c b/src/devices/wifi/nm-device-p2p-wifi.c index 6400bedcfa..0b82db4280 100644 --- a/src/devices/wifi/nm-device-p2p-wifi.c +++ b/src/devices/wifi/nm-device-p2p-wifi.c @@ -48,8 +48,6 @@ _LOG_DECLARE_SELF(NMDeviceP2PWifi); NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceP2PWifi, PROP_GROUP_OWNER, - //PROP_SSID, - //PROP_BSSID, PROP_PEERS, PROP_WFDIES, /* TODO: Make this a property of the setting and Find feature * making the device stateless. @@ -58,14 +56,6 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceP2PWifi, PROP_MGMT_IFACE, ); -enum { - SCANNING_PROHIBITED, - - LAST_SIGNAL -}; - -//static guint signals[LAST_SIGNAL] = { 0 }; - typedef struct { NMSupplicantManager *sup_mgr; @@ -554,12 +544,6 @@ peer_add_remove (NMDeviceP2PWifi *self, } update_disconnect_on_connection_peer_missing (self); - -#if 0 - nm_device_emit_recheck_auto_activate (NM_DEVICE (self)); - if (recheck_available_connections) - nm_device_recheck_available_connections (NM_DEVICE (self)); -#endif } static void @@ -961,11 +945,6 @@ device_state_changed (NMDevice *device, NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); -#if 0 - if (new_state > NM_DEVICE_STATE_ACTIVATED) - wifi_secrets_cancel (self); -#endif - update_disconnect_on_connection_peer_missing (self); if (new_state <= NM_DEVICE_STATE_UNAVAILABLE) { @@ -1356,11 +1335,5 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *klass) G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - /* obj_properties[PROP_SCANNING] = */ - /* g_param_spec_boolean (NM_DEVICE_WIFI_SCANNING, "", "", */ - /* FALSE, */ - /* G_PARAM_READABLE | */ - /* G_PARAM_STATIC_STRINGS); */ - g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/src/devices/wifi/nm-wifi-p2p-peer.c b/src/devices/wifi/nm-wifi-p2p-peer.c index 57184f8eb0..a22db4b75f 100644 --- a/src/devices/wifi/nm-wifi-p2p-peer.c +++ b/src/devices/wifi/nm-wifi-p2p-peer.c @@ -43,23 +43,12 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMWifiP2PPeer, PROP_MODEL, PROP_MODEL_NUMBER, PROP_SERIAL, - //PROP_PRIMARY_DEVICE_TYPE, { "PrimaryDeviceType", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay", - // "devicecapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y", - // "groupcapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y", - // "SecondaryDeviceTypes", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay", - // "VendorExtension", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay", PROP_WFD_IES, PROP_GROUPS, - PROP_HW_ADDRESS, - //PROP_MODE, PROP_STRENGTH, PROP_LAST_SEEN, - - //PROP_MAX_BITRATE, - // One of the following (FLAGS would simply mirror/use the same as AP flags) PROP_FLAGS, - //PROP_CONFIG_METHOD, ); struct _NMWifiP2PPeerPrivate { From 0420fa1f2c176f5044ff4c17703f5775c43f5804 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 12:39:38 +0100 Subject: [PATCH 14/16] wifi-p2p: rename files for consistent Wi-Fi P2P naming We named the types inconsistently: - "p2p-wireless" ("libnm-core/nm-setting-p2p-wireless.h") - "p2p" ("libnm/nm-p2p-peer.h") - "p2p-wifi" ("src/devices/wifi/nm-device-p2p-wifi.h") It seems to me, "libnm/nm-p2p-peer.h" should be qualified with a "Wi-Fi" specific name. It's not just peer-to-peer, it's Wi-Fi P2P. Yes, there is an inconsistency now, because there is already "libnm/nm-access-point.h". It seems to me (from looking at the internet), that the name "Wi-Fi P2P" is more common than "P2P Wi-Fi" -- although both are used. There is also the name "Wi-Fi Direct". But it's not clear which name should be preferred here, so stick to "Wi-Fi P2P". In this first commit only rename the files. The following commit will rename the content. --- Makefile.am | 22 +++++++++---------- docs/libnm/libnm-docs.xml | 8 +++---- libnm-core/meson.build | 4 ++-- libnm-core/nm-core-enum-types.c.template | 4 ++-- libnm-core/nm-core-internal.h | 8 +++---- ...g-p2p-wireless.c => nm-setting-wifi-p2p.c} | 4 ++-- ...g-p2p-wireless.h => nm-setting-wifi-p2p.h} | 0 libnm/NetworkManager.h | 8 +++---- libnm/meson.build | 18 +++++++-------- libnm/nm-client.c | 8 +++---- ...device-p2p-wifi.c => nm-device-wifi-p2p.c} | 6 ++--- ...device-p2p-wifi.h => nm-device-wifi-p2p.h} | 0 libnm/{nm-p2p-peer.c => nm-wifi-p2p-peer.c} | 4 ++-- libnm/{nm-p2p-peer.h => nm-wifi-p2p-peer.h} | 0 po/POTFILES.in | 12 +++++----- shared/nm-meta-setting.c | 12 +++++----- src/devices/wifi/meson.build | 2 +- ...device-p2p-wifi.c => nm-device-wifi-p2p.c} | 4 ++-- ...device-p2p-wifi.h => nm-device-wifi-p2p.h} | 0 src/devices/wifi/nm-device-wifi.c | 2 +- src/devices/wifi/nm-wifi-factory.c | 2 +- 21 files changed, 64 insertions(+), 64 deletions(-) rename libnm-core/{nm-setting-p2p-wireless.c => nm-setting-wifi-p2p.c} (99%) rename libnm-core/{nm-setting-p2p-wireless.h => nm-setting-wifi-p2p.h} (100%) rename libnm/{nm-device-p2p-wifi.c => nm-device-wifi-p2p.c} (99%) rename libnm/{nm-device-p2p-wifi.h => nm-device-wifi-p2p.h} (100%) rename libnm/{nm-p2p-peer.c => nm-wifi-p2p-peer.c} (99%) rename libnm/{nm-p2p-peer.h => nm-wifi-p2p-peer.h} (100%) rename src/devices/wifi/{nm-device-p2p-wifi.c => nm-device-wifi-p2p.c} (99%) rename src/devices/wifi/{nm-device-p2p-wifi.h => nm-device-wifi-p2p.h} (100%) diff --git a/Makefile.am b/Makefile.am index 7a75a6637f..8a03f1993f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -653,7 +653,6 @@ libnm_core_lib_h_pub_real = \ libnm-core/nm-setting-ovs-interface.h \ libnm-core/nm-setting-ovs-patch.h \ libnm-core/nm-setting-ovs-port.h \ - libnm-core/nm-setting-p2p-wireless.h \ libnm-core/nm-setting-ppp.h \ libnm-core/nm-setting-pppoe.h \ libnm-core/nm-setting-proxy.h \ @@ -667,6 +666,7 @@ libnm_core_lib_h_pub_real = \ libnm-core/nm-setting-vlan.h \ libnm-core/nm-setting-vpn.h \ libnm-core/nm-setting-vxlan.h \ + libnm-core/nm-setting-wifi-p2p.h \ libnm-core/nm-setting-wimax.h \ libnm-core/nm-setting-wired.h \ libnm-core/nm-setting-wireless-security.h \ @@ -722,7 +722,6 @@ libnm_core_lib_c_settings_real = \ libnm-core/nm-setting-ovs-interface.c \ libnm-core/nm-setting-ovs-patch.c \ libnm-core/nm-setting-ovs-port.c \ - libnm-core/nm-setting-p2p-wireless.c \ libnm-core/nm-setting-ppp.c \ libnm-core/nm-setting-pppoe.c \ libnm-core/nm-setting-proxy.c \ @@ -736,6 +735,7 @@ libnm_core_lib_c_settings_real = \ libnm-core/nm-setting-vlan.c \ libnm-core/nm-setting-vpn.c \ libnm-core/nm-setting-vxlan.c \ + libnm-core/nm-setting-wifi-p2p.c \ libnm-core/nm-setting-wimax.c \ libnm-core/nm-setting-wired.c \ libnm-core/nm-setting-wireless-security.c \ @@ -1041,15 +1041,15 @@ libnm_lib_h_pub_real = \ libnm/nm-device-macvlan.h \ libnm/nm-device-modem.h \ libnm/nm-device-olpc-mesh.h \ + libnm/nm-device-ovs-bridge.h \ libnm/nm-device-ovs-interface.h \ libnm/nm-device-ovs-port.h \ - libnm/nm-device-ovs-bridge.h \ - libnm/nm-device-p2p-wifi.h \ libnm/nm-device-ppp.h \ libnm/nm-device-team.h \ libnm/nm-device-tun.h \ libnm/nm-device-vlan.h \ libnm/nm-device-vxlan.h \ + libnm/nm-device-wifi-p2p.h \ libnm/nm-device-wifi.h \ libnm/nm-device-wimax.h \ libnm/nm-device-wireguard.h \ @@ -1058,7 +1058,6 @@ libnm_lib_h_pub_real = \ libnm/nm-dhcp-config.h \ libnm/nm-ip-config.h \ libnm/nm-object.h \ - libnm/nm-p2p-peer.h \ libnm/nm-remote-connection.h \ libnm/nm-secret-agent-old.h \ libnm/nm-types.h \ @@ -1066,6 +1065,7 @@ libnm_lib_h_pub_real = \ libnm/nm-vpn-editor.h \ libnm/nm-vpn-plugin-old.h \ libnm/nm-vpn-service-plugin.h \ + libnm/nm-wifi-p2p-peer.h \ libnm/nm-wimax-nsp.h libnm_lib_h_pub_mkenums = \ libnm/nm-enum-types.h @@ -1102,15 +1102,15 @@ libnm_lib_c_real = \ libnm/nm-device-macvlan.c \ libnm/nm-device-modem.c \ libnm/nm-device-olpc-mesh.c \ + libnm/nm-device-ovs-bridge.c \ libnm/nm-device-ovs-interface.c \ libnm/nm-device-ovs-port.c \ - libnm/nm-device-ovs-bridge.c \ - libnm/nm-device-p2p-wifi.c \ libnm/nm-device-ppp.c \ libnm/nm-device-team.c \ libnm/nm-device-tun.c \ libnm/nm-device-vlan.c \ libnm/nm-device-vxlan.c \ + libnm/nm-device-wifi-p2p.c \ libnm/nm-device-wifi.c \ libnm/nm-device-wimax.c \ libnm/nm-device-wireguard.c \ @@ -1125,14 +1125,14 @@ libnm_lib_c_real = \ libnm/nm-ip6-config.c \ libnm/nm-manager.c \ libnm/nm-object.c \ - libnm/nm-p2p-peer.c \ libnm/nm-remote-connection.c \ libnm/nm-remote-settings.c \ libnm/nm-secret-agent-old.c \ libnm/nm-vpn-connection.c \ - libnm/nm-vpn-plugin-old.c \ libnm/nm-vpn-editor.c \ + libnm/nm-vpn-plugin-old.c \ libnm/nm-vpn-service-plugin.c \ + libnm/nm-wifi-p2p-peer.c \ libnm/nm-wimax-nsp.c libnm_lib_c_mkenums = \ libnm/nm-enum-types.c @@ -3256,8 +3256,8 @@ core_plugins += src/devices/wifi/libnm-device-plugin-wifi.la src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES = \ src/devices/wifi/nm-device-olpc-mesh.c \ src/devices/wifi/nm-device-olpc-mesh.h \ - src/devices/wifi/nm-device-p2p-wifi.c \ - src/devices/wifi/nm-device-p2p-wifi.h \ + src/devices/wifi/nm-device-wifi-p2p.c \ + src/devices/wifi/nm-device-wifi-p2p.h \ src/devices/wifi/nm-device-wifi.c \ src/devices/wifi/nm-device-wifi.h \ src/devices/wifi/nm-wifi-ap.c \ diff --git a/docs/libnm/libnm-docs.xml b/docs/libnm/libnm-docs.xml index 03f6835737..2a7b76bf34 100644 --- a/docs/libnm/libnm-docs.xml +++ b/docs/libnm/libnm-docs.xml @@ -218,9 +218,8 @@ print ("NetworkManager version " + client.get_version())]]> - - + @@ -232,6 +231,7 @@ print ("NetworkManager version " + client.get_version())]]> + @@ -261,12 +261,12 @@ print ("NetworkManager version " + client.get_version())]]> - + @@ -275,7 +275,7 @@ print ("NetworkManager version " + client.get_version())]]> - + diff --git a/libnm-core/meson.build b/libnm-core/meson.build index e615b3451e..89b8746e39 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -32,7 +32,6 @@ libnm_core_headers = files( 'nm-setting-ovs-interface.h', 'nm-setting-ovs-patch.h', 'nm-setting-ovs-port.h', - 'nm-setting-p2p-wireless.h', 'nm-setting-ppp.h', 'nm-setting-pppoe.h', 'nm-setting-proxy.h', @@ -46,6 +45,7 @@ libnm_core_headers = files( 'nm-setting-vlan.h', 'nm-setting-vpn.h', 'nm-setting-vxlan.h', + 'nm-setting-wifi-p2p.h', 'nm-setting-wimax.h', 'nm-setting-wired.h', 'nm-setting-wireless-security.h', @@ -88,7 +88,6 @@ libnm_core_settings_sources = files( 'nm-setting-ovs-interface.c', 'nm-setting-ovs-patch.c', 'nm-setting-ovs-port.c', - 'nm-setting-p2p-wireless.c', 'nm-setting-ppp.c', 'nm-setting-pppoe.c', 'nm-setting-proxy.c', @@ -102,6 +101,7 @@ libnm_core_settings_sources = files( 'nm-setting-vlan.c', 'nm-setting-vpn.c', 'nm-setting-vxlan.c', + 'nm-setting-wifi-p2p.c', 'nm-setting-wimax.c', 'nm-setting-wired.c', 'nm-setting-wireless-security.c', diff --git a/libnm-core/nm-core-enum-types.c.template b/libnm-core/nm-core-enum-types.c.template index 0edb97dcc7..2cef0307a1 100644 --- a/libnm-core/nm-core-enum-types.c.template +++ b/libnm-core/nm-core-enum-types.c.template @@ -4,7 +4,6 @@ #include "nm-core-enum-types.h" #include "nm-default.h" -#include "nm-version-macros.h" #include "nm-connection.h" #include "nm-core-types.h" #include "nm-dbus-interface.h" @@ -33,7 +32,6 @@ #include "nm-setting-ovs-interface.h" #include "nm-setting-ovs-patch.h" #include "nm-setting-ovs-port.h" -#include "nm-setting-p2p-wireless.h" #include "nm-setting-ppp.h" #include "nm-setting-pppoe.h" #include "nm-setting-proxy.h" @@ -45,6 +43,7 @@ #include "nm-setting-vlan.h" #include "nm-setting-vpn.h" #include "nm-setting-vxlan.h" +#include "nm-setting-wifi-p2p.h" #include "nm-setting-wimax.h" #include "nm-setting-wired.h" #include "nm-setting-wireless-security.h" @@ -53,6 +52,7 @@ #include "nm-setting.h" #include "nm-simple-connection.h" #include "nm-utils.h" +#include "nm-version-macros.h" #include "nm-version.h" #include "nm-vpn-dbus-interface.h" #include "nm-vpn-editor-plugin.h" diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index f73d728b7d..b3d664dcea 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -37,6 +37,8 @@ #include "nm-connection.h" #include "nm-core-enum-types.h" +#include "nm-core-types-internal.h" +#include "nm-meta-setting.h" #include "nm-setting-6lowpan.h" #include "nm-setting-8021x.h" #include "nm-setting-adsl.h" @@ -52,7 +54,6 @@ #include "nm-setting-gsm.h" #include "nm-setting-infiniband.h" #include "nm-setting-ip-tunnel.h" -#include "nm-setting-proxy.h" #include "nm-setting-ip4-config.h" #include "nm-setting-ip6-config.h" #include "nm-setting-macsec.h" @@ -63,9 +64,9 @@ #include "nm-setting-ovs-interface.h" #include "nm-setting-ovs-patch.h" #include "nm-setting-ovs-port.h" -#include "nm-setting-p2p-wireless.h" #include "nm-setting-ppp.h" #include "nm-setting-pppoe.h" +#include "nm-setting-proxy.h" #include "nm-setting-serial.h" #include "nm-setting-sriov.h" #include "nm-setting-tc-config.h" @@ -75,6 +76,7 @@ #include "nm-setting-vlan.h" #include "nm-setting-vpn.h" #include "nm-setting-vxlan.h" +#include "nm-setting-wifi-p2p.h" #include "nm-setting-wimax.h" #include "nm-setting-wired.h" #include "nm-setting-wireless-security.h" @@ -84,9 +86,7 @@ #include "nm-simple-connection.h" #include "nm-utils.h" #include "nm-vpn-dbus-interface.h" -#include "nm-core-types-internal.h" #include "nm-vpn-editor-plugin.h" -#include "nm-meta-setting.h" /* IEEE 802.1D-1998 timer values */ #define NM_BR_MIN_HELLO_TIME 1 diff --git a/libnm-core/nm-setting-p2p-wireless.c b/libnm-core/nm-setting-wifi-p2p.c similarity index 99% rename from libnm-core/nm-setting-p2p-wireless.c rename to libnm-core/nm-setting-wifi-p2p.c index 8188cab5d2..4c679a99d6 100644 --- a/libnm-core/nm-setting-p2p-wireless.c +++ b/libnm-core/nm-setting-wifi-p2p.c @@ -19,7 +19,7 @@ #include "nm-default.h" -#include "nm-setting-p2p-wireless.h" +#include "nm-setting-wifi-p2p.h" #include #include @@ -30,7 +30,7 @@ #include "nm-setting-private.h" /** - * SECTION:nm-setting-p2p-wireless + * SECTION:nm-setting-wifi-p2p * @short_description: Describes connection properties for 802.11 Wi-Fi P2P networks * * The #NMSettingP2PWireless object is a #NMSetting subclass that describes properties diff --git a/libnm-core/nm-setting-p2p-wireless.h b/libnm-core/nm-setting-wifi-p2p.h similarity index 100% rename from libnm-core/nm-setting-p2p-wireless.h rename to libnm-core/nm-setting-wifi-p2p.h diff --git a/libnm/NetworkManager.h b/libnm/NetworkManager.h index 1f98e50b11..1e59d11758 100644 --- a/libnm/NetworkManager.h +++ b/libnm/NetworkManager.h @@ -43,15 +43,15 @@ #include "nm-device-macvlan.h" #include "nm-device-modem.h" #include "nm-device-olpc-mesh.h" +#include "nm-device-ovs-bridge.h" #include "nm-device-ovs-interface.h" #include "nm-device-ovs-port.h" -#include "nm-device-ovs-bridge.h" -#include "nm-device-p2p-wifi.h" #include "nm-device-ppp.h" #include "nm-device-team.h" #include "nm-device-tun.h" #include "nm-device-vlan.h" #include "nm-device-vxlan.h" +#include "nm-device-wifi-p2p.h" #include "nm-device-wifi.h" #include "nm-device-wimax.h" #include "nm-device-wireguard.h" @@ -61,7 +61,6 @@ #include "nm-enum-types.h" #include "nm-ip-config.h" #include "nm-object.h" -#include "nm-p2p-peer.h" #include "nm-remote-connection.h" #include "nm-setting-6lowpan.h" #include "nm-setting-8021x.h" @@ -90,7 +89,7 @@ #include "nm-setting-ovs-interface.h" #include "nm-setting-ovs-patch.h" #include "nm-setting-ovs-port.h" -#include "nm-setting-p2p-wireless.h" +#include "nm-setting-wifi-p2p.h" #include "nm-setting-ppp.h" #include "nm-setting-pppoe.h" #include "nm-setting-proxy.h" @@ -119,6 +118,7 @@ #include "nm-vpn-editor-plugin.h" #include "nm-vpn-plugin-info.h" #include "nm-vpn-service-plugin.h" +#include "nm-wifi-p2p-peer.h" #include "nm-wimax-nsp.h" #include "nm-autoptr.h" diff --git a/libnm/meson.build b/libnm/meson.build index dee4e36bdf..f538dbfbaf 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -40,30 +40,29 @@ libnm_headers = files( 'nm-device-dummy.h', 'nm-device-ethernet.h', 'nm-device-generic.h', - 'nm-device.h', 'nm-device-infiniband.h', 'nm-device-ip-tunnel.h', 'nm-device-macsec.h', 'nm-device-macvlan.h', 'nm-device-modem.h', 'nm-device-olpc-mesh.h', + 'nm-device-ovs-bridge.h', 'nm-device-ovs-interface.h', 'nm-device-ovs-port.h', - 'nm-device-ovs-bridge.h', - 'nm-device-p2p-wifi.h', 'nm-device-ppp.h', 'nm-device-team.h', 'nm-device-tun.h', 'nm-device-vlan.h', 'nm-device-vxlan.h', + 'nm-device-wifi-p2p.h', 'nm-device-wifi.h', 'nm-device-wimax.h', 'nm-device-wireguard.h', 'nm-device-wpan.h', + 'nm-device.h', 'nm-dhcp-config.h', 'nm-ip-config.h', 'nm-object.h', - 'nm-p2p-peer.h', 'nm-remote-connection.h', 'nm-secret-agent-old.h', 'nm-types.h', @@ -71,6 +70,7 @@ libnm_headers = files( 'nm-vpn-editor.h', 'nm-vpn-plugin-old.h', 'nm-vpn-service-plugin.h', + 'nm-wifi-p2p-peer.h', 'nm-wimax-nsp.h', ) @@ -103,7 +103,6 @@ libnm_sources = files( 'nm-device-bond.c', 'nm-device-bridge.c', 'nm-device-bt.c', - 'nm-device.c', 'nm-device-dummy.c', 'nm-device-ethernet.c', 'nm-device-generic.c', @@ -113,19 +112,20 @@ libnm_sources = files( 'nm-device-macvlan.c', 'nm-device-modem.c', 'nm-device-olpc-mesh.c', + 'nm-device-ovs-bridge.c', 'nm-device-ovs-interface.c', 'nm-device-ovs-port.c', - 'nm-device-ovs-bridge.c', - 'nm-device-p2p-wifi.c', 'nm-device-ppp.c', 'nm-device-team.c', 'nm-device-tun.c', 'nm-device-vlan.c', 'nm-device-vxlan.c', + 'nm-device-wifi-p2p.c', 'nm-device-wifi.c', 'nm-device-wimax.c', 'nm-device-wireguard.c', 'nm-device-wpan.c', + 'nm-device.c', 'nm-dhcp-config.c', 'nm-dhcp4-config.c', 'nm-dhcp6-config.c', @@ -135,14 +135,14 @@ libnm_sources = files( 'nm-ip6-config.c', 'nm-manager.c', 'nm-object.c', - 'nm-p2p-peer.c', 'nm-remote-connection.c', 'nm-remote-settings.c', 'nm-secret-agent-old.c', 'nm-vpn-connection.c', - 'nm-vpn-plugin-old.c', 'nm-vpn-editor.c', + 'nm-vpn-plugin-old.c', 'nm-vpn-service-plugin.c', + 'nm-wifi-p2p-peer.c', 'nm-wimax-nsp.c', ) diff --git a/libnm/nm-client.c b/libnm/nm-client.c index e5902ad051..1cb73b73a6 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -66,26 +66,26 @@ #include "nm-device-macvlan.h" #include "nm-device-modem.h" #include "nm-device-olpc-mesh.h" +#include "nm-device-ovs-bridge.h" #include "nm-device-ovs-interface.h" #include "nm-device-ovs-port.h" -#include "nm-device-ovs-bridge.h" -#include "nm-device-p2p-wifi.h" #include "nm-device-ppp.h" #include "nm-device-team.h" #include "nm-device-tun.h" #include "nm-device-vlan.h" #include "nm-device-vxlan.h" +#include "nm-device-wifi-p2p.h" #include "nm-device-wifi.h" #include "nm-device-wimax.h" #include "nm-device-wireguard.h" #include "nm-device-wpan.h" +#include "nm-dhcp-config.h" #include "nm-dhcp4-config.h" #include "nm-dhcp6-config.h" -#include "nm-dhcp-config.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" #include "nm-manager.h" -#include "nm-p2p-peer.h" +#include "nm-wifi-p2p-peer.h" #include "nm-remote-connection.h" #include "nm-remote-settings.h" #include "nm-vpn-connection.h" diff --git a/libnm/nm-device-p2p-wifi.c b/libnm/nm-device-wifi-p2p.c similarity index 99% rename from libnm/nm-device-p2p-wifi.c rename to libnm/nm-device-wifi-p2p.c index c9be88ff1a..65be8d2aaf 100644 --- a/libnm/nm-device-p2p-wifi.c +++ b/libnm/nm-device-wifi-p2p.c @@ -19,15 +19,15 @@ #include "nm-default.h" -#include "nm-device-p2p-wifi.h" +#include "nm-device-wifi-p2p.h" #include #include "nm-setting-connection.h" -#include "nm-setting-p2p-wireless.h" +#include "nm-setting-wifi-p2p.h" #include "nm-utils.h" -#include "nm-p2p-peer.h" +#include "nm-wifi-p2p-peer.h" #include "nm-object-private.h" #include "nm-core-internal.h" #include "nm-dbus-helpers.h" diff --git a/libnm/nm-device-p2p-wifi.h b/libnm/nm-device-wifi-p2p.h similarity index 100% rename from libnm/nm-device-p2p-wifi.h rename to libnm/nm-device-wifi-p2p.h diff --git a/libnm/nm-p2p-peer.c b/libnm/nm-wifi-p2p-peer.c similarity index 99% rename from libnm/nm-p2p-peer.c rename to libnm/nm-wifi-p2p-peer.c index 164a758e83..5edbef090e 100644 --- a/libnm/nm-p2p-peer.c +++ b/libnm/nm-wifi-p2p-peer.c @@ -19,13 +19,13 @@ #include "nm-default.h" -#include "nm-p2p-peer.h" +#include "nm-wifi-p2p-peer.h" #include #include "nm-connection.h" #include "nm-setting-connection.h" -#include "nm-setting-p2p-wireless.h" +#include "nm-setting-wifi-p2p.h" #include "nm-utils.h" #include "nm-dbus-interface.h" diff --git a/libnm/nm-p2p-peer.h b/libnm/nm-wifi-p2p-peer.h similarity index 100% rename from libnm/nm-p2p-peer.h rename to libnm/nm-wifi-p2p-peer.h diff --git a/po/POTFILES.in b/po/POTFILES.in index 31a614fc8a..393f84e8ca 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -72,29 +72,29 @@ libnm-core/nm-setting-ethtool.c libnm-core/nm-setting-gsm.c libnm-core/nm-setting-infiniband.c libnm-core/nm-setting-ip-config.c +libnm-core/nm-setting-ip-tunnel.c libnm-core/nm-setting-ip4-config.c libnm-core/nm-setting-ip6-config.c -libnm-core/nm-setting-ip-tunnel.c libnm-core/nm-setting-macsec.c libnm-core/nm-setting-macvlan.c libnm-core/nm-setting-olpc-mesh.c +libnm-core/nm-setting-ovs-bridge.c libnm-core/nm-setting-ovs-interface.c libnm-core/nm-setting-ovs-patch.c libnm-core/nm-setting-ovs-port.c -libnm-core/nm-setting-ovs-bridge.c -libnm-core/nm-setting-p2p-wireless.c libnm-core/nm-setting-ppp.c libnm-core/nm-setting-pppoe.c libnm-core/nm-setting-proxy.c libnm-core/nm-setting-sriov.c libnm-core/nm-setting-tc-config.c -libnm-core/nm-setting-team.c libnm-core/nm-setting-team-port.c +libnm-core/nm-setting-team.c libnm-core/nm-setting-tun.c libnm-core/nm-setting-user.c libnm-core/nm-setting-vlan.c libnm-core/nm-setting-vpn.c libnm-core/nm-setting-vxlan.c +libnm-core/nm-setting-wifi-p2p.c libnm-core/nm-setting-wimax.c libnm-core/nm-setting-wired.c libnm-core/nm-setting-wireless-security.c @@ -143,7 +143,6 @@ libnm/nm-device-bt.c libnm/nm-device-dummy.c libnm/nm-device-ethernet.c libnm/nm-device-generic.c -libnm/nm-device-tun.c libnm/nm-device-infiniband.c libnm/nm-device-ip-tunnel.c libnm/nm-device-macvlan.c @@ -152,10 +151,11 @@ libnm/nm-device-olpc-mesh.c libnm/nm-device-ovs-bridge.c libnm/nm-device-ovs-interface.c libnm/nm-device-ovs-port.c -libnm/nm-device-p2p-wifi.c libnm/nm-device-team.c +libnm/nm-device-tun.c libnm/nm-device-vlan.c libnm/nm-device-vxlan.c +libnm/nm-device-wifi-p2p.c libnm/nm-device-wifi.c libnm/nm-device-wimax.c libnm/nm-device-wpan.c diff --git a/shared/nm-meta-setting.c b/shared/nm-meta-setting.c index 6256b06c00..06e24f1a42 100644 --- a/shared/nm-meta-setting.c +++ b/shared/nm-meta-setting.c @@ -28,8 +28,8 @@ #include "nm-setting-adsl.h" #include "nm-setting-bluetooth.h" #include "nm-setting-bond.h" -#include "nm-setting-bridge.h" #include "nm-setting-bridge-port.h" +#include "nm-setting-bridge.h" #include "nm-setting-cdma.h" #include "nm-setting-connection.h" #include "nm-setting-dcb.h" @@ -38,10 +38,10 @@ #include "nm-setting-generic.h" #include "nm-setting-gsm.h" #include "nm-setting-infiniband.h" -#include "nm-setting-ip4-config.h" -#include "nm-setting-ip6-config.h" #include "nm-setting-ip-config.h" #include "nm-setting-ip-tunnel.h" +#include "nm-setting-ip4-config.h" +#include "nm-setting-ip6-config.h" #include "nm-setting-macsec.h" #include "nm-setting-macvlan.h" #include "nm-setting-match.h" @@ -50,23 +50,23 @@ #include "nm-setting-ovs-interface.h" #include "nm-setting-ovs-patch.h" #include "nm-setting-ovs-port.h" -#include "nm-setting-p2p-wireless.h" #include "nm-setting-ppp.h" #include "nm-setting-pppoe.h" #include "nm-setting-proxy.h" #include "nm-setting-serial.h" #include "nm-setting-tc-config.h" -#include "nm-setting-team.h" #include "nm-setting-team-port.h" +#include "nm-setting-team.h" #include "nm-setting-tun.h" #include "nm-setting-user.h" #include "nm-setting-vlan.h" #include "nm-setting-vpn.h" #include "nm-setting-vxlan.h" +#include "nm-setting-wifi-p2p.h" #include "nm-setting-wimax.h" #include "nm-setting-wired.h" -#include "nm-setting-wireless.h" #include "nm-setting-wireless-security.h" +#include "nm-setting-wireless.h" #include "nm-setting-wpan.h" /*****************************************************************************/ diff --git a/src/devices/wifi/meson.build b/src/devices/wifi/meson.build index d2b807fc95..4dfbe4c8da 100644 --- a/src/devices/wifi/meson.build +++ b/src/devices/wifi/meson.build @@ -6,7 +6,7 @@ common_sources = files( sources = common_sources + files( 'nm-device-olpc-mesh.c', - 'nm-device-p2p-wifi.c', + 'nm-device-wifi-p2p.c', 'nm-device-wifi.c', 'nm-wifi-common.c', 'nm-wifi-factory.c', diff --git a/src/devices/wifi/nm-device-p2p-wifi.c b/src/devices/wifi/nm-device-wifi-p2p.c similarity index 99% rename from src/devices/wifi/nm-device-p2p-wifi.c rename to src/devices/wifi/nm-device-wifi-p2p.c index 0b82db4280..8880b5b179 100644 --- a/src/devices/wifi/nm-device-p2p-wifi.c +++ b/src/devices/wifi/nm-device-wifi-p2p.c @@ -20,7 +20,7 @@ #include "nm-default.h" -#include "nm-device-p2p-wifi.h" +#include "nm-device-wifi-p2p.h" #include @@ -33,7 +33,7 @@ #include "NetworkManagerUtils.h" #include "devices/nm-device-private.h" #include "settings/nm-settings.h" -#include "nm-setting-p2p-wireless.h" +#include "nm-setting-wifi-p2p.h" #include "nm-act-request.h" #include "nm-ip4-config.h" #include "platform/nm-platform.h" diff --git a/src/devices/wifi/nm-device-p2p-wifi.h b/src/devices/wifi/nm-device-wifi-p2p.h similarity index 100% rename from src/devices/wifi/nm-device-p2p-wifi.h rename to src/devices/wifi/nm-device-wifi-p2p.h diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index cd1b5e6927..4df39b8dc1 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -28,7 +28,7 @@ #include #include -#include "nm-device-p2p-wifi.h" +#include "nm-device-wifi-p2p.h" #include "nm-wifi-ap.h" #include "nm-common-macros.h" #include "devices/nm-device.h" diff --git a/src/devices/wifi/nm-wifi-factory.c b/src/devices/wifi/nm-wifi-factory.c index e220c3a4cb..e44169ab52 100644 --- a/src/devices/wifi/nm-wifi-factory.c +++ b/src/devices/wifi/nm-wifi-factory.c @@ -26,7 +26,7 @@ #include "nm-setting-wireless.h" #include "nm-setting-olpc-mesh.h" #include "nm-device-wifi.h" -#include "nm-device-p2p-wifi.h" +#include "nm-device-wifi-p2p.h" #include "nm-device-olpc-mesh.h" #include "nm-device-iwd.h" #include "settings/nm-settings-connection.h" From 09090f266979faf8904b207d81f2c1b9b43edf5b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 15:21:59 +0100 Subject: [PATCH 15/16] wifi-p2p: rename Wi-Fi P2P After renaming the files, also rename all the content to follow the "Wi-Fi P2P" naming scheme. --- Makefile.am | 39 +-- clients/cli/connections.c | 2 +- clients/common/nm-meta-setting-desc.c | 56 ++-- clients/common/settings-docs.h.in | 4 +- docs/api/Makefile.am | 2 +- docs/api/network-manager-docs.xml | 14 +- introspection/meson.build | 20 +- ...desktop.NetworkManager.Device.WifiP2P.xml} | 18 +- ...reedesktop.NetworkManager.WifiP2PPeer.xml} | 20 +- libnm-core/nm-core-types.h | 10 +- libnm-core/nm-dbus-interface.h | 71 ++-- libnm-core/nm-setting-wifi-p2p.c | 90 ++--- libnm-core/nm-setting-wifi-p2p.h | 36 +- libnm/libnm.ver | 42 +-- libnm/nm-autoptr.h | 4 +- libnm/nm-client.c | 14 +- libnm/nm-device-wifi-p2p.c | 164 ++++----- libnm/nm-device-wifi-p2p.h | 38 +-- libnm/nm-types.h | 6 +- libnm/nm-wifi-p2p-peer.c | 242 +++++++------- libnm/nm-wifi-p2p-peer.h | 70 ++-- shared/nm-meta-setting.c | 12 +- shared/nm-meta-setting.h | 2 +- src/devices/wifi/nm-device-wifi-p2p.c | 316 +++++++++--------- src/devices/wifi/nm-device-wifi-p2p.h | 44 +-- src/devices/wifi/nm-device-wifi.c | 12 +- src/devices/wifi/nm-wifi-factory.c | 4 +- src/devices/wifi/nm-wifi-p2p-peer.c | 14 +- src/devices/wifi/nm-wifi-p2p-peer.h | 2 +- src/nm-types.h | 2 +- src/org.freedesktop.NetworkManager.conf | 4 +- vapi/NM-1.0.metadata | 6 +- 32 files changed, 692 insertions(+), 688 deletions(-) rename introspection/{org.freedesktop.NetworkManager.Device.P2PWireless.xml => org.freedesktop.NetworkManager.Device.WifiP2P.xml} (75%) rename introspection/{org.freedesktop.NetworkManager.P2PPeer.xml => org.freedesktop.NetworkManager.WifiP2PPeer.xml} (76%) diff --git a/Makefile.am b/Makefile.am index 8a03f1993f..0a4063c39e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -431,8 +431,6 @@ introspection_sources = \ introspection/org.freedesktop.NetworkManager.Device.OvsInterface.h \ introspection/org.freedesktop.NetworkManager.Device.OvsPort.c \ introspection/org.freedesktop.NetworkManager.Device.OvsPort.h \ - introspection/org.freedesktop.NetworkManager.Device.P2PWireless.c \ - introspection/org.freedesktop.NetworkManager.Device.P2PWireless.h \ introspection/org.freedesktop.NetworkManager.Device.Ppp.c \ introspection/org.freedesktop.NetworkManager.Device.Ppp.h \ introspection/org.freedesktop.NetworkManager.Device.Statistics.c \ @@ -449,6 +447,8 @@ introspection_sources = \ introspection/org.freedesktop.NetworkManager.Device.Vxlan.h \ introspection/org.freedesktop.NetworkManager.Device.WiMax.c \ introspection/org.freedesktop.NetworkManager.Device.WiMax.h \ + introspection/org.freedesktop.NetworkManager.Device.WifiP2P.c \ + introspection/org.freedesktop.NetworkManager.Device.WifiP2P.h \ introspection/org.freedesktop.NetworkManager.Device.WireGuard.c \ introspection/org.freedesktop.NetworkManager.Device.WireGuard.h \ introspection/org.freedesktop.NetworkManager.Device.Wired.c \ @@ -465,8 +465,8 @@ introspection_sources = \ introspection/org.freedesktop.NetworkManager.IP4Config.h \ introspection/org.freedesktop.NetworkManager.IP6Config.c \ introspection/org.freedesktop.NetworkManager.IP6Config.h \ - introspection/org.freedesktop.NetworkManager.P2PPeer.c \ - introspection/org.freedesktop.NetworkManager.P2PPeer.h \ + introspection/org.freedesktop.NetworkManager.WifiP2PPeer.c \ + introspection/org.freedesktop.NetworkManager.WifiP2PPeer.h \ introspection/org.freedesktop.NetworkManager.PPP.c \ introspection/org.freedesktop.NetworkManager.PPP.h \ introspection/org.freedesktop.NetworkManager.SecretAgent.c \ @@ -508,7 +508,6 @@ DBUS_INTERFACE_DOCS = \ docs/api/dbus-org.freedesktop.NetworkManager.Device.OvsBridge.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.OvsInterface.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.OvsPort.xml \ - docs/api/dbus-org.freedesktop.NetworkManager.Device.P2PWireless.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.Ppp.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.Statistics.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.Team.xml \ @@ -517,6 +516,7 @@ DBUS_INTERFACE_DOCS = \ docs/api/dbus-org.freedesktop.NetworkManager.Device.Vlan.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.Vxlan.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.WiMax.xml \ + docs/api/dbus-org.freedesktop.NetworkManager.Device.WifiP2P.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.WireGuard.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.Wired.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Device.Wireless.xml \ @@ -525,13 +525,13 @@ DBUS_INTERFACE_DOCS = \ docs/api/dbus-org.freedesktop.NetworkManager.DnsManager.xml \ docs/api/dbus-org.freedesktop.NetworkManager.IP4Config.xml \ docs/api/dbus-org.freedesktop.NetworkManager.IP6Config.xml \ - docs/api/dbus-org.freedesktop.NetworkManager.P2PPeer.xml \ docs/api/dbus-org.freedesktop.NetworkManager.PPP.xml \ docs/api/dbus-org.freedesktop.NetworkManager.SecretAgent.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Settings.Connection.xml \ docs/api/dbus-org.freedesktop.NetworkManager.Settings.xml \ docs/api/dbus-org.freedesktop.NetworkManager.VPN.Connection.xml \ docs/api/dbus-org.freedesktop.NetworkManager.VPN.Plugin.xml \ + docs/api/dbus-org.freedesktop.NetworkManager.WifiP2PPeer.xml \ docs/api/dbus-org.freedesktop.NetworkManager.xml \ $(NULL) @@ -554,27 +554,27 @@ dbusinterfacesdir = $(datadir)/dbus-1/interfaces dbusinterfaces_DATA = \ introspection/org.freedesktop.NetworkManager.AccessPoint.xml \ - introspection/org.freedesktop.NetworkManager.Connection.Active.xml \ introspection/org.freedesktop.NetworkManager.AgentManager.xml \ introspection/org.freedesktop.NetworkManager.Checkpoint.xml \ + introspection/org.freedesktop.NetworkManager.Connection.Active.xml \ + introspection/org.freedesktop.NetworkManager.DHCP4Config.xml \ + introspection/org.freedesktop.NetworkManager.DHCP6Config.xml \ introspection/org.freedesktop.NetworkManager.Device.Adsl.xml \ + introspection/org.freedesktop.NetworkManager.Device.Bluetooth.xml \ introspection/org.freedesktop.NetworkManager.Device.Bond.xml \ introspection/org.freedesktop.NetworkManager.Device.Bridge.xml \ - introspection/org.freedesktop.NetworkManager.Device.Bluetooth.xml \ introspection/org.freedesktop.NetworkManager.Device.Dummy.xml \ - introspection/org.freedesktop.NetworkManager.Device.Wired.xml \ introspection/org.freedesktop.NetworkManager.Device.Generic.xml \ - introspection/org.freedesktop.NetworkManager.Device.Infiniband.xml \ introspection/org.freedesktop.NetworkManager.Device.IPTunnel.xml \ + introspection/org.freedesktop.NetworkManager.Device.Infiniband.xml \ introspection/org.freedesktop.NetworkManager.Device.Lowpan.xml \ introspection/org.freedesktop.NetworkManager.Device.Macsec.xml \ introspection/org.freedesktop.NetworkManager.Device.Macvlan.xml \ introspection/org.freedesktop.NetworkManager.Device.Modem.xml \ introspection/org.freedesktop.NetworkManager.Device.OlpcMesh.xml \ + introspection/org.freedesktop.NetworkManager.Device.OvsBridge.xml \ introspection/org.freedesktop.NetworkManager.Device.OvsInterface.xml \ introspection/org.freedesktop.NetworkManager.Device.OvsPort.xml \ - introspection/org.freedesktop.NetworkManager.Device.OvsBridge.xml \ - introspection/org.freedesktop.NetworkManager.Device.P2PWireless.xml \ introspection/org.freedesktop.NetworkManager.Device.Ppp.xml \ introspection/org.freedesktop.NetworkManager.Device.Statistics.xml \ introspection/org.freedesktop.NetworkManager.Device.Team.xml \ @@ -582,25 +582,26 @@ dbusinterfaces_DATA = \ introspection/org.freedesktop.NetworkManager.Device.Veth.xml \ introspection/org.freedesktop.NetworkManager.Device.Vlan.xml \ introspection/org.freedesktop.NetworkManager.Device.Vxlan.xml \ - introspection/org.freedesktop.NetworkManager.Device.WireGuard.xml \ - introspection/org.freedesktop.NetworkManager.Device.Wireless.xml \ introspection/org.freedesktop.NetworkManager.Device.WiMax.xml \ + introspection/org.freedesktop.NetworkManager.Device.WifiP2P.xml \ + introspection/org.freedesktop.NetworkManager.Device.WireGuard.xml \ + introspection/org.freedesktop.NetworkManager.Device.Wired.xml \ + introspection/org.freedesktop.NetworkManager.Device.Wireless.xml \ introspection/org.freedesktop.NetworkManager.Device.Wpan.xml \ introspection/org.freedesktop.NetworkManager.Device.xml \ - introspection/org.freedesktop.NetworkManager.DHCP4Config.xml \ - introspection/org.freedesktop.NetworkManager.DHCP6Config.xml \ introspection/org.freedesktop.NetworkManager.DnsManager.xml \ introspection/org.freedesktop.NetworkManager.IP4Config.xml \ introspection/org.freedesktop.NetworkManager.IP6Config.xml \ - introspection/org.freedesktop.NetworkManager.xml \ - introspection/org.freedesktop.NetworkManager.P2PPeer.xml \ introspection/org.freedesktop.NetworkManager.PPP.xml \ introspection/org.freedesktop.NetworkManager.SecretAgent.xml \ introspection/org.freedesktop.NetworkManager.Settings.Connection.xml \ introspection/org.freedesktop.NetworkManager.Settings.xml \ introspection/org.freedesktop.NetworkManager.VPN.Connection.xml \ introspection/org.freedesktop.NetworkManager.VPN.Plugin.xml \ - introspection/org.freedesktop.NetworkManager.WiMax.Nsp.xml + introspection/org.freedesktop.NetworkManager.WiMax.Nsp.xml \ + introspection/org.freedesktop.NetworkManager.WifiP2PPeer.xml \ + introspection/org.freedesktop.NetworkManager.xml \ + $(NULL) CLEANFILES += $(introspection_sources) CLEANFILES += $(DBUS_INTERFACE_DOCS) diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 8155bfb960..e2c23cb8c1 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -796,7 +796,7 @@ const NmcMetaGenericInfo *const metagen_con_active_vpn[_NMC_GENERIC_INFO_TYPE_CO NM_SETTING_IP4_CONFIG_SETTING_NAME","\ NM_SETTING_IP6_CONFIG_SETTING_NAME","\ NM_SETTING_SERIAL_SETTING_NAME","\ - NM_SETTING_P2P_WIRELESS_SETTING_NAME","\ + NM_SETTING_WIFI_P2P_SETTING_NAME","\ NM_SETTING_PPP_SETTING_NAME","\ NM_SETTING_PPPOE_SETTING_NAME","\ NM_SETTING_ADSL_SETTING_NAME","\ diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 41cf35d93e..ebaf35b864 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -6619,27 +6619,6 @@ static const NMMetaPropertyInfo *const property_infos_OLPC_MESH[] = { NULL }; -#undef _CURRENT_NM_META_SETTING_TYPE -#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_P2P_WIRELESS -static const NMMetaPropertyInfo *const property_infos_P2P_WIRELESS[] = { - PROPERTY_INFO_WITH_DESC (NM_SETTING_P2P_WIRELESS_PEER, - .is_cli_option = TRUE, - .property_alias = "peer", - .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, - .prompt = N_("Peer"), - .property_type = &_pt_gobject_mac, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, - .property_type = &_pt_gobject_enum, - .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( - PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, - .get_gtype = nm_setting_wireless_security_wps_method_get_type, - ), - ), - ), - NULL -}; - #undef _CURRENT_NM_META_SETTING_TYPE #define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PPPOE static const NMMetaPropertyInfo *const property_infos_PPPOE[] = { @@ -7385,6 +7364,27 @@ static const NMMetaPropertyInfo *const property_infos_VXLAN[] = { NULL }; +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIFI_P2P +static const NMMetaPropertyInfo *const property_infos_WIFI_P2P[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIFI_P2P_PEER, + .is_cli_option = TRUE, + .property_alias = "peer", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("Peer"), + .property_type = &_pt_gobject_mac, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_wireless_security_wps_method_get_type, + ), + ), + ), + NULL +}; + #undef _CURRENT_NM_META_SETTING_TYPE #define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIMAX static const NMMetaPropertyInfo *const property_infos_WIMAX[] = { @@ -8011,7 +8011,6 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN) #define SETTING_PRETTY_NAME_OVS_INTERFACE N_("Open vSwitch interface settings") #define SETTING_PRETTY_NAME_OVS_PATCH N_("Open vSwitch patch interface settings") #define SETTING_PRETTY_NAME_OVS_PORT N_("Open vSwitch port settings") -#define SETTING_PRETTY_NAME_P2P_WIRELESS N_("P2P Wi-Fi connection") #define SETTING_PRETTY_NAME_PPP N_("PPP settings") #define SETTING_PRETTY_NAME_PPPOE N_("PPPoE") #define SETTING_PRETTY_NAME_PROXY N_("Proxy") @@ -8025,6 +8024,7 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN) #define SETTING_PRETTY_NAME_VLAN N_("VLAN connection") #define SETTING_PRETTY_NAME_VPN N_("VPN connection") #define SETTING_PRETTY_NAME_VXLAN N_("VXLAN connection") +#define SETTING_PRETTY_NAME_WIFI_P2P N_("Wi-Fi P2P connection") #define SETTING_PRETTY_NAME_WIMAX N_("WiMAX connection") #define SETTING_PRETTY_NAME_WIRED N_("Wired Ethernet") #define SETTING_PRETTY_NAME_WIRELESS N_("Wi-Fi connection") @@ -8205,12 +8205,6 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = { NM_META_SETTING_VALID_PART_ITEM (OVS_PORT, TRUE), ), ), - SETTING_INFO (P2P_WIRELESS, - .valid_parts = NM_META_SETTING_VALID_PARTS ( - NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), - NM_META_SETTING_VALID_PART_ITEM (P2P_WIRELESS, TRUE), - ), - ), SETTING_INFO (PPPOE, /* PPPoE is a base connection type from historical reasons. * See libnm-core/nm-setting.c:_nm_setting_is_base_type() @@ -8273,6 +8267,12 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = { NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE), ), ), + SETTING_INFO (WIFI_P2P, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIFI_P2P, TRUE), + ), + ), SETTING_INFO (WIMAX, .valid_parts = NM_META_SETTING_VALID_PARTS ( NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in index 7f1a59d5fa..725ca7d6b8 100644 --- a/clients/common/settings-docs.h.in +++ b/clients/common/settings-docs.h.in @@ -263,8 +263,6 @@ #define DESCRIBE_DOC_NM_SETTING_OVS_PORT_LACP N_("LACP mode. One of \"active\", \"off\", or \"passive\".") #define DESCRIBE_DOC_NM_SETTING_OVS_PORT_TAG N_("The VLAN tag in the range 0-4095.") #define DESCRIBE_DOC_NM_SETTING_OVS_PORT_VLAN_MODE N_("The VLAN mode. One of \"access\", \"native-tagged\", \"native-untagged\", \"trunk\" or unset.") -#define DESCRIBE_DOC_NM_SETTING_P2P_WIRELESS_PEER N_("The P2P device that should be connected to. Currently this is the only way to create or join a group.") -#define DESCRIBE_DOC_NM_SETTING_P2P_WIRELESS_WPS_METHOD N_("Flags indicating which mode of WPS is to be used. There's little point in changing the default setting as NetworkManager will automatically determine the best method to use.") #define DESCRIBE_DOC_NM_SETTING_PPP_BAUD N_("If non-zero, instruct pppd to set the serial port to the specified baudrate. This value should normally be left as 0 to automatically choose the speed.") #define DESCRIBE_DOC_NM_SETTING_PPP_CRTSCTS N_("If TRUE, specify that pppd should set the serial port to use hardware flow control with RTS and CTS signals. This value should normally be set to FALSE.") #define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_FAILURE N_("If non-zero, instruct pppd to presume the connection to the peer has failed if the specified number of LCP echo-requests go unanswered by the peer. The \"lcp-echo-interval\" property must also be set to a non-zero value if this property is used.") @@ -359,6 +357,8 @@ #define DESCRIBE_DOC_NM_SETTING_VXLAN_SOURCE_PORT_MIN N_("Specifies the minimum UDP source port to communicate to the remote VXLAN tunnel endpoint.") #define DESCRIBE_DOC_NM_SETTING_VXLAN_TOS N_("Specifies the TOS value to use in outgoing packets.") #define DESCRIBE_DOC_NM_SETTING_VXLAN_TTL N_("Specifies the time-to-live value to use in outgoing packets.") +#define DESCRIBE_DOC_NM_SETTING_WIFI_P2P_PEER N_("The P2P device that should be connected to. Currently this is the only way to create or join a group.") +#define DESCRIBE_DOC_NM_SETTING_WIFI_P2P_WPS_METHOD N_("Flags indicating which mode of WPS is to be used. There's little point in changing the default setting as NetworkManager will automatically determine the best method to use.") #define DESCRIBE_DOC_NM_SETTING_WIMAX_MAC_ADDRESS N_("If specified, this connection will only apply to the WiMAX device whose MAC address matches. This property does not change the MAC address of the device (known as MAC spoofing). Deprecated: 1") #define DESCRIBE_DOC_NM_SETTING_WIMAX_NETWORK_NAME N_("Network Service Provider (NSP) name of the WiMAX network this connection should use. Deprecated: 1") #define DESCRIBE_DOC_NM_SETTING_WPAN_CHANNEL N_("IEEE 802.15.4 channel. A positive integer or -1, meaning \"do not set, use whatever the device is already set to\".") diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am index 7ec77963f2..33ca2e35e3 100644 --- a/docs/api/Makefile.am +++ b/docs/api/Makefile.am @@ -64,8 +64,8 @@ content_files = \ dbus-org.freedesktop.NetworkManager.Device.Veth.xml \ dbus-org.freedesktop.NetworkManager.Device.Vlan.xml \ dbus-org.freedesktop.NetworkManager.Device.Vxlan.xml \ + dbus-org.freedesktop.NetworkManager.Device.WifiP2P.xml \ dbus-org.freedesktop.NetworkManager.Device.WireGuard.xml \ - dbus-org.freedesktop.NetworkManager.Device.P2PWireless.xml \ dbus-org.freedesktop.NetworkManager.Device.Wired.xml \ dbus-org.freedesktop.NetworkManager.Device.Wireless.xml \ dbus-org.freedesktop.NetworkManager.Device.xml \ diff --git a/docs/api/network-manager-docs.xml b/docs/api/network-manager-docs.xml index 8b7c8c6bf9..8cf97585a0 100644 --- a/docs/api/network-manager-docs.xml +++ b/docs/api/network-manager-docs.xml @@ -182,14 +182,13 @@ + - - - + @@ -204,9 +203,10 @@ + + - @@ -248,10 +248,10 @@ - - The <literal>/org/freedesktop/NetworkManager/P2PPeer/*</literal> objects + + The <literal>/org.freedesktop.NetworkManager.WifiP2PPeer/*</literal> objects - + diff --git a/introspection/meson.build b/introspection/meson.build index e5bbe2a284..e442ac85f8 100644 --- a/introspection/meson.build +++ b/introspection/meson.build @@ -3,27 +3,30 @@ ifaces_secret_agent_xml = files('org.freedesktop.NetworkManager.SecretAgent.xml' ifaces_vpn_plugin_xml = files('org.freedesktop.NetworkManager.VPN.Plugin.xml') ifaces = [ + 'org.freedesktop.NetworkManager', 'org.freedesktop.NetworkManager.AccessPoint', 'org.freedesktop.NetworkManager.AgentManager', 'org.freedesktop.NetworkManager.Checkpoint', 'org.freedesktop.NetworkManager.Connection.Active', + 'org.freedesktop.NetworkManager.DHCP4Config', + 'org.freedesktop.NetworkManager.DHCP6Config', + 'org.freedesktop.NetworkManager.Device', 'org.freedesktop.NetworkManager.Device.Adsl', 'org.freedesktop.NetworkManager.Device.Bluetooth', 'org.freedesktop.NetworkManager.Device.Bond', 'org.freedesktop.NetworkManager.Device.Bridge', 'org.freedesktop.NetworkManager.Device.Dummy', 'org.freedesktop.NetworkManager.Device.Generic', - 'org.freedesktop.NetworkManager.Device.Infiniband', 'org.freedesktop.NetworkManager.Device.IPTunnel', + 'org.freedesktop.NetworkManager.Device.Infiniband', 'org.freedesktop.NetworkManager.Device.Lowpan', 'org.freedesktop.NetworkManager.Device.Macsec', 'org.freedesktop.NetworkManager.Device.Macvlan', 'org.freedesktop.NetworkManager.Device.Modem', 'org.freedesktop.NetworkManager.Device.OlpcMesh', + 'org.freedesktop.NetworkManager.Device.OvsBridge', 'org.freedesktop.NetworkManager.Device.OvsInterface', 'org.freedesktop.NetworkManager.Device.OvsPort', - 'org.freedesktop.NetworkManager.Device.OvsBridge', - 'org.freedesktop.NetworkManager.Device.P2PWireless', 'org.freedesktop.NetworkManager.Device.Ppp', 'org.freedesktop.NetworkManager.Device.Statistics', 'org.freedesktop.NetworkManager.Device.Team', @@ -32,25 +35,22 @@ ifaces = [ 'org.freedesktop.NetworkManager.Device.Vlan', 'org.freedesktop.NetworkManager.Device.Vxlan', 'org.freedesktop.NetworkManager.Device.WiMax', - 'org.freedesktop.NetworkManager.Device.Wpan', + 'org.freedesktop.NetworkManager.Device.WifiP2P', 'org.freedesktop.NetworkManager.Device.WireGuard', 'org.freedesktop.NetworkManager.Device.Wired', 'org.freedesktop.NetworkManager.Device.Wireless', - 'org.freedesktop.NetworkManager.Device', - 'org.freedesktop.NetworkManager.DHCP4Config', - 'org.freedesktop.NetworkManager.DHCP6Config', + 'org.freedesktop.NetworkManager.Device.Wpan', 'org.freedesktop.NetworkManager.DnsManager', 'org.freedesktop.NetworkManager.IP4Config', 'org.freedesktop.NetworkManager.IP6Config', - 'org.freedesktop.NetworkManager', - 'org.freedesktop.NetworkManager.P2PPeer', 'org.freedesktop.NetworkManager.PPP', 'org.freedesktop.NetworkManager.SecretAgent', - 'org.freedesktop.NetworkManager.Settings.Connection', 'org.freedesktop.NetworkManager.Settings', + 'org.freedesktop.NetworkManager.Settings.Connection', 'org.freedesktop.NetworkManager.VPN.Connection', 'org.freedesktop.NetworkManager.VPN.Plugin', 'org.freedesktop.NetworkManager.WiMax.Nsp', + 'org.freedesktop.NetworkManager.WifiP2PPeer', ] ifaces_xmls = [] diff --git a/introspection/org.freedesktop.NetworkManager.Device.P2PWireless.xml b/introspection/org.freedesktop.NetworkManager.Device.WifiP2P.xml similarity index 75% rename from introspection/org.freedesktop.NetworkManager.Device.P2PWireless.xml rename to introspection/org.freedesktop.NetworkManager.Device.WifiP2P.xml index 0e6a1cbca2..82a0e89b62 100644 --- a/introspection/org.freedesktop.NetworkManager.Device.P2PWireless.xml +++ b/introspection/org.freedesktop.NetworkManager.Device.WifiP2P.xml @@ -1,13 +1,13 @@ - - + + @@ -56,7 +56,7 @@ in the range of 1-600 seconds is supported. The default is 30 seconds. - Start a find operation for P2P peers. + Start a find operation for Wi-Fi P2P peers. Since: 1.16 --> @@ -78,7 +78,7 @@ PeerAdded: @peer: The object path of the newly found access point. - Emitted when a new P2P peer is found by the device. + Emitted when a new Wi-Fi P2P peer is found by the device. Since: 1.16 --> @@ -88,9 +88,9 @@ diff --git a/introspection/org.freedesktop.NetworkManager.P2PPeer.xml b/introspection/org.freedesktop.NetworkManager.WifiP2PPeer.xml similarity index 76% rename from introspection/org.freedesktop.NetworkManager.P2PPeer.xml rename to introspection/org.freedesktop.NetworkManager.WifiP2PPeer.xml index 4ffba1d14e..9068f071de 100644 --- a/introspection/org.freedesktop.NetworkManager.P2PPeer.xml +++ b/introspection/org.freedesktop.NetworkManager.WifiP2PPeer.xml @@ -1,13 +1,13 @@ - - + + @@ -32,7 +32,7 @@ @@ -41,7 +41,7 @@ @@ -50,16 +50,16 @@ diff --git a/libnm-core/nm-core-types.h b/libnm-core/nm-core-types.h index 823001324e..e8aa67a93f 100644 --- a/libnm-core/nm-core-types.h +++ b/libnm-core/nm-core-types.h @@ -43,12 +43,11 @@ typedef struct _NMSettingDummy NMSettingDummy; typedef struct _NMSettingEthtool NMSettingEthtool; typedef struct _NMSettingGeneric NMSettingGeneric; typedef struct _NMSettingGsm NMSettingGsm; -typedef struct _NMSettingInfiniband NMSettingInfiniband; -typedef struct _NMSettingIPConfig NMSettingIPConfig; -typedef struct _NMSettingIPTunnel NMSettingIPTunnel; -typedef struct _NMSettingProxy NMSettingProxy; typedef struct _NMSettingIP4Config NMSettingIP4Config; typedef struct _NMSettingIP6Config NMSettingIP6Config; +typedef struct _NMSettingIPConfig NMSettingIPConfig; +typedef struct _NMSettingIPTunnel NMSettingIPTunnel; +typedef struct _NMSettingInfiniband NMSettingInfiniband; typedef struct _NMSettingMacsec NMSettingMacsec; typedef struct _NMSettingMacvlan NMSettingMacvlan; typedef struct _NMSettingMatch NMSettingMatch; @@ -57,9 +56,9 @@ typedef struct _NMSettingOvsBridge NMSettingOvsBridge; typedef struct _NMSettingOvsInterface NMSettingOvsInterface; typedef struct _NMSettingOvsPatch NMSettingOvsPatch; typedef struct _NMSettingOvsPort NMSettingOvsPort; -typedef struct _NMSettingP2PWireless NMSettingP2PWireless; typedef struct _NMSettingPpp NMSettingPpp; typedef struct _NMSettingPppoe NMSettingPppoe; +typedef struct _NMSettingProxy NMSettingProxy; typedef struct _NMSettingSerial NMSettingSerial; typedef struct _NMSettingSriov NMSettingSriov; typedef struct _NMSettingTCConfig NMSettingTCConfig; @@ -70,6 +69,7 @@ typedef struct _NMSettingUser NMSettingUser; typedef struct _NMSettingVlan NMSettingVlan; typedef struct _NMSettingVpn NMSettingVpn; typedef struct _NMSettingVxlan NMSettingVxlan; +typedef struct _NMSettingWifiP2P NMSettingWifiP2P; typedef struct _NMSettingWimax NMSettingWimax; typedef struct _NMSettingWired NMSettingWired; typedef struct _NMSettingWireless NMSettingWireless; diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h index 924140edef..2db31243fd 100644 --- a/libnm-core/nm-dbus-interface.h +++ b/libnm-core/nm-dbus-interface.h @@ -38,51 +38,52 @@ */ #define NM_DBUS_SERVICE "org.freedesktop.NetworkManager" -#define NM_DBUS_PATH "/org/freedesktop/NetworkManager" #define NM_DBUS_INTERFACE "org.freedesktop.NetworkManager" -#define NM_DBUS_INTERFACE_DEVICE NM_DBUS_INTERFACE ".Device" -#define NM_DBUS_INTERFACE_DEVICE_WIRED NM_DBUS_INTERFACE_DEVICE ".Wired" -#define NM_DBUS_INTERFACE_DEVICE_ADSL NM_DBUS_INTERFACE_DEVICE ".Adsl" -#define NM_DBUS_INTERFACE_DEVICE_WIRELESS NM_DBUS_INTERFACE_DEVICE ".Wireless" -#define NM_DBUS_INTERFACE_DEVICE_P2P_WIRELESS NM_DBUS_INTERFACE_DEVICE ".P2PWireless" -#define NM_DBUS_INTERFACE_DEVICE_BLUETOOTH NM_DBUS_INTERFACE_DEVICE ".Bluetooth" -#define NM_DBUS_INTERFACE_DEVICE_OLPC_MESH NM_DBUS_INTERFACE_DEVICE ".OlpcMesh" -#define NM_DBUS_INTERFACE_DEVICE_OVS_INTERFACE NM_DBUS_INTERFACE_DEVICE ".OvsInterface" -#define NM_DBUS_INTERFACE_DEVICE_OVS_PORT NM_DBUS_INTERFACE_DEVICE ".OvsPort" -#define NM_DBUS_INTERFACE_DEVICE_OVS_BRIDGE NM_DBUS_INTERFACE_DEVICE ".OvsBridge" -#define NM_DBUS_PATH_ACCESS_POINT NM_DBUS_PATH "/AccessPoint" #define NM_DBUS_INTERFACE_ACCESS_POINT NM_DBUS_INTERFACE ".AccessPoint" -#define NM_DBUS_PATH_P2P_PEER NM_DBUS_PATH "/P2PPeer" -#define NM_DBUS_INTERFACE_P2P_PEER NM_DBUS_INTERFACE ".P2PPeer" -#define NM_DBUS_INTERFACE_DEVICE_MODEM NM_DBUS_INTERFACE_DEVICE ".Modem" -#define NM_DBUS_INTERFACE_DEVICE_WIMAX NM_DBUS_INTERFACE_DEVICE ".WiMax" -#define NM_DBUS_INTERFACE_WIMAX_NSP NM_DBUS_INTERFACE ".WiMax.Nsp" -#define NM_DBUS_PATH_WIMAX_NSP NM_DBUS_PATH "/Nsp" #define NM_DBUS_INTERFACE_ACTIVE_CONNECTION NM_DBUS_INTERFACE ".Connection.Active" -#define NM_DBUS_INTERFACE_IP4_CONFIG NM_DBUS_INTERFACE ".IP4Config" -#define NM_DBUS_INTERFACE_DHCP4_CONFIG NM_DBUS_INTERFACE ".DHCP4Config" -#define NM_DBUS_INTERFACE_IP6_CONFIG NM_DBUS_INTERFACE ".IP6Config" -#define NM_DBUS_INTERFACE_DHCP6_CONFIG NM_DBUS_INTERFACE ".DHCP6Config" -#define NM_DBUS_INTERFACE_DEVICE_INFINIBAND NM_DBUS_INTERFACE_DEVICE ".Infiniband" +#define NM_DBUS_INTERFACE_CHECKPOINT NM_DBUS_INTERFACE ".Checkpoint" +#define NM_DBUS_INTERFACE_DEVICE NM_DBUS_INTERFACE ".Device" +#define NM_DBUS_INTERFACE_DEVICE_6LOWPAN NM_DBUS_INTERFACE_DEVICE ".Lowpan" +#define NM_DBUS_INTERFACE_DEVICE_ADSL NM_DBUS_INTERFACE_DEVICE ".Adsl" +#define NM_DBUS_INTERFACE_DEVICE_BLUETOOTH NM_DBUS_INTERFACE_DEVICE ".Bluetooth" #define NM_DBUS_INTERFACE_DEVICE_BOND NM_DBUS_INTERFACE_DEVICE ".Bond" -#define NM_DBUS_INTERFACE_DEVICE_DUMMY NM_DBUS_INTERFACE_DEVICE ".Dummy" -#define NM_DBUS_INTERFACE_DEVICE_TEAM NM_DBUS_INTERFACE_DEVICE ".Team" -#define NM_DBUS_INTERFACE_DEVICE_VLAN NM_DBUS_INTERFACE_DEVICE ".Vlan" #define NM_DBUS_INTERFACE_DEVICE_BRIDGE NM_DBUS_INTERFACE_DEVICE ".Bridge" +#define NM_DBUS_INTERFACE_DEVICE_DUMMY NM_DBUS_INTERFACE_DEVICE ".Dummy" #define NM_DBUS_INTERFACE_DEVICE_GENERIC NM_DBUS_INTERFACE_DEVICE ".Generic" -#define NM_DBUS_INTERFACE_DEVICE_VETH NM_DBUS_INTERFACE_DEVICE ".Veth" -#define NM_DBUS_INTERFACE_DEVICE_TUN NM_DBUS_INTERFACE_DEVICE ".Tun" +#define NM_DBUS_INTERFACE_DEVICE_GRE NM_DBUS_INTERFACE_DEVICE ".Gre" +#define NM_DBUS_INTERFACE_DEVICE_INFINIBAND NM_DBUS_INTERFACE_DEVICE ".Infiniband" +#define NM_DBUS_INTERFACE_DEVICE_IP_TUNNEL NM_DBUS_INTERFACE_DEVICE ".IPTunnel" #define NM_DBUS_INTERFACE_DEVICE_MACSEC NM_DBUS_INTERFACE_DEVICE ".Macsec" #define NM_DBUS_INTERFACE_DEVICE_MACVLAN NM_DBUS_INTERFACE_DEVICE ".Macvlan" +#define NM_DBUS_INTERFACE_DEVICE_MODEM NM_DBUS_INTERFACE_DEVICE ".Modem" +#define NM_DBUS_INTERFACE_DEVICE_OLPC_MESH NM_DBUS_INTERFACE_DEVICE ".OlpcMesh" +#define NM_DBUS_INTERFACE_DEVICE_OVS_BRIDGE NM_DBUS_INTERFACE_DEVICE ".OvsBridge" +#define NM_DBUS_INTERFACE_DEVICE_OVS_INTERFACE NM_DBUS_INTERFACE_DEVICE ".OvsInterface" +#define NM_DBUS_INTERFACE_DEVICE_OVS_PORT NM_DBUS_INTERFACE_DEVICE ".OvsPort" #define NM_DBUS_INTERFACE_DEVICE_PPP NM_DBUS_INTERFACE_DEVICE ".Ppp" -#define NM_DBUS_INTERFACE_DEVICE_VXLAN NM_DBUS_INTERFACE_DEVICE ".Vxlan" -#define NM_DBUS_INTERFACE_DEVICE_WIREGUARD NM_DBUS_INTERFACE_DEVICE ".WireGuard" -#define NM_DBUS_INTERFACE_DEVICE_GRE NM_DBUS_INTERFACE_DEVICE ".Gre" -#define NM_DBUS_INTERFACE_DEVICE_IP_TUNNEL NM_DBUS_INTERFACE_DEVICE ".IPTunnel" -#define NM_DBUS_INTERFACE_DEVICE_WPAN NM_DBUS_INTERFACE_DEVICE ".Wpan" -#define NM_DBUS_INTERFACE_DEVICE_6LOWPAN NM_DBUS_INTERFACE_DEVICE ".Lowpan" #define NM_DBUS_INTERFACE_DEVICE_STATISTICS NM_DBUS_INTERFACE_DEVICE ".Statistics" -#define NM_DBUS_INTERFACE_CHECKPOINT NM_DBUS_INTERFACE ".Checkpoint" +#define NM_DBUS_INTERFACE_DEVICE_TEAM NM_DBUS_INTERFACE_DEVICE ".Team" +#define NM_DBUS_INTERFACE_DEVICE_TUN NM_DBUS_INTERFACE_DEVICE ".Tun" +#define NM_DBUS_INTERFACE_DEVICE_VETH NM_DBUS_INTERFACE_DEVICE ".Veth" +#define NM_DBUS_INTERFACE_DEVICE_VLAN NM_DBUS_INTERFACE_DEVICE ".Vlan" +#define NM_DBUS_INTERFACE_DEVICE_VXLAN NM_DBUS_INTERFACE_DEVICE ".Vxlan" +#define NM_DBUS_INTERFACE_DEVICE_WIFI_P2P NM_DBUS_INTERFACE_DEVICE ".WifiP2P" +#define NM_DBUS_INTERFACE_DEVICE_WIMAX NM_DBUS_INTERFACE_DEVICE ".WiMax" +#define NM_DBUS_INTERFACE_DEVICE_WIRED NM_DBUS_INTERFACE_DEVICE ".Wired" +#define NM_DBUS_INTERFACE_DEVICE_WIREGUARD NM_DBUS_INTERFACE_DEVICE ".WireGuard" +#define NM_DBUS_INTERFACE_DEVICE_WIRELESS NM_DBUS_INTERFACE_DEVICE ".Wireless" +#define NM_DBUS_INTERFACE_DEVICE_WPAN NM_DBUS_INTERFACE_DEVICE ".Wpan" +#define NM_DBUS_INTERFACE_DHCP4_CONFIG NM_DBUS_INTERFACE ".DHCP4Config" +#define NM_DBUS_INTERFACE_DHCP6_CONFIG NM_DBUS_INTERFACE ".DHCP6Config" +#define NM_DBUS_INTERFACE_IP4_CONFIG NM_DBUS_INTERFACE ".IP4Config" +#define NM_DBUS_INTERFACE_IP6_CONFIG NM_DBUS_INTERFACE ".IP6Config" +#define NM_DBUS_INTERFACE_WIFI_P2P_PEER NM_DBUS_INTERFACE ".WifiP2PPeer" +#define NM_DBUS_INTERFACE_WIMAX_NSP NM_DBUS_INTERFACE ".WiMax.Nsp" + +#define NM_DBUS_PATH "/org/freedesktop/NetworkManager" +#define NM_DBUS_PATH_ACCESS_POINT NM_DBUS_PATH "/AccessPoint" +#define NM_DBUS_PATH_WIFI_P2P_PEER NM_DBUS_PATH "/WifiP2PPeer" +#define NM_DBUS_PATH_WIMAX_NSP NM_DBUS_PATH "/Nsp" #define NM_DBUS_INTERFACE_SETTINGS "org.freedesktop.NetworkManager.Settings" #define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManager/Settings" diff --git a/libnm-core/nm-setting-wifi-p2p.c b/libnm-core/nm-setting-wifi-p2p.c index 4c679a99d6..893170fc28 100644 --- a/libnm-core/nm-setting-wifi-p2p.c +++ b/libnm-core/nm-setting-wifi-p2p.c @@ -33,14 +33,14 @@ * SECTION:nm-setting-wifi-p2p * @short_description: Describes connection properties for 802.11 Wi-Fi P2P networks * - * The #NMSettingP2PWireless object is a #NMSetting subclass that describes properties + * The #NMSettingWifiP2P object is a #NMSetting subclass that describes properties * necessary for connection to 802.11 Wi-Fi P2P networks (aka Wi-Fi Direct). **/ /** - * NMSettingP2PWireless: + * NMSettingWifiP2P: * - * P2P Wi-Fi Settings + * Wi-Fi P2P Settings * * Since: 1.16 */ @@ -56,53 +56,53 @@ typedef struct { char *peer_mac_address; NMSettingWirelessSecurityWpsMethod wps_method; -} NMSettingP2PWirelessPrivate; +} NMSettingWifiP2PPrivate; -struct _NMSettingP2PWireless { +struct _NMSettingWifiP2P { NMSetting parent; - NMSettingP2PWirelessPrivate _priv; + NMSettingWifiP2PPrivate _priv; }; -struct _NMSettingP2PWirelessClass { +struct _NMSettingWifiP2PClass { NMSettingClass parent; }; -G_DEFINE_TYPE (NMSettingP2PWireless, nm_setting_p2p_wireless, NM_TYPE_SETTING) +G_DEFINE_TYPE (NMSettingWifiP2P, nm_setting_wifi_p2p, NM_TYPE_SETTING) -#define NM_SETTING_P2P_WIRELESS_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSettingP2PWireless, NM_IS_SETTING_P2P_WIRELESS, NMSetting) +#define NM_SETTING_WIFI_P2P_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSettingWifiP2P, NM_IS_SETTING_WIFI_P2P, NMSetting) /*****************************************************************************/ /** - * nm_setting_p2p_wireless_get_peer: - * @setting: the #NMSettingP2PWireless + * nm_setting_wifi_p2p_get_peer: + * @setting: the #NMSettingWifiP2P * - * Returns: the #NMSettingP2PWireless:peer property of the setting + * Returns: the #NMSettingWifiP2P:peer property of the setting * * Since: 1.16 **/ const char * -nm_setting_p2p_wireless_get_peer (NMSettingP2PWireless *setting) +nm_setting_wifi_p2p_get_peer (NMSettingWifiP2P *setting) { - g_return_val_if_fail (NM_IS_SETTING_P2P_WIRELESS (setting), NULL); + g_return_val_if_fail (NM_IS_SETTING_WIFI_P2P (setting), NULL); - return NM_SETTING_P2P_WIRELESS_GET_PRIVATE (setting)->peer_mac_address; + return NM_SETTING_WIFI_P2P_GET_PRIVATE (setting)->peer_mac_address; } /** - * nm_setting_p2p_wireless_get_wps_method: - * @setting: the #NMSettingP2PWireless + * nm_setting_wifi_p2p_get_wps_method: + * @setting: the #NMSettingWifiP2P * - * Returns: the #NMSettingP2PWireless:wps-method property of the setting + * Returns: the #NMSettingWifiP2P:wps-method property of the setting * * Since: 1.16 **/ NMSettingWirelessSecurityWpsMethod -nm_setting_p2p_wireless_get_wps_method (NMSettingP2PWireless *setting) +nm_setting_wifi_p2p_get_wps_method (NMSettingWifiP2P *setting) { - g_return_val_if_fail (NM_IS_SETTING_P2P_WIRELESS (setting), NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT); + g_return_val_if_fail (NM_IS_SETTING_WIFI_P2P (setting), NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT); - return NM_SETTING_P2P_WIRELESS_GET_PRIVATE (setting)->wps_method; + return NM_SETTING_WIFI_P2P_GET_PRIVATE (setting)->wps_method; } /*****************************************************************************/ @@ -110,14 +110,14 @@ nm_setting_p2p_wireless_get_wps_method (NMSettingP2PWireless *setting) static gboolean verify (NMSetting *setting, NMConnection *connection, GError **error) { - NMSettingP2PWirelessPrivate *priv = NM_SETTING_P2P_WIRELESS_GET_PRIVATE (setting); + NMSettingWifiP2PPrivate *priv = NM_SETTING_WIFI_P2P_GET_PRIVATE (setting); if (!priv->peer_mac_address) { g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_MISSING_PROPERTY, _("property is missing")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_P2P_WIRELESS_SETTING_NAME, NM_SETTING_P2P_WIRELESS_PEER); + g_prefix_error (error, "%s.%s: ", NM_SETTING_WIFI_P2P_SETTING_NAME, NM_SETTING_WIFI_P2P_PEER); return FALSE; } @@ -126,13 +126,13 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, _("property is invalid")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_P2P_WIRELESS_SETTING_NAME, NM_SETTING_P2P_WIRELESS_PEER); + g_prefix_error (error, "%s.%s: ", NM_SETTING_WIFI_P2P_SETTING_NAME, NM_SETTING_WIFI_P2P_PEER); return FALSE; } if (!_nm_utils_wps_method_validate (priv->wps_method, - NM_SETTING_P2P_WIRELESS_SETTING_NAME, - NM_SETTING_P2P_WIRELESS_WPS_METHOD, + NM_SETTING_WIFI_P2P_SETTING_NAME, + NM_SETTING_WIFI_P2P_WPS_METHOD, TRUE, error)) return FALSE; @@ -146,14 +146,14 @@ static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - NMSettingP2PWireless *setting = NM_SETTING_P2P_WIRELESS (object); + NMSettingWifiP2P *setting = NM_SETTING_WIFI_P2P (object); switch (prop_id) { case PROP_PEER: - g_value_set_string (value, nm_setting_p2p_wireless_get_peer (setting)); + g_value_set_string (value, nm_setting_wifi_p2p_get_peer (setting)); break; case PROP_WPS_METHOD: - g_value_set_uint (value, nm_setting_p2p_wireless_get_wps_method (setting)); + g_value_set_uint (value, nm_setting_wifi_p2p_get_wps_method (setting)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -165,7 +165,7 @@ static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - NMSettingP2PWirelessPrivate *priv = NM_SETTING_P2P_WIRELESS_GET_PRIVATE (object); + NMSettingWifiP2PPrivate *priv = NM_SETTING_WIFI_P2P_GET_PRIVATE (object); switch (prop_id) { case PROP_PEER: @@ -185,40 +185,40 @@ set_property (GObject *object, guint prop_id, /*****************************************************************************/ static void -nm_setting_p2p_wireless_init (NMSettingP2PWireless *setting) +nm_setting_wifi_p2p_init (NMSettingWifiP2P *setting) { } /** - * nm_setting_p2p_wireless_new: + * nm_setting_wifi_p2p_new: * - * Creates a new #NMSettingP2PWireless object with default values. + * Creates a new #NMSettingWifiP2P object with default values. * - * Returns: (transfer full): the new empty #NMSettingP2PWireless object + * Returns: (transfer full): the new empty #NMSettingWifiP2P object * * Since: 1.16 **/ NMSetting * -nm_setting_p2p_wireless_new (void) +nm_setting_wifi_p2p_new (void) { - return g_object_new (NM_TYPE_SETTING_P2P_WIRELESS, NULL); + return g_object_new (NM_TYPE_SETTING_WIFI_P2P, NULL); } static void finalize (GObject *object) { - NMSettingP2PWirelessPrivate *priv = NM_SETTING_P2P_WIRELESS_GET_PRIVATE (object); + NMSettingWifiP2PPrivate *priv = NM_SETTING_WIFI_P2P_GET_PRIVATE (object); g_free (priv->peer_mac_address); - G_OBJECT_CLASS (nm_setting_p2p_wireless_parent_class)->finalize (object); + G_OBJECT_CLASS (nm_setting_wifi_p2p_parent_class)->finalize (object); } static void -nm_setting_p2p_wireless_class_init (NMSettingP2PWirelessClass *setting_p2p_wireless_class) +nm_setting_wifi_p2p_class_init (NMSettingWifiP2PClass *setting_wifi_p2p_class) { - GObjectClass *object_class = G_OBJECT_CLASS (setting_p2p_wireless_class); - NMSettingClass *setting_class = NM_SETTING_CLASS (setting_p2p_wireless_class); + GObjectClass *object_class = G_OBJECT_CLASS (setting_wifi_p2p_class); + NMSettingClass *setting_class = NM_SETTING_CLASS (setting_wifi_p2p_class); object_class->get_property = get_property; object_class->set_property = set_property; @@ -227,7 +227,7 @@ nm_setting_p2p_wireless_class_init (NMSettingP2PWirelessClass *setting_p2p_wirel setting_class->verify = verify; /** - * NMSettingP2PWireless:peer: + * NMSettingWifiP2P:peer: * * The P2P device that should be connected to. Currently this is the only * way to create or join a group. @@ -243,13 +243,13 @@ nm_setting_p2p_wireless_class_init (NMSettingP2PWirelessClass *setting_p2p_wirel * ---end--- */ obj_properties[PROP_PEER] = - g_param_spec_string (NM_SETTING_P2P_WIRELESS_PEER, "", "", + g_param_spec_string (NM_SETTING_WIFI_P2P_PEER, "", "", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); /** - * NMSettingP2PWireless:wps-method: + * NMSettingWifiP2P:wps-method: * * Flags indicating which mode of WPS is to be used. * @@ -269,5 +269,5 @@ nm_setting_p2p_wireless_class_init (NMSettingP2PWirelessClass *setting_p2p_wirel g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); - _nm_setting_class_commit (setting_class, NM_META_SETTING_TYPE_P2P_WIRELESS); + _nm_setting_class_commit (setting_class, NM_META_SETTING_TYPE_WIFI_P2P); } diff --git a/libnm-core/nm-setting-wifi-p2p.h b/libnm-core/nm-setting-wifi-p2p.h index 09ac934e31..c9ed49e1ac 100644 --- a/libnm-core/nm-setting-wifi-p2p.h +++ b/libnm-core/nm-setting-wifi-p2p.h @@ -17,8 +17,8 @@ * Copyright 2019 Red Hat, Inc. */ -#ifndef __NM_SETTING_P2P_WIRELESS_H__ -#define __NM_SETTING_P2P_WIRELESS_H__ +#ifndef __NM_SETTING_WIFI_P2P_H__ +#define __NM_SETTING_WIFI_P2P_H__ #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION) #error "Only can be included directly." @@ -29,37 +29,37 @@ G_BEGIN_DECLS -#define NM_TYPE_SETTING_P2P_WIRELESS (nm_setting_p2p_wireless_get_type ()) -#define NM_SETTING_P2P_WIRELESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_P2P_WIRELESS, NMSettingP2PWireless)) -#define NM_SETTING_P2P_WIRELESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_P2P_WIRELESS, NMSettingP2PWirelessClass)) -#define NM_IS_SETTING_P2P_WIRELESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_P2P_WIRELESS)) -#define NM_IS_SETTING_P2P_WIRELESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_P2P_WIRELESS)) -#define NM_SETTING_P2P_WIRELESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_P2P_WIRELESS, NMSettingP2PWirelessClass)) +#define NM_TYPE_SETTING_WIFI_P2P (nm_setting_wifi_p2p_get_type ()) +#define NM_SETTING_WIFI_P2P(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_WIFI_P2P, NMSettingWifiP2P)) +#define NM_SETTING_WIFI_P2P_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_WIFI_P2P, NMSettingWifiP2PClass)) +#define NM_IS_SETTING_WIFI_P2P(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_WIFI_P2P)) +#define NM_IS_SETTING_WIFI_P2P_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_WIFI_P2P)) +#define NM_SETTING_WIFI_P2P_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_WIFI_P2P, NMSettingWifiP2PClass)) -#define NM_SETTING_P2P_WIRELESS_SETTING_NAME "p2p-wireless" +#define NM_SETTING_WIFI_P2P_SETTING_NAME "wifi-p2p" /** - * NM_SETTING_P2P_WIRELESS_PEER: + * NM_SETTING_WIFI_P2P_PEER: * * The mac address of the peer to connect to. */ -#define NM_SETTING_P2P_WIRELESS_PEER "peer" -#define NM_SETTING_P2P_WIRELESS_WPS_METHOD "wps-method" +#define NM_SETTING_WIFI_P2P_PEER "peer" +#define NM_SETTING_WIFI_P2P_WPS_METHOD "wps-method" -typedef struct _NMSettingP2PWirelessClass NMSettingP2PWirelessClass; +typedef struct _NMSettingWifiP2PClass NMSettingWifiP2PClass; NM_AVAILABLE_IN_1_16 -GType nm_setting_p2p_wireless_get_type (void); +GType nm_setting_wifi_p2p_get_type (void); NM_AVAILABLE_IN_1_16 -NMSetting *nm_setting_p2p_wireless_new (void); +NMSetting *nm_setting_wifi_p2p_new (void); NM_AVAILABLE_IN_1_16 -const char *nm_setting_p2p_wireless_get_peer (NMSettingP2PWireless *setting); +const char *nm_setting_wifi_p2p_get_peer (NMSettingWifiP2P *setting); NM_AVAILABLE_IN_1_16 -NMSettingWirelessSecurityWpsMethod nm_setting_p2p_wireless_get_wps_method (NMSettingP2PWireless *setting); +NMSettingWirelessSecurityWpsMethod nm_setting_wifi_p2p_get_wps_method (NMSettingWifiP2P *setting); G_END_DECLS -#endif /* __NM_SETTING_P2P_WIRELESS_H__ */ +#endif /* __NM_SETTING_WIFI_P2P_H__ */ diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 21dfb8ee1e..edef0b6298 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1450,27 +1450,27 @@ global: nm_client_add_and_activate_connection2; nm_client_add_and_activate_connection2_finish; nm_device_get_connectivity; - nm_device_p2p_wifi_get_group_owner; - nm_device_p2p_wifi_get_hw_address; - nm_device_p2p_wifi_get_peers; - nm_device_p2p_wifi_get_type; - nm_p2p_peer_connection_valid; - nm_p2p_peer_filter_connections; - nm_p2p_peer_get_flags; - nm_p2p_peer_get_hw_address; - nm_p2p_peer_get_last_seen; - nm_p2p_peer_get_manufacturer; - nm_p2p_peer_get_model; - nm_p2p_peer_get_model_number; - nm_p2p_peer_get_name; - nm_p2p_peer_get_serial; - nm_p2p_peer_get_strength; - nm_p2p_peer_get_type; - nm_p2p_peer_get_wfd_ies; - nm_setting_p2p_wireless_get_peer; - nm_setting_p2p_wireless_get_type; - nm_setting_p2p_wireless_get_wps_method; - nm_setting_p2p_wireless_new; + nm_device_wifi_p2p_get_group_owner; + nm_device_wifi_p2p_get_hw_address; + nm_device_wifi_p2p_get_peers; + nm_device_wifi_p2p_get_type; + nm_setting_wifi_p2p_get_peer; + nm_setting_wifi_p2p_get_type; + nm_setting_wifi_p2p_get_wps_method; + nm_setting_wifi_p2p_new; nm_team_link_watcher_get_vlanid; nm_team_link_watcher_new_arp_ping2; + nm_wifi_p2p_peer_connection_valid; + nm_wifi_p2p_peer_filter_connections; + nm_wifi_p2p_peer_get_flags; + nm_wifi_p2p_peer_get_hw_address; + nm_wifi_p2p_peer_get_last_seen; + nm_wifi_p2p_peer_get_manufacturer; + nm_wifi_p2p_peer_get_model; + nm_wifi_p2p_peer_get_model_number; + nm_wifi_p2p_peer_get_name; + nm_wifi_p2p_peer_get_serial; + nm_wifi_p2p_peer_get_strength; + nm_wifi_p2p_peer_get_type; + nm_wifi_p2p_peer_get_wfd_ies; } libnm_1_14_0; diff --git a/libnm/nm-autoptr.h b/libnm/nm-autoptr.h index bffacd39cd..8abd792e22 100644 --- a/libnm/nm-autoptr.h +++ b/libnm/nm-autoptr.h @@ -51,11 +51,11 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingDummy, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingEthtool, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingGeneric, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingGsm, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingInfiniband, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingIP4Config, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingIP6Config, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingIPConfig, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingIPTunnel, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingInfiniband, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingMacsec, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingMacvlan, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingMatch, g_object_unref) @@ -64,7 +64,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingOvsBridge, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingOvsInterface, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingOvsPatch, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingOvsPort, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingP2PWireless, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingPpp, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingPppoe, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingProxy, g_object_unref) @@ -78,6 +77,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingUser, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingVlan, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingVpn, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingVxlan, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingWifiP2P, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingWimax, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingWired, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingWireless, g_object_unref) diff --git a/libnm/nm-client.c b/libnm/nm-client.c index 1cb73b73a6..870adfc750 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -41,7 +41,7 @@ #include "introspection/org.freedesktop.NetworkManager.h" #include "introspection/org.freedesktop.NetworkManager.Device.Wireless.h" -#include "introspection/org.freedesktop.NetworkManager.Device.P2PWireless.h" +#include "introspection/org.freedesktop.NetworkManager.Device.WifiP2P.h" #include "introspection/org.freedesktop.NetworkManager.Device.h" #include "introspection/org.freedesktop.NetworkManager.DnsManager.h" #include "introspection/org.freedesktop.NetworkManager.Settings.h" @@ -2614,8 +2614,8 @@ proxy_type (GDBusObjectManagerClient *manager, return NMDBUS_TYPE_MANAGER_PROXY; else if (strcmp (interface_name, NM_DBUS_INTERFACE_DEVICE_WIRELESS) == 0) return NMDBUS_TYPE_DEVICE_WIFI_PROXY; - else if (strcmp (interface_name, NM_DBUS_INTERFACE_DEVICE_P2P_WIRELESS) == 0) - return NMDBUS_TYPE_DEVICE_P2P_WIFI_PROXY; + else if (strcmp (interface_name, NM_DBUS_INTERFACE_DEVICE_WIFI_P2P) == 0) + return NMDBUS_TYPE_DEVICE_WIFI_P2P_PROXY; else if (strcmp (interface_name, NM_DBUS_INTERFACE_DEVICE) == 0) return NMDBUS_TYPE_DEVICE_PROXY; else if (strcmp (interface_name, NM_DBUS_INTERFACE_SETTINGS_CONNECTION) == 0) @@ -2694,8 +2694,8 @@ obj_nm_for_gdbus_object (NMClient *self, GDBusObject *object, GDBusObjectManager type = NM_TYPE_DEVICE_OVS_PORT; else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_OVS_BRIDGE) == 0) type = NM_TYPE_DEVICE_OVS_BRIDGE; - else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_P2P_WIRELESS) == 0) - type = NM_TYPE_DEVICE_P2P_WIFI; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_WIFI_P2P) == 0) + type = NM_TYPE_DEVICE_WIFI_P2P; else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_PPP) == 0) type = NM_TYPE_DEVICE_PPP; else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_TEAM) == 0) @@ -2722,8 +2722,8 @@ obj_nm_for_gdbus_object (NMClient *self, GDBusObject *object, GDBusObjectManager type = NM_TYPE_IP4_CONFIG; else if (strcmp (ifname, NM_DBUS_INTERFACE_IP6_CONFIG) == 0) type = NM_TYPE_IP6_CONFIG; - else if (strcmp (ifname, NM_DBUS_INTERFACE_P2P_PEER) == 0) - type = NM_TYPE_P2P_PEER; + else if (strcmp (ifname, NM_DBUS_INTERFACE_WIFI_P2P_PEER) == 0) + type = NM_TYPE_WIFI_P2P_PEER; else if (strcmp (ifname, NM_DBUS_INTERFACE_SETTINGS_CONNECTION) == 0) type = NM_TYPE_REMOTE_CONNECTION; else if (strcmp (ifname, NM_DBUS_INTERFACE_SETTINGS) == 0) diff --git a/libnm/nm-device-wifi-p2p.c b/libnm/nm-device-wifi-p2p.c index 65be8d2aaf..0c90bd89ab 100644 --- a/libnm/nm-device-wifi-p2p.c +++ b/libnm/nm-device-wifi-p2p.c @@ -32,12 +32,12 @@ #include "nm-core-internal.h" #include "nm-dbus-helpers.h" -#include "introspection/org.freedesktop.NetworkManager.Device.P2PWireless.h" +#include "introspection/org.freedesktop.NetworkManager.Device.WifiP2P.h" /*****************************************************************************/ typedef struct { - NMDeviceP2PWifi *device; + NMDeviceWifiP2P *device; GSimpleAsyncResult *simple; } RequestScanInfo; @@ -58,7 +58,7 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; typedef struct { - NMDBusDeviceP2PWifi *proxy; + NMDBusDeviceWifiP2P *proxy; char *hw_address; @@ -66,33 +66,33 @@ typedef struct { GPtrArray *peers; gboolean group_owner; -} NMDeviceP2PWifiPrivate; +} NMDeviceWifiP2PPrivate; /** - * NMDeviceP2PWifi: + * NMDeviceWifiP2P: * * Since: 1.16 */ -struct _NMDeviceP2PWifi { +struct _NMDeviceWifiP2P { NMDevice parent; - NMDeviceP2PWifiPrivate _priv; + NMDeviceWifiP2PPrivate _priv; }; -struct _NMDeviceP2PWifiClass { +struct _NMDeviceWifiP2PClass { NMDeviceClass parent; }; -G_DEFINE_TYPE (NMDeviceP2PWifi, nm_device_p2p_wifi, NM_TYPE_DEVICE) +G_DEFINE_TYPE (NMDeviceWifiP2P, nm_device_wifi_p2p, NM_TYPE_DEVICE) -#define NM_DEVICE_P2P_WIFI_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceP2PWifi, NM_IS_DEVICE_P2P_WIFI, NMDevice, NMObject) +#define NM_DEVICE_WIFI_P2P_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceWifiP2P, NM_IS_DEVICE_WIFI_P2P, NMDevice, NMObject) /*****************************************************************************/ /** - * nm_device_p2p_wifi_get_hw_address: - * @device: a #NMDeviceP2PWifi + * nm_device_wifi_p2p_get_hw_address: + * @device: a #NMDeviceWifiP2P * - * Gets the actual hardware (MAC) address of the #NMDeviceP2PWifi + * Gets the actual hardware (MAC) address of the #NMDeviceWifiP2P * * Returns: the actual hardware address. This is the internal string used by the * device, and must not be modified. @@ -100,16 +100,16 @@ G_DEFINE_TYPE (NMDeviceP2PWifi, nm_device_p2p_wifi, NM_TYPE_DEVICE) * Since: 1.16 **/ const char * -nm_device_p2p_wifi_get_hw_address (NMDeviceP2PWifi *device) +nm_device_wifi_p2p_get_hw_address (NMDeviceWifiP2P *device) { - g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), NULL); + g_return_val_if_fail (NM_IS_DEVICE_WIFI_P2P (device), NULL); - return nm_str_not_empty (NM_DEVICE_P2P_WIFI_GET_PRIVATE (device)->hw_address); + return nm_str_not_empty (NM_DEVICE_WIFI_P2P_GET_PRIVATE (device)->hw_address); } /** - * nm_device_p2p_wifi_get_group_owner: - * @device: a #NMDeviceP2PWifi + * nm_device_wifi_p2p_get_group_owner: + * @device: a #NMDeviceWifiP2P * * Gets whether the device is currently the P2P group owner. This is only * valid when a connection is established. @@ -119,61 +119,61 @@ nm_device_p2p_wifi_get_hw_address (NMDeviceP2PWifi *device) * Since: 1.16 **/ gboolean -nm_device_p2p_wifi_get_group_owner (NMDeviceP2PWifi *device) +nm_device_wifi_p2p_get_group_owner (NMDeviceWifiP2P *device) { - g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), FALSE); + g_return_val_if_fail (NM_IS_DEVICE_WIFI_P2P (device), FALSE); - return NM_DEVICE_P2P_WIFI_GET_PRIVATE (device)->group_owner; + return NM_DEVICE_WIFI_P2P_GET_PRIVATE (device)->group_owner; } /** - * nm_device_p2p_wifi_get_peers: - * @device: a #NMDeviceP2PWifi + * nm_device_wifi_p2p_get_peers: + * @device: a #NMDeviceWifiP2P * - * Gets all the found peers of the #NMDeviceP2PWifi. + * Gets all the found peers of the #NMDeviceWifiP2P. * - * Returns: (element-type NMP2PPeer): a #GPtrArray containing all the - * found #NMP2PPeers. + * Returns: (element-type NMWifiP2PPeer): a #GPtrArray containing all the + * found #NMWifiP2PPeers. * The returned array is owned by the client and should not be modified. * * Since: 1.16 **/ const GPtrArray * -nm_device_p2p_wifi_get_peers (NMDeviceP2PWifi *device) +nm_device_wifi_p2p_get_peers (NMDeviceWifiP2P *device) { - g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), NULL); + g_return_val_if_fail (NM_IS_DEVICE_WIFI_P2P (device), NULL); - return NM_DEVICE_P2P_WIFI_GET_PRIVATE (device)->peers; + return NM_DEVICE_WIFI_P2P_GET_PRIVATE (device)->peers; } /** - * nm_device_p2p_wifi_get_peer_by_path: - * @device: a #NMDeviceP2PWifi + * nm_device_wifi_p2p_get_peer_by_path: + * @device: a #NMDeviceWifiP2P * @path: the object path of the peer * - * Gets a #NMP2PPeer by path. + * Gets a #NMWifiP2PPeer by path. * * Returns: (transfer none): the peer or %NULL if none is found. * * Since: 1.16 **/ -NMP2PPeer * -nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *device, +NMWifiP2PPeer * +nm_device_wifi_p2p_get_peer_by_path (NMDeviceWifiP2P *device, const char *path) { const GPtrArray *peers; int i; - NMP2PPeer *peer = NULL; + NMWifiP2PPeer *peer = NULL; - g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), NULL); + g_return_val_if_fail (NM_IS_DEVICE_WIFI_P2P (device), NULL); g_return_val_if_fail (path != NULL, NULL); - peers = nm_device_p2p_wifi_get_peers (device); + peers = nm_device_wifi_p2p_get_peers (device); if (!peers) return NULL; for (i = 0; i < peers->len; i++) { - NMP2PPeer *candidate = g_ptr_array_index (peers, i); + NMWifiP2PPeer *candidate = g_ptr_array_index (peers, i); if (!strcmp (nm_object_get_path (NM_OBJECT (candidate)), path)) { peer = candidate; break; @@ -184,12 +184,12 @@ nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *device, } static void -clean_up_peers (NMDeviceP2PWifi *self) +clean_up_peers (NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); while (priv->peers->len > 0) { - NMP2PPeer *peer; + NMWifiP2PPeer *peer; peer = priv->peers->pdata[priv->peers->len - 1]; g_ptr_array_remove_index (priv->peers, priv->peers->len - 1); @@ -201,12 +201,12 @@ clean_up_peers (NMDeviceP2PWifi *self) static gboolean connection_compatible (NMDevice *device, NMConnection *connection, GError **error) { - if (!NM_DEVICE_CLASS (nm_device_p2p_wifi_parent_class)->connection_compatible (device, connection, error)) + if (!NM_DEVICE_CLASS (nm_device_wifi_p2p_parent_class)->connection_compatible (device, connection, error)) return FALSE; - if (!nm_connection_is_type (connection, NM_SETTING_P2P_WIRELESS_SETTING_NAME)) { + if (!nm_connection_is_type (connection, NM_SETTING_WIFI_P2P_SETTING_NAME)) { g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, - _("The connection was not a P2P Wi-Fi connection.")); + _("The connection was not a Wi-Fi P2P connection.")); return FALSE; } @@ -222,13 +222,13 @@ get_setting_type (NMDevice *device) static const char * get_hw_address (NMDevice *device) { - return nm_device_p2p_wifi_get_hw_address (NM_DEVICE_P2P_WIFI (device)); + return nm_device_wifi_p2p_get_hw_address (NM_DEVICE_WIFI_P2P (device)); } static GVariant * -nm_device_p2p_wifi_get_wfdies_as_variant (const NMDeviceP2PWifi *self) +nm_device_wifi_p2p_get_wfdies_as_variant (const NMDeviceWifiP2P *self) { - const NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + const NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); if (priv->wfd_ies) { return g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, @@ -245,20 +245,20 @@ get_property (GObject *object, GValue *value, GParamSpec *pspec) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (object); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (object); switch (prop_id) { case PROP_HW_ADDRESS: - g_value_set_string (value, nm_device_p2p_wifi_get_hw_address (self)); + g_value_set_string (value, nm_device_wifi_p2p_get_hw_address (self)); break; case PROP_GROUP_OWNER: - g_value_set_enum (value, nm_device_p2p_wifi_get_group_owner (self)); + g_value_set_enum (value, nm_device_wifi_p2p_get_group_owner (self)); break; case PROP_WFDIES: - g_value_take_variant (value, nm_device_p2p_wifi_get_wfdies_as_variant (self)); + g_value_take_variant (value, nm_device_wifi_p2p_get_wfdies_as_variant (self)); break; case PROP_PEERS: - g_value_take_boxed (value, _nm_utils_copy_object_array (nm_device_p2p_wifi_get_peers (self))); + g_value_take_boxed (value, _nm_utils_copy_object_array (nm_device_wifi_p2p_get_peers (self))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -267,9 +267,9 @@ get_property (GObject *object, } static void -nm_device_p2p_wifi_init (NMDeviceP2PWifi *device) +nm_device_wifi_p2p_init (NMDeviceWifiP2P *device) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (device); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (device); priv->peers = g_ptr_array_new (); } @@ -277,35 +277,35 @@ nm_device_p2p_wifi_init (NMDeviceP2PWifi *device) static void init_dbus (NMObject *object) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (object); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (object); const NMPropertiesInfo property_info[] = { - { NM_DEVICE_P2P_WIFI_HW_ADDRESS, &priv->hw_address }, - { NM_DEVICE_P2P_WIFI_GROUP_OWNER, &priv->group_owner }, - { NM_DEVICE_P2P_WIFI_WFDIES, &priv->wfd_ies }, - { NM_DEVICE_P2P_WIFI_PEERS, &priv->peers, NULL, NM_TYPE_P2P_PEER, "peer" }, + { NM_DEVICE_WIFI_P2P_HW_ADDRESS, &priv->hw_address }, + { NM_DEVICE_WIFI_P2P_GROUP_OWNER, &priv->group_owner }, + { NM_DEVICE_WIFI_P2P_WFDIES, &priv->wfd_ies }, + { NM_DEVICE_WIFI_P2P_PEERS, &priv->peers, NULL, NM_TYPE_WIFI_P2P_PEER, "peer" }, { NULL }, }; - NM_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->init_dbus (object); + NM_OBJECT_CLASS (nm_device_wifi_p2p_parent_class)->init_dbus (object); - priv->proxy = NMDBUS_DEVICE_P2P_WIFI (_nm_object_get_proxy (object, NM_DBUS_INTERFACE_DEVICE_P2P_WIRELESS)); + priv->proxy = NMDBUS_DEVICE_WIFI_P2P (_nm_object_get_proxy (object, NM_DBUS_INTERFACE_DEVICE_WIFI_P2P)); _nm_object_register_properties (object, - NM_DBUS_INTERFACE_DEVICE_P2P_WIRELESS, + NM_DBUS_INTERFACE_DEVICE_WIFI_P2P, property_info); } static void dispose (GObject *object) { - clean_up_peers (NM_DEVICE_P2P_WIFI (object)); + clean_up_peers (NM_DEVICE_WIFI_P2P (object)); - G_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->dispose (object); + G_OBJECT_CLASS (nm_device_wifi_p2p_parent_class)->dispose (object); } static void finalize (GObject *object) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (object); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (object); g_clear_object (&priv->proxy); g_free (priv->hw_address); @@ -314,11 +314,11 @@ finalize (GObject *object) if (priv->peers) g_ptr_array_unref (priv->peers); - G_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->finalize (object); + G_OBJECT_CLASS (nm_device_wifi_p2p_parent_class)->finalize (object); } static void -nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) +nm_device_wifi_p2p_class_init (NMDeviceWifiP2PClass *wifi_class) { GObjectClass *object_class = G_OBJECT_CLASS (wifi_class); NMObjectClass *nm_object_class = NM_OBJECT_CLASS (wifi_class); @@ -335,55 +335,55 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) nm_object_class->init_dbus = init_dbus; /** - * NMDeviceP2PWifi:hw-address: + * NMDeviceWifiP2P:hw-address: * * The hardware (MAC) address of the device. * * Since: 1.16 **/ obj_properties[PROP_HW_ADDRESS] = - g_param_spec_string (NM_DEVICE_P2P_WIFI_HW_ADDRESS, "", "", + g_param_spec_string (NM_DEVICE_WIFI_P2P_HW_ADDRESS, "", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMDeviceP2PWifi:group-owner: + * NMDeviceWifiP2P:group-owner: * * Whether the device is currently the group owner. * * Since: 1.16 **/ obj_properties[PROP_GROUP_OWNER] = - g_param_spec_boolean (NM_DEVICE_P2P_WIFI_GROUP_OWNER, "", "", + g_param_spec_boolean (NM_DEVICE_WIFI_P2P_GROUP_OWNER, "", "", FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMDeviceP2PWifi:wfd-ies: + * NMDeviceWifiP2P:wfd-ies: * * Whether the device is currently the group owner. * * Since: 1.16 **/ obj_properties[PROP_WFDIES] = - g_param_spec_variant (NM_DEVICE_P2P_WIFI_WFDIES, "", "", + g_param_spec_variant (NM_DEVICE_WIFI_P2P_WFDIES, "", "", G_VARIANT_TYPE ("ay"), NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMDeviceP2PWifi:peers: (type GPtrArray(NMP2PPeer)) + * NMDeviceWifiP2P:peers: (type GPtrArray(NMWifiP2PPeer)) * - * List of all P2P Wi-Fi peers the device can see. + * List of all Wi-Fi P2P peers the device can see. * * Since: 1.16 **/ obj_properties[PROP_PEERS] = - g_param_spec_boxed (NM_DEVICE_P2P_WIFI_PEERS, "", "", + g_param_spec_boxed (NM_DEVICE_WIFI_P2P_PEERS, "", "", G_TYPE_PTR_ARRAY, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); @@ -391,11 +391,11 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); /** - * NMDeviceP2PWifi::peer-added: - * @device: the P2P Wi-Fi device that received the signal + * NMDeviceWifiP2P::peer-added: + * @device: the Wi-Fi P2P device that received the signal * @peer: the new access point * - * Notifies that a #NMP2PPeer is added to the P2P Wi-Fi device. + * Notifies that a #NMWifiP2PPeer is added to the Wi-Fi P2P device. * * Since: 1.16 **/ @@ -409,11 +409,11 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class) G_TYPE_OBJECT); /** - * NMDeviceP2PWifi::peer-removed: - * @device: the P2P Wi-Fi device that received the signal + * NMDeviceWifiP2P::peer-removed: + * @device: the Wi-Fi P2P device that received the signal * @peer: the removed access point * - * Notifies that a #NMP2PPeer is removed from the P2P Wi-Fi device. + * Notifies that a #NMWifiP2PPeer is removed from the Wi-Fi P2P device. * * Since: 1.16 **/ diff --git a/libnm/nm-device-wifi-p2p.h b/libnm/nm-device-wifi-p2p.h index bd5841fde2..4ff4d03842 100644 --- a/libnm/nm-device-wifi-p2p.h +++ b/libnm/nm-device-wifi-p2p.h @@ -17,8 +17,8 @@ * Copyright 2018 - 2019 Red Hat, Inc. */ -#ifndef __NM_DEVICE_P2P_WIFI_H__ -#define __NM_DEVICE_P2P_WIFI_H__ +#ifndef __NM_DEVICE_WIFI_P2P_H__ +#define __NM_DEVICE_WIFI_P2P_H__ #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION) #error "Only can be included directly." @@ -28,36 +28,36 @@ G_BEGIN_DECLS -#define NM_TYPE_DEVICE_P2P_WIFI (nm_device_p2p_wifi_get_type ()) -#define NM_DEVICE_P2P_WIFI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_P2P_WIFI, NMDeviceP2PWifi)) -#define NM_DEVICE_P2P_WIFI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_P2P_WIFI, NMDeviceP2PWifiClass)) -#define NM_IS_DEVICE_P2P_WIFI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_P2P_WIFI)) -#define NM_IS_DEVICE_P2P_WIFI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_P2P_WIFI)) -#define NM_DEVICE_P2P_WIFI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_P2P_WIFI, NMDeviceP2PWifiClass)) +#define NM_TYPE_DEVICE_WIFI_P2P (nm_device_wifi_p2p_get_type ()) +#define NM_DEVICE_WIFI_P2P(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_WIFI_P2P, NMDeviceWifiP2P)) +#define NM_DEVICE_WIFI_P2P_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_WIFI_P2P, NMDeviceWifiP2PClass)) +#define NM_IS_DEVICE_WIFI_P2P(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_WIFI_P2P)) +#define NM_IS_DEVICE_WIFI_P2P_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_WIFI_P2P)) +#define NM_DEVICE_WIFI_P2P_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_WIFI_P2P, NMDeviceWifiP2PClass)) -#define NM_DEVICE_P2P_WIFI_HW_ADDRESS "hw-address" -#define NM_DEVICE_P2P_WIFI_GROUP_OWNER "group-owner" -#define NM_DEVICE_P2P_WIFI_PEERS "peers" -#define NM_DEVICE_P2P_WIFI_WFDIES "wfdies" +#define NM_DEVICE_WIFI_P2P_HW_ADDRESS "hw-address" +#define NM_DEVICE_WIFI_P2P_GROUP_OWNER "group-owner" +#define NM_DEVICE_WIFI_P2P_PEERS "peers" +#define NM_DEVICE_WIFI_P2P_WFDIES "wfdies" -typedef struct _NMDeviceP2PWifiClass NMDeviceP2PWifiClass; +typedef struct _NMDeviceWifiP2PClass NMDeviceWifiP2PClass; NM_AVAILABLE_IN_1_16 -GType nm_device_p2p_wifi_get_type (void); +GType nm_device_wifi_p2p_get_type (void); NM_AVAILABLE_IN_1_16 -const char * nm_device_p2p_wifi_get_hw_address (NMDeviceP2PWifi *device); +const char * nm_device_wifi_p2p_get_hw_address (NMDeviceWifiP2P *device); NM_AVAILABLE_IN_1_16 -gboolean nm_device_p2p_wifi_get_group_owner (NMDeviceP2PWifi *device); +gboolean nm_device_wifi_p2p_get_group_owner (NMDeviceWifiP2P *device); NM_AVAILABLE_IN_1_16 -NMP2PPeer * nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *device, +NMWifiP2PPeer * nm_device_wifi_p2p_get_peer_by_path (NMDeviceWifiP2P *device, const char *path); NM_AVAILABLE_IN_1_16 -const GPtrArray * nm_device_p2p_wifi_get_peers (NMDeviceP2PWifi *device); +const GPtrArray * nm_device_wifi_p2p_get_peers (NMDeviceWifiP2P *device); G_END_DECLS -#endif /* __NM_DEVICE_P2P_WIFI_H__ */ +#endif /* __NM_DEVICE_WIFI_P2P_H__ */ diff --git a/libnm/nm-types.h b/libnm/nm-types.h index 0cf8186f5c..16a2ba188c 100644 --- a/libnm/nm-types.h +++ b/libnm/nm-types.h @@ -39,8 +39,8 @@ typedef struct _NMDeviceBt NMDeviceBt; typedef struct _NMDeviceDummy NMDeviceDummy; typedef struct _NMDeviceEthernet NMDeviceEthernet; typedef struct _NMDeviceGeneric NMDeviceGeneric; -typedef struct _NMDeviceInfiniband NMDeviceInfiniband; typedef struct _NMDeviceIPTunnel NMDeviceIPTunnel; +typedef struct _NMDeviceInfiniband NMDeviceInfiniband; typedef struct _NMDeviceMacsec NMDeviceMacsec; typedef struct _NMDeviceMacvlan NMDeviceMacvlan; typedef struct _NMDeviceModem NMDeviceModem; @@ -54,16 +54,16 @@ typedef struct _NMDeviceTun NMDeviceTun; typedef struct _NMDeviceVlan NMDeviceVlan; typedef struct _NMDeviceVxlan NMDeviceVxlan; typedef struct _NMDeviceWifi NMDeviceWifi; -typedef struct _NMDeviceP2PWifi NMDeviceP2PWifi; +typedef struct _NMDeviceWifiP2P NMDeviceWifiP2P; typedef struct _NMDeviceWimax NMDeviceWimax; typedef struct _NMDeviceWireGuard NMDeviceWireGuard; typedef struct _NMDeviceWpan NMDeviceWpan; typedef struct _NMDhcpConfig NMDhcpConfig; typedef struct _NMIPConfig NMIPConfig; -typedef struct _NMP2PPeer NMP2PPeer; typedef struct _NMObject NMObject; typedef struct _NMRemoteConnection NMRemoteConnection; typedef struct _NMVpnConnection NMVpnConnection; +typedef struct _NMWifiP2PPeer NMWifiP2PPeer; typedef struct _NMWimaxNsp NMWimaxNsp; #endif /* NM_TYPES_H */ diff --git a/libnm/nm-wifi-p2p-peer.c b/libnm/nm-wifi-p2p-peer.c index 5edbef090e..d17010ce0f 100644 --- a/libnm/nm-wifi-p2p-peer.c +++ b/libnm/nm-wifi-p2p-peer.c @@ -62,29 +62,29 @@ typedef struct { NM80211ApFlags flags; guint8 strength; -} NMP2PPeerPrivate; +} NMWifiP2PPeerPrivate; /** - * NMP2PPeer: + * NMWifiP2PPeer: */ -struct _NMP2PPeer { +struct _NMWifiP2PPeer { NMObject parent; - NMP2PPeerPrivate _priv; + NMWifiP2PPeerPrivate _priv; }; -struct _NMP2PPeerClass { +struct _NMWifiP2PPeerClass { NMObjectClass parent; }; -G_DEFINE_TYPE (NMP2PPeer, nm_p2p_peer, NM_TYPE_OBJECT) +G_DEFINE_TYPE (NMWifiP2PPeer, nm_wifi_p2p_peer, NM_TYPE_OBJECT) -#define NM_P2P_PEER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMP2PPeer, NM_IS_P2P_PEER, NMObject) +#define NM_WIFI_P2P_PEER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMWifiP2PPeer, NM_IS_WIFI_P2P_PEER, NMObject) /*****************************************************************************/ /** - * nm_p2p_peer_get_flags: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_flags: + * @peer: a #NMWifiP2PPeer * * Gets the flags of the P2P peer. * @@ -93,16 +93,16 @@ G_DEFINE_TYPE (NMP2PPeer, nm_p2p_peer, NM_TYPE_OBJECT) * Since: 1.16 **/ NM80211ApFlags -nm_p2p_peer_get_flags (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_flags (NMWifiP2PPeer *peer) { - g_return_val_if_fail (NM_IS_P2P_PEER (peer), NM_802_11_AP_FLAGS_NONE); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), NM_802_11_AP_FLAGS_NONE); - return NM_P2P_PEER_GET_PRIVATE (peer)->flags; + return NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->flags; } /** - * nm_p2p_peer_get_name: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_name: + * @peer: a #NMWifiP2PPeer * * Gets the name of the P2P peer. * @@ -111,16 +111,16 @@ nm_p2p_peer_get_flags (NMP2PPeer *peer) * Since: 1.16 **/ const char * -nm_p2p_peer_get_name (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_name (NMWifiP2PPeer *peer) { - g_return_val_if_fail (NM_IS_P2P_PEER (peer), NULL); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), NULL); - return NM_P2P_PEER_GET_PRIVATE (peer)->name; + return NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->name; } /** - * nm_p2p_peer_get_manufacturer: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_manufacturer: + * @peer: a #NMWifiP2PPeer * * Gets the manufacturer of the P2P peer. * @@ -129,16 +129,16 @@ nm_p2p_peer_get_name (NMP2PPeer *peer) * Since: 1.16 **/ const char * -nm_p2p_peer_get_manufacturer (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_manufacturer (NMWifiP2PPeer *peer) { - g_return_val_if_fail (NM_IS_P2P_PEER (peer), NULL); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), NULL); - return NM_P2P_PEER_GET_PRIVATE (peer)->manufacturer; + return NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->manufacturer; } /** - * nm_p2p_peer_get_model: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_model: + * @peer: a #NMWifiP2PPeer * * Gets the model of the P2P peer. * @@ -147,16 +147,16 @@ nm_p2p_peer_get_manufacturer (NMP2PPeer *peer) * Since: 1.16 **/ const char * -nm_p2p_peer_get_model (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_model (NMWifiP2PPeer *peer) { - g_return_val_if_fail (NM_IS_P2P_PEER (peer), NULL); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), NULL); - return NM_P2P_PEER_GET_PRIVATE (peer)->model; + return NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->model; } /** - * nm_p2p_peer_get_model_number: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_model_number: + * @peer: a #NMWifiP2PPeer * * Gets the model number of the P2P peer. * @@ -165,16 +165,16 @@ nm_p2p_peer_get_model (NMP2PPeer *peer) * Since: 1.16 **/ const char * -nm_p2p_peer_get_model_number (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_model_number (NMWifiP2PPeer *peer) { - g_return_val_if_fail (NM_IS_P2P_PEER (peer), NULL); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), NULL); - return NM_P2P_PEER_GET_PRIVATE (peer)->model_number; + return NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->model_number; } /** - * nm_p2p_peer_get_serial: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_serial: + * @peer: a #NMWifiP2PPeer * * Gets the serial number of the P2P peer. * @@ -183,16 +183,16 @@ nm_p2p_peer_get_model_number (NMP2PPeer *peer) * Since: 1.16 **/ const char * -nm_p2p_peer_get_serial (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_serial (NMWifiP2PPeer *peer) { - g_return_val_if_fail (NM_IS_P2P_PEER (peer), NULL); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), NULL); - return NM_P2P_PEER_GET_PRIVATE (peer)->serial; + return NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->serial; } /** - * nm_p2p_peer_get_wfd_ies: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_wfd_ies: + * @peer: a #NMWifiP2PPeer * * Gets the WFD information elements of the P2P peer. * @@ -201,13 +201,13 @@ nm_p2p_peer_get_serial (NMP2PPeer *peer) * Since: 1.16 **/ GBytes * -nm_p2p_peer_get_wfd_ies (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_wfd_ies (NMWifiP2PPeer *peer) { - NMP2PPeerPrivate *priv; + NMWifiP2PPeerPrivate *priv; - g_return_val_if_fail (NM_IS_P2P_PEER (peer), NULL); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), NULL); - priv = NM_P2P_PEER_GET_PRIVATE (peer); + priv = NM_WIFI_P2P_PEER_GET_PRIVATE (peer); if (!priv->wfd_ies || g_bytes_get_size (priv->wfd_ies) == 0) return NULL; @@ -215,8 +215,8 @@ nm_p2p_peer_get_wfd_ies (NMP2PPeer *peer) } /** - * nm_p2p_peer_get_hw_address: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_hw_address: + * @peer: a #NMWifiP2PPeer * * Gets the hardware address of the P2P peer. * @@ -225,16 +225,16 @@ nm_p2p_peer_get_wfd_ies (NMP2PPeer *peer) * Since: 1.16 **/ const char * -nm_p2p_peer_get_hw_address (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_hw_address (NMWifiP2PPeer *peer) { - g_return_val_if_fail (NM_IS_P2P_PEER (peer), NULL); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), NULL); - return NM_P2P_PEER_GET_PRIVATE (peer)->hw_address; + return NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->hw_address; } /** - * nm_p2p_peer_get_strength: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_strength: + * @peer: a #NMWifiP2PPeer * * Gets the current signal strength of the P2P peer as a percentage. * @@ -243,16 +243,16 @@ nm_p2p_peer_get_hw_address (NMP2PPeer *peer) * Since: 1.16 **/ guint8 -nm_p2p_peer_get_strength (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_strength (NMWifiP2PPeer *peer) { - g_return_val_if_fail (NM_IS_P2P_PEER (peer), 0); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), 0); - return NM_P2P_PEER_GET_PRIVATE (peer)->strength; + return NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->strength; } /** - * nm_p2p_peer_get_last_seen: - * @peer: a #NMP2PPeer + * nm_wifi_p2p_peer_get_last_seen: + * @peer: a #NMWifiP2PPeer * * Returns the timestamp (in CLOCK_BOOTTIME seconds) for the last time the * P2P peer was seen. A value of -1 means the P2P peer has never been seen. @@ -262,16 +262,16 @@ nm_p2p_peer_get_strength (NMP2PPeer *peer) * Since: 1.16 **/ int -nm_p2p_peer_get_last_seen (NMP2PPeer *peer) +nm_wifi_p2p_peer_get_last_seen (NMWifiP2PPeer *peer) { - g_return_val_if_fail (NM_IS_P2P_PEER (peer), -1); + g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (peer), -1); - return NM_P2P_PEER_GET_PRIVATE (peer)->last_seen; + return NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->last_seen; } /** - * nm_p2p_peer_connection_valid: - * @peer: an #NMP2PPeer to validate @connection against + * nm_wifi_p2p_peer_connection_valid: + * @peer: an #NMWifiP2PPeer to validate @connection against * @connection: an #NMConnection to validate against @peer * * Validates a given connection against a given Wi-Fi P2P peer to ensure that @@ -284,16 +284,16 @@ nm_p2p_peer_get_last_seen (NMP2PPeer *peer) * Since: 1.16 **/ gboolean -nm_p2p_peer_connection_valid (NMP2PPeer *peer, NMConnection *connection) +nm_wifi_p2p_peer_connection_valid (NMWifiP2PPeer *peer, NMConnection *connection) { NMSettingConnection *s_con; - NMSettingP2PWireless *s_p2p_wifi; + NMSettingWifiP2P *s_wifi_p2p; const char *ctype; const char *hw_address; const char *setting_peer; - s_p2p_wifi = (NMSettingP2PWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_P2P_WIRELESS); - if (!s_p2p_wifi) + s_wifi_p2p = (NMSettingWifiP2P *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIFI_P2P); + if (!s_wifi_p2p) return FALSE; s_con = nm_connection_get_setting_connection (connection); @@ -302,15 +302,15 @@ nm_p2p_peer_connection_valid (NMP2PPeer *peer, NMConnection *connection) ctype = nm_setting_connection_get_connection_type (s_con); if ( !ctype - || !nm_streq (ctype, NM_SETTING_P2P_WIRELESS_SETTING_NAME)) + || !nm_streq (ctype, NM_SETTING_WIFI_P2P_SETTING_NAME)) return FALSE; /* HW Address check */ - hw_address = nm_p2p_peer_get_hw_address (peer); + hw_address = nm_wifi_p2p_peer_get_hw_address (peer); if (!hw_address) return FALSE; - setting_peer = nm_setting_p2p_wireless_get_peer (s_p2p_wifi); + setting_peer = nm_setting_wifi_p2p_get_peer (s_wifi_p2p); if ( !setting_peer || !nm_streq (hw_address, setting_peer)) return FALSE; @@ -319,12 +319,12 @@ nm_p2p_peer_connection_valid (NMP2PPeer *peer, NMConnection *connection) } /** - * nm_p2p_peer_filter_connections: - * @peer: an #NMP2PPeer to filter connections for + * nm_wifi_p2p_peer_filter_connections: + * @peer: an #NMWifiP2PPeer to filter connections for * @connections: (element-type NMConnection): an array of #NMConnections to * filter * - * Filters a given array of connections for a given #NMP2PPeer object and + * Filters a given array of connections for a given #NMWifiP2PPeer object and * returns connections which may be activated with the P2P peer. Any * returned connections will match the @peers's HW address and in the future * possibly other attributes. @@ -341,7 +341,7 @@ nm_p2p_peer_connection_valid (NMP2PPeer *peer, NMConnection *connection) * Since: 1.16 **/ GPtrArray * -nm_p2p_peer_filter_connections (NMP2PPeer *peer, const GPtrArray *connections) +nm_wifi_p2p_peer_filter_connections (NMWifiP2PPeer *peer, const GPtrArray *connections) { GPtrArray *filtered; guint i; @@ -350,7 +350,7 @@ nm_p2p_peer_filter_connections (NMP2PPeer *peer, const GPtrArray *connections) for (i = 0; i < connections->len; i++) { NMConnection *candidate = connections->pdata[i]; - if (nm_p2p_peer_connection_valid (peer, candidate)) + if (nm_wifi_p2p_peer_connection_valid (peer, candidate)) g_ptr_array_add (filtered, g_object_ref (candidate)); } @@ -362,25 +362,25 @@ nm_p2p_peer_filter_connections (NMP2PPeer *peer, const GPtrArray *connections) static void init_dbus (NMObject *object) { - NMP2PPeerPrivate *priv = NM_P2P_PEER_GET_PRIVATE (object); + NMWifiP2PPeerPrivate *priv = NM_WIFI_P2P_PEER_GET_PRIVATE (object); const NMPropertiesInfo property_info[] = { - { NM_P2P_PEER_FLAGS, &priv->flags }, - { NM_P2P_PEER_NAME, &priv->name }, - { NM_P2P_PEER_MANUFACTURER, &priv->manufacturer }, - { NM_P2P_PEER_MODEL, &priv->model }, - { NM_P2P_PEER_MODEL_NUMBER, &priv->model_number }, - { NM_P2P_PEER_SERIAL, &priv->serial }, - { NM_P2P_PEER_WFD_IES, &priv->wfd_ies }, - { NM_P2P_PEER_HW_ADDRESS, &priv->hw_address }, - { NM_P2P_PEER_STRENGTH, &priv->strength }, - { NM_P2P_PEER_LAST_SEEN, &priv->last_seen }, + { NM_WIFI_P2P_PEER_FLAGS, &priv->flags }, + { NM_WIFI_P2P_PEER_NAME, &priv->name }, + { NM_WIFI_P2P_PEER_MANUFACTURER, &priv->manufacturer }, + { NM_WIFI_P2P_PEER_MODEL, &priv->model }, + { NM_WIFI_P2P_PEER_MODEL_NUMBER, &priv->model_number }, + { NM_WIFI_P2P_PEER_SERIAL, &priv->serial }, + { NM_WIFI_P2P_PEER_WFD_IES, &priv->wfd_ies }, + { NM_WIFI_P2P_PEER_HW_ADDRESS, &priv->hw_address }, + { NM_WIFI_P2P_PEER_STRENGTH, &priv->strength }, + { NM_WIFI_P2P_PEER_LAST_SEEN, &priv->last_seen }, { NULL }, }; - NM_OBJECT_CLASS (nm_p2p_peer_parent_class)->init_dbus (object); + NM_OBJECT_CLASS (nm_wifi_p2p_peer_parent_class)->init_dbus (object); _nm_object_register_properties (object, - NM_DBUS_INTERFACE_P2P_PEER, + NM_DBUS_INTERFACE_WIFI_P2P_PEER, property_info); } @@ -392,38 +392,38 @@ get_property (GObject *object, GValue *value, GParamSpec *pspec) { - NMP2PPeer *peer = NM_P2P_PEER (object); + NMWifiP2PPeer *peer = NM_WIFI_P2P_PEER (object); switch (prop_id) { case PROP_FLAGS: - g_value_set_flags (value, nm_p2p_peer_get_flags (peer)); + g_value_set_flags (value, nm_wifi_p2p_peer_get_flags (peer)); break; case PROP_NAME: - g_value_set_string (value, nm_p2p_peer_get_name (peer)); + g_value_set_string (value, nm_wifi_p2p_peer_get_name (peer)); break; case PROP_MANUFACTURER: - g_value_set_string (value, nm_p2p_peer_get_manufacturer (peer)); + g_value_set_string (value, nm_wifi_p2p_peer_get_manufacturer (peer)); break; case PROP_MODEL: - g_value_set_string (value, nm_p2p_peer_get_model (peer)); + g_value_set_string (value, nm_wifi_p2p_peer_get_model (peer)); break; case PROP_MODEL_NUMBER: - g_value_set_string (value, nm_p2p_peer_get_model_number (peer)); + g_value_set_string (value, nm_wifi_p2p_peer_get_model_number (peer)); break; case PROP_SERIAL: - g_value_set_string (value, nm_p2p_peer_get_serial (peer)); + g_value_set_string (value, nm_wifi_p2p_peer_get_serial (peer)); break; case PROP_WFD_IES: - g_value_set_boxed (value, nm_p2p_peer_get_wfd_ies (peer)); + g_value_set_boxed (value, nm_wifi_p2p_peer_get_wfd_ies (peer)); break; case PROP_HW_ADDRESS: - g_value_set_string (value, nm_p2p_peer_get_hw_address (peer)); + g_value_set_string (value, nm_wifi_p2p_peer_get_hw_address (peer)); break; case PROP_STRENGTH: - g_value_set_uchar (value, nm_p2p_peer_get_strength (peer)); + g_value_set_uchar (value, nm_wifi_p2p_peer_get_strength (peer)); break; case PROP_LAST_SEEN: - g_value_set_int (value, nm_p2p_peer_get_last_seen (peer)); + g_value_set_int (value, nm_wifi_p2p_peer_get_last_seen (peer)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -434,15 +434,15 @@ get_property (GObject *object, /*****************************************************************************/ static void -nm_p2p_peer_init (NMP2PPeer *peer) +nm_wifi_p2p_peer_init (NMWifiP2PPeer *peer) { - NM_P2P_PEER_GET_PRIVATE (peer)->last_seen = -1; + NM_WIFI_P2P_PEER_GET_PRIVATE (peer)->last_seen = -1; } static void finalize (GObject *object) { - NMP2PPeerPrivate *priv = NM_P2P_PEER_GET_PRIVATE (object); + NMWifiP2PPeerPrivate *priv = NM_WIFI_P2P_PEER_GET_PRIVATE (object); g_free (priv->name); g_free (priv->manufacturer); @@ -454,11 +454,11 @@ finalize (GObject *object) g_bytes_unref (priv->wfd_ies); - G_OBJECT_CLASS (nm_p2p_peer_parent_class)->finalize (object); + G_OBJECT_CLASS (nm_wifi_p2p_peer_parent_class)->finalize (object); } static void -nm_p2p_peer_class_init (NMP2PPeerClass *klass) +nm_wifi_p2p_peer_class_init (NMWifiP2PPeerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); NMObjectClass *nm_object_class = NM_OBJECT_CLASS (klass); @@ -469,124 +469,124 @@ nm_p2p_peer_class_init (NMP2PPeerClass *klass) nm_object_class->init_dbus = init_dbus; /** - * NMP2PPeer:flags: + * NMWifiP2PPeer:flags: * * The flags of the P2P peer. * * Since: 1.16 **/ obj_properties[PROP_FLAGS] = - g_param_spec_flags (NM_P2P_PEER_FLAGS, "", "", + g_param_spec_flags (NM_WIFI_P2P_PEER_FLAGS, "", "", NM_TYPE_802_11_AP_FLAGS, NM_802_11_AP_FLAGS_NONE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMP2PPeer:name: + * NMWifiP2PPeer:name: * * The name of the P2P peer. * * Since: 1.16 **/ obj_properties[PROP_NAME] = - g_param_spec_string (NM_P2P_PEER_NAME, "", "", + g_param_spec_string (NM_WIFI_P2P_PEER_NAME, "", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMP2PPeer:manufacturer: + * NMWifiP2PPeer:manufacturer: * * The manufacturer of the P2P peer. * * Since: 1.16 **/ obj_properties[PROP_MANUFACTURER] = - g_param_spec_string (NM_P2P_PEER_MANUFACTURER, "", "", + g_param_spec_string (NM_WIFI_P2P_PEER_MANUFACTURER, "", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMP2PPeer:model: + * NMWifiP2PPeer:model: * * The model of the P2P peer. * * Since: 1.16 **/ obj_properties[PROP_MODEL] = - g_param_spec_string (NM_P2P_PEER_MODEL, "", "", + g_param_spec_string (NM_WIFI_P2P_PEER_MODEL, "", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMP2PPeer:model-number: + * NMWifiP2PPeer:model-number: * * The hardware address of the P2P peer. * * Since: 1.16 **/ obj_properties[PROP_MODEL_NUMBER] = - g_param_spec_string (NM_P2P_PEER_MODEL_NUMBER, "", "", + g_param_spec_string (NM_WIFI_P2P_PEER_MODEL_NUMBER, "", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMP2PPeer:serial: + * NMWifiP2PPeer:serial: * * The serial number of the P2P peer. * * Since: 1.16 **/ obj_properties[PROP_SERIAL] = - g_param_spec_string (NM_P2P_PEER_SERIAL, "", "", + g_param_spec_string (NM_WIFI_P2P_PEER_SERIAL, "", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMP2PPeer:wfd-ies: + * NMWifiP2PPeer:wfd-ies: * * The WFD information elements of the P2P peer. * * Since: 1.16 **/ obj_properties[PROP_WFD_IES] = - g_param_spec_boxed (NM_P2P_PEER_WFD_IES, "", "", + g_param_spec_boxed (NM_WIFI_P2P_PEER_WFD_IES, "", "", G_TYPE_BYTES, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMP2PPeer:hw-address: + * NMWifiP2PPeer:hw-address: * * The hardware address of the P2P peer. * * Since: 1.16 **/ obj_properties[PROP_HW_ADDRESS] = - g_param_spec_string (NM_P2P_PEER_HW_ADDRESS, "", "", + g_param_spec_string (NM_WIFI_P2P_PEER_HW_ADDRESS, "", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMP2PPeer:strength: + * NMWifiP2PPeer:strength: * * The current signal strength of the P2P peer. * * Since: 1.16 **/ obj_properties[PROP_STRENGTH] = - g_param_spec_uchar (NM_P2P_PEER_STRENGTH, "", "", + g_param_spec_uchar (NM_WIFI_P2P_PEER_STRENGTH, "", "", 0, G_MAXUINT8, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMP2PPeer:last-seen: + * NMWifiP2PPeer:last-seen: * * The timestamp (in CLOCK_BOOTTIME seconds) for the last time the * P2P peer was found. A value of -1 means the peer has never been seen. @@ -594,7 +594,7 @@ nm_p2p_peer_class_init (NMP2PPeerClass *klass) * Since: 1.16 **/ obj_properties[PROP_LAST_SEEN] = - g_param_spec_int (NM_P2P_PEER_LAST_SEEN, "", "", + g_param_spec_int (NM_WIFI_P2P_PEER_LAST_SEEN, "", "", -1, G_MAXINT, -1, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); diff --git a/libnm/nm-wifi-p2p-peer.h b/libnm/nm-wifi-p2p-peer.h index 0c52ecb3c0..7d48883b3b 100644 --- a/libnm/nm-wifi-p2p-peer.h +++ b/libnm/nm-wifi-p2p-peer.h @@ -17,8 +17,8 @@ * Copyright 2018 - 2019 Red Hat, Inc. */ -#ifndef __NM_P2P_PEER_H__ -#define __NM_P2P_PEER_H__ +#ifndef __NM_WIFI_P2P_PEER_H__ +#define __NM_WIFI_P2P_PEER_H__ #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION) #error "Only can be included directly." @@ -28,62 +28,62 @@ G_BEGIN_DECLS -#define NM_TYPE_P2P_PEER (nm_p2p_peer_get_type ()) -#define NM_P2P_PEER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_P2P_PEER, NMP2PPeer)) -#define NM_P2P_PEER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_P2P_PEER, NMP2PPeerClass)) -#define NM_IS_P2P_PEER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_P2P_PEER)) -#define NM_IS_P2P_PEER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_P2P_PEER)) -#define NM_P2P_PEER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_P2P_PEER, NMP2PPeerClass)) +#define NM_TYPE_WIFI_P2P_PEER (nm_wifi_p2p_peer_get_type ()) +#define NM_WIFI_P2P_PEER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_WIFI_P2P_PEER, NMWifiP2PPeer)) +#define NM_WIFI_P2P_PEER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_WIFI_P2P_PEER, NMWifiP2PPeerClass)) +#define NM_IS_WIFI_P2P_PEER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_WIFI_P2P_PEER)) +#define NM_IS_WIFI_P2P_PEER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_WIFI_P2P_PEER)) +#define NM_WIFI_P2P_PEER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_WIFI_P2P_PEER, NMWifiP2PPeerClass)) -#define NM_P2P_PEER_FLAGS "flags" -#define NM_P2P_PEER_NAME "name" -#define NM_P2P_PEER_MANUFACTURER "manufacturer" -#define NM_P2P_PEER_MODEL "model" -#define NM_P2P_PEER_MODEL_NUMBER "model-number" -#define NM_P2P_PEER_SERIAL "serial" -#define NM_P2P_PEER_WFD_IES "wfd-ies" -#define NM_P2P_PEER_HW_ADDRESS "hw-address" -#define NM_P2P_PEER_STRENGTH "strength" -#define NM_P2P_PEER_LAST_SEEN "last-seen" +#define NM_WIFI_P2P_PEER_FLAGS "flags" +#define NM_WIFI_P2P_PEER_NAME "name" +#define NM_WIFI_P2P_PEER_MANUFACTURER "manufacturer" +#define NM_WIFI_P2P_PEER_MODEL "model" +#define NM_WIFI_P2P_PEER_MODEL_NUMBER "model-number" +#define NM_WIFI_P2P_PEER_SERIAL "serial" +#define NM_WIFI_P2P_PEER_WFD_IES "wfd-ies" +#define NM_WIFI_P2P_PEER_HW_ADDRESS "hw-address" +#define NM_WIFI_P2P_PEER_STRENGTH "strength" +#define NM_WIFI_P2P_PEER_LAST_SEEN "last-seen" -typedef struct _NMP2PPeerClass NMP2PPeerClass; +typedef struct _NMWifiP2PPeerClass NMWifiP2PPeerClass; NM_AVAILABLE_IN_1_16 -GType nm_p2p_peer_get_type (void); +GType nm_wifi_p2p_peer_get_type (void); NM_AVAILABLE_IN_1_16 -NM80211ApFlags nm_p2p_peer_get_flags (NMP2PPeer *peer); +NM80211ApFlags nm_wifi_p2p_peer_get_flags (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -const char * nm_p2p_peer_get_name (NMP2PPeer *peer); +const char * nm_wifi_p2p_peer_get_name (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -const char * nm_p2p_peer_get_manufacturer (NMP2PPeer *peer); +const char * nm_wifi_p2p_peer_get_manufacturer (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -const char * nm_p2p_peer_get_model (NMP2PPeer *peer); +const char * nm_wifi_p2p_peer_get_model (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -const char * nm_p2p_peer_get_model_number (NMP2PPeer *peer); +const char * nm_wifi_p2p_peer_get_model_number (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -const char * nm_p2p_peer_get_serial (NMP2PPeer *peer); +const char * nm_wifi_p2p_peer_get_serial (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -GBytes * nm_p2p_peer_get_wfd_ies (NMP2PPeer *peer); +GBytes * nm_wifi_p2p_peer_get_wfd_ies (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -const char * nm_p2p_peer_get_hw_address (NMP2PPeer *peer); +const char * nm_wifi_p2p_peer_get_hw_address (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -guint8 nm_p2p_peer_get_strength (NMP2PPeer *peer); +guint8 nm_wifi_p2p_peer_get_strength (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -int nm_p2p_peer_get_last_seen (NMP2PPeer *peer); +int nm_wifi_p2p_peer_get_last_seen (NMWifiP2PPeer *peer); NM_AVAILABLE_IN_1_16 -GPtrArray * nm_p2p_peer_filter_connections (NMP2PPeer *peer, - const GPtrArray *connections); +GPtrArray * nm_wifi_p2p_peer_filter_connections (NMWifiP2PPeer *peer, + const GPtrArray *connections); NM_AVAILABLE_IN_1_16 -gboolean nm_p2p_peer_connection_valid (NMP2PPeer *peer, - NMConnection *connection); +gboolean nm_wifi_p2p_peer_connection_valid (NMWifiP2PPeer *peer, + NMConnection *connection); G_END_DECLS -#endif /* __NM_P2P_PEER_H__ */ +#endif /* __NM_WIFI_P2P_PEER_H__ */ diff --git a/shared/nm-meta-setting.c b/shared/nm-meta-setting.c index 06e24f1a42..e7e73bd88e 100644 --- a/shared/nm-meta-setting.c +++ b/shared/nm-meta-setting.c @@ -306,12 +306,6 @@ const NMMetaSettingInfo nm_meta_setting_infos[] = { .setting_name = NM_SETTING_OVS_PORT_SETTING_NAME, .get_setting_gtype = nm_setting_ovs_port_get_type, }, - [NM_META_SETTING_TYPE_P2P_WIRELESS] = { - .meta_type = NM_META_SETTING_TYPE_P2P_WIRELESS, - .setting_priority = NM_SETTING_PRIORITY_HW_BASE, - .setting_name = NM_SETTING_P2P_WIRELESS_SETTING_NAME, - .get_setting_gtype = nm_setting_p2p_wireless_get_type, - }, [NM_META_SETTING_TYPE_PPPOE] = { .meta_type = NM_META_SETTING_TYPE_PPPOE, .setting_priority = NM_SETTING_PRIORITY_AUX, @@ -390,6 +384,12 @@ const NMMetaSettingInfo nm_meta_setting_infos[] = { .setting_name = NM_SETTING_VXLAN_SETTING_NAME, .get_setting_gtype = nm_setting_vxlan_get_type, }, + [NM_META_SETTING_TYPE_WIFI_P2P] = { + .meta_type = NM_META_SETTING_TYPE_WIFI_P2P, + .setting_priority = NM_SETTING_PRIORITY_HW_BASE, + .setting_name = NM_SETTING_WIFI_P2P_SETTING_NAME, + .get_setting_gtype = nm_setting_wifi_p2p_get_type, + }, [NM_META_SETTING_TYPE_WIMAX] = { .meta_type = NM_META_SETTING_TYPE_WIMAX, .setting_priority = NM_SETTING_PRIORITY_HW_BASE, diff --git a/shared/nm-meta-setting.h b/shared/nm-meta-setting.h index 089acc8e9c..883d8ca195 100644 --- a/shared/nm-meta-setting.h +++ b/shared/nm-meta-setting.h @@ -132,7 +132,6 @@ typedef enum { NM_META_SETTING_TYPE_OVS_INTERFACE, NM_META_SETTING_TYPE_OVS_PATCH, NM_META_SETTING_TYPE_OVS_PORT, - NM_META_SETTING_TYPE_P2P_WIRELESS, NM_META_SETTING_TYPE_PPP, NM_META_SETTING_TYPE_PPPOE, NM_META_SETTING_TYPE_PROXY, @@ -146,6 +145,7 @@ typedef enum { NM_META_SETTING_TYPE_VLAN, NM_META_SETTING_TYPE_VPN, NM_META_SETTING_TYPE_VXLAN, + NM_META_SETTING_TYPE_WIFI_P2P, NM_META_SETTING_TYPE_WIMAX, NM_META_SETTING_TYPE_WPAN, diff --git a/src/devices/wifi/nm-device-wifi-p2p.c b/src/devices/wifi/nm-device-wifi-p2p.c index 8880b5b179..1043b69a14 100644 --- a/src/devices/wifi/nm-device-wifi-p2p.c +++ b/src/devices/wifi/nm-device-wifi-p2p.c @@ -1,4 +1,4 @@ -/* NetworkManager -- P2P Wi-Fi Device +/* NetworkManager -- Wi-Fi P2P Device * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -42,11 +42,11 @@ #include "platform/nmp-object.h" #include "devices/nm-device-logging.h" -_LOG_DECLARE_SELF(NMDeviceP2PWifi); +_LOG_DECLARE_SELF(NMDeviceWifiP2P); /*****************************************************************************/ -NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceP2PWifi, +NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceWifiP2P, PROP_GROUP_OWNER, PROP_PEERS, PROP_WFDIES, /* TODO: Make this a property of the setting and Find feature @@ -60,7 +60,7 @@ typedef struct { NMSupplicantManager *sup_mgr; /* NOTE: In theory management and group ifaces could be identical. However, - * in practice, this cannot happen currently as NMDeviceP2PWifi is only + * in practice, this cannot happen currently as NMDeviceWifiP2P is only * created for existing non-P2P interfaces. * (i.e. a single standalone P2P interface is not supported at this point) */ @@ -75,34 +75,34 @@ typedef struct { guint peer_missing_id; gboolean group_owner; -} NMDeviceP2PWifiPrivate; +} NMDeviceWifiP2PPrivate; -struct _NMDeviceP2PWifi { +struct _NMDeviceWifiP2P { NMDevice parent; - NMDeviceP2PWifiPrivate _priv; + NMDeviceWifiP2PPrivate _priv; }; -struct _NMDeviceP2PWifiClass { +struct _NMDeviceWifiP2PClass { NMDeviceClass parent; }; -G_DEFINE_TYPE (NMDeviceP2PWifi, nm_device_p2p_wifi, NM_TYPE_DEVICE) +G_DEFINE_TYPE (NMDeviceWifiP2P, nm_device_wifi_p2p, NM_TYPE_DEVICE) -#define NM_DEVICE_P2P_WIFI_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceP2PWifi, NM_IS_DEVICE_P2P_WIFI, NMDevice) +#define NM_DEVICE_WIFI_P2P_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceWifiP2P, NM_IS_DEVICE_WIFI_P2P, NMDevice) /*****************************************************************************/ -static const NMDBusInterfaceInfoExtended interface_info_device_p2p_wifi; -static const GDBusSignalInfo nm_signal_info_p2p_wireless_peer_added; -static const GDBusSignalInfo nm_signal_info_p2p_wireless_peer_removed; +static const NMDBusInterfaceInfoExtended interface_info_device_wifi_p2p; +static const GDBusSignalInfo nm_signal_info_wifi_p2p_peer_added; +static const GDBusSignalInfo nm_signal_info_wifi_p2p_peer_removed; -static void supplicant_group_interface_release (NMDeviceP2PWifi *self); -static void supplicant_interfaces_release (NMDeviceP2PWifi *self); +static void supplicant_group_interface_release (NMDeviceWifiP2P *self); +static void supplicant_interfaces_release (NMDeviceWifiP2P *self); /*****************************************************************************/ static void -_peer_dump (NMDeviceP2PWifi *self, +_peer_dump (NMDeviceWifiP2P *self, NMLogLevel log_level, const NMWifiP2PPeer *peer, const char *prefix, @@ -118,8 +118,8 @@ _peer_dump (NMDeviceP2PWifi *self, static gboolean peer_list_dump (gpointer user_data) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (user_data); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (user_data); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); priv->peer_dump_id = 0; @@ -135,9 +135,9 @@ peer_list_dump (gpointer user_data) } static void -schedule_peer_list_dump (NMDeviceP2PWifi *self) +schedule_peer_list_dump (NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); if ( !priv->peer_dump_id && _LOGD_ENABLED (LOGD_WIFI_SCAN)) @@ -147,9 +147,9 @@ schedule_peer_list_dump (NMDeviceP2PWifi *self) /*****************************************************************************/ static gboolean -check_connection_peer_joined (NMDeviceP2PWifi *device) +check_connection_peer_joined (NMDeviceWifiP2P *device) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (device); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (device); NMConnection *conn = nm_device_get_applied_connection (NM_DEVICE (device)); NMWifiP2PPeer *peer; const char* group; @@ -181,8 +181,8 @@ static gboolean disconnect_on_connection_peer_missing_cb (gpointer user_data) { NMDevice *device = NM_DEVICE (user_data); - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (device); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); _LOGW (LOGD_WIFI, "Peer requested in connection is missing for too long, failing connection."); @@ -195,9 +195,9 @@ disconnect_on_connection_peer_missing_cb (gpointer user_data) } static void -update_disconnect_on_connection_peer_missing (NMDeviceP2PWifi *self) +update_disconnect_on_connection_peer_missing (NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); NMDeviceState state; state = nm_device_get_state (NM_DEVICE (self)); @@ -222,8 +222,8 @@ update_disconnect_on_connection_peer_missing (NMDeviceP2PWifi *self) static gboolean is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (device); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); NMSupplicantInterfaceState supplicant_state; if (!priv->mgmt_iface) @@ -240,7 +240,7 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags) static gboolean check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error) { - if (!NM_DEVICE_CLASS (nm_device_p2p_wifi_parent_class)->check_connection_compatible (device, connection, error)) + if (!NM_DEVICE_CLASS (nm_device_wifi_p2p_parent_class)->check_connection_compatible (device, connection, error)) return FALSE; /* TODO: Allow limitting the interface using the HW-address? */ @@ -260,30 +260,32 @@ complete_connection (NMDevice *device, NMConnection *const*existing_connections, GError **error) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (device); gs_free char *setting_name = NULL; - NMSettingP2PWireless *s_p2p_wireless; + NMSettingWifiP2P *s_wifi_p2p; NMWifiP2PPeer *peer; const char *setting_peer; - s_p2p_wireless = NM_SETTING_P2P_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_P2P_WIRELESS)); + s_wifi_p2p = NM_SETTING_WIFI_P2P (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIFI_P2P)); if (!specific_object) { /* If not given a specific object, we need at minimum a peer address */ - if (!s_p2p_wireless) { - g_set_error_literal (error, - NM_DEVICE_ERROR, - NM_DEVICE_ERROR_INVALID_CONNECTION, - "A 'p2p-wireless' setting is required if no Peer path was given."); + if (!s_wifi_p2p) { + g_set_error (error, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, + "A '%s' setting is required if no Peer path was given", + NM_SETTING_WIFI_P2P_SETTING_NAME); return FALSE; } - setting_peer = nm_setting_p2p_wireless_get_peer (s_p2p_wireless); + setting_peer = nm_setting_wifi_p2p_get_peer (s_wifi_p2p); if (!setting_peer) { - g_set_error_literal (error, - NM_DEVICE_ERROR, - NM_DEVICE_ERROR_INVALID_CONNECTION, - "A 'p2p-wireless' setting with a valid Peer is required if no Peer path was given."); + g_set_error (error, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, + "A '%s' setting with a valid Peer is required if no Peer path was given", + NM_SETTING_WIFI_P2P_SETTING_NAME); return FALSE; } @@ -293,7 +295,7 @@ complete_connection (NMDevice *device, g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_SPECIFIC_OBJECT_NOT_FOUND, - "The P2P peer %s is unknown.", + "The P2P peer %s is unknown", specific_object); return FALSE; } @@ -302,18 +304,18 @@ complete_connection (NMDevice *device, g_return_val_if_fail (setting_peer, FALSE); } - /* Add a P2P wifi setting if one doesn't exist yet */ - if (!s_p2p_wireless) { - s_p2p_wireless = NM_SETTING_P2P_WIRELESS (nm_setting_p2p_wireless_new ()); - nm_connection_add_setting (connection, NM_SETTING (s_p2p_wireless)); + /* Add a Wi-Fi P2P setting if one doesn't exist yet */ + if (!s_wifi_p2p) { + s_wifi_p2p = NM_SETTING_WIFI_P2P (nm_setting_wifi_p2p_new ()); + nm_connection_add_setting (connection, NM_SETTING (s_wifi_p2p)); } - g_object_set (G_OBJECT (s_p2p_wireless), NM_SETTING_P2P_WIRELESS_PEER, setting_peer, NULL); + g_object_set (G_OBJECT (s_wifi_p2p), NM_SETTING_WIFI_P2P_PEER, setting_peer, NULL); - setting_name = g_strdup_printf ("P2P Peer %s", setting_peer); + setting_name = g_strdup_printf ("Wi-Fi P2P Peer %s", setting_peer); nm_utils_complete_generic (nm_device_get_platform (device), connection, - NM_SETTING_P2P_WIRELESS_SETTING_NAME, + NM_SETTING_WIFI_P2P_SETTING_NAME, existing_connections, setting_name, setting_name, @@ -332,8 +334,8 @@ static gboolean supplicant_find_timeout_cb (gpointer user_data) { NMDevice *device = NM_DEVICE (user_data); - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (user_data); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (user_data); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); priv->sup_timeout_id = 0; @@ -341,7 +343,7 @@ supplicant_find_timeout_cb (gpointer user_data) if (nm_device_is_activating (device)) { _LOGW (LOGD_DEVICE | LOGD_WIFI, - "Activation: (p2p-wifi) could not find peer, failing activation"); + "Activation: (wifi-p2p) could not find peer, failing activation"); nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_PEER_NOT_FOUND); } @@ -352,17 +354,17 @@ supplicant_find_timeout_cb (gpointer user_data) static NMActStageReturn act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (device); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); NMActStageReturn ret; NMActRequest *req; NMConnection *connection; - NMSettingP2PWireless *s_p2p_wireless; + NMSettingWifiP2P *s_wifi_p2p; NMWifiP2PPeer *peer; nm_clear_g_source (&priv->sup_timeout_id); - ret = NM_DEVICE_CLASS (nm_device_p2p_wifi_parent_class)->act_stage1_prepare (device, out_failure_reason); + ret = NM_DEVICE_CLASS (nm_device_wifi_p2p_parent_class)->act_stage1_prepare (device, out_failure_reason); if (ret != NM_ACT_STAGE_RETURN_SUCCESS) return ret; @@ -377,8 +379,8 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) connection = nm_act_request_get_applied_connection (req); g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE); - s_p2p_wireless = NM_SETTING_P2P_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_P2P_WIRELESS)); - g_return_val_if_fail (s_p2p_wireless, NM_ACT_STAGE_RETURN_FAILURE); + s_wifi_p2p = NM_SETTING_WIFI_P2P (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIFI_P2P)); + g_return_val_if_fail (s_wifi_p2p, NM_ACT_STAGE_RETURN_FAILURE); peer = nm_wifi_p2p_peers_find_first_compatible (&priv->peers_lst_head, connection); if (!peer) { @@ -398,9 +400,9 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) } static void -cleanup_p2p_connect_attempt (NMDeviceP2PWifi *self, gboolean disconnect) +cleanup_p2p_connect_attempt (NMDeviceWifiP2P *self, gboolean disconnect) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); nm_clear_g_source (&priv->sup_timeout_id); nm_clear_g_source (&priv->peer_missing_id); @@ -422,8 +424,8 @@ static gboolean supplicant_connection_timeout_cb (gpointer user_data) { NMDevice *device = NM_DEVICE (user_data); - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (user_data); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (user_data); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); priv->sup_timeout_id = 0; @@ -431,7 +433,7 @@ supplicant_connection_timeout_cb (gpointer user_data) if (nm_device_is_activating (device)) { _LOGW (LOGD_DEVICE | LOGD_WIFI, - "Activation: (p2p-wifi) connecting took too long, failing activation"); + "Activation: (wifi-p2p) connecting took too long, failing activation"); nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT); } @@ -442,8 +444,8 @@ supplicant_connection_timeout_cb (gpointer user_data) static NMActStageReturn act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (device); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); NMConnection *connection; NMWifiP2PPeer *peer; @@ -452,7 +454,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason) connection = nm_device_get_applied_connection (device); g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE); - nm_assert (NM_IS_SETTING_P2P_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_P2P_WIRELESS))); + nm_assert (NM_IS_SETTING_WIFI_P2P (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIFI_P2P))); /* The prepare stage ensures that the peer has been found */ peer = nm_wifi_p2p_peers_find_first_compatible (&priv->peers_lst_head, connection); @@ -480,27 +482,27 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason) /*****************************************************************************/ static void -emit_signal_p2p_peer_add_remove (NMDeviceP2PWifi *device, +emit_signal_p2p_peer_add_remove (NMDeviceWifiP2P *device, NMWifiP2PPeer *peer, gboolean is_added /* or else is_removed */) { nm_dbus_object_emit_signal (NM_DBUS_OBJECT (device), - &interface_info_device_p2p_wifi, + &interface_info_device_wifi_p2p, is_added - ? &nm_signal_info_p2p_wireless_peer_added - : &nm_signal_info_p2p_wireless_peer_removed, + ? &nm_signal_info_wifi_p2p_peer_added + : &nm_signal_info_wifi_p2p_peer_removed, "(o)", nm_dbus_object_get_path (NM_DBUS_OBJECT (peer))); } static void -peer_add_remove (NMDeviceP2PWifi *self, +peer_add_remove (NMDeviceWifiP2P *self, gboolean is_adding, /* or else removing */ NMWifiP2PPeer *peer, gboolean recheck_available_connections) { NMDevice *device = NM_DEVICE (self); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); if (is_adding) { g_object_ref (peer); @@ -547,9 +549,9 @@ peer_add_remove (NMDeviceP2PWifi *self, } static void -remove_all_peers (NMDeviceP2PWifi *self) +remove_all_peers (NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); NMWifiP2PPeer *peer; if (c_list_is_empty (&priv->peers_lst_head)) @@ -569,8 +571,8 @@ act_stage3_ip4_config_start (NMDevice *device, NMIP4Config **out_config, NMDeviceStateReason *out_failure_reason) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (device); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); NMConnection *connection; NMSettingIPConfig *s_ip4; const char *method = NM_SETTING_IP4_CONFIG_METHOD_AUTO; @@ -587,7 +589,7 @@ act_stage3_ip4_config_start (NMDevice *device, && nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ip_ifindex (device), TRUE); - return NM_DEVICE_CLASS (nm_device_p2p_wifi_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason); + return NM_DEVICE_CLASS (nm_device_wifi_p2p_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason); } static NMActStageReturn @@ -611,13 +613,13 @@ act_stage3_ip6_config_start (NMDevice *device, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ip_ifindex (device), TRUE); - return NM_DEVICE_CLASS (nm_device_p2p_wifi_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason); + return NM_DEVICE_CLASS (nm_device_wifi_p2p_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason); } static void deactivate (NMDevice *device) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (device); int ifindex = nm_device_get_ip_ifindex (device); cleanup_p2p_connect_attempt (self, TRUE); @@ -637,8 +639,8 @@ get_configured_mtu (NMDevice *device, NMDeviceMtuSource *out_source) static const char * get_auto_ip_config_method (NMDevice *device, int addr_family) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (device); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); /* Override the AUTO method to mean shared if we are group owner. */ if ( priv->group_iface @@ -666,7 +668,7 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, int disconnect_reason, gpointer user_data) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (user_data); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (user_data); NMDevice *device = NM_DEVICE (self); NMSupplicantInterfaceState new_state = new_state_i; NMSupplicantInterfaceState old_state = old_state_i; @@ -705,15 +707,15 @@ static void supplicant_iface_peer_updated_cb (NMSupplicantInterface *iface, const char *object_path, GVariant *properties, - NMDeviceP2PWifi *self) + NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv; + NMDeviceWifiP2PPrivate *priv; NMWifiP2PPeer *found_peer; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); - priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); found_peer = nm_wifi_p2p_peers_find_by_supplicant_path (&priv->peers_lst_head, object_path); if (found_peer) { @@ -740,15 +742,15 @@ supplicant_iface_peer_updated_cb (NMSupplicantInterface *iface, static void supplicant_iface_peer_removed_cb (NMSupplicantInterface *iface, const char *object_path, - NMDeviceP2PWifi *self) + NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv; + NMDeviceWifiP2PPrivate *priv; NMWifiP2PPeer *peer; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); - priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); peer = nm_wifi_p2p_peers_find_by_supplicant_path (&priv->peers_lst_head, object_path); if (!peer) return; @@ -758,9 +760,9 @@ supplicant_iface_peer_removed_cb (NMSupplicantInterface *iface, } static void -check_group_iface_ready (NMDeviceP2PWifi *self) +check_group_iface_ready (NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self);; + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self);; if (!priv->group_iface) return; @@ -784,8 +786,8 @@ supplicant_group_iface_state_cb (NMSupplicantInterface *iface, int disconnect_reason, gpointer user_data) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (user_data); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (user_data); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); NMDevice *device = NM_DEVICE (self); NMSupplicantInterfaceState new_state = new_state_i; NMSupplicantInterfaceState old_state = old_state_i; @@ -830,7 +832,7 @@ static void supplicant_group_iface_group_finished_cb (NMSupplicantInterface *iface, void *user_data) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (user_data); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (user_data); supplicant_group_interface_release (self); @@ -844,7 +846,7 @@ supplicant_iface_group_joined_updated_cb (NMSupplicantInterface *iface, GParamSpec *pspec, void *user_data) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (user_data); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (user_data); check_group_iface_ready (self); } @@ -852,9 +854,9 @@ supplicant_iface_group_joined_updated_cb (NMSupplicantInterface *iface, static void supplicant_iface_group_started_cb (NMSupplicantInterface *iface, NMSupplicantInterface *group_iface, - NMDeviceP2PWifi *self) + NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv; + NMDeviceWifiP2PPrivate *priv; g_return_if_fail (self != NULL); @@ -863,7 +865,7 @@ supplicant_iface_group_started_cb (NMSupplicantInterface *iface, return; } - priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); supplicant_group_interface_release (self); priv->group_iface = g_object_ref (group_iface); @@ -891,13 +893,13 @@ supplicant_iface_group_started_cb (NMSupplicantInterface *iface, } static void -supplicant_group_interface_release (NMDeviceP2PWifi *self) +supplicant_group_interface_release (NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv; + NMDeviceWifiP2PPrivate *priv; g_return_if_fail (self != NULL); - priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); if (priv->group_iface) { /* Tell the supplicant to disconnect from the current Group/Peer */ @@ -911,13 +913,13 @@ supplicant_group_interface_release (NMDeviceP2PWifi *self) } static void -supplicant_interfaces_release (NMDeviceP2PWifi *self) +supplicant_interfaces_release (NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv; + NMDeviceWifiP2PPrivate *priv; g_return_if_fail (self != NULL); - priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); _LOGD (LOGD_DEVICE | LOGD_WIFI, "P2P: Releasing WPA supplicant interfaces."); @@ -942,8 +944,8 @@ device_state_changed (NMDevice *device, NMDeviceState old_state, NMDeviceStateReason reason) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (device); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (device); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); update_disconnect_on_connection_peer_missing (self); @@ -993,7 +995,7 @@ device_state_changed (NMDevice *device, } static void -impl_device_p2p_wifi_start_find (NMDBusObject *obj, +impl_device_wifi_p2p_start_find (NMDBusObject *obj, const NMDBusInterfaceInfoExtended *interface_info, const NMDBusMethodInfoExtended *method_info, GDBusConnection *connection, @@ -1001,8 +1003,8 @@ impl_device_p2p_wifi_start_find (NMDBusObject *obj, GDBusMethodInvocation *invocation, GVariant *parameters) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (obj); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (obj); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); gs_unref_variant GVariant *options = NULL; int timeout; @@ -1038,7 +1040,7 @@ impl_device_p2p_wifi_start_find (NMDBusObject *obj, } static void -impl_device_p2p_wifi_stop_find (NMDBusObject *obj, +impl_device_wifi_p2p_stop_find (NMDBusObject *obj, const NMDBusInterfaceInfoExtended *interface_info, const NMDBusMethodInfoExtended *method_info, GDBusConnection *connection, @@ -1046,8 +1048,8 @@ impl_device_p2p_wifi_stop_find (NMDBusObject *obj, GDBusMethodInvocation *invocation, GVariant *parameters) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (obj); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (obj); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); nm_supplicant_interface_p2p_stop_find (priv->mgmt_iface); @@ -1057,18 +1059,18 @@ impl_device_p2p_wifi_stop_find (NMDBusObject *obj, /*****************************************************************************/ NMSupplicantInterface * -nm_device_p2p_wifi_get_mgmt_iface (NMDeviceP2PWifi *self) +nm_device_wifi_p2p_get_mgmt_iface (NMDeviceWifiP2P *self) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); return priv->mgmt_iface; } void -nm_device_p2p_wifi_set_mgmt_iface (NMDeviceP2PWifi *self, +nm_device_wifi_p2p_set_mgmt_iface (NMDeviceWifiP2P *self, NMSupplicantInterface *iface) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); /* Don't do anything if nothing changed. */ if (priv->mgmt_iface == iface) @@ -1108,30 +1110,30 @@ nm_device_p2p_wifi_set_mgmt_iface (NMDeviceP2PWifi *self, } void -nm_device_p2p_wifi_remove (NMDeviceP2PWifi* self) +nm_device_wifi_p2p_remove (NMDeviceWifiP2P* self) { g_signal_emit_by_name (self, NM_DEVICE_REMOVED); } /*****************************************************************************/ -static const GDBusSignalInfo nm_signal_info_p2p_wireless_peer_added = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT ( +static const GDBusSignalInfo nm_signal_info_wifi_p2p_peer_added = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT ( "PeerAdded", .args = NM_DEFINE_GDBUS_ARG_INFOS ( NM_DEFINE_GDBUS_ARG_INFO ("peer", "o"), ), ); -static const GDBusSignalInfo nm_signal_info_p2p_wireless_peer_removed = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT ( +static const GDBusSignalInfo nm_signal_info_wifi_p2p_peer_removed = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT ( "PeerRemoved", .args = NM_DEFINE_GDBUS_ARG_INFOS ( NM_DEFINE_GDBUS_ARG_INFO ("peer", "o"), ), ); -static const NMDBusInterfaceInfoExtended interface_info_device_p2p_wifi = { +static const NMDBusInterfaceInfoExtended interface_info_device_wifi_p2p = { .parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT ( - NM_DBUS_INTERFACE_DEVICE_P2P_WIRELESS, + NM_DBUS_INTERFACE_DEVICE_WIFI_P2P, .methods = NM_DEFINE_GDBUS_METHOD_INFOS ( NM_DEFINE_DBUS_METHOD_INFO_EXTENDED ( NM_DEFINE_GDBUS_METHOD_INFO_INIT ( @@ -1140,24 +1142,24 @@ static const NMDBusInterfaceInfoExtended interface_info_device_p2p_wifi = { NM_DEFINE_GDBUS_ARG_INFO ("options", "a{sv}"), ), ), - .handle = impl_device_p2p_wifi_start_find, + .handle = impl_device_wifi_p2p_start_find, ), NM_DEFINE_DBUS_METHOD_INFO_EXTENDED ( NM_DEFINE_GDBUS_METHOD_INFO_INIT ( "StopFind", ), - .handle = impl_device_p2p_wifi_stop_find, + .handle = impl_device_wifi_p2p_stop_find, ), ), .signals = NM_DEFINE_GDBUS_SIGNAL_INFOS ( - &nm_signal_info_p2p_wireless_peer_added, - &nm_signal_info_p2p_wireless_peer_removed, + &nm_signal_info_wifi_p2p_peer_added, + &nm_signal_info_wifi_p2p_peer_removed, ), .properties = NM_DEFINE_GDBUS_PROPERTY_INFOS ( NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("HwAddress", "s", NM_DEVICE_HW_ADDRESS), - NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("GroupOwner", "b", NM_DEVICE_P2P_WIFI_GROUP_OWNER), - NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("Peers", "ao", NM_DEVICE_P2P_WIFI_PEERS), - NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("WFDIEs", "ay", NM_DEVICE_P2P_WIFI_WFDIES), + NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("GroupOwner", "b", NM_DEVICE_WIFI_P2P_GROUP_OWNER), + NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("Peers", "ao", NM_DEVICE_WIFI_P2P_PEERS), + NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("WFDIEs", "ay", NM_DEVICE_WIFI_P2P_WFDIES), ), ), .legacy_property_changed = FALSE, @@ -1169,8 +1171,8 @@ static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (object); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (object); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); const char **list; switch (prop_id) { @@ -1197,12 +1199,12 @@ static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (object); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (object); switch (prop_id) { case PROP_MGMT_IFACE: /* construct-only */ - nm_device_p2p_wifi_set_mgmt_iface (self, g_value_get_object (value)); + nm_device_wifi_p2p_set_mgmt_iface (self, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1213,19 +1215,19 @@ set_property (GObject *object, guint prop_id, /*****************************************************************************/ static void -nm_device_p2p_wifi_init (NMDeviceP2PWifi * self) +nm_device_wifi_p2p_init (NMDeviceWifiP2P * self) { - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); c_list_init (&priv->peers_lst_head); } static void constructed (GObject *object) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (object); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (self); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (object); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (self); - G_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->constructed (object); + G_OBJECT_CLASS (nm_device_wifi_p2p_parent_class)->constructed (object); priv->sup_mgr = g_object_ref (nm_supplicant_manager_get ()); @@ -1233,46 +1235,46 @@ constructed (GObject *object) } NMDevice* -nm_device_p2p_wifi_new (NMSupplicantInterface *mgmt_iface, const char *iface) +nm_device_wifi_p2p_new (NMSupplicantInterface *mgmt_iface, const char *iface) { - return g_object_new (NM_TYPE_DEVICE_P2P_WIFI, + return g_object_new (NM_TYPE_DEVICE_WIFI_P2P, NM_DEVICE_IFACE, iface, - NM_DEVICE_TYPE_DESC, "802.11 P2P WiFi", - NM_DEVICE_DEVICE_TYPE, NM_TYPE_DEVICE_P2P_WIFI, + NM_DEVICE_TYPE_DESC, "802.11 Wi-Fi P2P", + NM_DEVICE_DEVICE_TYPE, NM_TYPE_DEVICE_WIFI_P2P, NM_DEVICE_LINK_TYPE, NM_LINK_TYPE_WIFI, NM_DEVICE_RFKILL_TYPE, RFKILL_TYPE_WLAN, - NM_DEVICE_P2P_WIFI_MGMT_IFACE, mgmt_iface, + NM_DEVICE_WIFI_P2P_MGMT_IFACE, mgmt_iface, NULL); } static void dispose (GObject *object) { - NMDeviceP2PWifi *self = NM_DEVICE_P2P_WIFI (object); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (object); + NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (object); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (object); g_clear_object (&priv->sup_mgr); supplicant_interfaces_release (self); - G_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->dispose (object); + G_OBJECT_CLASS (nm_device_wifi_p2p_parent_class)->dispose (object); } static void finalize (GObject *object) { - NMDeviceP2PWifi *peer = NM_DEVICE_P2P_WIFI (object); - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (peer); + NMDeviceWifiP2P *peer = NM_DEVICE_WIFI_P2P (object); + NMDeviceWifiP2PPrivate *priv = NM_DEVICE_WIFI_P2P_GET_PRIVATE (peer); nm_assert (c_list_is_empty (&priv->peers_lst_head)); g_bytes_unref (priv->wfd_ies); - G_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->finalize (object); + G_OBJECT_CLASS (nm_device_wifi_p2p_parent_class)->finalize (object); } static void -nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *klass) +nm_device_wifi_p2p_class_init (NMDeviceWifiP2PClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); @@ -1284,11 +1286,11 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *klass) object_class->dispose = dispose; object_class->finalize = finalize; - dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_p2p_wifi); + dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_wifi_p2p); - device_class->connection_type_supported = NM_SETTING_P2P_WIRELESS_SETTING_NAME; - device_class->connection_type_check_compatible = NM_SETTING_P2P_WIRELESS_SETTING_NAME; - device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_P2P_WIFI); + device_class->connection_type_supported = NM_SETTING_WIFI_P2P_SETTING_NAME; + device_class->connection_type_check_compatible = NM_SETTING_WIFI_P2P_SETTING_NAME; + device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_WIFI_P2P); /* Do we need compatibility checking or is the default good enough? */ device_class->is_available = is_available; @@ -1310,26 +1312,26 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *klass) /*klass->scanning_prohibited = scanning_prohibited;*/ obj_properties[PROP_GROUP_OWNER] = - g_param_spec_boolean (NM_DEVICE_P2P_WIFI_GROUP_OWNER, "", "", + g_param_spec_boolean (NM_DEVICE_WIFI_P2P_GROUP_OWNER, "", "", FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); obj_properties[PROP_PEERS] = - g_param_spec_boxed (NM_DEVICE_P2P_WIFI_PEERS, "", "", + g_param_spec_boxed (NM_DEVICE_WIFI_P2P_PEERS, "", "", G_TYPE_STRV, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); obj_properties[PROP_WFDIES] = - g_param_spec_variant (NM_DEVICE_P2P_WIFI_WFDIES, "", "", + g_param_spec_variant (NM_DEVICE_WIFI_P2P_WFDIES, "", "", G_VARIANT_TYPE ("ay"), NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); obj_properties[PROP_MGMT_IFACE] = - g_param_spec_object (NM_DEVICE_P2P_WIFI_MGMT_IFACE, "", "", + g_param_spec_object (NM_DEVICE_WIFI_P2P_MGMT_IFACE, "", "", NM_TYPE_SUPPLICANT_INTERFACE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | diff --git a/src/devices/wifi/nm-device-wifi-p2p.h b/src/devices/wifi/nm-device-wifi-p2p.h index b57a3f835b..12c0a8ef4d 100644 --- a/src/devices/wifi/nm-device-wifi-p2p.h +++ b/src/devices/wifi/nm-device-wifi-p2p.h @@ -1,4 +1,4 @@ -/* NetworkManager -- P2P Wi-Fi Device +/* NetworkManager -- Wi-Fi P2P Device * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,38 +18,38 @@ * (C) Copyright 2018 Red Hat, Inc. */ -#ifndef __NM_DEVICE_P2P_WIFI_H__ -#define __NM_DEVICE_P2P_WIFI_H__ +#ifndef __NM_DEVICE_WIFI_P2P_H__ +#define __NM_DEVICE_WIFI_P2P_H__ #include "devices/nm-device.h" #include "supplicant/nm-supplicant-interface.h" -#define NM_TYPE_DEVICE_P2P_WIFI (nm_device_p2p_wifi_get_type ()) -#define NM_DEVICE_P2P_WIFI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_P2P_WIFI, NMDeviceP2PWifi)) -#define NM_DEVICE_P2P_WIFI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_P2P_WIFI, NMDeviceP2PWifiClass)) -#define NM_IS_DEVICE_P2P_WIFI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_P2P_WIFI)) -#define NM_IS_DEVICE_P2P_WIFI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_P2P_WIFI)) -#define NM_DEVICE_P2P_WIFI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_P2P_WIFI, NMDeviceP2PWifiClass)) +#define NM_TYPE_DEVICE_WIFI_P2P (nm_device_wifi_p2p_get_type ()) +#define NM_DEVICE_WIFI_P2P(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_WIFI_P2P, NMDeviceWifiP2P)) +#define NM_DEVICE_WIFI_P2P_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_WIFI_P2P, NMDeviceWifiP2PClass)) +#define NM_IS_DEVICE_WIFI_P2P(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_WIFI_P2P)) +#define NM_IS_DEVICE_WIFI_P2P_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_WIFI_P2P)) +#define NM_DEVICE_WIFI_P2P_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_WIFI_P2P, NMDeviceWifiP2PClass)) -#define NM_DEVICE_P2P_WIFI_GROUP_OWNER "group-owner" -#define NM_DEVICE_P2P_WIFI_PEERS "peers" -#define NM_DEVICE_P2P_WIFI_GROUPS "groups" -#define NM_DEVICE_P2P_WIFI_WFDIES "WFDIEs" +#define NM_DEVICE_WIFI_P2P_GROUP_OWNER "group-owner" +#define NM_DEVICE_WIFI_P2P_PEERS "peers" +#define NM_DEVICE_WIFI_P2P_GROUPS "groups" +#define NM_DEVICE_WIFI_P2P_WFDIES "WFDIEs" -#define NM_DEVICE_P2P_WIFI_MGMT_IFACE "mgmt-iface" +#define NM_DEVICE_WIFI_P2P_MGMT_IFACE "mgmt-iface" -typedef struct _NMDeviceP2PWifi NMDeviceP2PWifi; -typedef struct _NMDeviceP2PWifiClass NMDeviceP2PWifiClass; +typedef struct _NMDeviceWifiP2P NMDeviceWifiP2P; +typedef struct _NMDeviceWifiP2PClass NMDeviceWifiP2PClass; -GType nm_device_p2p_wifi_get_type (void); +GType nm_device_wifi_p2p_get_type (void); -NMDevice* nm_device_p2p_wifi_new (NMSupplicantInterface *mgmt_iface, +NMDevice* nm_device_wifi_p2p_new (NMSupplicantInterface *mgmt_iface, const char* iface); -NMSupplicantInterface * nm_device_p2p_wifi_get_mgmt_iface (NMDeviceP2PWifi *self); -void nm_device_p2p_wifi_set_mgmt_iface (NMDeviceP2PWifi *self, +NMSupplicantInterface * nm_device_wifi_p2p_get_mgmt_iface (NMDeviceWifiP2P *self); +void nm_device_wifi_p2p_set_mgmt_iface (NMDeviceWifiP2P *self, NMSupplicantInterface *iface); -void nm_device_p2p_wifi_remove (NMDeviceP2PWifi *self); +void nm_device_wifi_p2p_remove (NMDeviceWifiP2P *self); -#endif /* __NM_DEVICE_P2P_WIFI_H__ */ +#endif /* __NM_DEVICE_WIFI_P2P_H__ */ diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 4df39b8dc1..edc099493d 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -127,7 +127,7 @@ typedef struct { NMSettingWirelessWakeOnWLan wowlan_restore; - NMDeviceP2PWifi *p2p_device; + NMDeviceWifiP2P *p2p_device; } NMDeviceWifiPrivate; struct _NMDeviceWifi @@ -363,7 +363,7 @@ supplicant_interface_release (NMDeviceWifi *self) if (priv->p2p_device) { /* Signal to P2P device to also release its reference */ - nm_device_p2p_wifi_set_mgmt_iface (priv->p2p_device, NULL); + nm_device_wifi_p2p_set_mgmt_iface (priv->p2p_device, NULL); } _notify_scanning (self); @@ -2239,7 +2239,7 @@ static void recheck_p2p_availability (NMDeviceWifi *self) { NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - NMDeviceP2PWifi *p2p_device; + NMDeviceWifiP2P *p2p_device; gboolean p2p_available; g_object_get (priv->sup_iface, @@ -2253,7 +2253,7 @@ recheck_p2p_availability (NMDeviceWifi *self) * wpa_supplicant internally. */ iface_name = g_strconcat ("p2p-dev-", nm_device_get_iface (NM_DEVICE (self)), NULL); - p2p_device = NM_DEVICE_P2P_WIFI (nm_device_p2p_wifi_new (priv->sup_iface, iface_name)); + p2p_device = NM_DEVICE_WIFI_P2P (nm_device_wifi_p2p_new (priv->sup_iface, iface_name)); priv->p2p_device = p2p_device; g_signal_emit (self, signals[P2P_DEVICE_CREATED], 0, priv->p2p_device); @@ -2261,12 +2261,12 @@ recheck_p2p_availability (NMDeviceWifi *self) g_object_unref (p2p_device); } else if (p2p_available && priv->p2p_device) { - nm_device_p2p_wifi_set_mgmt_iface (priv->p2p_device, priv->sup_iface); + nm_device_wifi_p2p_set_mgmt_iface (priv->p2p_device, priv->sup_iface); } else if (!p2p_available && priv->p2p_device) { /* Destroy the P2P device. */ g_object_remove_weak_pointer (G_OBJECT (priv->p2p_device), (gpointer*) &priv->p2p_device); - nm_device_p2p_wifi_remove (g_steal_pointer (&priv->p2p_device)); + nm_device_wifi_p2p_remove (g_steal_pointer (&priv->p2p_device)); } } diff --git a/src/devices/wifi/nm-wifi-factory.c b/src/devices/wifi/nm-wifi-factory.c index e44169ab52..9a89bbe92b 100644 --- a/src/devices/wifi/nm-wifi-factory.c +++ b/src/devices/wifi/nm-wifi-factory.c @@ -71,11 +71,11 @@ nm_device_factory_create (GError **error) static void p2p_device_created (NMDeviceWifi *device, - NMDeviceP2PWifi *p2p_device, + NMDeviceWifiP2P *p2p_device, NMDeviceFactory *self) { nm_log_info (LOGD_PLATFORM | LOGD_WIFI, - "P2P Wifi device controlled by wifi interface %s created", + "Wi-Fi P2P device controlled by interface %s created", nm_device_get_iface (NM_DEVICE (device))); g_signal_emit_by_name (self, NM_DEVICE_FACTORY_DEVICE_ADDED, p2p_device); diff --git a/src/devices/wifi/nm-wifi-p2p-peer.c b/src/devices/wifi/nm-wifi-p2p-peer.c index a22db4b75f..db114381b0 100644 --- a/src/devices/wifi/nm-wifi-p2p-peer.c +++ b/src/devices/wifi/nm-wifi-p2p-peer.c @@ -1,4 +1,4 @@ -/* NetworkManager -- P2P Wi-Fi Peer +/* NetworkManager -- Wi-Fi P2P Peer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -565,7 +565,7 @@ nm_wifi_p2p_peer_check_compatible (NMWifiP2PPeer *self, NMConnection *connection) { NMWifiP2PPeerPrivate *priv; - NMSettingP2PWireless *s_p2p_wireless; + NMSettingWifiP2P *s_wifi_p2p; const char *hwaddr; g_return_val_if_fail (NM_IS_WIFI_P2P_PEER (self), FALSE); @@ -573,11 +573,11 @@ nm_wifi_p2p_peer_check_compatible (NMWifiP2PPeer *self, priv = NM_WIFI_P2P_PEER_GET_PRIVATE (self); - s_p2p_wireless = NM_SETTING_P2P_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_P2P_WIRELESS)); - if (s_p2p_wireless == NULL) + s_wifi_p2p = NM_SETTING_WIFI_P2P (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIFI_P2P)); + if (s_wifi_p2p == NULL) return FALSE; - hwaddr = nm_setting_p2p_wireless_get_peer (s_p2p_wireless); + hwaddr = nm_setting_wifi_p2p_get_peer (s_wifi_p2p); if ( hwaddr && ( !priv->address || !nm_utils_hwaddr_matches (hwaddr, -1, priv->address, -1))) @@ -702,7 +702,7 @@ finalize (GObject *object) static const NMDBusInterfaceInfoExtended interface_info_p2p_peer = { .parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT ( - NM_DBUS_INTERFACE_P2P_PEER, + NM_DBUS_INTERFACE_WIFI_P2P_PEER, .properties = NM_DEFINE_GDBUS_PROPERTY_INFOS ( NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("Flags", "u", NM_WIFI_P2P_PEER_FLAGS), NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("Name", "s", NM_WIFI_P2P_PEER_NAME), @@ -728,7 +728,7 @@ nm_wifi_p2p_peer_class_init (NMWifiP2PPeerClass *klass) g_type_class_add_private (object_class, sizeof (NMWifiP2PPeerPrivate)); - dbus_object_class->export_path = NM_DBUS_EXPORT_PATH_NUMBERED (NM_DBUS_PATH_P2P_PEER); + dbus_object_class->export_path = NM_DBUS_EXPORT_PATH_NUMBERED (NM_DBUS_PATH_WIFI_P2P_PEER); dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_p2p_peer); object_class->get_property = get_property; diff --git a/src/devices/wifi/nm-wifi-p2p-peer.h b/src/devices/wifi/nm-wifi-p2p-peer.h index 13c4add6cd..d6ff7abc56 100644 --- a/src/devices/wifi/nm-wifi-p2p-peer.h +++ b/src/devices/wifi/nm-wifi-p2p-peer.h @@ -1,4 +1,4 @@ -/* NetworkManager -- P2P Wi-Fi Peer +/* NetworkManager -- Wi-Fi P2P Peer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/nm-types.h b/src/nm-types.h index 9a384e5800..b6b49028ca 100644 --- a/src/nm-types.h +++ b/src/nm-types.h @@ -152,7 +152,7 @@ typedef enum { NM_LINK_TYPE_WIMAX, NM_LINK_TYPE_WPAN, NM_LINK_TYPE_6LOWPAN, - NM_LINK_TYPE_P2P_WIFI, + NM_LINK_TYPE_WIFI_P2P, /* Software types */ NM_LINK_TYPE_BNEP = 0x10000, /* Bluetooth Ethernet emulation */ diff --git a/src/org.freedesktop.NetworkManager.conf b/src/org.freedesktop.NetworkManager.conf index 2bc7b4de94..720c090ef1 100644 --- a/src/org.freedesktop.NetworkManager.conf +++ b/src/org.freedesktop.NetworkManager.conf @@ -85,7 +85,7 @@ + send_interface="org.freedesktop.NetworkManager.WifiP2PPeer"/> + send_interface="org.freedesktop.NetworkManager.Device.WifiP2P"/> diff --git a/vapi/NM-1.0.metadata b/vapi/NM-1.0.metadata index 98fd071e2d..67587af736 100644 --- a/vapi/NM-1.0.metadata +++ b/vapi/NM-1.0.metadata @@ -22,15 +22,14 @@ SETTING_DCB_* parent="NM.SettingDcb" name="SETTIN SETTING_GENERIC_* parent="NM.SettingGeneric" name="SETTING_GENERIC_(.+)" SETTING_GSM_* parent="NM.SettingGsm" name="SETTING_GSM_(.+)" SETTING_INFINIBAND_* parent="NM.SettingInfiniband" name="SETTING_INFINIBAND_(.+)" -SETTING_IP_CONFIG_* parent="NM.SettingIPConfig" name="SETTING_IP_CONFIG_(.+)" SETTING_IP4_CONFIG_* parent="NM.SettingIP4Config" name="SETTING_IP4_CONFIG_(.+)" SETTING_IP6_CONFIG_* parent="NM.SettingIP6Config" name="SETTING_IP6_CONFIG_(.+)" +SETTING_IP_CONFIG_* parent="NM.SettingIPConfig" name="SETTING_IP_CONFIG_(.+)" SETTING_IP_TUNNEL_* parent="NM.SettingIPTunnel" name="SETTING_IP_TUNNEL_(.+)" SETTING_MACVLAN_* parent="NM.SettingMacvlan" name="SETTING_MACVLAN_(.+)" SETTING_OLPC_MESH_* parent="NM.SettingOlpcMesh" name="SETTING_OLPC_MESH_(.+)" -SETTING_P2P_WIRELESS_* parent="NM.SettingP2PWireless" name="SETTING_P2P_WIRELESS_(.+)" -SETTING_PPP_* parent="NM.SettingPpp" name="SETTING_PPP_(.+)" SETTING_PPPOE_* parent="NM.SettingPppoe" name="SETTING_PPPOE_(.+)" +SETTING_PPP_* parent="NM.SettingPpp" name="SETTING_PPP_(.+)" SETTING_PROXY_* parent="NM.SettingProxy" name="SETTING_PROXY_(.+)" SETTING_SERIAL_* parent="NM.SettingSerial" name="SETTING_SERIAL_(.+)" SETTING_TEAM_* parent="NM.SettingTeam" name="SETTING_TEAM_(.+)" @@ -38,6 +37,7 @@ SETTING_TUN_* parent="NM.SettingTun" name="SETTIN SETTING_VLAN_* parent="NM.SettingVlan" name="SETTING_VLAN_(.+)" SETTING_VPN_* parent="NM.SettingVpn" name="SETTING_VPN_(.+)" SETTING_VXLAN_* parent="NM.SettingVxlan" name="SETTING_VXLAN_(.+)" +SETTING_WIFI_P2P_* parent="NM.SettingWifiP2P" name="SETTING_WIFI_P2P_(.+)" SETTING_WIMAX_* parent="NM.SettingWimax" name="SETTING_WIMAX_(.+)" SETTING_WIRED_* parent="NM.SettingWired" name="SETTING_WIRED_(.+)" SETTING_WIRELESS_* parent="NM.SettingWireless" name="SETTING_WIRELESS_(.+)" From 0ec30f890469c438e953d4a321d3852c565d2ccb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 16:58:58 +0100 Subject: [PATCH 16/16] clients/trivial: move code in nm-meta-setting-desc around Sort by name. --- clients/common/nm-meta-setting-desc.c | 240 +++++++++++++------------- 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index ebaf35b864..d5435683e1 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -5171,6 +5171,19 @@ static const NMMetaPropertyType _pt_ethtool = { ), \ ), +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_6LOWPAN +static const NMMetaPropertyInfo *const property_infos_6LOWPAN[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_6LOWPAN_PARENT, + .is_cli_option = TRUE, + .property_alias = "dev", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("IEEE 802.15.4 (WPAN) parent device or connection UUID"), + .property_type = &_pt_gobject_string, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE #define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_802_1X static const NMMetaPropertyInfo *const property_infos_802_1X[] = { PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_EAP, @@ -6619,41 +6632,6 @@ static const NMMetaPropertyInfo *const property_infos_OLPC_MESH[] = { NULL }; -#undef _CURRENT_NM_META_SETTING_TYPE -#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PPPOE -static const NMMetaPropertyInfo *const property_infos_PPPOE[] = { - PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PARENT, - .is_cli_option = TRUE, - .property_alias = "parent", - .prompt = N_("PPPoE parent device"), - .property_type = &_pt_gobject_string, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_SERVICE, - .is_cli_option = TRUE, - .property_alias = "service", - .prompt = N_("Service [none]"), - .property_type = &_pt_gobject_string, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_USERNAME, - .is_cli_option = TRUE, - .property_alias = "username", - .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, - .prompt = N_("PPPoE username"), - .property_type = &_pt_gobject_string, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PASSWORD, - .is_cli_option = TRUE, - .property_alias = "password", - .prompt = N_("Password [none]"), - .is_secret = TRUE, - .property_type = &_pt_gobject_string, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PASSWORD_FLAGS, - .property_type = &_pt_gobject_secret_flags, - ), - NULL -}; - #undef _CURRENT_NM_META_SETTING_TYPE #define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OVS_BRIDGE static const NMMetaPropertyInfo *const property_infos_OVS_BRIDGE[] = { @@ -6792,6 +6770,41 @@ static const NMMetaPropertyInfo *const property_infos_PPP[] = { NULL }; +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PPPOE +static const NMMetaPropertyInfo *const property_infos_PPPOE[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PARENT, + .is_cli_option = TRUE, + .property_alias = "parent", + .prompt = N_("PPPoE parent device"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_SERVICE, + .is_cli_option = TRUE, + .property_alias = "service", + .prompt = N_("Service [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_USERNAME, + .is_cli_option = TRUE, + .property_alias = "username", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("PPPoE username"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PASSWORD, + .is_cli_option = TRUE, + .property_alias = "password", + .prompt = N_("Password [none]"), + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + NULL +}; + #undef _CURRENT_NM_META_SETTING_TYPE #define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PROXY static const NMMetaPropertyInfo *const property_infos_PROXY[] = { @@ -6833,6 +6846,78 @@ static const NMMetaPropertyInfo *const property_infos_PROXY[] = { NULL }; +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_SERIAL +static const NMMetaPropertyInfo *const property_infos_SERIAL[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_BAUD, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_BITS, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_PARITY, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .value_infos = ENUM_VALUE_INFOS ( + { + .value = NM_SETTING_SERIAL_PARITY_EVEN, + .nick = "E", + }, + { + .value = NM_SETTING_SERIAL_PARITY_EVEN, + .nick = "e", + }, + { + .value = NM_SETTING_SERIAL_PARITY_ODD, + .nick = "O", + }, + { + .value = NM_SETTING_SERIAL_PARITY_ODD, + .nick = "o", + }, + { + .value = NM_SETTING_SERIAL_PARITY_NONE, + .nick = "N", + }, + { + .value = NM_SETTING_SERIAL_PARITY_NONE, + .nick = "n", + } + ), + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_STOPBITS, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_SEND_DELAY, + .property_type = &_pt_gobject_int, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_SRIOV +static const NMMetaPropertyInfo *const property_infos_SRIOV[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_TOTAL_VFS, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_VFS, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_sriov_vfs, + .set_fcn = _set_fcn_sriov_vfs, + .remove_fcn = _remove_fcn_sriov_vfs, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_AUTOPROBE_DRIVERS, + .property_type = &_pt_gobject_enum, + ), + NULL +}; + #undef _CURRENT_NM_META_SETTING_TYPE #define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_TC_CONFIG static const NMMetaPropertyInfo *const property_infos_TC_CONFIG[] = { @@ -7073,78 +7158,6 @@ static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = { NULL }; -#undef _CURRENT_NM_META_SETTING_TYPE -#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_SERIAL -static const NMMetaPropertyInfo *const property_infos_SERIAL[] = { - PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_BAUD, - .property_type = &_pt_gobject_int, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_BITS, - .property_type = &_pt_gobject_int, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_PARITY, - .property_type = &_pt_gobject_enum, - .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( - PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, - .value_infos = ENUM_VALUE_INFOS ( - { - .value = NM_SETTING_SERIAL_PARITY_EVEN, - .nick = "E", - }, - { - .value = NM_SETTING_SERIAL_PARITY_EVEN, - .nick = "e", - }, - { - .value = NM_SETTING_SERIAL_PARITY_ODD, - .nick = "O", - }, - { - .value = NM_SETTING_SERIAL_PARITY_ODD, - .nick = "o", - }, - { - .value = NM_SETTING_SERIAL_PARITY_NONE, - .nick = "N", - }, - { - .value = NM_SETTING_SERIAL_PARITY_NONE, - .nick = "n", - } - ), - ), - .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT - | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, - ), - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_STOPBITS, - .property_type = &_pt_gobject_int, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_SEND_DELAY, - .property_type = &_pt_gobject_int, - ), - NULL -}; - -#undef _CURRENT_NM_META_SETTING_TYPE -#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_SRIOV -static const NMMetaPropertyInfo *const property_infos_SRIOV[] = { - PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_TOTAL_VFS, - .property_type = &_pt_gobject_int, - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_VFS, - .property_type = DEFINE_PROPERTY_TYPE ( - .get_fcn = _get_fcn_sriov_vfs, - .set_fcn = _set_fcn_sriov_vfs, - .remove_fcn = _remove_fcn_sriov_vfs, - ), - ), - PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_AUTOPROBE_DRIVERS, - .property_type = &_pt_gobject_enum, - ), - NULL -}; - #undef _CURRENT_NM_META_SETTING_TYPE #define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_TUN static const NMMetaPropertyInfo *const property_infos_TUN[] = { @@ -7851,19 +7864,6 @@ static const NMMetaPropertyInfo *const property_infos_WPAN[] = { NULL }; -#undef _CURRENT_NM_META_SETTING_TYPE -#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_6LOWPAN -static const NMMetaPropertyInfo *const property_infos_6LOWPAN[] = { - PROPERTY_INFO_WITH_DESC (NM_SETTING_6LOWPAN_PARENT, - .is_cli_option = TRUE, - .property_alias = "dev", - .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, - .prompt = N_("IEEE 802.15.4 (WPAN) parent device or connection UUID"), - .property_type = &_pt_gobject_string, - ), - NULL -}; - /*****************************************************************************/ static void