From: Guillaume Lucas Date: Fri, 4 Feb 2011 08:04:05 +0000 (+0000) Subject: technology: trigger technology creation by new interface X-Git-Tag: 0.69~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=483fb555c74ad7ee754c0292a9ecefff28e54cf8;p=platform%2Fupstream%2Fconnman.git technology: trigger technology creation by new interface --- diff --git a/src/technology.c b/src/technology.c index 7d89b2e..5ef3d10 100644 --- a/src/technology.c +++ b/src/technology.c @@ -139,81 +139,6 @@ void connman_technology_driver_unregister(struct connman_technology_driver *driv driver_list = g_slist_remove(driver_list, driver); } -void __connman_technology_add_interface(enum connman_service_type type, - int index, const char *name, const char *ident) -{ - GSList *list; - - switch (type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - case CONNMAN_SERVICE_TYPE_SYSTEM: - return; - case CONNMAN_SERVICE_TYPE_ETHERNET: - case CONNMAN_SERVICE_TYPE_WIFI: - case CONNMAN_SERVICE_TYPE_WIMAX: - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - case CONNMAN_SERVICE_TYPE_CELLULAR: - case CONNMAN_SERVICE_TYPE_GPS: - case CONNMAN_SERVICE_TYPE_VPN: - case CONNMAN_SERVICE_TYPE_GADGET: - break; - } - - connman_info("Create interface %s [ %s ]", name, - __connman_service_type2string(type)); - - for (list = technology_list; list; list = list->next) { - struct connman_technology *technology = list->data; - - if (technology->type != type) - continue; - - if (technology->driver == NULL) - continue; - - if (technology->driver->add_interface) - technology->driver->add_interface(technology, - index, name, ident); - } -} - -void __connman_technology_remove_interface(enum connman_service_type type, - int index, const char *name, const char *ident) -{ - GSList *list; - - switch (type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - case CONNMAN_SERVICE_TYPE_SYSTEM: - return; - case CONNMAN_SERVICE_TYPE_ETHERNET: - case CONNMAN_SERVICE_TYPE_WIFI: - case CONNMAN_SERVICE_TYPE_WIMAX: - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - case CONNMAN_SERVICE_TYPE_CELLULAR: - case CONNMAN_SERVICE_TYPE_GPS: - case CONNMAN_SERVICE_TYPE_VPN: - case CONNMAN_SERVICE_TYPE_GADGET: - break; - } - - connman_info("Remove interface %s [ %s ]", name, - __connman_service_type2string(type)); - - for (list = technology_list; list; list = list->next) { - struct connman_technology *technology = list->data; - - if (technology->type != type) - continue; - - if (technology->driver == NULL) - continue; - - if (technology->driver->remove_interface) - technology->driver->remove_interface(technology, index); - } -} - static void tethering_changed(struct connman_technology *technology) { connman_bool_t tethering = technology->tethering; @@ -619,6 +544,85 @@ static void technology_put(struct connman_technology *technology) g_free(technology); } +void __connman_technology_add_interface(enum connman_service_type type, + int index, const char *name, const char *ident) +{ + GSList *list; + + switch (type) { + case CONNMAN_SERVICE_TYPE_UNKNOWN: + case CONNMAN_SERVICE_TYPE_SYSTEM: + return; + case CONNMAN_SERVICE_TYPE_ETHERNET: + case CONNMAN_SERVICE_TYPE_WIFI: + case CONNMAN_SERVICE_TYPE_WIMAX: + case CONNMAN_SERVICE_TYPE_BLUETOOTH: + case CONNMAN_SERVICE_TYPE_CELLULAR: + case CONNMAN_SERVICE_TYPE_GPS: + case CONNMAN_SERVICE_TYPE_VPN: + case CONNMAN_SERVICE_TYPE_GADGET: + break; + } + + connman_info("Create interface %s [ %s ]", name, + __connman_service_type2string(type)); + + technology_get(type); + + for (list = technology_list; list; list = list->next) { + struct connman_technology *technology = list->data; + + if (technology->type != type) + continue; + + if (technology->driver == NULL) + continue; + + if (technology->driver->add_interface) + technology->driver->add_interface(technology, + index, name, ident); + } +} + +void __connman_technology_remove_interface(enum connman_service_type type, + int index, const char *name, const char *ident) +{ + GSList *list; + + switch (type) { + case CONNMAN_SERVICE_TYPE_UNKNOWN: + case CONNMAN_SERVICE_TYPE_SYSTEM: + return; + case CONNMAN_SERVICE_TYPE_ETHERNET: + case CONNMAN_SERVICE_TYPE_WIFI: + case CONNMAN_SERVICE_TYPE_WIMAX: + case CONNMAN_SERVICE_TYPE_BLUETOOTH: + case CONNMAN_SERVICE_TYPE_CELLULAR: + case CONNMAN_SERVICE_TYPE_GPS: + case CONNMAN_SERVICE_TYPE_VPN: + case CONNMAN_SERVICE_TYPE_GADGET: + break; + } + + connman_info("Remove interface %s [ %s ]", name, + __connman_service_type2string(type)); + + for (list = technology_list; list; list = list->next) { + struct connman_technology *technology = list->data; + + if (technology->type != type) + continue; + + if (technology->driver == NULL) + continue; + + if (technology->driver->remove_interface) + technology->driver->remove_interface(technology, index); + + technology_put(technology); + } +} + static void unregister_technology(gpointer data) { struct connman_technology *technology = data;