From: Mohamed Abbas Date: Fri, 28 Jan 2011 04:55:33 +0000 (-0800) Subject: provider: Report VPN error code X-Git-Tag: 0.68~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=864c2f1123c8db196c7a9225ba3f5f4851ef8678;p=platform%2Fupstream%2Fconnman.git provider: Report VPN error code --- diff --git a/include/provider.h b/include/provider.h index b46033fd..03700aa1 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 dd857e20..faa6cf8d 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 e6bcb3df..6bd2df52 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 6417d10d..fa2d3e4d 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;