Commit fe3d586c authored by Patrik Flykt's avatar Patrik Flykt Committed by Pasi Sjöholm

ipconfig: Define unique value for CONNMAN_IPCONFIG_TYPE_ALL

Make a distinction between all and unknown ipconfig type values. As a
result Update the code to handle CONNMAN_IPCONFIG_TYPE_ALL in switch
statements.

As the unknown and all ipconfig values are now semantically different,
modify __connman_service_is_connected_state() to return the combined
state of IPv4 and IPv6 when given a value of CONNMAN_IPCONFIG_TYPE_ALL.
parent f37105bf
......@@ -36,9 +36,9 @@ extern "C" {
enum connman_ipconfig_type {
CONNMAN_IPCONFIG_TYPE_UNKNOWN = 0,
CONNMAN_IPCONFIG_TYPE_ALL = 0,
CONNMAN_IPCONFIG_TYPE_IPV4 = 1,
CONNMAN_IPCONFIG_TYPE_IPV6 = 2,
CONNMAN_IPCONFIG_TYPE_ALL = 3,
};
enum connman_ipconfig_method {
......
......@@ -128,6 +128,7 @@ const char *__connman_ipconfig_type2string(enum connman_ipconfig_type type)
{
switch (type) {
case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
case CONNMAN_IPCONFIG_TYPE_ALL:
return "unknown";
case CONNMAN_IPCONFIG_TYPE_IPV4:
return "IPv4";
......@@ -2142,6 +2143,7 @@ int __connman_ipconfig_set_config(struct connman_ipconfig *ipconfig,
type = AF_INET6;
break;
case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
case CONNMAN_IPCONFIG_TYPE_ALL:
type = -1;
break;
}
......@@ -2231,6 +2233,7 @@ int __connman_ipconfig_load(struct connman_ipconfig *ipconfig,
ipconfig->method = CONNMAN_IPCONFIG_METHOD_AUTO;
break;
case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
case CONNMAN_IPCONFIG_TYPE_ALL:
ipconfig->method = CONNMAN_IPCONFIG_METHOD_OFF;
break;
}
......
......@@ -5178,6 +5178,11 @@ bool __connman_service_is_connected_state(struct connman_service *service,
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_ALL:
return is_connected_state(service,
CONNMAN_IPCONFIG_TYPE_IPV4) &&
is_connected_state(service,
CONNMAN_IPCONFIG_TYPE_IPV6);
}
return false;
......@@ -6093,6 +6098,7 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
switch (type) {
case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
case CONNMAN_IPCONFIG_TYPE_ALL:
return -EINVAL;
case CONNMAN_IPCONFIG_TYPE_IPV4:
......
......@@ -144,6 +144,7 @@ static void free_wispr_routes(struct connman_wispr_portal_context *wp_context)
route->address);
break;
case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
case CONNMAN_IPCONFIG_TYPE_ALL:
break;
}
......@@ -496,6 +497,7 @@ static bool wispr_route_request(const char *address, int ai_family,
gateway);
break;
case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
case CONNMAN_IPCONFIG_TYPE_ALL:
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment