provider: Report VPN error code
authorMohamed Abbas <mabbas@linux.intel.com>
Fri, 28 Jan 2011 04:55:33 +0000 (20:55 -0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 28 Jan 2011 11:33:09 +0000 (12:33 +0100)
include/provider.h
include/service.h
src/provider.c
src/service.c

index b46033fda2293a7ab53ae043411e07f51115b6e8..03700aa159d069e54594ab5d1467ab404a3a716c 100644 (file)
@@ -49,8 +49,10 @@ enum connman_provider_state {
 };
 
 enum connman_provider_error {
-       CONNMAN_PROVIDER_ERROR_UNKNOWN        = 0,
-       CONNMAN_PROVIDER_ERROR_CONNECT_FAILED = 1,
+       CONNMAN_PROVIDER_ERROR_UNKNOWN          = 0,
+       CONNMAN_PROVIDER_ERROR_CONNECT_FAILED   = 1,
+       CONNMAN_PROVIDER_ERROR_LOGIN_FAILED     = 2,
+       CONNMAN_PROVIDER_ERROR_AUTH_FAILED      = 3,
 };
 
 struct connman_provider;
@@ -66,6 +68,9 @@ const char *connman_provider_get_string(struct connman_provider *provider,
 int connman_provider_set_state(struct connman_provider *provider,
                                        enum connman_provider_state state);
 
+int connman_provider_indicate_error(struct connman_provider *provider,
+                                       enum connman_provider_error error);
+
 void connman_provider_set_index(struct connman_provider *provider, int index);
 int connman_provider_get_index(struct connman_provider *provider);
 
index dd857e201fa93644c14cbfc7c582030bd53c8519..faa6cf8d71ecc35741d3db53bca58fb1f99e0499 100644 (file)
@@ -83,6 +83,8 @@ enum connman_service_error {
        CONNMAN_SERVICE_ERROR_PIN_MISSING    = 2,
        CONNMAN_SERVICE_ERROR_DHCP_FAILED    = 3,
        CONNMAN_SERVICE_ERROR_CONNECT_FAILED = 4,
+       CONNMAN_SERVICE_ERROR_LOGIN_FAILED  = 5,
+       CONNMAN_SERVICE_ERROR_AUTH_FAILED    = 6,
 };
 
 enum connman_service_proxy_method {
index e6bcb3df72a165d9ce857d3e79f88abeb7213483..6bd2df5259c757de2f7871093a01613aea1fa492 100644 (file)
@@ -393,6 +393,30 @@ int connman_provider_set_state(struct connman_provider *provider,
        return -EINVAL;
 }
 
+int connman_provider_indicate_error(struct connman_provider *provider,
+                                       enum connman_provider_error error)
+{
+       enum connman_service_error service_error;
+
+       switch (error) {
+       case CONNMAN_PROVIDER_ERROR_LOGIN_FAILED:
+               service_error = CONNMAN_SERVICE_ERROR_LOGIN_FAILED;
+               break;
+       case CONNMAN_PROVIDER_ERROR_AUTH_FAILED:
+               service_error = CONNMAN_SERVICE_ERROR_AUTH_FAILED;
+               break;
+       case CONNMAN_PROVIDER_ERROR_CONNECT_FAILED:
+               service_error = CONNMAN_SERVICE_ERROR_CONNECT_FAILED;
+               break;
+       default:
+               service_error = CONNMAN_SERVICE_ERROR_UNKNOWN;
+               break;
+       }
+
+       return __connman_service_indicate_error(provider->vpn_service,
+                                                       service_error);
+}
+
 static void unregister_provider(gpointer data)
 {
        struct connman_provider *provider = data;
index 6417d10d866c57186e7202f16bfff24efcf18065..fa2d3e4db7655275659debb2f09fdc41a897c731 100644 (file)
@@ -261,6 +261,10 @@ static const char *error2string(enum connman_service_error error)
                return "dhcp-failed";
        case CONNMAN_SERVICE_ERROR_CONNECT_FAILED:
                return "connect-failed";
+       case CONNMAN_SERVICE_ERROR_LOGIN_FAILED:
+               return "login-failed";
+       case CONNMAN_SERVICE_ERROR_AUTH_FAILED:
+               return "auth-failed";
        }
 
        return NULL;