From 3f85bd180b7afbee747273fba194f89ee792d2c6 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 29 Nov 2009 20:33:09 +0100 Subject: [PATCH] Add network type for cable/carrier detection --- include/network.h | 5 +++-- src/network.c | 6 ++++++ src/service.c | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/network.h b/include/network.h index 2378d30..c95d4c6 100644 --- a/include/network.h +++ b/include/network.h @@ -37,8 +37,9 @@ extern "C" { enum connman_network_type { CONNMAN_NETWORK_TYPE_UNKNOWN = 0, - CONNMAN_NETWORK_TYPE_WIFI = 1, - CONNMAN_NETWORK_TYPE_WIMAX = 2, + CONNMAN_NETWORK_TYPE_CABLE = 1, + CONNMAN_NETWORK_TYPE_WIFI = 2, + CONNMAN_NETWORK_TYPE_WIMAX = 3, CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8, CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9, CONNMAN_NETWORK_TYPE_CELLULAR = 10, diff --git a/src/network.c b/src/network.c index 727cfa3..c885122 100644 --- a/src/network.c +++ b/src/network.c @@ -75,6 +75,8 @@ static const char *type2string(enum connman_network_type type) case CONNMAN_NETWORK_TYPE_UNKNOWN: case CONNMAN_NETWORK_TYPE_VENDOR: break; + case CONNMAN_NETWORK_TYPE_CABLE: + return "cable"; case CONNMAN_NETWORK_TYPE_WIFI: return "wifi"; case CONNMAN_NETWORK_TYPE_WIMAX: @@ -552,6 +554,7 @@ void connman_network_set_group(struct connman_network *network, switch (network->type) { case CONNMAN_NETWORK_TYPE_UNKNOWN: + case CONNMAN_NETWORK_TYPE_CABLE: case CONNMAN_NETWORK_TYPE_VENDOR: return; case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: @@ -609,6 +612,7 @@ connman_bool_t __connman_network_get_weakness(struct connman_network *network) switch (network->type) { case CONNMAN_NETWORK_TYPE_UNKNOWN: case CONNMAN_NETWORK_TYPE_VENDOR: + case CONNMAN_NETWORK_TYPE_CABLE: case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: case CONNMAN_NETWORK_TYPE_CELLULAR: @@ -1336,6 +1340,7 @@ static int network_probe(struct connman_element *element) case CONNMAN_NETWORK_TYPE_UNKNOWN: case CONNMAN_NETWORK_TYPE_VENDOR: break; + case CONNMAN_NETWORK_TYPE_CABLE: case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: case CONNMAN_NETWORK_TYPE_CELLULAR: @@ -1367,6 +1372,7 @@ static void network_remove(struct connman_element *element) case CONNMAN_NETWORK_TYPE_UNKNOWN: case CONNMAN_NETWORK_TYPE_VENDOR: break; + case CONNMAN_NETWORK_TYPE_CABLE: case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: case CONNMAN_NETWORK_TYPE_CELLULAR: diff --git a/src/service.c b/src/service.c index a3a6cf3..3175471 100644 --- a/src/service.c +++ b/src/service.c @@ -1595,6 +1595,7 @@ static connman_bool_t prepare_network(struct connman_service *service) connman_network_set_string(service->network, "WiFi.Passphrase", service->passphrase); break; + case CONNMAN_NETWORK_TYPE_CABLE: case CONNMAN_NETWORK_TYPE_WIMAX: case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: @@ -2207,6 +2208,8 @@ static enum connman_service_type convert_network_type(struct connman_network *ne case CONNMAN_NETWORK_TYPE_UNKNOWN: case CONNMAN_NETWORK_TYPE_VENDOR: break; + case CONNMAN_NETWORK_TYPE_CABLE: + return CONNMAN_SERVICE_TYPE_ETHERNET; case CONNMAN_NETWORK_TYPE_WIFI: return CONNMAN_SERVICE_TYPE_WIFI; case CONNMAN_NETWORK_TYPE_WIMAX: -- 2.7.4