summary refs log tree commit diff
path: root/libnm-core/nm-setting-connection.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-01-20 16:26:51 +0100
committerMichael Biebl <biebl@debian.org>2016-01-20 16:26:51 +0100
commit494f296a3baab08522617b24b1f126d8f9a17502 (patch)
treec8ef32fb0dd1c4ff35a0b38e787abb58692de0cd /libnm-core/nm-setting-connection.c
parent54f6333410ffd570e62717d9e77c5c987175e397 (diff)
Imported Upstream version 1.1.90 upstream/1.1.90
Diffstat (limited to 'libnm-core/nm-setting-connection.c')
-rw-r--r--libnm-core/nm-setting-connection.c77
1 files changed, 72 insertions, 5 deletions
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c
index 28e590df..f341a398 100644
--- a/libnm-core/nm-setting-connection.c
+++ b/libnm-core/nm-setting-connection.c
@@ -23,7 +23,6 @@
 #include "config.h"
 
 #include <string.h>
-#include <glib/gi18n-lib.h>
 
 #include "nm-utils.h"
 #include "nm-utils-private.h"
@@ -34,6 +33,7 @@
 #include "nm-setting-bridge.h"
 #include "nm-setting-team.h"
 #include "nm-setting-vlan.h"
+#include "nm-macros-internal.h"
 
 /**
  * SECTION:nm-setting-connection
@@ -77,6 +77,7 @@ typedef struct {
 	GSList *secondaries; /* secondary connections to activate with the base connection */
 	guint gateway_ping_timeout;
 	NMMetered metered;
+	NMSettingConnectionLldp lldp;
 } NMSettingConnectionPrivate;
 
 enum {
@@ -97,6 +98,7 @@ enum {
 	PROP_SECONDARIES,
 	PROP_GATEWAY_PING_TIMEOUT,
 	PROP_METERED,
+	PROP_LLDP,
 
 	LAST_PROP
 };
@@ -616,7 +618,7 @@ nm_setting_connection_is_slave_type (NMSettingConnection *setting,
  * Returns: whether slaves of the connection should be activated together
  *          with the connection.
  *
- * Since: 1.0.4
+ * Since: 1.2
  **/
 NMSettingConnectionAutoconnectSlaves
 nm_setting_connection_get_autoconnect_slaves (NMSettingConnection *setting)
@@ -625,6 +627,9 @@ nm_setting_connection_get_autoconnect_slaves (NMSettingConnection *setting)
 
 	return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->autoconnect_slaves;
 }
+NM_BACKPORT_SYMBOL (libnm_1_0_4, NMSettingConnectionAutoconnectSlaves, nm_setting_connection_get_autoconnect_slaves, (NMSettingConnection *setting), (setting));
+
+NM_BACKPORT_SYMBOL (libnm_1_0_4, GType, nm_setting_connection_autoconnect_slaves_get_type, (void), ());
 
 /**
  * nm_setting_connection_get_num_secondaries:
@@ -768,7 +773,7 @@ nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting)
  *
  * Returns: the #NMSettingConnection:metered property of the setting.
  *
- * Since: 1.0.6
+ * Since: 1.2
  **/
 NMMetered
 nm_setting_connection_get_metered (NMSettingConnection *setting)
@@ -779,6 +784,29 @@ nm_setting_connection_get_metered (NMSettingConnection *setting)
 	return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->metered;
 }
 
