From: Patrik Flykt Date: Fri, 2 Dec 2011 14:18:33 +0000 (+0200) Subject: service: Factor out passphrase setting functionality X-Git-Tag: 2.0_alpha~854 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4db70ebb8d6b4bda8ad46ce230d12296b14bc6dd;p=framework%2Fconnectivity%2Fconnman.git service: Factor out passphrase setting functionality Factor out passphrase setting functionality, as it will be needed by other parts of the hidden network code. --- diff --git a/src/connman.h b/src/connman.h index 0d8ef1e..4745c22 100644 --- a/src/connman.h +++ b/src/connman.h @@ -82,6 +82,8 @@ void __connman_counter_cleanup(void); struct connman_service; +void __connman_service_add_passphrase(struct connman_service *service, + const gchar *passphrase); typedef void (* authentication_cb_t) (struct connman_service *service, connman_bool_t values_received, const char *name, int name_len, diff --git a/src/service.c b/src/service.c index 464c681..299844e 100644 --- a/src/service.c +++ b/src/service.c @@ -3955,6 +3955,29 @@ static void report_error_cb(struct connman_service *service, } } +void __connman_service_add_passphrase(struct connman_service *service, + const gchar *passphrase) +{ + switch (service->security) { + case CONNMAN_SERVICE_SECURITY_WEP: + case CONNMAN_SERVICE_SECURITY_PSK: + __connman_service_set_passphrase(service, passphrase); + break; + case CONNMAN_SERVICE_SECURITY_8021X: + __connman_service_set_agent_passphrase(service, + passphrase); + break; + case CONNMAN_SERVICE_SECURITY_UNKNOWN: + case CONNMAN_SERVICE_SECURITY_NONE: + case CONNMAN_SERVICE_SECURITY_WPA: + case CONNMAN_SERVICE_SECURITY_RSN: + DBG("service security '%s' not handled", + security2string(service->security)); + break; + } + +} + static void request_input_cb (struct connman_service *service, connman_bool_t values_received, const char *name, int name_len, @@ -3973,25 +3996,8 @@ static void request_input_cb (struct connman_service *service, if (identity != NULL) __connman_service_set_agent_identity(service, identity); - if (passphrase != NULL) { - switch (service->security) { - case CONNMAN_SERVICE_SECURITY_WEP: - case CONNMAN_SERVICE_SECURITY_PSK: - __connman_service_set_passphrase(service, passphrase); - break; - case CONNMAN_SERVICE_SECURITY_8021X: - __connman_service_set_agent_passphrase(service, - passphrase); - break; - case CONNMAN_SERVICE_SECURITY_UNKNOWN: - case CONNMAN_SERVICE_SECURITY_NONE: - case CONNMAN_SERVICE_SECURITY_WPA: - case CONNMAN_SERVICE_SECURITY_RSN: - DBG("service security '%s' not handled", - security2string(service->security)); - break; - } - } + if (passphrase != NULL) + __connman_service_add_passphrase(service, passphrase); __connman_service_connect(service);