static int tech_set_tethering(struct connman_technology *technology, const char *identifier, const char *passphrase, const char *bridge, connman_bool_t enabled) { DBG("bridge %s enabled %d", bridge, enabled); if (enabled) enable_tethering(technology, bridge); else disable_tethering(technology, bridge); return 0; }
static int technology_enabled(struct connman_technology *technology) { DBG(""); __sync_synchronize(); if (technology->enabled == TRUE) return -EALREADY; technology->enabled = TRUE; if (technology->tethering_persistent == TRUE) enable_tethering(technology); powered_changed(technology); return 0; }
void __connman_technology_add_interface(enum connman_service_type type, int index, const char *name, const char *ident) { struct connman_technology *technology; GSList *tech_drivers; struct connman_technology_driver *driver; 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_BLUETOOTH: case CONNMAN_SERVICE_TYPE_CELLULAR: case CONNMAN_SERVICE_TYPE_GPS: case CONNMAN_SERVICE_TYPE_VPN: case CONNMAN_SERVICE_TYPE_GADGET: break; } connman_info("Adding interface %s [ %s ]", name, __connman_service_type2string(type)); technology = technology_find(type); if (technology == NULL) return; for (tech_drivers = technology->driver_list; tech_drivers != NULL; tech_drivers = g_slist_next(tech_drivers)) { driver = tech_drivers->data; if(driver->add_interface != NULL) driver->add_interface(technology, index, name, ident); } /* * At this point we can try to enable tethering automatically as * now the interfaces are set properly. */ if (technology->tethering_persistent == TRUE) enable_tethering(technology); }
int __connman_technology_enabled(enum connman_service_type type) { struct connman_technology *technology; technology = technology_find(type); if (technology == NULL) return -ENXIO; DBG("technology %p type %s rfkill %d enabled %d", technology, get_name(type), technology->rfkill_driven, technology->enabled); if (technology->rfkill_driven == TRUE) { if (technology->tethering_persistent == TRUE) enable_tethering(technology); return 0; } return technology_enabled(technology); }