service: adding a function to know the connected state of an ipconfig
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Wed, 15 Feb 2012 08:19:42 +0000 (10:19 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 28 Feb 2012 11:16:43 +0000 (13:16 +0200)
src/connman.h
src/service.c

index 2cb78c8..8609614 100644 (file)
@@ -537,6 +537,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);
index a21ee3f..210f021 100644 (file)
@@ -3795,6 +3795,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)