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
31 static GSList *network_list = NULL;
32 static GSList *driver_list = NULL;
34 struct connman_network {
36 enum connman_network_type type;
37 connman_bool_t available;
38 connman_bool_t connected;
39 connman_bool_t roaming;
40 connman_uint8_t strength;
41 connman_uint16_t frequency;
48 int router_solicit_count;
50 struct connman_network_driver *driver;
53 connman_bool_t connecting;
54 connman_bool_t associating;
56 struct connman_device *device;
62 unsigned short channel;
65 char *agent_passphrase;
70 char *client_cert_path;
71 char *private_key_path;
72 char *private_key_passphrase;
75 connman_bool_t use_wps;
85 static const char *type2string(enum connman_network_type type)
88 case CONNMAN_NETWORK_TYPE_UNKNOWN:
89 case CONNMAN_NETWORK_TYPE_VENDOR:
91 case CONNMAN_NETWORK_TYPE_ETHERNET:
93 case CONNMAN_NETWORK_TYPE_WIFI:
95 case CONNMAN_NETWORK_TYPE_WIMAX:
97 case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
98 case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
100 case CONNMAN_NETWORK_TYPE_CELLULAR:
107 connman_bool_t __connman_network_has_driver(struct connman_network *network)
109 if (network == NULL || network->driver == NULL)
115 static gboolean match_driver(struct connman_network *network,
116 struct connman_network_driver *driver)
118 if (network->type == driver->type ||
119 driver->type == CONNMAN_NETWORK_TYPE_UNKNOWN)
125 static int network_probe(struct connman_network *network)
128 struct connman_network_driver *driver = NULL;
130 DBG("network %p name %s", network, network->name);
132 if (network->driver != NULL)
135 for (list = driver_list; list; list = list->next) {
138 if (match_driver(network, driver) == FALSE)
141 DBG("driver %p name %s", driver, driver->name);
143 if (driver->probe(network) == 0)
152 if (network->group == NULL)
155 switch (network->type) {
156 case CONNMAN_NETWORK_TYPE_UNKNOWN:
157 case CONNMAN_NETWORK_TYPE_VENDOR:
159 case CONNMAN_NETWORK_TYPE_ETHERNET:
160 case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
161 case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
162 case CONNMAN_NETWORK_TYPE_CELLULAR:
163 case CONNMAN_NETWORK_TYPE_WIFI:
164 case CONNMAN_NETWORK_TYPE_WIMAX:
165 network->driver = driver;
166 if (__connman_service_create_from_network(network) == NULL) {
167 network->driver = NULL;
175 static void network_remove(struct connman_network *network)
177 DBG("network %p name %s", network, network->name);
179 if (network->driver == NULL)
182 connman_network_set_connected(network, FALSE);
184 switch (network->type) {
185 case CONNMAN_NETWORK_TYPE_UNKNOWN:
186 case CONNMAN_NETWORK_TYPE_VENDOR:
188 case CONNMAN_NETWORK_TYPE_ETHERNET:
189 case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
190 case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
191 case CONNMAN_NETWORK_TYPE_CELLULAR:
192 case CONNMAN_NETWORK_TYPE_WIFI:
193 case CONNMAN_NETWORK_TYPE_WIMAX:
194 if (network->group != NULL) {
195 __connman_service_remove_from_network(network);
197 g_free(network->group);
198 network->group = NULL;
203 if (network->driver->remove)
204 network->driver->remove(network);
206 network->driver = NULL;
209 static void network_change(struct connman_network *network)
211 DBG("network %p name %s", network, network->name);
213 if (network->connected == FALSE)
216 connman_device_set_disconnected(network->device, TRUE);
218 if (network->driver && network->driver->disconnect) {
219 network->driver->disconnect(network);
223 network->connected = FALSE;
226 static void probe_driver(struct connman_network_driver *driver)
230 DBG("driver %p name %s", driver, driver->name);
232 for (list = network_list; list != NULL; list = list->next) {
233 struct connman_network *network = list->data;
235 if (network->driver != NULL)
238 if (driver->type != network->type)
241 if (driver->probe(network) < 0)
244 network->driver = driver;
248 static void remove_driver(struct connman_network_driver *driver)
252 DBG("driver %p name %s", driver, driver->name);
254 for (list = network_list; list != NULL; list = list->next) {
255 struct connman_network *network = list->data;
257 if (network->driver == driver)
258 network_remove(network);
262 static gint compare_priority(gconstpointer a, gconstpointer b)
264 const struct connman_network_driver *driver1 = a;
265 const struct connman_network_driver *driver2 = b;
267 return driver2->priority - driver1->priority;
271 * connman_network_driver_register:
272 * @driver: network driver definition
274 * Register a new network driver
276 * Returns: %0 on success
278 int connman_network_driver_register(struct connman_network_driver *driver)
282 DBG("driver %p name %s", driver, driver->name);
284 for (list = driver_list; list; list = list->next) {
285 struct connman_network_driver *tmp = list->data;
287 if (tmp->type == driver->type)
292 driver_list = g_slist_insert_sorted(driver_list, driver,
295 probe_driver(driver);
301 * connman_network_driver_unregister:
302 * @driver: network driver definition
304 * Remove a previously registered network driver
306 void connman_network_driver_unregister(struct connman_network_driver *driver)
308 DBG("driver %p name %s", driver, driver->name);
310 driver_list = g_slist_remove(driver_list, driver);
312 remove_driver(driver);
315 static void network_destruct(struct connman_network *network)
317 DBG("network %p name %s", network, network->name);
319 g_free(network->wifi.ssid);
320 g_free(network->wifi.mode);
321 g_free(network->wifi.security);
322 g_free(network->wifi.passphrase);
323 g_free(network->wifi.agent_passphrase);
324 g_free(network->wifi.eap);
325 g_free(network->wifi.identity);
326 g_free(network->wifi.agent_identity);
327 g_free(network->wifi.ca_cert_path);
328 g_free(network->wifi.client_cert_path);
329 g_free(network->wifi.private_key_path);
330 g_free(network->wifi.private_key_passphrase);
331 g_free(network->wifi.phase2_auth);
332 g_free(network->wifi.pin_wps);
334 g_free(network->path);
335 g_free(network->group);
336 g_free(network->node);
337 g_free(network->name);
338 g_free(network->identifier);
340 network->device = NULL;
346 * connman_network_create:
347 * @identifier: network identifier (for example an unqiue name)
349 * Allocate a new network and assign the #identifier to it.
351 * Returns: a newly-allocated #connman_network structure
353 struct connman_network *connman_network_create(const char *identifier,
354 enum connman_network_type type)
356 struct connman_network *network;
359 DBG("identifier %s type %d", identifier, type);
361 network = g_try_new0(struct connman_network, 1);
365 DBG("network %p", network);
367 network->refcount = 1;
369 ident = g_strdup(identifier);
376 network->type = type;
377 network->identifier = ident;
379 network_list = g_slist_append(network_list, network);
385 * connman_network_ref:
386 * @network: network structure
388 * Increase reference counter of network
390 struct connman_network *connman_network_ref(struct connman_network *network)
392 DBG("network %p name %s refcount %d", network, network->name,
393 network->refcount + 1);
395 __sync_fetch_and_add(&network->refcount, 1);
401 * connman_network_unref:
402 * @network: network structure
404 * Decrease reference counter of network
406 void connman_network_unref(struct connman_network *network)
408 DBG("network %p name %s refcount %d", network, network->name,
409 network->refcount - 1);
411 if (__sync_fetch_and_sub(&network->refcount, 1) != 1)
414 network_list = g_slist_remove(network_list, network);
416 network_destruct(network);
419 const char *__connman_network_get_type(struct connman_network *network)
421 return type2string(network->type);
425 * connman_network_get_type:
426 * @network: network structure
428 * Get type of network
430 enum connman_network_type connman_network_get_type(struct connman_network *network)
432 return network->type;
436 * connman_network_get_identifier:
437 * @network: network structure
439 * Get identifier of network
441 const char *connman_network_get_identifier(struct connman_network *network)
443 return network->identifier;
447 * connman_network_set_index:
448 * @network: network structure
449 * @index: index number
451 * Set index number of network
453 void connman_network_set_index(struct connman_network *network, int index)
455 struct connman_service *service;
456 struct connman_ipconfig *ipconfig;
458 service = __connman_service_lookup_from_network(network);
462 ipconfig = __connman_service_get_ip4config(service);
464 DBG("index %d service %p ip4config %p", network->index,
467 if (network->index < 0 && ipconfig == NULL) {
469 ipconfig = __connman_service_get_ip4config(service);
470 if (ipconfig == NULL)
472 * This is needed for plugins that havent set their
473 * ipconfig layer yet, due to not being able to get
474 * a network index prior to creating a service.
476 __connman_service_create_ip4config(service, index);
478 __connman_ipconfig_set_index(ipconfig, index);
481 /* If index changed, the index of ipconfig must be reset. */
482 if (ipconfig == NULL)
485 __connman_ipconfig_set_index(ipconfig, index);
489 network->index = index;
493 * connman_network_get_index:
494 * @network: network structure
496 * Get index number of network
498 int connman_network_get_index(struct connman_network *network)
500 return network->index;
504 * connman_network_set_group:
505 * @network: network structure
508 * Set group name for automatic clustering
510 void connman_network_set_group(struct connman_network *network,
513 switch (network->type) {
514 case CONNMAN_NETWORK_TYPE_UNKNOWN:
515 case CONNMAN_NETWORK_TYPE_VENDOR:
517 case CONNMAN_NETWORK_TYPE_ETHERNET:
518 case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
519 case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
520 case CONNMAN_NETWORK_TYPE_CELLULAR:
521 case CONNMAN_NETWORK_TYPE_WIFI:
522 case CONNMAN_NETWORK_TYPE_WIMAX:
526 if (g_strcmp0(network->group, group) == 0) {
528 __connman_service_update_from_network(network);
532 if (network->group != NULL) {
533 __connman_service_remove_from_network(network);
535 g_free(network->group);
538 network->group = g_strdup(group);
540 if (network->group != NULL)
541 network_probe(network);
545 * connman_network_get_group:
546 * @network: network structure
548 * Get group name for automatic clustering
550 const char *connman_network_get_group(struct connman_network *network)
552 return network->group;
555 const char *__connman_network_get_ident(struct connman_network *network)
557 if (network->device == NULL)
560 return connman_device_get_ident(network->device);
563 connman_bool_t __connman_network_get_weakness(struct connman_network *network)
565 switch (network->type) {
566 case CONNMAN_NETWORK_TYPE_UNKNOWN:
567 case CONNMAN_NETWORK_TYPE_VENDOR:
568 case CONNMAN_NETWORK_TYPE_ETHERNET:
569 case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
570 case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
571 case CONNMAN_NETWORK_TYPE_CELLULAR:
572 case CONNMAN_NETWORK_TYPE_WIMAX:
574 case CONNMAN_NETWORK_TYPE_WIFI:
575 if (g_strcmp0(network->wifi.mode, "adhoc") == 0)
577 if (network->strength > 0 && network->strength < 20)
585 connman_bool_t connman_network_get_connecting(struct connman_network *network)
587 return network->connecting;
591 * connman_network_set_available:
592 * @network: network structure
593 * @available: availability state
595 * Change availability state of network (in range)
597 int connman_network_set_available(struct connman_network *network,
598 connman_bool_t available)
600 DBG("network %p available %d", network, available);
602 if (network->available == available)
605 network->available = available;
611 * connman_network_get_available:
612 * @network: network structure
614 * Get network available setting
616 connman_bool_t connman_network_get_available(struct connman_network *network)
618 return network->available;
622 * connman_network_set_associating:
623 * @network: network structure
624 * @associating: associating state
626 * Change associating state of network
628 int connman_network_set_associating(struct connman_network *network,
629 connman_bool_t associating)
631 DBG("network %p associating %d", network, associating);
633 if (network->associating == associating)
636 network->associating = associating;
638 if (associating == TRUE) {
639 struct connman_service *service;
641 service = __connman_service_lookup_from_network(network);
642 __connman_service_ipconfig_indicate_state(service,
643 CONNMAN_SERVICE_STATE_ASSOCIATION,
644 CONNMAN_IPCONFIG_TYPE_IPV4);
645 __connman_service_ipconfig_indicate_state(service,
646 CONNMAN_SERVICE_STATE_ASSOCIATION,
647 CONNMAN_IPCONFIG_TYPE_IPV6);
653 static void set_associate_error(struct connman_network *network)
655 struct connman_service *service;
657 service = __connman_service_lookup_from_network(network);
659 __connman_service_indicate_error(service,
660 CONNMAN_SERVICE_ERROR_CONNECT_FAILED);
663 static void set_configure_error(struct connman_network *network)
665 struct connman_service *service;
667 service = __connman_service_lookup_from_network(network);
669 __connman_service_indicate_error(service,
670 CONNMAN_SERVICE_ERROR_CONNECT_FAILED);
673 static void set_invalid_key_error(struct connman_network *network)
675 struct connman_service *service;
677 service = __connman_service_lookup_from_network(network);
679 __connman_service_indicate_error(service,
680 CONNMAN_SERVICE_ERROR_INVALID_KEY);
683 static void set_connect_error(struct connman_network *network)
685 struct connman_service *service;
687 service = __connman_service_lookup_from_network(network);
689 __connman_service_indicate_error(service,
690 CONNMAN_SERVICE_ERROR_CONNECT_FAILED);
693 void connman_network_set_ipv4_method(struct connman_network *network,
694 enum connman_ipconfig_method method)
696 struct connman_service *service;
697 struct connman_ipconfig *ipconfig;
699 service = __connman_service_lookup_from_network(network);
703 ipconfig = __connman_service_get_ip4config(service);
704 if (ipconfig == NULL)
707 __connman_ipconfig_set_method(ipconfig, method);
710 void connman_network_set_ipv6_method(struct connman_network *network,
711 enum connman_ipconfig_method method)
713 struct connman_service *service;
714 struct connman_ipconfig *ipconfig;
716 service = __connman_service_lookup_from_network(network);
720 ipconfig = __connman_service_get_ip6config(service);
721 if (ipconfig == NULL)
724 __connman_ipconfig_set_method(ipconfig, method);
727 void connman_network_set_error(struct connman_network *network,
728 enum connman_network_error error)
730 DBG("nework %p, error %d", network, error);
732 network->connecting = FALSE;
733 network->associating = FALSE;
736 case CONNMAN_NETWORK_ERROR_UNKNOWN:
738 case CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL:
739 set_associate_error(network);
741 case CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL:
742 set_configure_error(network);
744 case CONNMAN_NETWORK_ERROR_INVALID_KEY:
745 set_invalid_key_error(network);
747 case CONNMAN_NETWORK_ERROR_CONNECT_FAIL:
748 set_connect_error(network);
752 network_change(network);
755 void connman_network_clear_error(struct connman_network *network)
757 struct connman_service *service;
759 DBG("network %p", network);
764 if (network->connecting == TRUE || network->associating == TRUE)
767 service = __connman_service_lookup_from_network(network);
768 __connman_service_clear_error(service);
771 static void set_configuration(struct connman_network *network,
772 enum connman_ipconfig_type type)
774 struct connman_service *service;
776 DBG("network %p", network);
778 if (network->device == NULL)
781 __connman_device_set_network(network->device, network);
783 connman_device_set_disconnected(network->device, FALSE);
785 service = __connman_service_lookup_from_network(network);
786 __connman_service_ipconfig_indicate_state(service,
787 CONNMAN_SERVICE_STATE_CONFIGURATION,
791 static void dhcp_success(struct connman_network *network)
793 struct connman_service *service;
794 struct connman_ipconfig *ipconfig_ipv4;
797 service = __connman_service_lookup_from_network(network);
801 connman_network_set_associating(network, FALSE);
803 network->connecting = FALSE;
805 ipconfig_ipv4 = __connman_service_get_ip4config(service);
806 err = __connman_ipconfig_address_add(ipconfig_ipv4);
810 err = __connman_ipconfig_gateway_add(ipconfig_ipv4);
817 connman_network_set_error(network,
818 CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
821 static void dhcp_failure(struct connman_network *network)
823 struct connman_service *service;
825 service = __connman_service_lookup_from_network(network);
829 __connman_service_ipconfig_indicate_state(service,
830 CONNMAN_SERVICE_STATE_IDLE,
831 CONNMAN_IPCONFIG_TYPE_IPV4);
834 static void dhcp_callback(struct connman_network *network,
835 connman_bool_t success)
837 DBG("success %d", success);
840 dhcp_success(network);
842 dhcp_failure(network);
845 static int set_connected_fixed(struct connman_network *network)
847 struct connman_service *service;
848 struct connman_ipconfig *ipconfig_ipv4;
853 service = __connman_service_lookup_from_network(network);
855 ipconfig_ipv4 = __connman_service_get_ip4config(service);
857 set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
859 network->connecting = FALSE;
861 connman_network_set_associating(network, FALSE);
863 err = __connman_ipconfig_address_add(ipconfig_ipv4);
867 err = __connman_ipconfig_gateway_add(ipconfig_ipv4);
874 connman_network_set_error(network,
875 CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
880 static void set_connected_manual(struct connman_network *network)
882 struct connman_service *service;
883 struct connman_ipconfig *ipconfig;
886 DBG("network %p", network);
888 service = __connman_service_lookup_from_network(network);
890 ipconfig = __connman_service_get_ip4config(service);
892 if (__connman_ipconfig_get_local(ipconfig) == NULL)
893 __connman_service_read_ip4config(service);
895 set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
897 err = __connman_ipconfig_address_add(ipconfig);
901 err = __connman_ipconfig_gateway_add(ipconfig);
905 network->connecting = FALSE;
907 connman_network_set_associating(network, FALSE);
912 connman_network_set_error(network,
913 CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
917 static int set_connected_dhcp(struct connman_network *network)
921 DBG("network %p", network);
923 set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
925 err = __connman_dhcp_start(network, dhcp_callback);
927 connman_error("Can not request DHCP lease");
934 static int manual_ipv6_set(struct connman_network *network,
935 struct connman_ipconfig *ipconfig_ipv6)
937 struct connman_service *service;
940 DBG("network %p ipv6 %p", network, ipconfig_ipv6);
942 service = __connman_service_lookup_from_network(network);
946 if (__connman_ipconfig_get_local(ipconfig_ipv6) == NULL)
947 __connman_service_read_ip6config(service);
949 err = __connman_ipconfig_address_add(ipconfig_ipv6);
951 connman_network_set_error(network,
952 CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
956 err = __connman_ipconfig_gateway_add(ipconfig_ipv6);
960 __connman_connection_gateway_activate(service,
961 CONNMAN_IPCONFIG_TYPE_IPV6);
963 __connman_device_set_network(network->device, network);
965 connman_device_set_disconnected(network->device, FALSE);
967 network->connecting = FALSE;
972 static void stop_dhcpv6(struct connman_network *network)
974 __connman_dhcpv6_stop(network);
977 static void dhcpv6_release_callback(struct connman_network *network,
978 connman_bool_t success)
980 DBG("success %d", success);
982 stop_dhcpv6(network);
985 static void release_dhcpv6(struct connman_network *network)
987 __connman_dhcpv6_start_release(network, dhcpv6_release_callback);
988 stop_dhcpv6(network);
991 static void dhcpv6_info_callback(struct connman_network *network,
992 connman_bool_t success)
994 DBG("success %d", success);
996 stop_dhcpv6(network);
999 static gboolean dhcpv6_set_addresses(struct connman_network *network)
1001 struct connman_service *service;
1002 struct connman_ipconfig *ipconfig_ipv6;
1005 service = __connman_service_lookup_from_network(network);
1006 if (service == NULL)
1009 connman_network_set_associating(network, FALSE);
1011 network->connecting = FALSE;
1013 ipconfig_ipv6 = __connman_service_get_ip6config(service);
1014 err = __connman_ipconfig_address_add(ipconfig_ipv6);
1018 err = __connman_ipconfig_gateway_add(ipconfig_ipv6);
1025 connman_network_set_error(network,
1026 CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
1030 static void autoconf_ipv6_set(struct connman_network *network);
1031 static void dhcpv6_callback(struct connman_network *network,
1032 connman_bool_t success);
1035 * Have a separate callback for renew so that we do not do autoconf
1036 * in wrong phase as the dhcpv6_callback() is also called when doing
1037 * DHCPv6 solicitation.
1039 static void dhcpv6_renew_callback(struct connman_network *network,
1040 connman_bool_t success)
1042 if (success == TRUE)
1043 dhcpv6_callback(network, success);
1045 stop_dhcpv6(network);
1047 /* restart and do solicit again. */
1048 autoconf_ipv6_set(network);
1052 static void dhcpv6_callback(struct connman_network *network,
1053 connman_bool_t success)
1055 DBG("success %d", success);
1057 /* Start the renew process if necessary */
1058 if (success == TRUE) {
1060 if (dhcpv6_set_addresses(network) < 0) {
1061 stop_dhcpv6(network);
1065 if (__connman_dhcpv6_start_renew(network,
1066 dhcpv6_renew_callback) == -ETIMEDOUT)
1067 dhcpv6_renew_callback(network, FALSE);
1069 stop_dhcpv6(network);
1072 static void check_dhcpv6(struct nd_router_advert *reply,
1073 unsigned int length, void *user_data)
1075 struct connman_network *network = user_data;
1078 DBG("reply %p", reply);
1080 if (reply == NULL) {
1082 * Router solicitation message seem to get lost easily so
1083 * try to send it again.
1085 if (network->router_solicit_count > 0) {
1086 DBG("re-send router solicitation %d",
1087 network->router_solicit_count);
1088 network->router_solicit_count--;
1089 __connman_inet_ipv6_send_rs(network->index, 1,
1090 check_dhcpv6, network);
1093 connman_network_unref(network);
1097 network->router_solicit_count = 0;
1100 * If we were disconnected while waiting router advertisement,
1101 * we just quit and do not start DHCPv6
1103 if (network->connected == FALSE) {
1104 connman_network_unref(network);
1108 prefixes = __connman_inet_ipv6_get_prefixes(reply, length);
1111 * We do stateful/stateless DHCPv6 if router advertisement says so.
1113 if (reply->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED)
1114 __connman_dhcpv6_start(network, prefixes, dhcpv6_callback);
1115 else if (reply->nd_ra_flags_reserved & ND_RA_FLAG_OTHER)
1116 __connman_dhcpv6_start_info(network, dhcpv6_info_callback);
1118 connman_network_unref(network);
1121 static void autoconf_ipv6_set(struct connman_network *network)
1123 struct connman_service *service;
1124 struct connman_ipconfig *ipconfig;
1127 DBG("network %p", network);
1129 __connman_device_set_network(network->device, network);
1131 connman_device_set_disconnected(network->device, FALSE);
1133 network->connecting = FALSE;
1135 service = __connman_service_lookup_from_network(network);
1136 if (service == NULL)
1139 ipconfig = __connman_service_get_ip6config(service);
1140 if (ipconfig == NULL)
1143 index = __connman_ipconfig_get_index(ipconfig);
1145 connman_network_ref(network);
1147 /* Try to get stateless DHCPv6 information, RFC 3736 */
1148 network->router_solicit_count = 3;
1149 __connman_inet_ipv6_send_rs(index, 1, check_dhcpv6, network);
1152 static gboolean set_connected(gpointer user_data)
1154 struct connman_network *network = user_data;
1155 struct connman_service *service;
1156 struct connman_ipconfig *ipconfig_ipv4, *ipconfig_ipv6;
1157 enum connman_ipconfig_method ipv4_method, ipv6_method;
1159 service = __connman_service_lookup_from_network(network);
1161 ipconfig_ipv4 = __connman_service_get_ip4config(service);
1162 ipconfig_ipv6 = __connman_service_get_ip6config(service);
1164 DBG("service %p ipv4 %p ipv6 %p", service, ipconfig_ipv4,
1167 ipv4_method = __connman_ipconfig_get_method(ipconfig_ipv4);
1168 ipv6_method = __connman_ipconfig_get_method(ipconfig_ipv6);
1170 DBG("method ipv4 %d ipv6 %d", ipv4_method, ipv6_method);
1171 DBG("network connected %d", network->connected);
1173 if (network->connected == TRUE) {
1176 switch (ipv6_method) {
1177 case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
1178 case CONNMAN_IPCONFIG_METHOD_OFF:
1180 case CONNMAN_IPCONFIG_METHOD_DHCP:
1181 case CONNMAN_IPCONFIG_METHOD_AUTO:
1182 autoconf_ipv6_set(network);
1184 case CONNMAN_IPCONFIG_METHOD_FIXED:
1185 case CONNMAN_IPCONFIG_METHOD_MANUAL:
1186 ret = manual_ipv6_set(network, ipconfig_ipv6);
1188 connman_network_set_error(network,
1189 CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL);
1195 switch (ipv4_method) {
1196 case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
1197 case CONNMAN_IPCONFIG_METHOD_OFF:
1198 case CONNMAN_IPCONFIG_METHOD_AUTO:
1200 case CONNMAN_IPCONFIG_METHOD_FIXED:
1201 if (set_connected_fixed(network) < 0) {
1202 connman_network_set_error(network,
1203 CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL);
1207 case CONNMAN_IPCONFIG_METHOD_MANUAL:
1208 set_connected_manual(network);
1210 case CONNMAN_IPCONFIG_METHOD_DHCP:
1211 if (set_connected_dhcp(network) < 0) {
1212 connman_network_set_error(network,
1213 CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL);
1219 enum connman_service_state state;
1222 * Resetting solicit count here will prevent the RS resend loop
1223 * from sending packets in check_dhcpv6()
1225 network->router_solicit_count = 0;
1227 __connman_device_set_network(network->device, NULL);
1229 switch (ipv6_method) {
1230 case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
1231 case CONNMAN_IPCONFIG_METHOD_OFF:
1232 case CONNMAN_IPCONFIG_METHOD_FIXED:
1233 case CONNMAN_IPCONFIG_METHOD_MANUAL:
1235 case CONNMAN_IPCONFIG_METHOD_DHCP:
1236 case CONNMAN_IPCONFIG_METHOD_AUTO:
1237 release_dhcpv6(network);
1241 switch (ipv4_method) {
1242 case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
1243 case CONNMAN_IPCONFIG_METHOD_OFF:
1244 case CONNMAN_IPCONFIG_METHOD_AUTO:
1245 case CONNMAN_IPCONFIG_METHOD_FIXED:
1246 case CONNMAN_IPCONFIG_METHOD_MANUAL:
1248 case CONNMAN_IPCONFIG_METHOD_DHCP:
1249 __connman_dhcp_stop(network);
1254 * We only set the disconnect state if we were not in idle
1255 * or in failure. It does not make sense to go to disconnect
1256 * state if we were not connected.
1258 state = __connman_service_ipconfig_get_state(service,
1259 CONNMAN_IPCONFIG_TYPE_IPV4);
1260 if (state != CONNMAN_SERVICE_STATE_IDLE &&
1261 state != CONNMAN_SERVICE_STATE_FAILURE)
1262 __connman_service_ipconfig_indicate_state(service,
1263 CONNMAN_SERVICE_STATE_DISCONNECT,
1264 CONNMAN_IPCONFIG_TYPE_IPV4);
1266 state = __connman_service_ipconfig_get_state(service,
1267 CONNMAN_IPCONFIG_TYPE_IPV6);
1268 if (state != CONNMAN_SERVICE_STATE_IDLE &&
1269 state != CONNMAN_SERVICE_STATE_FAILURE)
1270 __connman_service_ipconfig_indicate_state(service,
1271 CONNMAN_SERVICE_STATE_DISCONNECT,
1272 CONNMAN_IPCONFIG_TYPE_IPV6);
1274 __connman_connection_gateway_remove(service,
1275 CONNMAN_IPCONFIG_TYPE_ALL);
1277 __connman_ipconfig_address_unset(ipconfig_ipv4);
1278 __connman_ipconfig_address_unset(ipconfig_ipv6);
1281 * Special handling for IPv6 autoconfigured address.
1282 * The simplest way to remove autoconfigured routes is to
1283 * disable IPv6 temporarily so that kernel will do the cleanup
1286 if (ipv6_method == CONNMAN_IPCONFIG_METHOD_AUTO) {
1287 __connman_ipconfig_disable_ipv6(ipconfig_ipv6);
1288 __connman_ipconfig_enable_ipv6(ipconfig_ipv6);
1291 __connman_service_ipconfig_indicate_state(service,
1292 CONNMAN_SERVICE_STATE_IDLE,
1293 CONNMAN_IPCONFIG_TYPE_IPV4);
1295 __connman_service_ipconfig_indicate_state(service,
1296 CONNMAN_SERVICE_STATE_IDLE,
1297 CONNMAN_IPCONFIG_TYPE_IPV6);
1300 network->connecting = FALSE;
1302 connman_network_set_associating(network, FALSE);
1308 * connman_network_set_connected:
1309 * @network: network structure
1310 * @connected: connected state
1312 * Change connected state of network
1314 int connman_network_set_connected(struct connman_network *network,
1315 connman_bool_t connected)
1317 DBG("network %p connected %d/%d connecting %d associating %d",
1318 network, network->connected, connected, network->connecting,
1319 network->associating);
1321 if ((network->connecting == TRUE || network->associating == TRUE) &&
1322 connected == FALSE) {
1323 connman_network_set_error(network,
1324 CONNMAN_NETWORK_ERROR_CONNECT_FAIL);
1325 __connman_network_disconnect(network);
1328 if (network->connected == connected)
1331 network->connected = connected;
1333 set_connected(network);
1339 * connman_network_get_connected:
1340 * @network: network structure
1342 * Get network connection status
1344 connman_bool_t connman_network_get_connected(struct connman_network *network)
1346 return network->connected;
1350 * connman_network_get_associating:
1351 * @network: network structure
1353 * Get network associating status
1355 connman_bool_t connman_network_get_associating(struct connman_network *network)
1357 return network->associating;
1360 int connman_network_connect_hidden(struct connman_network *network,
1361 char *identity, char* passphrase)
1363 struct connman_service *service;
1367 service = __connman_service_lookup_from_network(network);
1368 if (service == NULL)
1371 if (identity != NULL)
1372 __connman_service_set_agent_identity(service, identity);
1374 if (passphrase != NULL)
1375 __connman_service_add_passphrase(service, passphrase);
1377 return __connman_service_connect(service);
1381 * __connman_network_connect:
1382 * @network: network structure
1386 int __connman_network_connect(struct connman_network *network)
1390 DBG("network %p", network);
1392 if (network->connected == TRUE)
1395 if (network->connecting == TRUE || network->associating == TRUE)
1398 if (network->driver == NULL)
1401 if (network->driver->connect == NULL)
1404 if (network->device == NULL)
1407 network->connecting = TRUE;
1409 __connman_device_disconnect(network->device);
1411 err = network->driver->connect(network);
1413 if (err == -EINPROGRESS)
1414 connman_network_set_associating(network, TRUE);
1416 network->connecting = FALSE;
1422 network->connected = TRUE;
1423 set_connected(network);
1429 * __connman_network_disconnect:
1430 * @network: network structure
1432 * Disconnect network
1434 int __connman_network_disconnect(struct connman_network *network)
1438 DBG("network %p", network);
1440 if (network->connected == FALSE && network->connecting == FALSE &&
1441 network->associating == FALSE)
1444 if (network->driver == NULL)
1447 if (network->driver->disconnect == NULL)
1450 network->connecting = FALSE;
1452 err = network->driver->disconnect(network);
1454 connman_network_set_connected(network, FALSE);
1455 set_connected(network);
1461 static int manual_ipv4_set(struct connman_network *network,
1462 struct connman_ipconfig *ipconfig)
1464 struct connman_service *service;
1467 service = __connman_service_lookup_from_network(network);
1468 if (service == NULL)
1471 err = __connman_ipconfig_address_add(ipconfig);
1473 connman_network_set_error(network,
1474 CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
1478 return __connman_ipconfig_gateway_add(ipconfig);
1481 int __connman_network_clear_ipconfig(struct connman_network *network,
1482 struct connman_ipconfig *ipconfig)
1484 struct connman_service *service;
1485 enum connman_ipconfig_method method;
1486 enum connman_ipconfig_type type;
1488 service = __connman_service_lookup_from_network(network);
1489 if (service == NULL)
1492 method = __connman_ipconfig_get_method(ipconfig);
1493 type = __connman_ipconfig_get_config_type(ipconfig);
1496 case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
1497 case CONNMAN_IPCONFIG_METHOD_OFF:
1498 case CONNMAN_IPCONFIG_METHOD_FIXED:
1500 case CONNMAN_IPCONFIG_METHOD_AUTO:
1501 release_dhcpv6(network);
1503 case CONNMAN_IPCONFIG_METHOD_MANUAL:
1504 __connman_ipconfig_address_remove(ipconfig);
1506 case CONNMAN_IPCONFIG_METHOD_DHCP:
1507 __connman_dhcp_stop(network);
1511 if (type == CONNMAN_IPCONFIG_TYPE_IPV6)
1512 __connman_service_ipconfig_indicate_state(service,
1513 CONNMAN_SERVICE_STATE_CONFIGURATION,
1514 CONNMAN_IPCONFIG_TYPE_IPV6);
1515 else if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
1516 __connman_service_ipconfig_indicate_state(service,
1517 CONNMAN_SERVICE_STATE_CONFIGURATION,
1518 CONNMAN_IPCONFIG_TYPE_IPV4);
1523 int __connman_network_set_ipconfig(struct connman_network *network,
1524 struct connman_ipconfig *ipconfig_ipv4,
1525 struct connman_ipconfig *ipconfig_ipv6)
1527 enum connman_ipconfig_method method;
1530 if (network == NULL)
1533 if (ipconfig_ipv6) {
1534 method = __connman_ipconfig_get_method(ipconfig_ipv6);
1537 case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
1538 case CONNMAN_IPCONFIG_METHOD_OFF:
1540 case CONNMAN_IPCONFIG_METHOD_AUTO:
1541 autoconf_ipv6_set(network);
1543 case CONNMAN_IPCONFIG_METHOD_FIXED:
1544 case CONNMAN_IPCONFIG_METHOD_MANUAL:
1545 ret = manual_ipv6_set(network, ipconfig_ipv6);
1547 connman_network_set_error(network,
1548 CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL);
1552 case CONNMAN_IPCONFIG_METHOD_DHCP:
1557 if (ipconfig_ipv4) {
1558 method = __connman_ipconfig_get_method(ipconfig_ipv4);
1561 case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
1562 case CONNMAN_IPCONFIG_METHOD_OFF:
1563 case CONNMAN_IPCONFIG_METHOD_FIXED:
1564 case CONNMAN_IPCONFIG_METHOD_AUTO:
1566 case CONNMAN_IPCONFIG_METHOD_MANUAL:
1567 return manual_ipv4_set(network, ipconfig_ipv4);
1568 case CONNMAN_IPCONFIG_METHOD_DHCP:
1569 return __connman_dhcp_start(network, dhcp_callback);
1576 int connman_network_set_ipaddress(struct connman_network *network,
1577 struct connman_ipaddress *ipaddress)
1579 struct connman_service *service;
1580 struct connman_ipconfig *ipconfig = NULL;
1582 DBG("network %p", network);
1584 service = __connman_service_lookup_from_network(network);
1585 if (service == NULL)
1588 ipconfig = __connman_service_get_ipconfig(service, ipaddress->family);
1589 if (ipconfig == NULL)
1592 __connman_ipconfig_set_local(ipconfig, ipaddress->local);
1593 __connman_ipconfig_set_peer(ipconfig, ipaddress->peer);
1594 __connman_ipconfig_set_broadcast(ipconfig, ipaddress->broadcast);
1595 __connman_ipconfig_set_prefixlen(ipconfig, ipaddress->prefixlen);
1596 __connman_ipconfig_set_gateway(ipconfig, ipaddress->gateway);
1601 int connman_network_set_nameservers(struct connman_network *network,
1602 const char *nameservers)
1604 struct connman_service *service;
1605 char **nameservers_array;
1608 DBG("network %p nameservers %s", network, nameservers);
1610 service = __connman_service_lookup_from_network(network);
1611 if (service == NULL)
1614 __connman_service_nameserver_clear(service);
1616 if (nameservers == NULL)
1619 nameservers_array = g_strsplit(nameservers, " ", 0);
1621 for (i = 0; nameservers_array[i] != NULL; i++) {
1622 __connman_service_nameserver_append(service,
1623 nameservers_array[i], FALSE);
1626 g_strfreev(nameservers_array);
1631 int connman_network_set_domain(struct connman_network *network,
1634 struct connman_service *service;
1636 DBG("network %p domain %s", network, domain);
1638 service = __connman_service_lookup_from_network(network);
1639 if (service == NULL)
1642 __connman_service_set_domainname(service, domain);
1648 * connman_network_set_name:
1649 * @network: network structure
1652 * Set display name value for network
1654 int connman_network_set_name(struct connman_network *network,
1657 DBG("network %p name %s", network, name);
1659 g_free(network->name);
1660 network->name = g_strdup(name);
1666 * connman_network_set_strength:
1667 * @network: network structure
1668 * @strength: strength value
1670 * Set signal strength value for network
1673 int connman_network_set_strength(struct connman_network *network,
1674 connman_uint8_t strength)
1676 DBG("network %p strengh %d", network, strength);
1678 network->strength = strength;
1683 connman_uint8_t connman_network_get_strength(struct connman_network *network)
1685 return network->strength;
1688 int connman_network_set_frequency(struct connman_network *network,
1689 connman_uint16_t frequency)
1691 DBG("network %p frequency %d", network, frequency);
1693 network->frequency = frequency;
1698 connman_uint16_t connman_network_get_frequency(struct connman_network *network)
1700 return network->frequency;
1703 int connman_network_set_wifi_channel(struct connman_network *network,
1704 connman_uint16_t channel)
1706 DBG("network %p wifi channel %d", network, channel);
1708 network->wifi.channel = channel;
1713 connman_uint16_t connman_network_get_wifi_channel(struct connman_network *network)
1715 return network->wifi.channel;
1719 * connman_network_set_string:
1720 * @network: network structure
1721 * @key: unique identifier
1722 * @value: string value
1724 * Set string value for specific key
1726 int connman_network_set_string(struct connman_network *network,
1727 const char *key, const char *value)
1729 DBG("network %p key %s value %s", network, key, value);
1731 if (g_strcmp0(key, "Name") == 0)
1732 return connman_network_set_name(network, value);
1734 if (g_str_equal(key, "Path") == TRUE) {
1735 g_free(network->path);
1736 network->path = g_strdup(value);
1737 } else if (g_str_equal(key, "Node") == TRUE) {
1738 g_free(network->node);
1739 network->node = g_strdup(value);
1740 } else if (g_str_equal(key, "WiFi.Mode") == TRUE) {
1741 g_free(network->wifi.mode);
1742 network->wifi.mode = g_strdup(value);
1743 } else if (g_str_equal(key, "WiFi.Security") == TRUE) {
1744 g_free(network->wifi.security);
1745 network->wifi.security = g_strdup(value);
1746 } else if (g_str_equal(key, "WiFi.Passphrase") == TRUE) {
1747 g_free(network->wifi.passphrase);
1748 network->wifi.passphrase = g_strdup(value);
1749 } else if (g_str_equal(key, "WiFi.AgentPassphrase") == TRUE) {
1750 g_free(network->wifi.agent_passphrase);
1751 network->wifi.agent_passphrase = g_strdup(value);
1752 } else if (g_str_equal(key, "WiFi.EAP") == TRUE) {
1753 g_free(network->wifi.eap);
1754 network->wifi.eap = g_strdup(value);
1755 } else if (g_str_equal(key, "WiFi.Identity") == TRUE) {
1756 g_free(network->wifi.identity);
1757 network->wifi.identity = g_strdup(value);
1758 } else if (g_str_equal(key, "WiFi.AgentIdentity") == TRUE) {
1759 g_free(network->wifi.agent_identity);
1760 network->wifi.agent_identity = g_strdup(value);
1761 } else if (g_str_equal(key, "WiFi.CACertFile") == TRUE) {
1762 g_free(network->wifi.ca_cert_path);
1763 network->wifi.ca_cert_path = g_strdup(value);
1764 } else if (g_str_equal(key, "WiFi.ClientCertFile") == TRUE) {
1765 g_free(network->wifi.client_cert_path);
1766 network->wifi.client_cert_path = g_strdup(value);
1767 } else if (g_str_equal(key, "WiFi.PrivateKeyFile") == TRUE) {
1768 g_free(network->wifi.private_key_path);
1769 network->wifi.private_key_path = g_strdup(value);
1770 } else if (g_str_equal(key, "WiFi.PrivateKeyPassphrase") == TRUE) {
1771 g_free(network->wifi.private_key_passphrase);
1772 network->wifi.private_key_passphrase = g_strdup(value);
1773 } else if (g_str_equal(key, "WiFi.Phase2") == TRUE) {
1774 g_free(network->wifi.phase2_auth);
1775 network->wifi.phase2_auth = g_strdup(value);
1776 } else if (g_str_equal(key, "WiFi.PinWPS") == TRUE) {
1777 g_free(network->wifi.pin_wps);
1778 network->wifi.pin_wps = g_strdup(value);
1787 * connman_network_get_string:
1788 * @network: network structure
1789 * @key: unique identifier
1791 * Get string value for specific key
1793 const char *connman_network_get_string(struct connman_network *network,
1796 DBG("network %p key %s", network, key);
1798 if (g_str_equal(key, "Path") == TRUE)
1799 return network->path;
1800 else if (g_str_equal(key, "Name") == TRUE)
1801 return network->name;
1802 else if (g_str_equal(key, "Node") == TRUE)
1803 return network->node;
1804 else if (g_str_equal(key, "WiFi.Mode") == TRUE)
1805 return network->wifi.mode;
1806 else if (g_str_equal(key, "WiFi.Security") == TRUE)
1807 return network->wifi.security;
1808 else if (g_str_equal(key, "WiFi.Passphrase") == TRUE)
1809 return network->wifi.passphrase;
1810 else if (g_str_equal(key, "WiFi.AgentPassphrase") == TRUE)
1811 return network->wifi.agent_passphrase;
1812 else if (g_str_equal(key, "WiFi.EAP") == TRUE)
1813 return network->wifi.eap;
1814 else if (g_str_equal(key, "WiFi.Identity") == TRUE)
1815 return network->wifi.identity;
1816 else if (g_str_equal(key, "WiFi.AgentIdentity") == TRUE)
1817 return network->wifi.agent_identity;
1818 else if (g_str_equal(key, "WiFi.CACertFile") == TRUE)
1819 return network->wifi.ca_cert_path;
1820 else if (g_str_equal(key, "WiFi.ClientCertFile") == TRUE)
1821 return network->wifi.client_cert_path;
1822 else if (g_str_equal(key, "WiFi.PrivateKeyFile") == TRUE)
1823 return network->wifi.private_key_path;
1824 else if (g_str_equal(key, "WiFi.PrivateKeyPassphrase") == TRUE)
1825 return network->wifi.private_key_passphrase;
1826 else if (g_str_equal(key, "WiFi.Phase2") == TRUE)
1827 return network->wifi.phase2_auth;
1828 else if (g_str_equal(key, "WiFi.PinWPS") == TRUE)
1829 return network->wifi.pin_wps;
1835 * connman_network_set_bool:
1836 * @network: network structure
1837 * @key: unique identifier
1838 * @value: boolean value
1840 * Set boolean value for specific key
1842 int connman_network_set_bool(struct connman_network *network,
1843 const char *key, connman_bool_t value)
1845 DBG("network %p key %s value %d", network, key, value);
1847 if (g_strcmp0(key, "Roaming") == 0)
1848 network->roaming = value;
1849 else if (g_strcmp0(key, "WiFi.WPS") == 0)
1850 network->wifi.wps = value;
1851 else if (g_strcmp0(key, "WiFi.UseWPS") == 0)
1852 network->wifi.use_wps = value;
1858 * connman_network_get_bool:
1859 * @network: network structure
1860 * @key: unique identifier
1862 * Get boolean value for specific key
1864 connman_bool_t connman_network_get_bool(struct connman_network *network,
1867 DBG("network %p key %s", network, key);
1869 if (g_str_equal(key, "Roaming") == TRUE)
1870 return network->roaming;
1871 else if (g_str_equal(key, "WiFi.WPS") == TRUE)
1872 return network->wifi.wps;
1873 else if (g_str_equal(key, "WiFi.UseWPS") == TRUE)
1874 return network->wifi.use_wps;
1880 * connman_network_set_blob:
1881 * @network: network structure
1882 * @key: unique identifier
1886 * Set binary blob value for specific key
1888 int connman_network_set_blob(struct connman_network *network,
1889 const char *key, const void *data, unsigned int size)
1891 DBG("network %p key %s size %d", network, key, size);
1893 if (g_str_equal(key, "WiFi.SSID") == TRUE) {
1894 g_free(network->wifi.ssid);
1895 network->wifi.ssid = g_try_malloc(size);
1896 if (network->wifi.ssid != NULL) {
1897 memcpy(network->wifi.ssid, data, size);
1898 network->wifi.ssid_len = size;
1900 network->wifi.ssid_len = 0;
1909 * connman_network_get_blob:
1910 * @network: network structure
1911 * @key: unique identifier
1912 * @size: pointer to blob size
1914 * Get binary blob value for specific key
1916 const void *connman_network_get_blob(struct connman_network *network,
1917 const char *key, unsigned int *size)
1919 DBG("network %p key %s", network, key);
1921 if (g_str_equal(key, "WiFi.SSID") == TRUE) {
1923 *size = network->wifi.ssid_len;
1924 return network->wifi.ssid;
1930 void __connman_network_set_device(struct connman_network *network,
1931 struct connman_device *device)
1933 if (network->device == device)
1936 if (network->device != NULL)
1937 network_remove(network);
1939 network->device = device;
1941 if (network->device != NULL)
1942 network_probe(network);
1946 * connman_network_get_device:
1947 * @network: network structure
1949 * Get parent device of network
1951 struct connman_device *connman_network_get_device(struct connman_network *network)
1953 return network->device;
1957 * connman_network_get_data:
1958 * @network: network structure
1960 * Get private network data pointer
1962 void *connman_network_get_data(struct connman_network *network)
1964 return network->driver_data;
1968 * connman_network_set_data:
1969 * @network: network structure
1970 * @data: data pointer
1972 * Set private network data pointer
1974 void connman_network_set_data(struct connman_network *network, void *data)
1976 network->driver_data = data;
1979 void connman_network_update(struct connman_network *network)
1981 switch (network->type) {
1982 case CONNMAN_NETWORK_TYPE_UNKNOWN:
1983 case CONNMAN_NETWORK_TYPE_VENDOR:
1985 case CONNMAN_NETWORK_TYPE_ETHERNET:
1986 case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
1987 case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
1988 case CONNMAN_NETWORK_TYPE_CELLULAR:
1989 case CONNMAN_NETWORK_TYPE_WIFI:
1990 case CONNMAN_NETWORK_TYPE_WIMAX:
1994 if (network->group != NULL)
1995 __connman_service_update_from_network(network);
1998 int __connman_network_init(void)
2005 void __connman_network_cleanup(void)