diff options
author | Benjamin Berg <bberg@redhat.com> | 2018-10-10 17:23:42 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-01-27 23:45:11 +0100 |
commit | 42e60e327f92b7469fa1584682c09771017990fb (patch) | |
tree | a209e93e797be446cd002646e9e760ca896c031a | |
parent | c7d6e55ed7ebbed23f620c76329a773a38511a9d (diff) | |
download | NetworkManager-42e60e327f92b7469fa1584682c09771017990fb.tar.gz |
core: Add basic P2P Wi-Fi Settings
The support is rather basic and only allows connecting to a specific
peer. However, this is actually already enough for many usecases.
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | clients/cli/connections.c | 1 | ||||
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 28 | ||||
-rw-r--r-- | clients/common/settings-docs.h.in | 2 | ||||
-rw-r--r-- | docs/libnm/libnm-docs.xml | 1 | ||||
-rw-r--r-- | libnm-core/meson.build | 2 | ||||
-rw-r--r-- | libnm-core/nm-core-enum-types.c.template | 1 | ||||
-rw-r--r-- | libnm-core/nm-core-internal.h | 1 | ||||
-rw-r--r-- | libnm-core/nm-core-types.h | 1 | ||||
-rw-r--r-- | libnm-core/nm-setting-p2p-wireless.c | 281 | ||||
-rw-r--r-- | libnm-core/nm-setting-p2p-wireless.h | 74 | ||||
-rw-r--r-- | libnm/NetworkManager.h | 1 | ||||
-rw-r--r-- | libnm/libnm.ver | 4 | ||||
-rw-r--r-- | libnm/nm-autoptr.h | 1 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | shared/nm-meta-setting.c | 7 | ||||
-rw-r--r-- | shared/nm-meta-setting.h | 1 | ||||
-rw-r--r-- | vapi/NM-1.0.metadata | 1 |
18 files changed, 410 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index c8a5ed0617..f7f189b56c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -643,6 +643,7 @@ 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 \ @@ -711,6 +712,7 @@ 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 \ diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 446424ba46..8155bfb960 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -796,6 +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_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 4befce259a..6b76d80be3 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -7843,6 +7843,27 @@ 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 @@ -8008,6 +8029,7 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN) #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 }) @@ -8282,6 +8304,12 @@ 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), + ), + ), }; /*****************************************************************************/ diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in index ca0150e694..7f1a59d5fa 100644 --- a/clients/common/settings-docs.h.in +++ b/clients/common/settings-docs.h.in @@ -263,6 +263,8 @@ #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.") diff --git a/docs/libnm/libnm-docs.xml b/docs/libnm/libnm-docs.xml index eb4f6cf585..df5d9bab31 100644 --- a/docs/libnm/libnm-docs.xml +++ b/docs/libnm/libnm-docs.xml @@ -218,6 +218,7 @@ print ("NetworkManager version " + client.get_version())]]></programlisting></in <xi:include href="xml/nm-setting-ovs-interface.xml"/> <xi:include href="xml/nm-setting-ovs-patch.xml"/> <xi:include href="xml/nm-setting-ovs-port.xml"/> + <xi:include href="xml/nm-setting-p2p-wireless.xml"/> <xi:include href="xml/nm-setting-pppoe.xml"/> <xi:include href="xml/nm-setting-ppp.xml"/> <xi:include href="xml/nm-setting-proxy.xml"/> diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 812f12bbcc..e615b3451e 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -32,6 +32,7 @@ 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', @@ -87,6 +88,7 @@ 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', diff --git a/libnm-core/nm-core-enum-types.c.template b/libnm-core/nm-core-enum-types.c.template index 605fa34ae4..0edb97dcc7 100644 --- a/libnm-core/nm-core-enum-types.c.template +++ b/libnm-core/nm-core-enum-types.c.template @@ -33,6 +33,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-ppp.h" #include "nm-setting-pppoe.h" #include "nm-setting-proxy.h" diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index 6af293a013..f73d728b7d 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -63,6 +63,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-ppp.h" #include "nm-setting-pppoe.h" #include "nm-setting-serial.h" diff --git a/libnm-core/nm-core-types.h b/libnm-core/nm-core-types.h index 89d99579e5..823001324e 100644 --- a/libnm-core/nm-core-types.h +++ b/libnm-core/nm-core-types.h @@ -57,6 +57,7 @@ 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 _NMSettingSerial NMSettingSerial; diff --git a/libnm-core/nm-setting-p2p-wireless.c b/libnm-core/nm-setting-p2p-wireless.c new file mode 100644 index 0000000000..e49ff0d995 --- /dev/null +++ b/libnm-core/nm-setting-p2p-wireless.c @@ -0,0 +1,281 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright 2019 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-setting-p2p-wireless.h" + +#include <string.h> +#include <net/ethernet.h> + +#include "nm-utils.h" +#include "nm-common-macros.h" +#include "nm-utils-private.h" +#include "nm-setting-private.h" + +/** + * SECTION:nm-setting-p2p-wireless + * @short_description: Describes connection properties for 802.11 Wi-Fi P2P networks + * + * The #NMSettingP2PWireless object is a #NMSetting subclass that describes properties + * necessary for connection to 802.11 Wi-Fi P2P networks (aka Wi-Fi Direct). + **/ + +/** + * NMSettingP2PWireless: + * + * P2P Wi-Fi Settings + */ + +/*****************************************************************************/ + +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( + PROP_PEER, + PROP_WPS_METHOD, +#if 0 + PROP_WPS_PIN, + PROP_WPS_PIN_FLAGS, +#endif +); + +typedef struct { + char *peer_mac_address; + + NMSettingWirelessSecurityWpsMethod wps_method; +} NMSettingP2PWirelessPrivate; + +struct _NMSettingP2PWireless { + NMSetting parent; + NMSettingP2PWirelessPrivate _priv; +}; + +struct _NMSettingP2PWirelessClass { + NMSettingClass parent; +}; + +G_DEFINE_TYPE (NMSettingP2PWireless, nm_setting_p2p_wireless, NM_TYPE_SETTING) + +#define NM_SETTING_P2P_WIRELESS_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSettingP2PWireless, NM_IS_SETTING_P2P_WIRELESS, NMSetting) + +/*****************************************************************************/ + +/** + * nm_setting_p2p_wireless_get_peer: + * @setting: the #NMSettingP2PWireless + * + * Returns: the #NMSettingP2PWireless:peer property of the setting + * + * Since: 1.16 + **/ +const char * +nm_setting_p2p_wireless_get_peer (NMSettingP2PWireless *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_P2P_WIRELESS (setting), NULL); + + return NM_SETTING_P2P_WIRELESS_GET_PRIVATE (setting)->peer_mac_address; +} + +/** + * nm_setting_p2p_wireless_get_wps_method: + * @setting: the #NMSettingP2PWireless + * + * Returns: the #NMSettingP2PWireless:wps-method property of the setting + * + * Since: 1.16 + **/ +NMSettingWirelessSecurityWpsMethod +nm_setting_p2p_wireless_get_wps_method (NMSettingP2PWireless *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_P2P_WIRELESS (setting), NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT); + + 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)) { + g_set_error_literal (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); + 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")); + 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; +} + +/*****************************************************************************/ + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NMSettingP2PWireless *setting = NM_SETTING_P2P_WIRELESS (object); + + switch (prop_id) { + case PROP_PEER: + g_value_set_string (value, nm_setting_p2p_wireless_get_peer (setting)); + break; + case PROP_WPS_METHOD: + g_value_set_uint (value, nm_setting_p2p_wireless_get_wps_method (setting)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + NMSettingP2PWirelessPrivate *priv = NM_SETTING_P2P_WIRELESS_GET_PRIVATE (object); + + switch (prop_id) { + case PROP_PEER: + g_free (priv->peer_mac_address); + priv->peer_mac_address = _nm_utils_hwaddr_canonical_or_invalid (g_value_get_string (value), + ETH_ALEN); + break; + case PROP_WPS_METHOD: + priv->wps_method = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +/*****************************************************************************/ + +static void +nm_setting_p2p_wireless_init (NMSettingP2PWireless *setting) +{ +} + +/** + * nm_setting_p2p_wireless_new: + * + * Creates a new #NMSettingP2PWireless object with default values. + * + * Returns: (transfer full): the new empty #NMSettingP2PWireless object + * + * Since: 1.16 + **/ +NMSetting * +nm_setting_p2p_wireless_new (void) +{ + return (NMSetting *) g_object_new (NM_TYPE_SETTING_P2P_WIRELESS, NULL); +} + +static void +finalize (GObject *object) +{ + NMSettingP2PWirelessPrivate *priv = NM_SETTING_P2P_WIRELESS_GET_PRIVATE (object); + + g_free (priv->peer_mac_address); + + G_OBJECT_CLASS (nm_setting_p2p_wireless_parent_class)->finalize (object); +} + +static void +nm_setting_p2p_wireless_class_init (NMSettingP2PWirelessClass *setting_p2p_wireless_class) +{ + 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->finalize = finalize; + + setting_class->verify = verify; + + /** + * NMSettingP2PWireless:peer: + * + * The P2P device that should be connected to. Currently this is the only + * way to create or join a group. + * + * Since: 1.16 + */ + /* ---keyfile--- + * property: peer + * format: usual hex-digits-and-colons notation + * description: MAC address in traditional hex-digits-and-colons notation + * (e.g. 00:22:68:12:79:A2), or semicolon separated list of 6 bytes (obsolete) + * (e.g. 0;34;104;18;121;162). + * ---end--- + */ + obj_properties[PROP_PEER] = + g_param_spec_string (NM_SETTING_P2P_WIRELESS_PEER, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + /** + * NMSettingP2PWireless:wps-method: + * + * 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. + * + * Since: 1.16 + */ + obj_properties[PROP_WPS_METHOD] = + g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, "", "", + 0, + G_MAXUINT32, + NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); + + _nm_setting_class_commit (setting_class, NM_META_SETTING_TYPE_P2P_WIRELESS); +} diff --git a/libnm-core/nm-setting-p2p-wireless.h b/libnm-core/nm-setting-p2p-wireless.h new file mode 100644 index 0000000000..4880867198 --- /dev/null +++ b/libnm-core/nm-setting-p2p-wireless.h @@ -0,0 +1,74 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright 2019 Red Hat, Inc. + */ + +#ifndef __NM_SETTING_P2P_WIRELESS_H__ +#define __NM_SETTING_P2P_WIRELESS_H__ + +#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION) +#error "Only <NetworkManager.h> can be included directly." +#endif + +#include "nm-setting.h" +#include "nm-setting-wireless-security.h" + +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_SETTING_P2P_WIRELESS_SETTING_NAME "p2p-wireless" + +/** + * NM_SETTING_P2P_WIRELESS_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" +#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; + +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); + +NM_AVAILABLE_IN_1_16 +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); + +G_END_DECLS + +#endif /* __NM_SETTING_P2P_WIRELESS_H__ */ diff --git a/libnm/NetworkManager.h b/libnm/NetworkManager.h index 759a413187..30ec7905a2 100644 --- a/libnm/NetworkManager.h +++ b/libnm/NetworkManager.h @@ -88,6 +88,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-ppp.h" #include "nm-setting-pppoe.h" #include "nm-setting-proxy.h" diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 652e01eb68..b30e47af7d 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1450,6 +1450,10 @@ global: nm_client_add_and_activate_connection2; nm_client_add_and_activate_connection2_finish; nm_device_get_connectivity; + 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_team_link_watcher_get_vlanid; nm_team_link_watcher_new_arp_ping2; } libnm_1_14_0; diff --git a/libnm/nm-autoptr.h b/libnm/nm-autoptr.h index e96a03a099..bffacd39cd 100644 --- a/libnm/nm-autoptr.h +++ b/libnm/nm-autoptr.h @@ -64,6 +64,7 @@ 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) diff --git a/po/POTFILES.in b/po/POTFILES.in index 33192b1dd0..6700d5be82 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -82,6 +82,7 @@ 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 diff --git a/shared/nm-meta-setting.c b/shared/nm-meta-setting.c index 3e79747fba..6256b06c00 100644 --- a/shared/nm-meta-setting.c +++ b/shared/nm-meta-setting.c @@ -50,6 +50,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-ppp.h" #include "nm-setting-pppoe.h" #include "nm-setting-proxy.h" @@ -305,6 +306,12 @@ 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, diff --git a/shared/nm-meta-setting.h b/shared/nm-meta-setting.h index 26c29beaa7..089acc8e9c 100644 --- a/shared/nm-meta-setting.h +++ b/shared/nm-meta-setting.h @@ -132,6 +132,7 @@ 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, diff --git a/vapi/NM-1.0.metadata b/vapi/NM-1.0.metadata index ab43f3e174..98fd071e2d 100644 --- a/vapi/NM-1.0.metadata +++ b/vapi/NM-1.0.metadata @@ -28,6 +28,7 @@ SETTING_IP6_CONFIG_* parent="NM.SettingIP6Config" name="SETTIN 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_PROXY_* parent="NM.SettingProxy" name="SETTING_PROXY_(.+)" |