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

Tomasz Bursztyka tomasz.bursztyka at linux.intel.com
Wed Feb 15 00:19:42 PST 2012


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

diff --git a/src/connman.h b/src/connman.h
index dcde0f3..2bf43a5 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -531,6 +531,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 b0acd5f..f1def69 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3715,6 +3715,23 @@ __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_UNKNOWN:
+		break;
+	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);
+	}
+
+	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