summaryrefslogtreecommitdiff
path: root/libnm/nm-device-team.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm/nm-device-team.c')
-rw-r--r--libnm/nm-device-team.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libnm/nm-device-team.c b/libnm/nm-device-team.c
index b855d5ec38..059f13e59b 100644
--- a/libnm/nm-device-team.c
+++ b/libnm/nm-device-team.c
@@ -39,6 +39,7 @@ typedef struct {
char *hw_address;
gboolean carrier;
GPtrArray *slaves;
+ char *config;
} NMDeviceTeamPrivate;
enum {
@@ -46,6 +47,7 @@ enum {
PROP_HW_ADDRESS,
PROP_CARRIER,
PROP_SLAVES,
+ PROP_CONFIG,
LAST_PROP
};
@@ -101,6 +103,25 @@ nm_device_team_get_slaves (NMDeviceTeam *device)
return NM_DEVICE_TEAM_GET_PRIVATE (device)->slaves;
}
+/**
+ * nm_device_team_get_config:
+ * @device: a #NMDeviceTeam
+ *
+ * Gets the current JSON configuration of the #NMDeviceTeam
+ *
+ * Returns: the current configuration. This is the internal string used by the
+ * device, and must not be modified.
+ *
+ * Since: 1.4
+ **/
+const char *
+nm_device_team_get_config (NMDeviceTeam *device)
+{
+ g_return_val_if_fail (NM_IS_DEVICE_TEAM (device), NULL);
+
+ return NM_DEVICE_TEAM_GET_PRIVATE (device)->config;
+}
+
static const char *
get_hw_address (NMDevice *device)
{
@@ -150,6 +171,7 @@ init_dbus (NMObject *object)
{ NM_DEVICE_TEAM_HW_ADDRESS, &priv->hw_address },
{ NM_DEVICE_TEAM_CARRIER, &priv->carrier },
{ NM_DEVICE_TEAM_SLAVES, &priv->slaves, NULL, NM_TYPE_DEVICE },
+ { NM_DEVICE_TEAM_CONFIG, &priv->config },
{ NULL },
};
@@ -198,6 +220,9 @@ get_property (GObject *object,
case PROP_SLAVES:
g_value_take_boxed (value, _nm_utils_copy_object_array (nm_device_team_get_slaves (device)));
break;
+ case PROP_CONFIG:
+ g_value_set_string (value, nm_device_team_get_config (device));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -265,4 +290,18 @@ nm_device_team_class_init (NMDeviceTeamClass *team_class)
G_TYPE_PTR_ARRAY,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMDeviceTeam:config:
+ *
+ * The current JSON configuration of the device.
+ *
+ * Since: 1.4
+ **/
+ g_object_class_install_property
+ (object_class, PROP_CONFIG,
+ g_param_spec_string (NM_DEVICE_TEAM_CONFIG, "", "",
+ NULL,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
}