Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: src/service.c

Issue 6731067: flimflam: revise multi-profile support to pin objects to a profile (Closed) Base URL: ssh://gitrw.chromium.org:9222/flimflam.git@master
Patch Set: fix diff Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/profile.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * 2 *
3 * Connection Manager 3 * Connection Manager
4 * 4 *
5 * Copyright (C) 2007-2009 Intel Corporation. All rights reserved. 5 * Copyright (C) 2007-2009 Intel Corporation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 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 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 * 10 *
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 static DBusConnection *connection = NULL; 53 static DBusConnection *connection = NULL;
54 54
55 static GSequence *service_list = NULL; 55 static GSequence *service_list = NULL;
56 static GHashTable *service_hash = NULL; 56 static GHashTable *service_hash = NULL;
57 57
58 struct connman_service { 58 struct connman_service {
59 gint refcount; 59 gint refcount;
60 char *identifier; 60 char *identifier;
61 char *path; 61 char *path;
62 struct connman_profile *profile;
62 enum connman_service_type type; 63 enum connman_service_type type;
63 enum connman_service_mode mode; 64 enum connman_service_mode mode;
64 enum connman_service_security security; 65 enum connman_service_security security;
65 enum connman_service_state state; 66 enum connman_service_state state;
66 enum connman_service_error error; 67 enum connman_service_error error;
67 enum connman_service_connectivity_state connectivity_state; 68 enum connman_service_connectivity_state connectivity_state;
68 connman_uint8_t pri; 69 connman_uint8_t pri;
69 connman_uint8_t strength; 70 connman_uint8_t strength;
70 connman_bool_t favorite; 71 connman_bool_t favorite;
71 connman_bool_t hidden; 72 connman_bool_t hidden;
(...skipping 17 matching lines...) Expand all
89 char *private_key_passwd; 90 char *private_key_passwd;
90 char *key_id; 91 char *key_id;
91 char *ca_cert; /* formerly authpath */ 92 char *ca_cert; /* formerly authpath */
92 char *ca_cert_id; 93 char *ca_cert_id;
93 connman_bool_t use_system_cas; 94 connman_bool_t use_system_cas;
94 char *pin; 95 char *pin;
95 char *password; 96 char *password;
96 char *key_mgmt; 97 char *key_mgmt;
97 } eap; 98 } eap;
98 99
99 const struct connman_storage_ident *profile;
100 char *proxy_config; 100 char *proxy_config;
101 101
102 /* TODO(sleffler) overlay storage */ 102 /* TODO(sleffler) overlay storage */
103 struct { 103 struct {
104 char *operator_name; 104 char *operator_name;
105 char *operator_code; 105 char *operator_code;
106 char *olp_url; 106 char *olp_url;
107 char *usage_url; 107 char *usage_url;
108 enum connman_network_activation_state activation_state; 108 enum connman_network_activation_state activation_state;
109 enum connman_network_cellular_technology network_technology; 109 enum connman_network_cellular_technology network_technology;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 { 389 {
390 struct find_data data = { .path = path, .service = NULL }; 390 struct find_data data = { .path = path, .service = NULL };
391 391
392 _DBG_SERVICE("path %s", path); 392 _DBG_SERVICE("path %s", path);
393 393
394 g_sequence_foreach(service_list, compare_path, &data); 394 g_sequence_foreach(service_list, compare_path, &data);
395 395
396 return data.service; 396 return data.service;
397 } 397 }
398 398
399 struct connman_profile *__connman_service_get_profile(
400 struct connman_service *service)
401 {
402 return service->profile;
403 }
404
405 /*
406 * Set the service's bound profile.
407 */
408 void __connman_service_set_profile(struct connman_service *service,
409 struct connman_profile *profile)
410 {
411 _DBG_SERVICE("profile %p -> %p", service->profile, profile);
412
413 service->profile = profile;
414 }
415
416 /*
417 * Handle a profile being pop'd off the stack (e.g. on logout).
418 * Invalidate and possibly disconnect all services bound to the
419 * specified profile. Then re-load state from the profile (if
420 * available). Note this is assumed called AFTER the specified
421 * profile is pop'd off the stack (so we can explicitly re-load
422 * state and get any other data present, e.g. in the global profile).
423 */
399 static void invalidate_profile(gpointer value, gpointer user_data) 424 static void invalidate_profile(gpointer value, gpointer user_data)
400 { 425 {
401 struct connman_service *service = value; 426 struct connman_service *service = value;
402 » const struct connman_storage_ident *profile = user_data; 427 » const struct connman_profile *profile = user_data;
403 428
404 if (service->profile == profile) { 429 if (service->profile == profile) {
405 » » /* 430 » » _DBG_SERVICE("service %p", service);
406 » » * Invalidate profile-related data and force a re-load 431
407 » » * the next time the service is to be used (so it can
408 » » * come from the active profile).
409 » » */
410 service->profile = NULL; 432 service->profile = NULL;
411 433
412 /* 434 /*
413 * network_disconnect may drop the last reference to the 435 * network_disconnect may drop the last reference to the
414 * service and cause it to be freed, so take a reference 436 * service and cause it to be freed, so take a reference
415 * temporarily until we are done with it. 437 * temporarily until we are done with it.
416 */ 438 */
417 connman_service_ref(service); 439 connman_service_ref(service);
440
418 /* TODO(sleffler) skip wired ethernet, open auth? */ 441 /* TODO(sleffler) skip wired ethernet, open auth? */
442 service->autoconnect = FALSE;
419 __connman_service_disconnect(service); 443 __connman_service_disconnect(service);
420 service_clear_passphrase(service); 444 service_clear_passphrase(service);
421 service_clear_eap(service); 445 service_clear_eap(service);
446
447 /* re-load profile state */
448 __connman_profile_load_service(service);
449
422 connman_service_unref(service); 450 connman_service_unref(service);
423 } 451 }
424 } 452 }
453 static void service_profile_pop(struct connman_profile *profile)
454 {
455 _DBG_SERVICE("profile %p", profile);
425 456
426 void __connman_service_invalidate_profile(const struct connman_storage_ident *id ent) 457 » g_sequence_foreach(service_list, invalidate_profile, (gpointer)profile);
458 » /* NB: no need to kick auto-connect; it will happen due to invalidate */
459 }
460
461 /*
462 * Handle a profile being push'd on the stack (e.g. on login).
463 * Try to bind any service objects that are currently unbound
464 * and kick the autoconnect logic in case we can now login.
465 */
466 static void load_profile(gpointer value, gpointer user_data)
427 { 467 {
428 » _DBG_SERVICE("ident %s/%s", ident->user, ident->ident); 468 » struct connman_service *service = value;
429 469
430 » g_sequence_foreach(service_list, invalidate_profile, (gpointer) ident); 470 » if (service->profile == NULL)
471 » » __connman_profile_load_service(service);
472 }
473 static void service_profile_push(struct connman_profile *profile)
474 {
475 » _DBG_SERVICE("profile %p", profile);
476
477 » g_sequence_foreach(service_list, load_profile, NULL);
478
479 » __connman_service_auto_connect_any();
431 } 480 }
432 481
433 static const char *identifier(struct connman_service *service) 482 static const char *identifier(struct connman_service *service)
434 { 483 {
435 return service ? service->identifier : "<nil>"; 484 return service ? service->identifier : "<nil>";
436 } 485 }
437 486
438 static const char *type2string(enum connman_service_type type) 487 static const char *type2string(enum connman_service_type type)
439 { 488 {
440 switch (type) { 489 switch (type) {
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 static void proxy_configuration_changed(struct connman_service *service) 922 static void proxy_configuration_changed(struct connman_service *service)
874 { 923 {
875 if (service->proxy_config == NULL) 924 if (service->proxy_config == NULL)
876 return; 925 return;
877 926
878 connman_dbus_send_property_changed_variant(service->path, 927 connman_dbus_send_property_changed_variant(service->path,
879 CONNMAN_SERVICE_INTERFACE, "ProxyConfig", 928 CONNMAN_SERVICE_INTERFACE, "ProxyConfig",
880 DBUS_TYPE_STRING, &service->proxy_config); 929 DBUS_TYPE_STRING, &service->proxy_config);
881 } 930 }
882 931
932 static void profile_changed(struct connman_service *service)
933 {
934 const char *path;
935
936 CONNMAN_ASSERT(service->profile != NULL);
937
938 path = __connman_profile_get_path(service->profile);
939 connman_dbus_send_property_changed_variant(service->path,
940 CONNMAN_SERVICE_INTERFACE, "Profile",
941 DBUS_TYPE_STRING, &path);
942 }
943
883 static void get_properties_802_1x(DBusMessageIter *dict, 944 static void get_properties_802_1x(DBusMessageIter *dict,
884 struct connman_service *service) 945 struct connman_service *service)
885 { 946 {
886 if (service->eap.identity != NULL) 947 if (service->eap.identity != NULL)
887 connman_dbus_dict_append_variant(dict, kEAPIdentity, 948 connman_dbus_dict_append_variant(dict, kEAPIdentity,
888 DBUS_TYPE_STRING, &service->eap.identity); 949 DBUS_TYPE_STRING, &service->eap.identity);
889 if (service->eap.eap != NULL) 950 if (service->eap.eap != NULL)
890 connman_dbus_dict_append_variant(dict, kEAPEAP, 951 connman_dbus_dict_append_variant(dict, kEAPEAP,
891 DBUS_TYPE_STRING, &service->eap.eap); 952 DBUS_TYPE_STRING, &service->eap.eap);
892 if (service->eap.inner_eap != NULL) 953 if (service->eap.inner_eap != NULL)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 str = security2string(service->security); 1051 str = security2string(service->security);
991 if (str != NULL) 1052 if (str != NULL)
992 connman_dbus_dict_append_variant(&dict, "Security", 1053 connman_dbus_dict_append_variant(&dict, "Security",
993 DBUS_TYPE_STRING, &str); 1054 DBUS_TYPE_STRING, &str);
994 1055
995 str = connman_service_get_state(service); 1056 str = connman_service_get_state(service);
996 if (str != NULL) 1057 if (str != NULL)
997 connman_dbus_dict_append_variant(&dict, "State", 1058 connman_dbus_dict_append_variant(&dict, "State",
998 DBUS_TYPE_STRING, &str); 1059 DBUS_TYPE_STRING, &str);
999 1060
1061 if (service->profile != NULL) {
1062 str = __connman_profile_get_path(service->profile);
1063 connman_dbus_dict_append_variant(&dict, "Profile",
1064 DBUS_TYPE_STRING, &str);
1065 }
1066
1000 str = error2string(service->error); 1067 str = error2string(service->error);
1001 if (str != NULL) 1068 if (str != NULL)
1002 connman_dbus_dict_append_variant(&dict, "Error", 1069 connman_dbus_dict_append_variant(&dict, "Error",
1003 DBUS_TYPE_STRING, &str); 1070 DBUS_TYPE_STRING, &str);
1004 1071
1005 if (service->pri != CONNMAN_SERVICE_PRI_NONE) { 1072 if (service->pri != CONNMAN_SERVICE_PRI_NONE) {
1006 int pri = service->pri; 1073 int pri = service->pri;
1007 connman_dbus_dict_append_variant(&dict, "Priority", 1074 connman_dbus_dict_append_variant(&dict, "Priority",
1008 DBUS_TYPE_INT32, &pri); 1075 DBUS_TYPE_INT32, &pri);
1009 } 1076 }
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 dbus_message_iter_get_basic(&iter, &name); 1622 dbus_message_iter_get_basic(&iter, &name);
1556 dbus_message_iter_next(&iter); 1623 dbus_message_iter_next(&iter);
1557 dbus_message_iter_recurse(&iter, &value); 1624 dbus_message_iter_recurse(&iter, &value);
1558 1625
1559 if (__connman_security_check_privilege(msg, 1626 if (__connman_security_check_privilege(msg,
1560 CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0) 1627 CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0)
1561 return __connman_error_permission_denied(msg); 1628 return __connman_error_permission_denied(msg);
1562 1629
1563 type = dbus_message_iter_get_arg_type(&value); 1630 type = dbus_message_iter_get_arg_type(&value);
1564 1631
1565 » if (g_str_equal(name, "WiFi.HiddenSSID") == TRUE) { 1632 » if (g_str_equal(name, "Profile") == TRUE) {
1633 » » const char *path;
1634 » » struct connman_profile *profile;
1635
1636 » » if (type != DBUS_TYPE_STRING)
1637 » » » return __connman_error_invalid_arguments(msg);
1638
1639 » » dbus_message_iter_get_basic(&value, &path);
1640
1641 » » profile = __connman_profile_lookup_profile(path);
1642 » » /* TODO(sleffler) support setting a NULL profile? */
1643 » » if (profile == NULL)
1644 » » » return __connman_error_not_found(msg);
1645
1646 » » if (service->profile != profile) {
1647 » » » if (service->profile != NULL) {
1648 » » » » /* remove old entry */
1649 » » » » (void) __connman_profile_delete_entry(
1650 » » » » service->profile, service->identifier);
1651 » » » }
1652 » » » service->profile = profile;
1653
1654 » » » profile_changed(service);
1655
1656 » » » service_modified(service);
1657 » » }
1658 » } else if (g_str_equal(name, "WiFi.HiddenSSID") == TRUE) {
1566 connman_bool_t hidden_ssid; 1659 connman_bool_t hidden_ssid;
1567 1660
1568 if (type != DBUS_TYPE_BOOLEAN) 1661 if (type != DBUS_TYPE_BOOLEAN)
1569 return __connman_error_invalid_arguments(msg); 1662 return __connman_error_invalid_arguments(msg);
1570 1663
1571 if (service->type != CONNMAN_SERVICE_TYPE_WIFI) 1664 if (service->type != CONNMAN_SERVICE_TYPE_WIFI)
1572 return __connman_error_invalid_service(msg); 1665 return __connman_error_invalid_service(msg);
1573 1666
1574 dbus_message_iter_get_basic(&value, &hidden_ssid); 1667 dbus_message_iter_get_basic(&value, &hidden_ssid);
1575 1668
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 { 1915 {
1823 service_clear_passphrase(service); 1916 service_clear_passphrase(service);
1824 1917
1825 passphrase_required_changed(service); 1918 passphrase_required_changed(service);
1826 } 1919 }
1827 1920
1828 static void service_modified(struct connman_service *service) 1921 static void service_modified(struct connman_service *service)
1829 { 1922 {
1830 g_get_current_time(&service->modified); 1923 g_get_current_time(&service->modified);
1831 1924
1832 service->profile = __connman_profile_active_ident();
1833 __connman_profile_save_service(service); 1925 __connman_profile_save_service(service);
1834 } 1926 }
1835 1927
1836 static void service_clear_eap(struct connman_service *service) 1928 static void service_clear_eap(struct connman_service *service)
1837 { 1929 {
1838 g_free(service->eap.identity); 1930 g_free(service->eap.identity);
1839 service->eap.identity = NULL; 1931 service->eap.identity = NULL;
1840 1932
1841 g_free(service->eap.eap); 1933 g_free(service->eap.eap);
1842 service->eap.eap = NULL; 1934 service->eap.eap = NULL;
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 if (target->state != service->state) 2763 if (target->state != service->state)
2672 return __connman_error_invalid_service(msg); 2764 return __connman_error_invalid_service(msg);
2673 2765
2674 service_modified(service); 2766 service_modified(service);
2675 2767
2676 src = g_hash_table_lookup(service_hash, service->identifier); 2768 src = g_hash_table_lookup(service_hash, service->identifier);
2677 dst = g_hash_table_lookup(service_hash, target->identifier); 2769 dst = g_hash_table_lookup(service_hash, target->identifier);
2678 2770
2679 g_sequence_move(src, dst); 2771 g_sequence_move(src, dst);
2680 2772
2681 » __connman_profile_changed(FALSE); 2773 » __connman_profile_changed(service->profile, FALSE);
2682 2774
2683 return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); 2775 return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
2684 } 2776 }
2685 2777
2686 static DBusMessage *move_after(DBusConnection *conn, 2778 static DBusMessage *move_after(DBusConnection *conn,
2687 DBusMessage *msg, void *user_data) 2779 DBusMessage *msg, void *user_data)
2688 { 2780 {
2689 struct connman_service *service = user_data; 2781 struct connman_service *service = user_data;
2690 struct connman_service *target; 2782 struct connman_service *target;
2691 const char *path; 2783 const char *path;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2779 if (service->in_watchlist == TRUE) 2871 if (service->in_watchlist == TRUE)
2780 connman_service_notify_watchlist(CONNMAN_SERVICE_STATE_UNKNOWN); 2872 connman_service_notify_watchlist(CONNMAN_SERVICE_STATE_UNKNOWN);
2781 2873
2782 remove_timeout(service); 2874 remove_timeout(service);
2783 2875
2784 g_hash_table_remove(service_hash, service->identifier); 2876 g_hash_table_remove(service_hash, service->identifier);
2785 2877
2786 service->path = NULL; 2878 service->path = NULL;
2787 2879
2788 if (path != NULL) { 2880 if (path != NULL) {
2789 » » __connman_profile_changed(FALSE); 2881 » » __connman_profile_changed(service->profile, FALSE);
2790 2882
2791 g_dbus_unregister_interface(connection, path, 2883 g_dbus_unregister_interface(connection, path,
2792 CONNMAN_SERVICE_INTERFACE); 2884 CONNMAN_SERVICE_INTERFACE);
2793 g_free(path); 2885 g_free(path);
2794 } 2886 }
2795 2887
2796 if (service->network != NULL) 2888 if (service->network != NULL)
2797 connman_network_unref(service->network); 2889 connman_network_unref(service->network);
2798 if (service->provider != NULL) 2890 if (service->provider != NULL)
2799 connman_provider_unref(service->provider); 2891 connman_provider_unref(service->provider);
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 if (iter == NULL) 3205 if (iter == NULL)
3114 return -ENOENT; 3206 return -ENOENT;
3115 3207
3116 if (service->favorite == favorite) 3208 if (service->favorite == favorite)
3117 return -EALREADY; 3209 return -EALREADY;
3118 3210
3119 service->favorite = favorite; 3211 service->favorite = favorite;
3120 3212
3121 g_sequence_sort_changed(iter, service_compare, NULL); 3213 g_sequence_sort_changed(iter, service_compare, NULL);
3122 3214
3123 » __connman_profile_changed(FALSE); 3215 » __connman_profile_changed(service->profile, FALSE);
3124 3216
3125 return 0; 3217 return 0;
3126 } 3218 }
3127 3219
3128 /** 3220 /**
3129 * connman_service_get_device: 3221 * connman_service_get_device:
3130 * @service: service structure 3222 * @service: service structure
3131 * 3223 *
3132 * Return device for specified service. 3224 * Return device for specified service.
3133 */ 3225 */
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 if (state == CONNMAN_SERVICE_STATE_FAILURE) { 3321 if (state == CONNMAN_SERVICE_STATE_FAILURE) {
3230 remove_timeout(service); 3322 remove_timeout(service);
3231 3323
3232 if (service->userconnect == FALSE) 3324 if (service->userconnect == FALSE)
3233 connman_service_auto_connect(service); 3325 connman_service_auto_connect(service);
3234 3326
3235 service_modified(service); 3327 service_modified(service);
3236 } else if (state != CONNMAN_SERVICE_STATE_ACTIVATION_FAILURE) 3328 } else if (state != CONNMAN_SERVICE_STATE_ACTIVATION_FAILURE)
3237 service->error = CONNMAN_SERVICE_ERROR_UNKNOWN; 3329 service->error = CONNMAN_SERVICE_ERROR_UNKNOWN;
3238 3330
3239 » __connman_profile_changed(FALSE); 3331 » __connman_profile_changed(service->profile, FALSE);
3240 3332
3241 if (state == CONNMAN_SERVICE_STATE_DISCONNECT) { 3333 if (state == CONNMAN_SERVICE_STATE_DISCONNECT) {
3242 struct connman_service *act_service = get_active_service(); 3334 struct connman_service *act_service = get_active_service();
3243 3335
3244 /* TODO(sleffler) this looks wrong */ 3336 /* TODO(sleffler) this looks wrong */
3245 if (__connman_connection_is_online() == FALSE && 3337 if (__connman_connection_is_online() == FALSE &&
3246 act_service != NULL && act_service->provider != NULL) 3338 act_service != NULL && act_service->provider != NULL)
3247 __connman_provider_disconnect(act_service->provider); 3339 __connman_provider_disconnect(act_service->provider);
3248 } 3340 }
3249 3341
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 } 4019 }
3928 4020
3929 service = connman_service_create(); 4021 service = connman_service_create();
3930 if (service == NULL) 4022 if (service == NULL)
3931 return NULL; 4023 return NULL;
3932 4024
3933 _DBG_SERVICE("service %p", service); 4025 _DBG_SERVICE("service %p", service);
3934 4026
3935 service->identifier = g_strdup(identifier); 4027 service->identifier = g_strdup(identifier);
3936 4028
3937 service->profile = __connman_profile_active_ident();
3938
3939 __connman_profile_load_service(service); 4029 __connman_profile_load_service(service);
3940 4030
3941 iter = g_sequence_insert_sorted(service_list, service, 4031 iter = g_sequence_insert_sorted(service_list, service,
3942 service_compare, NULL); 4032 service_compare, NULL);
3943 4033
3944 g_hash_table_insert(service_hash, service->identifier, iter); 4034 g_hash_table_insert(service_hash, service->identifier, iter);
3945 4035
3946 return service; 4036 return service;
3947 } 4037 }
3948 4038
3949 static int service_register(struct connman_service *service) 4039 static int service_register(struct connman_service *service)
3950 { 4040 {
3951 const char *path = __connman_profile_active_path();
3952
3953 _DBG_SERVICE("service %p", service); 4041 _DBG_SERVICE("service %p", service);
3954 4042
3955 if (service->path != NULL) 4043 if (service->path != NULL)
3956 return -EALREADY; 4044 return -EALREADY;
3957 4045
3958 » service->path = g_strdup_printf("%s/%s", path, service->identifier); 4046 » service->path = g_strdup_printf("/%s", service->identifier);
3959
3960 » _DBG_SERVICE("path %s", service->path);
3961 4047
3962 g_dbus_register_interface(connection, service->path, 4048 g_dbus_register_interface(connection, service->path,
3963 CONNMAN_SERVICE_INTERFACE, 4049 CONNMAN_SERVICE_INTERFACE,
3964 service_methods, service_signals, 4050 service_methods, service_signals,
3965 NULL, service, NULL); 4051 NULL, service, NULL);
3966 4052
3967 __connman_profile_load_service(service); 4053 __connman_profile_load_service(service);
3968 4054
3969 __service_resort(service); 4055 __service_resort(service);
3970 4056
3971 » __connman_profile_changed(TRUE); 4057 » __connman_profile_changed(service->profile, TRUE);
3972 4058
3973 return 0; 4059 return 0;
3974 } 4060 }
3975 4061
3976 /** 4062 /**
3977 * __connman_service_lookup_from_device: 4063 * __connman_service_lookup_from_device:
3978 * @device: device structure 4064 * @device: device structure
3979 * 4065 *
3980 * Look up a service by device (reference count will not be increased) 4066 * Look up a service by device (reference count will not be increased)
3981 */ 4067 */
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4016 4102
4017 name = g_strdup_printf("%s_%s", 4103 name = g_strdup_printf("%s_%s",
4018 __connman_device_get_type(device), ident); 4104 __connman_device_get_type(device), ident);
4019 service = __connman_service_get(name); 4105 service = __connman_service_get(name);
4020 g_free(name); 4106 g_free(name);
4021 4107
4022 if (service == NULL) 4108 if (service == NULL)
4023 return NULL; 4109 return NULL;
4024 4110
4025 if (service->path != NULL) { 4111 if (service->path != NULL) {
4026 » » __connman_profile_changed(TRUE); 4112 » » __connman_profile_changed(service->profile, TRUE);
4027 return service; 4113 return service;
4028 } 4114 }
4029 4115
4030 service->type = __connman_device_get_service_type(device); 4116 service->type = __connman_device_get_service_type(device);
4031 4117
4032 service->autoconnect = FALSE; 4118 service->autoconnect = FALSE;
4033 4119
4034 service->device = device; 4120 service->device = device;
4035 4121
4036 __connman_profile_load_service(service); 4122 __connman_profile_load_service(service);
4037 4123
4038 service_register(service); 4124 service_register(service);
4039 4125
4040 » __connman_profile_changed(TRUE); 4126 » __connman_profile_changed(service->profile, TRUE);
4041 4127
4042 if (service->favorite == TRUE) 4128 if (service->favorite == TRUE)
4043 connman_service_auto_connect(service); 4129 connman_service_auto_connect(service);
4044 4130
4045 return service; 4131 return service;
4046 } 4132 }
4047 4133
4048 void __connman_service_remove_from_device(struct connman_device *device) 4134 void __connman_service_remove_from_device(struct connman_device *device)
4049 { 4135 {
4050 struct connman_service *service; 4136 struct connman_service *service;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
4402 g_free(name); 4488 g_free(name);
4403 4489
4404 if (service == NULL) 4490 if (service == NULL)
4405 return NULL; 4491 return NULL;
4406 4492
4407 if (__connman_network_get_weakness(network) == TRUE) 4493 if (__connman_network_get_weakness(network) == TRUE)
4408 return service; 4494 return service;
4409 4495
4410 if (service->path != NULL) { 4496 if (service->path != NULL) {
4411 update_from_network(service, network, FALSE); 4497 update_from_network(service, network, FALSE);
4412 » » __connman_profile_changed(TRUE); 4498 » » __connman_profile_changed(service->profile, TRUE);
4413 return service; 4499 return service;
4414 } 4500 }
4415 4501
4416 service->type = convert_network_type(network); 4502 service->type = convert_network_type(network);
4417 4503
4418 switch (service->type) { 4504 switch (service->type) {
4419 case CONNMAN_SERVICE_TYPE_UNKNOWN: 4505 case CONNMAN_SERVICE_TYPE_UNKNOWN:
4420 case CONNMAN_SERVICE_TYPE_ETHERNET: 4506 case CONNMAN_SERVICE_TYPE_ETHERNET:
4421 case CONNMAN_SERVICE_TYPE_WIMAX: 4507 case CONNMAN_SERVICE_TYPE_WIMAX:
4422 case CONNMAN_SERVICE_TYPE_BLUETOOTH: 4508 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
(...skipping 24 matching lines...) Expand all
4447 4533
4448 str = connman_network_get_string(network, "WiFi.Security"); 4534 str = connman_network_get_string(network, "WiFi.Security");
4449 service->security = convert_wifi_security(str); 4535 service->security = convert_wifi_security(str);
4450 4536
4451 update_from_network(service, network, FALSE); 4537 update_from_network(service, network, FALSE);
4452 4538
4453 __connman_profile_load_service(service); 4539 __connman_profile_load_service(service);
4454 4540
4455 service_register(service); 4541 service_register(service);
4456 4542
4457 » __connman_profile_changed(TRUE); 4543 » __connman_profile_changed(service->profile, TRUE);
4458 4544
4459 if (service->favorite == TRUE) 4545 if (service->favorite == TRUE)
4460 connman_service_auto_connect(service); 4546 connman_service_auto_connect(service);
4461 4547
4462 return service; 4548 return service;
4463 } 4549 }
4464 4550
4465 /** 4551 /**
4466 * connman_service_set_current_network: 4552 * connman_service_set_current_network:
4467 * @network: network structure 4553 * @network: network structure
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
5110 .service_load = service_load, 5196 .service_load = service_load,
5111 .service_save = service_save, 5197 .service_save = service_save,
5112 }; 5198 };
5113 5199
5114 static struct connman_notifier service_notifier = { 5200 static struct connman_notifier service_notifier = {
5115 .name = "service", 5201 .name = "service",
5116 .priority = CONNMAN_NOTIFIER_PRIORITY_DEFAULT, 5202 .priority = CONNMAN_NOTIFIER_PRIORITY_DEFAULT,
5117 .service_state_changed = notify_state_changed, 5203 .service_state_changed = notify_state_changed,
5118 .system_suspend = service_system_suspend, 5204 .system_suspend = service_system_suspend,
5119 .system_resume = service_system_resume, 5205 .system_resume = service_system_resume,
5206 .profile_push = service_profile_push,
5207 .profile_pop = service_profile_pop,
5120 }; 5208 };
5121 5209
5122 int __connman_service_init(const char *option_order) 5210 int __connman_service_init(const char *option_order)
5123 { 5211 {
5124 _DBG_SERVICE(""); 5212 _DBG_SERVICE("");
5125 5213
5126 connection = connman_dbus_get_connection(); 5214 connection = connman_dbus_get_connection();
5127 5215
5128 if (connman_storage_register(&service_storage) < 0) 5216 if (connman_storage_register(&service_storage) < 0)
5129 connman_error("Failed to register service storage"); 5217 connman_error("Failed to register service storage");
(...skipping 25 matching lines...) Expand all
5155 service_list = NULL; 5243 service_list = NULL;
5156 5244
5157 g_hash_table_destroy(service_hash); 5245 g_hash_table_destroy(service_hash);
5158 service_hash = NULL; 5246 service_hash = NULL;
5159 5247
5160 connman_storage_unregister(&service_storage); 5248 connman_storage_unregister(&service_storage);
5161 connman_notifier_unregister(&service_notifier); 5249 connman_notifier_unregister(&service_notifier);
5162 5250
5163 dbus_connection_unref(connection); 5251 dbus_connection_unref(connection);
5164 } 5252 }
OLDNEW
« no previous file with comments | « src/profile.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698