Add new error code to support VPN.
---
 include/provider.h |    9 +++++++--
 include/service.h  |    2 ++
 src/provider.c     |   24 ++++++++++++++++++++++++
 src/service.c      |    4 ++++
 4 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/include/provider.h b/include/provider.h
index b46033f..03700aa 100644
--- a/include/provider.h
+++ b/include/provider.h
@@ -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);
 
diff --git a/include/service.h b/include/service.h
index dd857e2..faa6cf8 100644
--- a/include/service.h
+++ b/include/service.h
@@ -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 {
diff --git a/src/provider.c b/src/provider.c
index e6bcb3d..6bd2df5 100644
--- a/src/provider.c
+++ b/src/provider.c
@@ -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;
diff --git a/src/service.c b/src/service.c
index 6417d10..fa2d3e4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -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;
-- 
1.7.3.4

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to