summaryrefslogtreecommitdiff
path: root/libnm-util/nm-setting-ppp.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2008-06-12 23:58:08 +0000
committerDan Williams <dcbw@redhat.com>2008-06-12 23:58:08 +0000
commit05e9de940206346e88f388aa6a7b7d785f58ffc4 (patch)
tree110817a4be122033efb1a33235f067048d4fad0f /libnm-util/nm-setting-ppp.c
parent99ef1936012d6696c3901fe0101ac0dedb2e69b0 (diff)
downloadNetworkManager-05e9de940206346e88f388aa6a7b7d785f58ffc4.tar.gz
2008-06-12 Dan Williams <dcbw@redhat.com>
Add a GError argument to nm_connection_verify() and nm_setting_verify(), and add error enums to each NMSetting subclass. Each NMSetting subclass now returns a descriptive GError when verification fails. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3751 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Diffstat (limited to 'libnm-util/nm-setting-ppp.c')
-rw-r--r--libnm-util/nm-setting-ppp.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/libnm-util/nm-setting-ppp.c b/libnm-util/nm-setting-ppp.c
index 706540a5cd..1bf7f50583 100644
--- a/libnm-util/nm-setting-ppp.c
+++ b/libnm-util/nm-setting-ppp.c
@@ -2,6 +2,42 @@
#include "nm-setting-ppp.h"
+GQuark
+nm_setting_ppp_error_quark (void)
+{
+ static GQuark quark;
+
+ if (G_UNLIKELY (!quark))
+ quark = g_quark_from_static_string ("nm-setting-ppp-error-quark");
+ return quark;
+}
+
+/* This should really be standard. */
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+
+GType
+nm_setting_ppp_error_get_type (void)
+{
+ static GType etype = 0;
+
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ /* Unknown error. */
+ ENUM_ENTRY (NM_SETTING_PPP_ERROR_UNKNOWN, "UnknownError"),
+ /* The specified property was invalid. */
+ ENUM_ENTRY (NM_SETTING_PPP_ERROR_INVALID_PROPERTY, "InvalidProperty"),
+ /* The specified property was missing and is required. */
+ ENUM_ENTRY (NM_SETTING_PPP_ERROR_MISSING_PROPERTY, "MissingProperty"),
+ /* The 'require-mppe' option is not allowed in conjunction with 'noauth'. */
+ ENUM_ENTRY (NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED, "RequireMPPENotAllowed"),
+ { 0, 0, 0 }
+ };
+ etype = g_enum_register_static ("NMSettingPPPError", values);
+ }
+ return etype;
+}
+
+
G_DEFINE_TYPE (NMSettingPPP, nm_setting_ppp, NM_TYPE_SETTING)
enum {
@@ -35,13 +71,16 @@ nm_setting_ppp_new (void)
}
static gboolean
-verify (NMSetting *setting, GSList *all_settings)
+verify (NMSetting *setting, GSList *all_settings, GError **error)
{
NMSettingPPP *self = NM_SETTING_PPP (setting);
if (self->noauth) {
if (self->require_mppe) {
- g_warning ("Option 'noauth' incompatible with 'require-mppe'");
+ g_set_error (error,
+ NM_SETTING_PPP_ERROR,
+ NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED,
+ NM_SETTING_PPP_REQUIRE_MPPE);
return FALSE;
}
}