+NM_BACKPORT_SYMBOL (libnm_1_0_6, NMMetered, nm_setting_connection_get_metered, (NMSettingConnection *setting), (setting));
+
+NM_BACKPORT_SYMBOL (libnm_1_0_6, GType, nm_metered_get_type, (void), ());
+
+/**
+ * nm_setting_connection_get_lldp:
+ * @setting: the #NMSettingConnection
+ *
+ * Returns the #NMSettingConnection:lldp property of the connection.
+ *
+ * Returns: a %NMSettingConnectionLldp which indicates whether LLDP must be
+ * enabled for the connection.
+ *
+ * Since: 1.2
+ **/
+NMSettingConnectionLldp
+nm_setting_connection_get_lldp (NMSettingConnection *setting)
+{
+	g_return_val_if_fail (NM_IS_SETTING_CONNECTION (setting), NM_SETTING_CONNECTION_LLDP_DEFAULT);
+
+	return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->lldp;
+}
+
 static void
 _set_error_missing_base_setting (GError **error, const char *type)
 {
@@ -1188,6 +1216,9 @@ set_property (GObject *object, guint prop_id,
 	case PROP_METERED:
 		priv->metered = g_value_get_enum (value);
 		break;
+	case PROP_LLDP:
+		priv->lldp = g_value_get_int (value);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -1264,6 +1295,9 @@ get_property (GObject *object, guint prop_id,
 	case PROP_METERED:
 		g_value_set_enum (value, priv->metered);
 		break;
+	case PROP_LLDP:
+		g_value_set_int (value, priv->lldp);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -1525,6 +1559,9 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
 	 * (for example "Home", "Work", "Public").  %NULL or unspecified zone means
 	 * the connection will be placed in the default zone as defined by the
 	 * firewall.
+	 *
+	 * When updating this property on a currently activated connection,
+	 * the change takes effect immediately.
 	 **/
 	/* ---ifcfg-rh---
 	 * property: zone
@@ -1541,6 +1578,7 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
 		                      G_PARAM_READWRITE |
 		                      G_PARAM_CONSTRUCT |
 		                      NM_SETTING_PARAM_FUZZY_IGNORE |
+		                      NM_SETTING_PARAM_REAPPLY_IMMEDIATELY |
 		                      G_PARAM_STATIC_STRINGS));
 
 	/**
@@ -1599,7 +1637,7 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
 	 * If -1 (default) is set, global connection.autoconnect-slaves is read to
 	 * determine the real value. If it is default as well, this fallbacks to 0.
 	 *
-	 * Since: 1.0.4
+	 * Since: 1.2
 	 **/
 	/* ---ifcfg-rh---
 	 * property: autoconnect-slaves
@@ -1669,7 +1707,10 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
 	 *
 	 * Whether the connection is metered.
 	 *
-	 * Since: 1.0.6
+	 * When updating this property on a currently activated connection,
+	 * the change takes effect immediately.
+	 *
+	 * Since: 1.2
 	 **/
 	/* ---ifcfg-rh---
 	 * property: metered
@@ -1685,5 +1726,31 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
 		                    NM_TYPE_METERED,
 		                    NM_METERED_UNKNOWN,
 		                    G_PARAM_READWRITE |
+		                    NM_SETTING_PARAM_REAPPLY_IMMEDIATELY |
 		                    G_PARAM_STATIC_STRINGS));
+
+	/**
+	 * NMSettingConnection:lldp:
+	 *
+	 * Whether LLDP is enabled for the connection.
+	 *
+	 * Since: 1.2
+	 **/
+	/* ---ifcfg-rh---
+	 * property: lldp
+	 * variable: LLDP
+	 * values: boolean value or 'rx'
+	 * default: missing variable means global default
+	 * description: whether LLDP is enabled for the connection
+	 * example: LLDP=no
+	 * ---end---
+	 */
+	g_object_class_install_property
+		(object_class, PROP_LLDP,
+		 g_param_spec_int (NM_SETTING_CONNECTION_LLDP, "", "",
+		                   G_MININT32, G_MAXINT32, NM_SETTING_CONNECTION_LLDP_DEFAULT,
+		                   NM_SETTING_PARAM_FUZZY_IGNORE |
+		                   G_PARAM_READWRITE |
+		                   G_PARAM_CONSTRUCT |
+		                   G_PARAM_STATIC_STRINGS));
 }