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)
157 DBG("technology %p enabled %u", technology, enabled);
159 if (technology->tethering == enabled)
162 technology->tethering = enabled;
164 tethering_changed(technology);
167 __connman_tethering_set_enabled();
169 __connman_tethering_set_disabled();
172 static int set_tethering(struct connman_technology *technology,
173 const char *bridge, connman_bool_t enabled)
175 const char *ident, *passphrase;
177 ident = technology->tethering_ident;
178 passphrase = technology->tethering_passphrase;
180 if (technology->driver == NULL ||
181 technology->driver->set_tethering == NULL)
184 if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
185 (ident == NULL || passphrase == NULL))
188 return technology->driver->set_tethering(technology, ident, passphrase,
192 void connman_technology_regdom_notify(struct connman_technology *technology,
198 connman_error("Failed to set regulatory domain");
200 DBG("Regulatory domain set to %s", alpha2);
202 g_free(technology->regdom);
203 technology->regdom = g_strdup(alpha2);
206 int connman_technology_set_regdom(const char *alpha2)
210 for (list = technology_list; list; list = list->next) {
211 struct connman_technology *technology = list->data;
213 if (technology->driver == NULL)
216 if (technology->driver->set_regdom)
217 technology->driver->set_regdom(technology, alpha2);
223 static void free_rfkill(gpointer data)
225 struct connman_rfkill *rfkill = data;
230 void __connman_technology_list(DBusMessageIter *iter, void *user_data)
234 for (list = technology_list; list; list = list->next) {
235 struct connman_technology *technology = list->data;
237 if (technology->path == NULL)
240 dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
245 static void technologies_changed(void)
247 connman_dbus_property_changed_array(CONNMAN_MANAGER_PATH,
248 CONNMAN_MANAGER_INTERFACE, "Technologies",
249 DBUS_TYPE_OBJECT_PATH, __connman_technology_list, NULL);
252 static const char *state2string(enum connman_technology_state state)
255 case CONNMAN_TECHNOLOGY_STATE_UNKNOWN:
257 case CONNMAN_TECHNOLOGY_STATE_OFFLINE:
259 case CONNMAN_TECHNOLOGY_STATE_ENABLED:
261 case CONNMAN_TECHNOLOGY_STATE_CONNECTED:
268 static void state_changed(struct connman_technology *technology)
272 str = state2string(technology->state);
276 connman_dbus_property_changed_basic(technology->path,
277 CONNMAN_TECHNOLOGY_INTERFACE, "State",
278 DBUS_TYPE_STRING, &str);
281 static const char *get_name(enum connman_service_type type)
284 case CONNMAN_SERVICE_TYPE_UNKNOWN:
285 case CONNMAN_SERVICE_TYPE_SYSTEM:
286 case CONNMAN_SERVICE_TYPE_GPS:
287 case CONNMAN_SERVICE_TYPE_VPN:
288 case CONNMAN_SERVICE_TYPE_GADGET:
290 case CONNMAN_SERVICE_TYPE_ETHERNET:
292 case CONNMAN_SERVICE_TYPE_WIFI:
294 case CONNMAN_SERVICE_TYPE_WIMAX:
296 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
298 case CONNMAN_SERVICE_TYPE_CELLULAR:
305 static void load_state(struct connman_technology *technology)
309 GError *error = NULL;
310 connman_bool_t enable;
312 DBG("technology %p", technology);
314 keyfile = __connman_storage_load_global();
315 /* Fallback on disabling technology if file not found. */
316 if (keyfile == NULL) {
317 technology->enable_persistent = FALSE;
321 identifier = g_strdup_printf("%s", get_name(technology->type));
322 if (identifier == NULL)
325 enable = g_key_file_get_boolean(keyfile, identifier, "Enable", &error);
327 technology->enable_persistent = enable;
329 technology->enable_persistent = FALSE;
330 g_clear_error(&error);
335 g_key_file_free(keyfile);
340 static void save_state(struct connman_technology *technology)
345 DBG("technology %p", technology);
347 keyfile = __connman_storage_load_global();
349 keyfile = g_key_file_new();
351 identifier = g_strdup_printf("%s", get_name(technology->type));
352 if (identifier == NULL)
355 g_key_file_set_boolean(keyfile, identifier, "Enable",
356 technology->enable_persistent);
361 __connman_storage_save_global(keyfile);
363 g_key_file_free(keyfile);
368 connman_bool_t __connman_technology_get_offlinemode(void)
370 return global_offlinemode;
373 static void connman_technology_save_offlinemode()
377 keyfile = __connman_storage_load_global();
379 keyfile = g_key_file_new();
381 g_key_file_set_boolean(keyfile, "global",
382 "OfflineMode", global_offlinemode);
384 __connman_storage_save_global(keyfile);
386 g_key_file_free(keyfile);
391 static connman_bool_t connman_technology_load_offlinemode()
394 GError *error = NULL;
395 connman_bool_t offlinemode;
397 /* If there is a error, we enable offlinemode */
398 keyfile = __connman_storage_load_global();
402 offlinemode = g_key_file_get_boolean(keyfile, "global",
403 "OfflineMode", &error);
406 g_clear_error(&error);
409 g_key_file_free(keyfile);
414 static DBusMessage *get_properties(DBusConnection *conn,
415 DBusMessage *message, void *user_data)
417 struct connman_technology *technology = user_data;
419 DBusMessageIter array, dict;
422 reply = dbus_message_new_method_return(message);
426 dbus_message_iter_init_append(reply, &array);
428 connman_dbus_dict_open(&array, &dict);
430 str = state2string(technology->state);
432 connman_dbus_dict_append_basic(&dict, "State",
433 DBUS_TYPE_STRING, &str);
435 str = get_name(technology->type);
437 connman_dbus_dict_append_basic(&dict, "Name",
438 DBUS_TYPE_STRING, &str);
440 str = __connman_service_type2string(technology->type);
442 connman_dbus_dict_append_basic(&dict, "Type",
443 DBUS_TYPE_STRING, &str);
445 connman_dbus_dict_append_basic(&dict, "Tethering",
447 &technology->tethering);
449 if (technology->tethering_ident != NULL)
450 connman_dbus_dict_append_basic(&dict, "TetheringIdentifier",
452 &technology->tethering_ident);
454 if (technology->tethering_passphrase != NULL)
455 connman_dbus_dict_append_basic(&dict, "TetheringPassphrase",
457 &technology->tethering_passphrase);
459 connman_dbus_dict_close(&array, &dict);
464 static DBusMessage *set_property(DBusConnection *conn,
465 DBusMessage *msg, void *data)
467 struct connman_technology *technology = data;
468 DBusMessageIter iter, value;
472 DBG("conn %p", conn);
474 if (dbus_message_iter_init(msg, &iter) == FALSE)
475 return __connman_error_invalid_arguments(msg);
477 dbus_message_iter_get_basic(&iter, &name);
478 dbus_message_iter_next(&iter);
479 dbus_message_iter_recurse(&iter, &value);
481 type = dbus_message_iter_get_arg_type(&value);
483 DBG("property %s", name);
485 if (g_str_equal(name, "Tethering") == TRUE) {
487 connman_bool_t tethering;
490 if (type != DBUS_TYPE_BOOLEAN)
491 return __connman_error_invalid_arguments(msg);
493 dbus_message_iter_get_basic(&value, &tethering);
495 if (technology->tethering == tethering)
496 return __connman_error_in_progress(msg);
498 bridge = __connman_tethering_get_bridge();
500 return __connman_error_not_supported(msg);
502 err = set_tethering(technology, bridge, tethering);
504 return __connman_error_failed(msg, -err);
506 } else if (g_str_equal(name, "TetheringIdentifier") == TRUE) {
509 dbus_message_iter_get_basic(&value, &str);
511 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
512 return __connman_error_not_supported(msg);
514 technology->tethering_ident = g_strdup(str);
515 } else if (g_str_equal(name, "TetheringPassphrase") == TRUE) {
518 dbus_message_iter_get_basic(&value, &str);
520 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
521 return __connman_error_not_supported(msg);
524 return __connman_error_invalid_arguments(msg);
526 technology->tethering_passphrase = g_strdup(str);
528 return __connman_error_invalid_property(msg);
530 return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
533 static GDBusMethodTable technology_methods[] = {
534 { "GetProperties", "", "a{sv}", get_properties },
535 { "SetProperty", "sv", "", set_property },
539 static GDBusSignalTable technology_signals[] = {
540 { "PropertyChanged", "sv" },
544 static struct connman_technology *technology_find(enum connman_service_type type)
548 DBG("type %d", type);
550 for (list = technology_list; list; list = list->next) {
551 struct connman_technology *technology = list->data;
553 if (technology->type == type)
560 static struct connman_technology *technology_get(enum connman_service_type type)
562 struct connman_technology *technology;
566 DBG("type %d", type);
568 technology = technology_find(type);
569 if (technology != NULL) {
570 g_atomic_int_inc(&technology->refcount);
574 str = __connman_service_type2string(type);
578 technology = g_try_new0(struct connman_technology, 1);
579 if (technology == NULL)
582 technology->refcount = 1;
584 technology->type = type;
585 technology->path = g_strdup_printf("%s/technology/%s",
588 technology->rfkill_list = g_hash_table_new_full(g_int_hash, g_int_equal,
590 technology->device_list = NULL;
592 technology->pending_reply = NULL;
593 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
595 load_state(technology);
597 if (g_dbus_register_interface(connection, technology->path,
598 CONNMAN_TECHNOLOGY_INTERFACE,
599 technology_methods, technology_signals,
600 NULL, technology, NULL) == FALSE) {
601 connman_error("Failed to register %s", technology->path);
606 technology_list = g_slist_append(technology_list, technology);
608 technologies_changed();
610 if (technology->driver != NULL)
613 for (list = driver_list; list; list = list->next) {
614 struct connman_technology_driver *driver = list->data;
616 DBG("driver %p name %s", driver, driver->name);
618 if (driver->type != technology->type)
621 if (driver->probe(technology) == 0) {
622 technology->driver = driver;
628 DBG("technology %p", technology);
633 static void technology_put(struct connman_technology *technology)
635 DBG("technology %p", technology);
637 if (g_atomic_int_dec_and_test(&technology->refcount) == FALSE)
640 if (technology->driver) {
641 technology->driver->remove(technology);
642 technology->driver = NULL;
645 technology_list = g_slist_remove(technology_list, technology);
647 technologies_changed();
649 g_dbus_unregister_interface(connection, technology->path,
650 CONNMAN_TECHNOLOGY_INTERFACE);
652 g_slist_free(technology->device_list);
653 g_hash_table_destroy(technology->rfkill_list);
655 g_free(technology->path);
656 g_free(technology->regdom);
660 void __connman_technology_add_interface(enum connman_service_type type,
661 int index, const char *name, const char *ident)
663 struct connman_technology *technology;
666 case CONNMAN_SERVICE_TYPE_UNKNOWN:
667 case CONNMAN_SERVICE_TYPE_SYSTEM:
669 case CONNMAN_SERVICE_TYPE_ETHERNET:
670 case CONNMAN_SERVICE_TYPE_WIFI:
671 case CONNMAN_SERVICE_TYPE_WIMAX:
672 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
673 case CONNMAN_SERVICE_TYPE_CELLULAR:
674 case CONNMAN_SERVICE_TYPE_GPS:
675 case CONNMAN_SERVICE_TYPE_VPN:
676 case CONNMAN_SERVICE_TYPE_GADGET:
680 connman_info("Create interface %s [ %s ]", name,
681 __connman_service_type2string(type));
683 technology = technology_get(type);
685 if (technology == NULL || technology->driver == NULL
686 || technology->driver->add_interface == NULL)
689 technology->driver->add_interface(technology,
693 void __connman_technology_remove_interface(enum connman_service_type type,
694 int index, const char *name, const char *ident)
696 struct connman_technology *technology;
699 case CONNMAN_SERVICE_TYPE_UNKNOWN:
700 case CONNMAN_SERVICE_TYPE_SYSTEM:
702 case CONNMAN_SERVICE_TYPE_ETHERNET:
703 case CONNMAN_SERVICE_TYPE_WIFI:
704 case CONNMAN_SERVICE_TYPE_WIMAX:
705 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
706 case CONNMAN_SERVICE_TYPE_CELLULAR:
707 case CONNMAN_SERVICE_TYPE_GPS:
708 case CONNMAN_SERVICE_TYPE_VPN:
709 case CONNMAN_SERVICE_TYPE_GADGET:
713 connman_info("Remove interface %s [ %s ]", name,
714 __connman_service_type2string(type));
716 technology = technology_find(type);
718 if (technology == NULL || technology->driver == NULL)
721 if (technology->driver->remove_interface)
722 technology->driver->remove_interface(technology, index);
724 technology_put(technology);
727 int __connman_technology_add_device(struct connman_device *device)
729 struct connman_technology *technology;
730 enum connman_service_type type;
732 DBG("device %p", device);
734 type = __connman_device_get_service_type(device);
735 __connman_notifier_register(type);
737 technology = technology_get(type);
738 if (technology == NULL)
741 if (technology->enable_persistent && !global_offlinemode)
742 __connman_device_enable(device);
743 /* if technology persistent state is offline */
744 if (!technology->enable_persistent)
745 __connman_device_disable(device);
747 technology->device_list = g_slist_append(technology->device_list,
753 int __connman_technology_remove_device(struct connman_device *device)
755 struct connman_technology *technology;
756 enum connman_service_type type;
758 DBG("device %p", device);
760 type = __connman_device_get_service_type(device);
761 __connman_notifier_unregister(type);
763 technology = technology_find(type);
764 if (technology == NULL)
767 technology->device_list = g_slist_remove(technology->device_list,
769 if (technology->device_list == NULL) {
770 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
771 state_changed(technology);
777 static gboolean technology_pending_reply(gpointer user_data)
779 struct connman_technology *technology = user_data;
782 /* Power request timedout, send ETIMEDOUT. */
783 if (technology->pending_reply != NULL) {
784 reply = __connman_error_failed(technology->pending_reply, ETIMEDOUT);
786 g_dbus_send_message(connection, reply);
788 dbus_message_unref(technology->pending_reply);
789 technology->pending_reply = NULL;
790 technology->pending_timeout = 0;
796 int __connman_technology_enabled(enum connman_service_type type)
798 struct connman_technology *technology;
800 technology = technology_find(type);
801 if (technology == NULL)
804 if (g_atomic_int_exchange_and_add(&technology->enabled, 1) == 0) {
805 __connman_notifier_enable(type);
806 technology->state = CONNMAN_TECHNOLOGY_STATE_ENABLED;
807 state_changed(technology);
810 if (technology->pending_reply != NULL) {
811 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
812 dbus_message_unref(technology->pending_reply);
813 technology->pending_reply = NULL;
814 technology->pending_timeout = 0;
820 int __connman_technology_enable(enum connman_service_type type, DBusMessage *msg)
822 struct connman_technology *technology;
828 DBG("type %d enable", type);
830 technology = technology_find(type);
831 if (technology == NULL) {
836 if (technology->pending_reply != NULL) {
842 technology->pending_reply = dbus_message_ref(msg);
844 * This is a bit of a trick. When msg is not NULL it means
845 * thats technology_enable was invoked from the manager API. Hence we save
848 technology->enable_persistent = TRUE;
849 save_state(technology);
852 __connman_rfkill_block(technology->type, FALSE);
854 for (list = technology->device_list; list; list = list->next) {
855 struct connman_device *device = list->data;
857 err = __connman_device_enable(device);
859 * err = 0 : Device was enabled right away.
860 * If atleast one device gets enabled, we consider
861 * the technology to be enabled.
872 if (err == -EINPROGRESS)
873 technology->pending_timeout = g_timeout_add_seconds(10,
874 technology_pending_reply, technology);
876 reply = __connman_error_failed(msg, -err);
878 g_dbus_send_message(connection, reply);
885 int __connman_technology_disabled(enum connman_service_type type)
887 struct connman_technology *technology;
889 technology = technology_find(type);
890 if (technology == NULL)
893 if (technology->pending_reply != NULL) {
894 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
895 dbus_message_unref(technology->pending_reply);
896 technology->pending_reply = NULL;
899 if (g_atomic_int_dec_and_test(&technology->enabled) == TRUE) {
900 __connman_notifier_disable(type);
901 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
902 state_changed(technology);
908 int __connman_technology_disable(enum connman_service_type type, DBusMessage *msg)
910 struct connman_technology *technology;
916 DBG("type %d disable", type);
918 technology = technology_find(type);
919 if (technology == NULL) {
924 if (technology->pending_reply != NULL) {
930 technology->pending_reply = dbus_message_ref(msg);
931 technology->enable_persistent = FALSE;
932 save_state(technology);
935 __connman_rfkill_block(technology->type, TRUE);
937 for (list = technology->device_list; list; list = list->next) {
938 struct connman_device *device = list->data;
940 err = __connman_device_disable(device);
950 if (err == -EINPROGRESS)
951 technology->pending_timeout = g_timeout_add_seconds(10,
952 technology_pending_reply, technology);
954 reply = __connman_error_failed(msg, -err);
956 g_dbus_send_message(connection, reply);
963 int __connman_technology_set_offlinemode(connman_bool_t offlinemode)
968 if (global_offlinemode == offlinemode)
971 DBG("offlinemode %s", offlinemode ? "On" : "Off");
974 * This is a bit tricky. When you set offlinemode, there is no
975 * way to differentiate between attempting offline mode and
976 * resuming offlinemode from last saved profile. We need that
977 * information in rfkill_update, otherwise it falls back on the
978 * technology's persistent state. Hence we set the offline mode here
979 * but save it & call the notifier only if its successful.
982 global_offlinemode = offlinemode;
984 /* Traverse technology list, enable/disable each technology. */
985 for (list = technology_list; list; list = list->next) {
986 struct connman_technology *technology = list->data;
989 err = __connman_technology_disable(technology->type, NULL);
991 if (!offlinemode && technology->enable_persistent)
992 err = __connman_technology_enable(technology->type, NULL);
995 if (err == 0 || err == -EINPROGRESS || err == -EALREADY) {
996 connman_technology_save_offlinemode();
997 __connman_notifier_offlinemode(offlinemode);
999 global_offlinemode = connman_technology_load_offlinemode();
1004 int __connman_technology_add_rfkill(unsigned int index,
1005 enum connman_service_type type,
1006 connman_bool_t softblock,
1007 connman_bool_t hardblock)
1009 struct connman_technology *technology;
1010 struct connman_rfkill *rfkill;
1012 DBG("index %u type %d soft %u hard %u", index, type,
1013 softblock, hardblock);
1015 technology = technology_get(type);
1016 if (technology == NULL)
1019 rfkill = g_try_new0(struct connman_rfkill, 1);
1023 rfkill->index = index;
1024 rfkill->type = type;
1025 rfkill->softblock = softblock;
1026 rfkill->hardblock = hardblock;
1028 g_hash_table_replace(technology->rfkill_list, &rfkill->index, rfkill);
1031 DBG("%s is switched off.", get_name(type));
1036 * If Offline mode is on, we softblock the device if it isnt already.
1037 * If Offline mode is off, we rely on the persistent state of tech.
1039 if (global_offlinemode) {
1041 return __connman_rfkill_block(type, TRUE);
1043 if (technology->enable_persistent && softblock)
1044 return __connman_rfkill_block(type, FALSE);
1045 /* if technology persistent state is offline */
1046 if (!technology->enable_persistent && !softblock)
1047 return __connman_rfkill_block(type, TRUE);
1053 int __connman_technology_update_rfkill(unsigned int index,
1054 enum connman_service_type type,
1055 connman_bool_t softblock,
1056 connman_bool_t hardblock)
1058 struct connman_technology *technology;
1059 struct connman_rfkill *rfkill;
1061 DBG("index %u soft %u hard %u", index, softblock, hardblock);
1063 technology = technology_find(type);
1064 if (technology == NULL)
1067 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
1071 if (rfkill->softblock == softblock &&
1072 rfkill->hardblock == hardblock)
1075 rfkill->softblock = softblock;
1076 rfkill->hardblock = hardblock;
1079 DBG("%s is switched off.", get_name(type));
1083 if (!global_offlinemode) {
1084 if (technology->enable_persistent && softblock)
1085 return __connman_rfkill_block(type, FALSE);
1086 if (!technology->enable_persistent && !softblock)
1087 return __connman_rfkill_block(type, TRUE);
1093 int __connman_technology_remove_rfkill(unsigned int index,
1094 enum connman_service_type type)
1096 struct connman_technology *technology;
1097 struct connman_rfkill *rfkill;
1099 DBG("index %u", index);
1101 technology = technology_find(type);
1102 if (technology == NULL)
1105 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
1109 g_hash_table_remove(technology->rfkill_list, &index);
1111 technology_put(technology);
1116 int __connman_technology_init(void)
1120 connection = connman_dbus_get_connection();
1122 global_offlinemode = connman_technology_load_offlinemode();
1127 void __connman_technology_cleanup(void)
1131 dbus_connection_unref(connection);