5 * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 static DBusConnection *connection;
35 static GSList *technology_list = NULL;
37 static connman_bool_t global_offlinemode;
39 struct connman_rfkill {
41 enum connman_service_type type;
42 connman_bool_t softblock;
43 connman_bool_t hardblock;
46 enum connman_technology_state {
47 CONNMAN_TECHNOLOGY_STATE_UNKNOWN = 0,
48 CONNMAN_TECHNOLOGY_STATE_OFFLINE = 1,
49 CONNMAN_TECHNOLOGY_STATE_ENABLED = 2,
50 CONNMAN_TECHNOLOGY_STATE_CONNECTED = 3,
53 struct connman_technology {
55 enum connman_service_type type;
56 enum connman_technology_state state;
58 GHashTable *rfkill_list;
63 connman_bool_t tethering;
64 char *tethering_ident;
65 char *tethering_passphrase;
67 connman_bool_t enable_persistent; /* Save the tech state */
69 struct connman_technology_driver *driver;
72 DBusMessage *pending_reply;
73 guint pending_timeout;
76 static GSList *driver_list = NULL;
78 static gint compare_priority(gconstpointer a, gconstpointer b)
80 const struct connman_technology_driver *driver1 = a;
81 const struct connman_technology_driver *driver2 = b;
83 return driver2->priority - driver1->priority;
87 * connman_technology_driver_register:
88 * @driver: Technology driver definition
90 * Register a new technology driver
92 * Returns: %0 on success
94 int connman_technology_driver_register(struct connman_technology_driver *driver)
97 struct connman_technology *technology;
99 DBG("driver %p name %s", driver, driver->name);
101 driver_list = g_slist_insert_sorted(driver_list, driver,
104 for (list = technology_list; list; list = list->next) {
105 technology = list->data;
107 if (technology->driver != NULL)
110 if (technology->type == driver->type)
111 technology->driver = driver;
118 * connman_technology_driver_unregister:
119 * @driver: Technology driver definition
121 * Remove a previously registered technology driver
123 void connman_technology_driver_unregister(struct connman_technology_driver *driver)
126 struct connman_technology *technology;
128 DBG("driver %p name %s", driver, driver->name);
130 for (list = technology_list; list; list = list->next) {
131 technology = list->data;
133 if (technology->driver == NULL)
136 if (technology->type == driver->type) {
137 technology->driver->remove(technology);
138 technology->driver = NULL;
142 driver_list = g_slist_remove(driver_list, driver);
145 static void tethering_changed(struct connman_technology *technology)
147 connman_bool_t tethering = technology->tethering;
149 connman_dbus_property_changed_basic(technology->path,
150 CONNMAN_TECHNOLOGY_INTERFACE, "Tethering",
151 DBUS_TYPE_BOOLEAN, &tethering);
154 void connman_technology_tethering_notify(struct connman_technology *technology,
155 connman_bool_t enabled)
159 DBG("technology %p enabled %u", technology, enabled);
161 if (technology->tethering == enabled)
164 technology->tethering = enabled;
166 tethering_changed(technology);
169 __connman_tethering_set_enabled();
171 for (list = technology_list; list; list = list->next) {
172 struct connman_technology *other_tech = list->data;
173 if (other_tech->tethering == TRUE)
177 __connman_tethering_set_disabled();
181 static int set_tethering(struct connman_technology *technology,
182 connman_bool_t enabled)
184 const char *ident, *passphrase, *bridge;
186 ident = technology->tethering_ident;
187 passphrase = technology->tethering_passphrase;
189 if (technology->driver == NULL ||
190 technology->driver->set_tethering == NULL)
193 bridge = __connman_tethering_get_bridge();
197 if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
198 (ident == NULL || passphrase == NULL))
201 return technology->driver->set_tethering(technology, ident, passphrase,
205 void connman_technology_regdom_notify(struct connman_technology *technology,
211 connman_error("Failed to set regulatory domain");
213 DBG("Regulatory domain set to %s", alpha2);
215 g_free(technology->regdom);
216 technology->regdom = g_strdup(alpha2);
219 int connman_technology_set_regdom(const char *alpha2)
223 for (list = technology_list; list; list = list->next) {
224 struct connman_technology *technology = list->data;
226 if (technology->driver == NULL)
229 if (technology->driver->set_regdom)
230 technology->driver->set_regdom(technology, alpha2);
236 static void free_rfkill(gpointer data)
238 struct connman_rfkill *rfkill = data;
243 void __connman_technology_list(DBusMessageIter *iter, void *user_data)
247 for (list = technology_list; list; list = list->next) {
248 struct connman_technology *technology = list->data;
250 if (technology->path == NULL)
253 dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
258 static void technologies_changed(void)
260 connman_dbus_property_changed_array(CONNMAN_MANAGER_PATH,
261 CONNMAN_MANAGER_INTERFACE, "Technologies",
262 DBUS_TYPE_OBJECT_PATH, __connman_technology_list, NULL);
265 static const char *state2string(enum connman_technology_state state)
268 case CONNMAN_TECHNOLOGY_STATE_UNKNOWN:
270 case CONNMAN_TECHNOLOGY_STATE_OFFLINE:
272 case CONNMAN_TECHNOLOGY_STATE_ENABLED:
274 case CONNMAN_TECHNOLOGY_STATE_CONNECTED:
281 static void state_changed(struct connman_technology *technology)
285 str = state2string(technology->state);
289 connman_dbus_property_changed_basic(technology->path,
290 CONNMAN_TECHNOLOGY_INTERFACE, "State",
291 DBUS_TYPE_STRING, &str);
294 static const char *get_name(enum connman_service_type type)
297 case CONNMAN_SERVICE_TYPE_UNKNOWN:
298 case CONNMAN_SERVICE_TYPE_SYSTEM:
299 case CONNMAN_SERVICE_TYPE_GPS:
300 case CONNMAN_SERVICE_TYPE_VPN:
301 case CONNMAN_SERVICE_TYPE_GADGET:
303 case CONNMAN_SERVICE_TYPE_ETHERNET:
305 case CONNMAN_SERVICE_TYPE_WIFI:
307 case CONNMAN_SERVICE_TYPE_WIMAX:
309 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
311 case CONNMAN_SERVICE_TYPE_CELLULAR:
318 static void load_state(struct connman_technology *technology)
322 GError *error = NULL;
323 connman_bool_t enable;
325 DBG("technology %p", technology);
327 keyfile = __connman_storage_load_global();
328 /* Fallback on disabling technology if file not found. */
329 if (keyfile == NULL) {
330 technology->enable_persistent = FALSE;
334 identifier = g_strdup_printf("%s", get_name(technology->type));
335 if (identifier == NULL)
338 enable = g_key_file_get_boolean(keyfile, identifier, "Enable", &error);
340 technology->enable_persistent = enable;
342 technology->enable_persistent = FALSE;
343 g_clear_error(&error);
348 g_key_file_free(keyfile);
353 static void save_state(struct connman_technology *technology)
358 DBG("technology %p", technology);
360 keyfile = __connman_storage_load_global();
362 keyfile = g_key_file_new();
364 identifier = g_strdup_printf("%s", get_name(technology->type));
365 if (identifier == NULL)
368 g_key_file_set_boolean(keyfile, identifier, "Enable",
369 technology->enable_persistent);
374 __connman_storage_save_global(keyfile);
376 g_key_file_free(keyfile);
381 connman_bool_t __connman_technology_get_offlinemode(void)
383 return global_offlinemode;
386 static void connman_technology_save_offlinemode()
390 keyfile = __connman_storage_load_global();
392 keyfile = g_key_file_new();
394 g_key_file_set_boolean(keyfile, "global",
395 "OfflineMode", global_offlinemode);
397 __connman_storage_save_global(keyfile);
399 g_key_file_free(keyfile);
404 static connman_bool_t connman_technology_load_offlinemode()
407 GError *error = NULL;
408 connman_bool_t offlinemode;
410 /* If there is a error, we enable offlinemode */
411 keyfile = __connman_storage_load_global();
415 offlinemode = g_key_file_get_boolean(keyfile, "global",
416 "OfflineMode", &error);
419 g_clear_error(&error);
422 g_key_file_free(keyfile);
427 static DBusMessage *get_properties(DBusConnection *conn,
428 DBusMessage *message, void *user_data)
430 struct connman_technology *technology = user_data;
432 DBusMessageIter array, dict;
435 reply = dbus_message_new_method_return(message);
439 dbus_message_iter_init_append(reply, &array);
441 connman_dbus_dict_open(&array, &dict);
443 str = state2string(technology->state);
445 connman_dbus_dict_append_basic(&dict, "State",
446 DBUS_TYPE_STRING, &str);
448 str = get_name(technology->type);
450 connman_dbus_dict_append_basic(&dict, "Name",
451 DBUS_TYPE_STRING, &str);
453 str = __connman_service_type2string(technology->type);
455 connman_dbus_dict_append_basic(&dict, "Type",
456 DBUS_TYPE_STRING, &str);
458 connman_dbus_dict_append_basic(&dict, "Tethering",
460 &technology->tethering);
462 if (technology->tethering_ident != NULL)
463 connman_dbus_dict_append_basic(&dict, "TetheringIdentifier",
465 &technology->tethering_ident);
467 if (technology->tethering_passphrase != NULL)
468 connman_dbus_dict_append_basic(&dict, "TetheringPassphrase",
470 &technology->tethering_passphrase);
472 connman_dbus_dict_close(&array, &dict);
477 static DBusMessage *set_property(DBusConnection *conn,
478 DBusMessage *msg, void *data)
480 struct connman_technology *technology = data;
481 DBusMessageIter iter, value;
485 DBG("conn %p", conn);
487 if (dbus_message_iter_init(msg, &iter) == FALSE)
488 return __connman_error_invalid_arguments(msg);
490 dbus_message_iter_get_basic(&iter, &name);
491 dbus_message_iter_next(&iter);
492 dbus_message_iter_recurse(&iter, &value);
494 type = dbus_message_iter_get_arg_type(&value);
496 DBG("property %s", name);
498 if (g_str_equal(name, "Tethering") == TRUE) {
500 connman_bool_t tethering;
502 if (type != DBUS_TYPE_BOOLEAN)
503 return __connman_error_invalid_arguments(msg);
505 dbus_message_iter_get_basic(&value, &tethering);
507 if (technology->tethering == tethering)
508 return __connman_error_in_progress(msg);
510 err = set_tethering(technology, tethering);
512 return __connman_error_failed(msg, -err);
514 } else if (g_str_equal(name, "TetheringIdentifier") == TRUE) {
517 dbus_message_iter_get_basic(&value, &str);
519 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
520 return __connman_error_not_supported(msg);
522 technology->tethering_ident = g_strdup(str);
523 } else if (g_str_equal(name, "TetheringPassphrase") == TRUE) {
526 dbus_message_iter_get_basic(&value, &str);
528 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
529 return __connman_error_not_supported(msg);
532 return __connman_error_invalid_arguments(msg);
534 technology->tethering_passphrase = g_strdup(str);
536 return __connman_error_invalid_property(msg);
538 return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
541 static GDBusMethodTable technology_methods[] = {
542 { "GetProperties", "", "a{sv}", get_properties },
543 { "SetProperty", "sv", "", set_property },
547 static GDBusSignalTable technology_signals[] = {
548 { "PropertyChanged", "sv" },
552 static struct connman_technology *technology_find(enum connman_service_type type)
556 DBG("type %d", type);
558 for (list = technology_list; list; list = list->next) {
559 struct connman_technology *technology = list->data;
561 if (technology->type == type)
568 static struct connman_technology *technology_get(enum connman_service_type type)
570 struct connman_technology *technology;
574 DBG("type %d", type);
576 technology = technology_find(type);
577 if (technology != NULL) {
578 g_atomic_int_inc(&technology->refcount);
582 str = __connman_service_type2string(type);
586 technology = g_try_new0(struct connman_technology, 1);
587 if (technology == NULL)
590 technology->refcount = 1;
592 technology->type = type;
593 technology->path = g_strdup_printf("%s/technology/%s",
596 technology->rfkill_list = g_hash_table_new_full(g_int_hash, g_int_equal,
598 technology->device_list = NULL;
600 technology->pending_reply = NULL;
601 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
603 load_state(technology);
605 if (g_dbus_register_interface(connection, technology->path,
606 CONNMAN_TECHNOLOGY_INTERFACE,
607 technology_methods, technology_signals,
608 NULL, technology, NULL) == FALSE) {
609 connman_error("Failed to register %s", technology->path);
614 technology_list = g_slist_append(technology_list, technology);
616 technologies_changed();
618 if (technology->driver != NULL)
621 for (list = driver_list; list; list = list->next) {
622 struct connman_technology_driver *driver = list->data;
624 DBG("driver %p name %s", driver, driver->name);
626 if (driver->type != technology->type)
629 if (driver->probe(technology) == 0) {
630 technology->driver = driver;
636 DBG("technology %p", technology);
641 static void technology_put(struct connman_technology *technology)
643 DBG("technology %p", technology);
645 if (g_atomic_int_dec_and_test(&technology->refcount) == FALSE)
648 if (technology->driver) {
649 technology->driver->remove(technology);
650 technology->driver = NULL;
653 technology_list = g_slist_remove(technology_list, technology);
655 technologies_changed();
657 g_dbus_unregister_interface(connection, technology->path,
658 CONNMAN_TECHNOLOGY_INTERFACE);
660 g_slist_free(technology->device_list);
661 g_hash_table_destroy(technology->rfkill_list);
663 g_free(technology->path);
664 g_free(technology->regdom);
668 void __connman_technology_add_interface(enum connman_service_type type,
669 int index, const char *name, const char *ident)
671 struct connman_technology *technology;
674 case CONNMAN_SERVICE_TYPE_UNKNOWN:
675 case CONNMAN_SERVICE_TYPE_SYSTEM:
677 case CONNMAN_SERVICE_TYPE_ETHERNET:
678 case CONNMAN_SERVICE_TYPE_WIFI:
679 case CONNMAN_SERVICE_TYPE_WIMAX:
680 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
681 case CONNMAN_SERVICE_TYPE_CELLULAR:
682 case CONNMAN_SERVICE_TYPE_GPS:
683 case CONNMAN_SERVICE_TYPE_VPN:
684 case CONNMAN_SERVICE_TYPE_GADGET:
688 connman_info("Create interface %s [ %s ]", name,
689 __connman_service_type2string(type));
691 technology = technology_get(type);
693 if (technology == NULL || technology->driver == NULL
694 || technology->driver->add_interface == NULL)
697 technology->driver->add_interface(technology,
701 void __connman_technology_remove_interface(enum connman_service_type type,
702 int index, const char *name, const char *ident)
704 struct connman_technology *technology;
707 case CONNMAN_SERVICE_TYPE_UNKNOWN:
708 case CONNMAN_SERVICE_TYPE_SYSTEM:
710 case CONNMAN_SERVICE_TYPE_ETHERNET:
711 case CONNMAN_SERVICE_TYPE_WIFI:
712 case CONNMAN_SERVICE_TYPE_WIMAX:
713 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
714 case CONNMAN_SERVICE_TYPE_CELLULAR:
715 case CONNMAN_SERVICE_TYPE_GPS:
716 case CONNMAN_SERVICE_TYPE_VPN:
717 case CONNMAN_SERVICE_TYPE_GADGET:
721 connman_info("Remove interface %s [ %s ]", name,
722 __connman_service_type2string(type));
724 technology = technology_find(type);
726 if (technology == NULL || technology->driver == NULL)
729 if (technology->driver->remove_interface)
730 technology->driver->remove_interface(technology, index);
732 technology_put(technology);
735 int __connman_technology_add_device(struct connman_device *device)
737 struct connman_technology *technology;
738 enum connman_service_type type;
740 DBG("device %p", device);
742 type = __connman_device_get_service_type(device);
743 __connman_notifier_register(type);
745 technology = technology_get(type);
746 if (technology == NULL)
749 if (technology->enable_persistent && !global_offlinemode)
750 __connman_device_enable(device);
751 /* if technology persistent state is offline */
752 if (!technology->enable_persistent)
753 __connman_device_disable(device);
755 technology->device_list = g_slist_append(technology->device_list,
761 int __connman_technology_remove_device(struct connman_device *device)
763 struct connman_technology *technology;
764 enum connman_service_type type;
766 DBG("device %p", device);
768 type = __connman_device_get_service_type(device);
769 __connman_notifier_unregister(type);
771 technology = technology_find(type);
772 if (technology == NULL)
775 technology->device_list = g_slist_remove(technology->device_list,
777 if (technology->device_list == NULL) {
778 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
779 state_changed(technology);
785 static gboolean technology_pending_reply(gpointer user_data)
787 struct connman_technology *technology = user_data;
790 /* Power request timedout, send ETIMEDOUT. */
791 if (technology->pending_reply != NULL) {
792 reply = __connman_error_failed(technology->pending_reply, ETIMEDOUT);
794 g_dbus_send_message(connection, reply);
796 dbus_message_unref(technology->pending_reply);
797 technology->pending_reply = NULL;
798 technology->pending_timeout = 0;
804 int __connman_technology_enabled(enum connman_service_type type)
806 struct connman_technology *technology;
808 technology = technology_find(type);
809 if (technology == NULL)
812 if (g_atomic_int_exchange_and_add(&technology->enabled, 1) == 0) {
813 __connman_notifier_enable(type);
814 technology->state = CONNMAN_TECHNOLOGY_STATE_ENABLED;
815 state_changed(technology);
818 if (technology->pending_reply != NULL) {
819 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
820 dbus_message_unref(technology->pending_reply);
821 technology->pending_reply = NULL;
822 technology->pending_timeout = 0;
828 int __connman_technology_enable(enum connman_service_type type, DBusMessage *msg)
830 struct connman_technology *technology;
836 DBG("type %d enable", type);
838 technology = technology_find(type);
839 if (technology == NULL) {
844 if (technology->pending_reply != NULL) {
850 technology->pending_reply = dbus_message_ref(msg);
852 * This is a bit of a trick. When msg is not NULL it means
853 * thats technology_enable was invoked from the manager API. Hence we save
856 technology->enable_persistent = TRUE;
857 save_state(technology);
860 __connman_rfkill_block(technology->type, FALSE);
862 for (list = technology->device_list; list; list = list->next) {
863 struct connman_device *device = list->data;
865 err = __connman_device_enable(device);
867 * err = 0 : Device was enabled right away.
868 * If atleast one device gets enabled, we consider
869 * the technology to be enabled.
880 if (err == -EINPROGRESS)
881 technology->pending_timeout = g_timeout_add_seconds(10,
882 technology_pending_reply, technology);
884 reply = __connman_error_failed(msg, -err);
886 g_dbus_send_message(connection, reply);
893 int __connman_technology_disabled(enum connman_service_type type)
895 struct connman_technology *technology;
897 technology = technology_find(type);
898 if (technology == NULL)
901 if (technology->pending_reply != NULL) {
902 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
903 dbus_message_unref(technology->pending_reply);
904 technology->pending_reply = NULL;
907 if (g_atomic_int_dec_and_test(&technology->enabled) == TRUE) {
908 __connman_notifier_disable(type);
909 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
910 state_changed(technology);
916 int __connman_technology_disable(enum connman_service_type type, DBusMessage *msg)
918 struct connman_technology *technology;
924 DBG("type %d disable", type);
926 technology = technology_find(type);
927 if (technology == NULL) {
932 if (technology->pending_reply != NULL) {
937 if (technology->tethering == TRUE)
938 set_tethering(technology, FALSE);
941 technology->pending_reply = dbus_message_ref(msg);
942 technology->enable_persistent = FALSE;
943 save_state(technology);
946 __connman_rfkill_block(technology->type, TRUE);
948 for (list = technology->device_list; list; list = list->next) {
949 struct connman_device *device = list->data;
951 err = __connman_device_disable(device);
961 if (err == -EINPROGRESS)
962 technology->pending_timeout = g_timeout_add_seconds(10,
963 technology_pending_reply, technology);
965 reply = __connman_error_failed(msg, -err);
967 g_dbus_send_message(connection, reply);
974 int __connman_technology_set_offlinemode(connman_bool_t offlinemode)
979 if (global_offlinemode == offlinemode)
982 DBG("offlinemode %s", offlinemode ? "On" : "Off");
985 * This is a bit tricky. When you set offlinemode, there is no
986 * way to differentiate between attempting offline mode and
987 * resuming offlinemode from last saved profile. We need that
988 * information in rfkill_update, otherwise it falls back on the
989 * technology's persistent state. Hence we set the offline mode here
990 * but save it & call the notifier only if its successful.
993 global_offlinemode = offlinemode;
995 /* Traverse technology list, enable/disable each technology. */
996 for (list = technology_list; list; list = list->next) {
997 struct connman_technology *technology = list->data;
1000 err = __connman_technology_disable(technology->type, NULL);
1002 if (!offlinemode && technology->enable_persistent)
1003 err = __connman_technology_enable(technology->type, NULL);
1006 if (err == 0 || err == -EINPROGRESS || err == -EALREADY) {
1007 connman_technology_save_offlinemode();
1008 __connman_notifier_offlinemode(offlinemode);
1010 global_offlinemode = connman_technology_load_offlinemode();
1015 int __connman_technology_add_rfkill(unsigned int index,
1016 enum connman_service_type type,
1017 connman_bool_t softblock,
1018 connman_bool_t hardblock)
1020 struct connman_technology *technology;
1021 struct connman_rfkill *rfkill;
1023 DBG("index %u type %d soft %u hard %u", index, type,
1024 softblock, hardblock);
1026 technology = technology_get(type);
1027 if (technology == NULL)
1030 rfkill = g_try_new0(struct connman_rfkill, 1);
1034 rfkill->index = index;
1035 rfkill->type = type;
1036 rfkill->softblock = softblock;
1037 rfkill->hardblock = hardblock;
1039 g_hash_table_replace(technology->rfkill_list, &rfkill->index, rfkill);
1042 DBG("%s is switched off.", get_name(type));
1047 * If Offline mode is on, we softblock the device if it isnt already.
1048 * If Offline mode is off, we rely on the persistent state of tech.
1050 if (global_offlinemode) {
1052 return __connman_rfkill_block(type, TRUE);
1054 if (technology->enable_persistent && softblock)
1055 return __connman_rfkill_block(type, FALSE);
1056 /* if technology persistent state is offline */
1057 if (!technology->enable_persistent && !softblock)
1058 return __connman_rfkill_block(type, TRUE);
1064 int __connman_technology_update_rfkill(unsigned int index,
1065 enum connman_service_type type,
1066 connman_bool_t softblock,
1067 connman_bool_t hardblock)
1069 struct connman_technology *technology;
1070 struct connman_rfkill *rfkill;
1072 DBG("index %u soft %u hard %u", index, softblock, hardblock);
1074 technology = technology_find(type);
1075 if (technology == NULL)
1078 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
1082 if (rfkill->softblock == softblock &&
1083 rfkill->hardblock == hardblock)
1086 rfkill->softblock = softblock;
1087 rfkill->hardblock = hardblock;
1090 DBG("%s is switched off.", get_name(type));
1094 if (!global_offlinemode) {
1095 if (technology->enable_persistent && softblock)
1096 return __connman_rfkill_block(type, FALSE);
1097 if (!technology->enable_persistent && !softblock)
1098 return __connman_rfkill_block(type, TRUE);
1104 int __connman_technology_remove_rfkill(unsigned int index,
1105 enum connman_service_type type)
1107 struct connman_technology *technology;
1108 struct connman_rfkill *rfkill;
1110 DBG("index %u", index);
1112 technology = technology_find(type);
1113 if (technology == NULL)
1116 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
1120 g_hash_table_remove(technology->rfkill_list, &index);
1122 technology_put(technology);
1127 int __connman_technology_init(void)
1131 connection = connman_dbus_get_connection();
1133 global_offlinemode = connman_technology_load_offlinemode();
1138 void __connman_technology_cleanup(void)
1142 dbus_connection_unref(connection);