[PATCH 05/11] service: adding a function to know the connected state of an ipconfig

Tomasz Bursztyka tomasz.bursztyka at linux.intel.com
Fri Feb 3 02:39:00 PST 2012


---
 src/connman.h |    2 ++
 src/service.c |   18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/connman.h b/src/connman.h
index 48848dd..2680be9 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -524,6 +524,8 @@ struct connman_ipconfig *__connman_service_get_ip6config(
 				struct connman_service *service);
 struct connman_ipconfig *__connman_service_get_ipconfig(
 				struct connman_service *service, int family);
+connman_bool_t __connman_service_is_connected_state(struct connman_service *service,
+					enum connman_ipconfig_type type);
 const char *__connman_service_get_ident(struct connman_service *service);
 const char *__connman_service_get_path(struct connman_service *service);
 unsigned int __connman_service_get_order(struct connman_service *service);
diff --git a/src/service.c b/src/service.c
index 84834c4..04d0586 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3745,6 +3745,24 @@ __connman_service_get_ipconfig(struct connman_service *service, int family)
 
 }
 
+connman_bool_t __connman_service_is_connected_state(struct connman_service *service,
+					enum connman_ipconfig_type type)
+{
+	if (service == NULL)
+		return FALSE;
+
+	switch (type) {
+	case CONNMAN_IPCONFIG_TYPE_IPV4:
+		return is_connected_state(service, service->state_ipv4);
+	case CONNMAN_IPCONFIG_TYPE_IPV6:
+		return is_connected_state(service, service->state_ipv6);
+	case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
+	default:
+		break;
+	}
+
+	return FALSE;
+}
 enum connman_service_security __connman_service_get_security(struct connman_service *service)
 {
 	if (service == NULL)
-- 
1.7.8.4




More information about the connman mailing list