const char *
nm_setting_pppoe_get_password (NMSettingPPPOE *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_PPPOE (setting), NULL);

	return NM_SETTING_PPPOE_GET_PRIVATE (setting)->password;
}
const char *
nm_setting_pppoe_get_username (NMSettingPPPOE *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_PPPOE (setting), NULL);

	return NM_SETTING_PPPOE_GET_PRIVATE (setting)->username;
}
static gboolean
verify (NMSetting *setting, GSList *all_settings, GError **error)
{
	NMSettingPPPOEPrivate *priv = NM_SETTING_PPPOE_GET_PRIVATE (setting);

	if (!priv->username) {
		g_set_error (error,
		             NM_SETTING_PPPOE_ERROR,
		             NM_SETTING_PPPOE_ERROR_MISSING_PROPERTY,
		             NM_SETTING_PPPOE_USERNAME);
		return FALSE;
	} else if (!strlen (priv->username)) {
		g_set_error (error,
		             NM_SETTING_PPPOE_ERROR,
		             NM_SETTING_PPPOE_ERROR_INVALID_PROPERTY,
		             NM_SETTING_PPPOE_USERNAME);
		return FALSE;
	}

	if (priv->service && !strlen (priv->service)) {
		g_set_error (error,
		             NM_SETTING_PPPOE_ERROR,
		             NM_SETTING_PPPOE_ERROR_INVALID_PROPERTY,
		             NM_SETTING_PPPOE_SERVICE);
		return FALSE;
	}

	return TRUE;
}
static void
set_property (GObject *object, guint prop_id,
		    const GValue *value, GParamSpec *pspec)
{
	NMSettingPPPOEPrivate *priv = NM_SETTING_PPPOE_GET_PRIVATE (object);

	switch (prop_id) {
	case PROP_SERVICE:
		g_free (priv->service);
		priv->service = g_value_dup_string (value);
		break;
	case PROP_USERNAME:
		g_free (priv->username);
		priv->username = g_value_dup_string (value);
		break;
	case PROP_PASSWORD:
		g_free (priv->password);
		priv->password = g_value_dup_string (value);
		break;
	case PROP_PASSWORD_FLAGS:
		priv->password_flags = g_value_get_uint (value);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
/**
 * nm_setting_pppoe_get_password_flags:
 * @setting: the #NMSettingPPPOE
 *
 * Returns: the #NMSettingSecretFlags pertaining to the #NMSettingPPPOE:password
 **/
NMSettingSecretFlags
nm_setting_pppoe_get_password_flags (NMSettingPPPOE *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_PPPOE (setting), NM_SETTING_SECRET_FLAG_NONE);

	return NM_SETTING_PPPOE_GET_PRIVATE (setting)->password_flags;
}
static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
	NMSettingPppoePrivate *priv = NM_SETTING_PPPOE_GET_PRIVATE (setting);

	if (!priv->username) {
		g_set_error_literal (error,
		                     NM_CONNECTION_ERROR,
		                     NM_CONNECTION_ERROR_MISSING_PROPERTY,
		                     _("property is missing"));
		g_prefix_error (error, "%s.%s: ", NM_SETTING_PPPOE_SETTING_NAME, NM_SETTING_PPPOE_USERNAME);
		return FALSE;
	} else if (!strlen (priv->username)) {
		g_set_error_literal (error,
		                     NM_CONNECTION_ERROR,
		                     NM_CONNECTION_ERROR_INVALID_PROPERTY,
		                     _("property is empty"));
		g_prefix_error (error, "%s.%s: ", NM_SETTING_PPPOE_SETTING_NAME, NM_SETTING_PPPOE_USERNAME);
		return FALSE;
	}

	if (priv->service && !strlen (priv->service)) {
		g_set_error_literal (error,
		                     NM_CONNECTION_ERROR,
		                     NM_CONNECTION_ERROR_INVALID_PROPERTY,
		                     _("property is empty"));
		g_prefix_error (error, "%s.%s: ", NM_SETTING_PPPOE_SETTING_NAME, NM_SETTING_PPPOE_SERVICE);
		return FALSE;
	}

	return TRUE;
}
static void
finalize (GObject *object)
{
	NMSettingPppoePrivate *priv = NM_SETTING_PPPOE_GET_PRIVATE (object);

	g_free (priv->username);
	g_free (priv->password);
	g_free (priv->service);

	G_OBJECT_CLASS (nm_setting_pppoe_parent_class)->finalize (object);
}
static GPtrArray *
need_secrets (NMSetting *setting)
{
	NMSettingPPPOEPrivate *priv = NM_SETTING_PPPOE_GET_PRIVATE (setting);
	GPtrArray *secrets;

	if (priv->password)
		return NULL;

	secrets = g_ptr_array_sized_new (1);
	g_ptr_array_add (secrets, NM_SETTING_PPPOE_PASSWORD);

	return secrets;
}
static GPtrArray *
need_secrets (NMSetting *setting)
{
	NMSettingPPPOEPrivate *priv = NM_SETTING_PPPOE_GET_PRIVATE (setting);
	GPtrArray *secrets = NULL;

	if (priv->password)
		return NULL;

	if (!(priv->password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)) {
		secrets = g_ptr_array_sized_new (1);
		g_ptr_array_add (secrets, NM_SETTING_PPPOE_PASSWORD);
	}

	return secrets;
}