*/
#define RS_REFRESH_TIMEOUT 3
+#if defined TIZEN_EXT
+#define WIFI_ENCYPTION_MODE_LEN_MAX 6
+#define WIFI_BSSID_LEN_MAX 6
+#endif
+
+/*
+ * As per RFC 4861, a host should transmit up to MAX_RTR_SOLICITATIONS(3)
+ * Router Solicitation messages, each separated by at least
+ * RTR_SOLICITATION_INTERVAL(4) seconds to obtain RA for IPv6 auto-configuration.
+ */
+#define RTR_SOLICITATION_INTERVAL 4
+
static GSList *network_list = NULL;
static GSList *driver_list = NULL;
char *passphrase;
char *eap;
char *identity;
+ char *anonymous_identity;
char *agent_identity;
char *ca_cert_path;
+ char *subject_match;
+ char *altsubject_match;
+ char *domain_suffix_match;
+ char *domain_match;
char *client_cert_path;
char *private_key_path;
char *private_key_passphrase;
bool wps;
bool use_wps;
char *pin_wps;
+#if defined TIZEN_EXT
+ char encryption_mode[WIFI_ENCYPTION_MODE_LEN_MAX];
+ unsigned char bssid[WIFI_BSSID_LEN_MAX];
+ unsigned int maxrate;
+ int maxspeed;
+ bool isHS20AP;
+ unsigned int keymgmt;
+ char *keymgmt_type;
+ bool rsn_mode;
+ int disconnect_reason;
+ int assoc_status_code;
+ GSList *vsie_list;
+ /*
+ * Only for EAP-FAST
+ */
+ char *phase1;
+ unsigned char country_code[WIFI_COUNTRY_CODE_LEN];
+ GSList *bssid_list;
+ ieee80211_modes_e phy_mode;
+ connection_mode_e connection_mode;
+#endif
} wifi;
+#if defined TIZEN_EXT
+ /* Multiple APN services and a default APN which a user selected */
+ bool default_internet;
+#endif
+
};
static const char *type2string(enum connman_network_type type)
__connman_device_set_network(network->device, network);
- connman_device_set_disconnected(network->device, false);
-
service = connman_service_lookup_from_network(network);
__connman_service_ipconfig_indicate_state(service,
CONNMAN_SERVICE_STATE_CONFIGURATION,
if (!service)
goto err;
- connman_network_set_associating(network, false);
-
- network->connecting = false;
-
ipconfig_ipv4 = __connman_service_get_ip4config(service);
DBG("lease acquired for ipconfig %p", ipconfig_ipv4);
if (err < 0)
goto err;
+#if defined TIZEN_EXT
+ err = __connman_ipconfig_gateway_add(ipconfig_ipv4, service);
+#else
err = __connman_ipconfig_gateway_add(ipconfig_ipv4);
+#endif
if (err < 0)
goto err;
+ __connman_service_save(service);
+
return;
err:
if (!service)
return;
- connman_network_set_associating(network, false);
- network->connecting = false;
-
ipconfig_ipv4 = __connman_service_get_ip4config(service);
DBG("lease lost for ipconfig %p", ipconfig_ipv4);
struct connman_network *network,
bool success, gpointer data)
{
+ network->connecting = false;
+
if (success)
dhcp_success(network);
else
dhcp_failure(network);
}
-static int set_connected_fixed(struct connman_network *network)
-{
- struct connman_service *service;
- struct connman_ipconfig *ipconfig_ipv4;
- int err;
-
- DBG("");
-
- service = connman_service_lookup_from_network(network);
-
- ipconfig_ipv4 = __connman_service_get_ip4config(service);
-
- set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
-
- network->connecting = false;
-
- connman_network_set_associating(network, false);
-
- err = __connman_ipconfig_address_add(ipconfig_ipv4);
- if (err < 0)
- goto err;
-
- err = __connman_ipconfig_gateway_add(ipconfig_ipv4);
- if (err < 0)
- goto err;
-
- return 0;
-
-err:
- connman_network_set_error(network,
- CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
-
- return err;
-}
-
-static void set_connected_manual(struct connman_network *network)
+static int set_connected_manual(struct connman_network *network)
{
+ int err = 0;
struct connman_service *service;
struct connman_ipconfig *ipconfig;
- int err;
DBG("network %p", network);
- service = connman_service_lookup_from_network(network);
+ network->connecting = false;
+ service = connman_service_lookup_from_network(network);
ipconfig = __connman_service_get_ip4config(service);
+ __connman_ipconfig_enable(ipconfig);
if (!__connman_ipconfig_get_local(ipconfig))
__connman_service_read_ip4config(service);
- set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
-
err = __connman_ipconfig_address_add(ipconfig);
if (err < 0)
goto err;
+#if defined TIZEN_EXT
+ err = __connman_ipconfig_gateway_add(ipconfig, service);
+#else
err = __connman_ipconfig_gateway_add(ipconfig);
+#endif
if (err < 0)
goto err;
- network->connecting = false;
-
- connman_network_set_associating(network, false);
-
- return;
-
err:
- connman_network_set_error(network,
- CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
- return;
+ return err;
}
static int set_connected_dhcp(struct connman_network *network)
DBG("network %p", network);
- set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
-
service = connman_service_lookup_from_network(network);
ipconfig_ipv4 = __connman_service_get_ip4config(service);
+ __connman_ipconfig_enable(ipconfig_ipv4);
err = __connman_dhcp_start(ipconfig_ipv4, network,
dhcp_callback, NULL);
return err;
}
+#if defined TIZEN_EXT
+ err = __connman_ipconfig_gateway_add(ipconfig_ipv6, service);
+#else
err = __connman_ipconfig_gateway_add(ipconfig_ipv6);
+#endif
if (err < 0)
return err;
- __connman_connection_gateway_activate(service,
- CONNMAN_IPCONFIG_TYPE_IPV6);
-
__connman_device_set_network(network->device, network);
- connman_device_set_disconnected(network->device, false);
+ connman_network_set_associating(network, false);
network->connecting = false;
static void stop_dhcpv6(struct connman_network *network)
{
+ network->connecting = false;
+
__connman_dhcpv6_stop(network);
}
if (!service)
goto err;
- connman_network_set_associating(network, false);
-
network->connecting = false;
ipconfig_ipv6 = __connman_service_get_ip6config(service);
if (err < 0)
goto err;
- err = __connman_ipconfig_gateway_add(ipconfig_ipv6);
- if (err < 0)
- goto err;
-
return 0;
err:
DBG("re-send router solicitation %d",
network->router_solicit_count);
network->router_solicit_count--;
- __connman_inet_ipv6_send_rs(network->index, 1,
+ __connman_inet_ipv6_send_rs(network->index, RTR_SOLICITATION_INTERVAL,
check_dhcpv6, network);
return;
}
+#if defined TIZEN_EXT
+ DBG("RA message is not received from server in reply of RS.");
+#endif
connman_network_unref(network);
return;
}
*/
if (!network->connected) {
connman_network_unref(network);
+#if defined TIZEN_EXT
+ DBG("Network is not connected");
+#endif
return;
}
if (service) {
connman_service_create_ip6config(service, network->index);
+ connman_network_set_associating(network, false);
+
__connman_service_ipconfig_indicate_state(service,
CONNMAN_SERVICE_STATE_CONFIGURATION,
CONNMAN_IPCONFIG_TYPE_IPV6);
/*
* We do stateful/stateless DHCPv6 if router advertisement says so.
*/
- if (reply->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED)
+ if (reply->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED) {
+#if defined TIZEN_EXT
+ DBG("IPv6 ND_RA_FLAG_MANAGED");
+#endif
__connman_dhcpv6_start(network, prefixes, dhcpv6_callback);
- else if (reply->nd_ra_flags_reserved & ND_RA_FLAG_OTHER)
- __connman_dhcpv6_start_info(network, dhcpv6_info_callback);
+ } else {
+ if (reply->nd_ra_flags_reserved & ND_RA_FLAG_OTHER)
+#if defined TIZEN_EXT
+ {
+ DBG("IPv6 ND_RA_FLAG_OTHER");
+#endif
+ __connman_dhcpv6_start_info(network,
+ dhcpv6_info_callback);
+#if defined TIZEN_EXT
+ }
+#endif
+
+ g_slist_free_full(prefixes, g_free);
+ network->connecting = false;
+ }
connman_network_unref(network);
}
__connman_device_set_network(network->device, network);
- connman_device_set_disconnected(network->device, false);
-
- network->connecting = false;
+#if defined TIZEN_EXT
+ if(network->type == CONNMAN_NETWORK_TYPE_CELLULAR)
+ return;
+#endif
service = connman_service_lookup_from_network(network);
if (!service)
if (!ipconfig)
return;
+ __connman_ipconfig_enable(ipconfig);
+
+ __connman_ipconfig_enable_ipv6(ipconfig);
+
__connman_ipconfig_address_remove(ipconfig);
index = __connman_ipconfig_get_index(ipconfig);
/* Try to get stateless DHCPv6 information, RFC 3736 */
network->router_solicit_count = 3;
- __connman_inet_ipv6_send_rs(index, 1, check_dhcpv6, network);
+ __connman_inet_ipv6_send_rs(index, RTR_SOLICITATION_INTERVAL,
+ check_dhcpv6, network);
}
static void set_connected(struct connman_network *network)
{
struct connman_ipconfig *ipconfig_ipv4, *ipconfig_ipv6;
- enum connman_ipconfig_method ipv4_method, ipv6_method;
struct connman_service *service;
- int ret;
if (network->connected)
return;
+ connman_network_set_associating(network, false);
+
network->connected = true;
service = connman_service_lookup_from_network(network);
DBG("service %p ipv4 %p ipv6 %p", service, ipconfig_ipv4,
ipconfig_ipv6);
- ipv4_method = __connman_ipconfig_get_method(ipconfig_ipv4);
- ipv6_method = __connman_ipconfig_get_method(ipconfig_ipv6);
-
- DBG("method ipv4 %d ipv6 %d", ipv4_method, ipv6_method);
-
- switch (ipv6_method) {
- case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
- case CONNMAN_IPCONFIG_METHOD_OFF:
- break;
- case CONNMAN_IPCONFIG_METHOD_DHCP:
- case CONNMAN_IPCONFIG_METHOD_AUTO:
- autoconf_ipv6_set(network);
- break;
- case CONNMAN_IPCONFIG_METHOD_FIXED:
- case CONNMAN_IPCONFIG_METHOD_MANUAL:
- ret = manual_ipv6_set(network, ipconfig_ipv6);
- if (ret != 0) {
- connman_network_set_error(network,
- CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL);
- return;
- }
- break;
- }
-
- switch (ipv4_method) {
- case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
- case CONNMAN_IPCONFIG_METHOD_OFF:
- case CONNMAN_IPCONFIG_METHOD_AUTO:
- return;
- case CONNMAN_IPCONFIG_METHOD_FIXED:
- if (set_connected_fixed(network) < 0) {
- connman_network_set_error(network,
- CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL);
- return;
- }
- return;
- case CONNMAN_IPCONFIG_METHOD_MANUAL:
- set_connected_manual(network);
- return;
- case CONNMAN_IPCONFIG_METHOD_DHCP:
- if (set_connected_dhcp(network) < 0) {
- connman_network_set_error(network,
- CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL);
- return;
- }
- }
-
- network->connecting = false;
-
- connman_network_set_associating(network, false);
+ __connman_network_enable_ipconfig(network, ipconfig_ipv4);
+ __connman_network_enable_ipconfig(network, ipconfig_ipv6);
}
static void set_disconnected(struct connman_network *network)
switch (ipv4_method) {
case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
case CONNMAN_IPCONFIG_METHOD_OFF:
- case CONNMAN_IPCONFIG_METHOD_AUTO:
case CONNMAN_IPCONFIG_METHOD_FIXED:
case CONNMAN_IPCONFIG_METHOD_MANUAL:
break;
+ case CONNMAN_IPCONFIG_METHOD_AUTO:
+ /*
+ * If the current method is AUTO then next time we
+ * try first DHCP. DHCP also needs to be stopped
+ * in this case because if we fell in AUTO means
+ * that DHCP was launched for IPv4 but it failed.
+ */
+ __connman_ipconfig_set_method(ipconfig_ipv4,
+ CONNMAN_IPCONFIG_METHOD_DHCP);
+ __connman_service_notify_ipv4_configuration(service);
+ /* fall through */
case CONNMAN_IPCONFIG_METHOD_DHCP:
__connman_dhcp_stop(ipconfig_ipv4);
break;
CONNMAN_IPCONFIG_TYPE_IPV6);
if (network->connected) {
+#if defined TIZEN_EXT
+ /**
+ * Do not remove gateway and its address,
+ * if there are connected profiles that use same interface (multiple PDN)
+ */
+ if (connman_service_get_type(service) != CONNMAN_SERVICE_TYPE_CELLULAR ||
+ __connman_service_get_connected_count_of_iface(service) <= 0) {
+#endif
__connman_connection_gateway_remove(service,
CONNMAN_IPCONFIG_TYPE_ALL);
__connman_ipconfig_address_unset(ipconfig_ipv4);
__connman_ipconfig_address_unset(ipconfig_ipv6);
-
+#if defined TIZEN_EXT
+ }
+#endif
/*
* Special handling for IPv6 autoconfigured address.
* The simplest way to remove autoconfigured routes is to
network->driver = NULL;
}
-static void network_change(struct connman_network *network)
-{
- DBG("network %p name %s", network, network->name);
-
- if (!network->connected)
- return;
-
- connman_device_set_disconnected(network->device, true);
-
- if (network->driver && network->driver->disconnect) {
- network->driver->disconnect(network);
- return;
- }
-
- network->connected = false;
-}
-
static void probe_driver(struct connman_network_driver *driver)
{
GSList *list;
}
}
-static void remove_driver(struct connman_network_driver *driver)
-{
- GSList *list;
-
- DBG("driver %p name %s", driver, driver->name);
-
- for (list = network_list; list; list = list->next) {
- struct connman_network *network = list->data;
-
- if (network->driver == driver)
- network_remove(network);
- }
-}
-
static gint compare_priority(gconstpointer a, gconstpointer b)
{
const struct connman_network_driver *driver1 = a;
*/
void connman_network_driver_unregister(struct connman_network_driver *driver)
{
+ GSList *list;
+
DBG("driver %p name %s", driver, driver->name);
driver_list = g_slist_remove(driver_list, driver);
- remove_driver(driver);
+ for (list = network_list; list; list = list->next) {
+ struct connman_network *network = list->data;
+
+ if (network->driver == driver)
+ network_remove(network);
+ }
}
static void network_destruct(struct connman_network *network)
g_free(network->wifi.passphrase);
g_free(network->wifi.eap);
g_free(network->wifi.identity);
+ g_free(network->wifi.anonymous_identity);
g_free(network->wifi.agent_identity);
g_free(network->wifi.ca_cert_path);
+ g_free(network->wifi.subject_match);
+ g_free(network->wifi.altsubject_match);
+ g_free(network->wifi.domain_suffix_match);
+ g_free(network->wifi.domain_match);
g_free(network->wifi.client_cert_path);
g_free(network->wifi.private_key_path);
g_free(network->wifi.private_key_passphrase);
g_free(network->wifi.phase2_auth);
g_free(network->wifi.pin_wps);
-
+#if defined TIZEN_EXT
+ g_slist_free_full(network->wifi.vsie_list, g_free);
+ g_slist_free_full(network->wifi.bssid_list, g_free);
+#endif
g_free(network->path);
g_free(network->group);
g_free(network->node);
struct connman_network *network;
char *ident;
- DBG("identifier %s type %d", identifier, type);
-
network = g_try_new0(struct connman_network, 1);
if (!network)
return NULL;
- DBG("network %p", network);
-
network->refcount = 1;
ident = g_strdup(identifier);
network_list = g_slist_prepend(network_list, network);
+ DBG("network %p identifier %s type %s", network, identifier,
+ type2string(type));
return network;
}
goto done;
ipconfig = __connman_service_get_ip4config(service);
- if (!ipconfig)
- goto done;
+ if (ipconfig) {
+ __connman_ipconfig_set_index(ipconfig, index);
+
+ DBG("index %d service %p ip4config %p", network->index,
+ service, ipconfig);
+ }
+
+ ipconfig = __connman_service_get_ip6config(service);
+ if (ipconfig) {
+ __connman_ipconfig_set_index(ipconfig, index);
- /* If index changed, the index of ipconfig must be reset. */
- __connman_ipconfig_set_index(ipconfig, index);
+ DBG("index %d service %p ip6config %p", network->index,
+ service, ipconfig);
+ }
- DBG("index %d service %p ip4config %p", network->index,
- service, ipconfig);
done:
network->index = index;
}
return false;
}
+#if defined TIZEN_EXT
+void connman_network_set_connecting(struct connman_network *network)
+{
+ DBG("set network connecting true");
+ network->connecting = TRUE;
+ return;
+}
+#endif
+
bool connman_network_get_connecting(struct connman_network *network)
{
return network->connecting;
int connman_network_set_available(struct connman_network *network,
bool available)
{
+#if !defined TIZEN_EXT
DBG("network %p available %d", network, available);
+#endif
if (network->available == available)
return -EALREADY;
return network->available;
}
-/**
- * connman_network_set_associating:
- * @network: network structure
- * @associating: associating state
- *
- * Change associating state of network
- */
-int connman_network_set_associating(struct connman_network *network,
- bool associating)
+#if defined TIZEN_EXT
+void connman_network_clear_associating(struct connman_network *network)
{
- DBG("network %p associating %d", network, associating);
+ struct connman_service *service;
+ enum connman_service_state state;
- if (network->associating == associating)
- return -EALREADY;
+ DBG("network %p", network);
- network->associating = associating;
+ network->connecting = FALSE;
+ network->associating = FALSE;
- if (associating) {
- struct connman_service *service;
+ service = connman_service_lookup_from_network(network);
+ if (!service)
+ return;
- service = connman_service_lookup_from_network(network);
+ state = __connman_service_ipconfig_get_state(service,
+ CONNMAN_IPCONFIG_TYPE_IPV4);
+ if (state != CONNMAN_SERVICE_STATE_IDLE &&
+ state != CONNMAN_SERVICE_STATE_FAILURE)
__connman_service_ipconfig_indicate_state(service,
- CONNMAN_SERVICE_STATE_ASSOCIATION,
+ CONNMAN_SERVICE_STATE_DISCONNECT,
CONNMAN_IPCONFIG_TYPE_IPV4);
+
+ state = __connman_service_ipconfig_get_state(service,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
+ if (state != CONNMAN_SERVICE_STATE_IDLE &&
+ state != CONNMAN_SERVICE_STATE_FAILURE)
__connman_service_ipconfig_indicate_state(service,
- CONNMAN_SERVICE_STATE_ASSOCIATION,
+ CONNMAN_SERVICE_STATE_DISCONNECT,
CONNMAN_IPCONFIG_TYPE_IPV6);
- }
- return 0;
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_IDLE,
+ CONNMAN_IPCONFIG_TYPE_IPV4);
+
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_IDLE,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
}
-static void set_associate_error(struct connman_network *network)
+static gboolean __connman_network_clear_associating_delayed(gpointer user_data)
{
+ GSList *list;
+ gboolean found = FALSE;
+ enum connman_service_state state_ipv4;
+ enum connman_service_state state_ipv6;
struct connman_service *service;
+ struct connman_network *network = (struct connman_network *)user_data;
- service = connman_service_lookup_from_network(network);
+ for (list = network_list; list != NULL; list = list->next) {
+ struct connman_network *item = list->data;
- __connman_service_indicate_error(service,
- CONNMAN_SERVICE_ERROR_CONNECT_FAILED);
-}
+ if (item == network) {
+ found = TRUE;
+ break;
+ }
+ }
-static void set_configure_error(struct connman_network *network)
-{
- struct connman_service *service;
+ if (found != TRUE)
+ return FALSE;
+ DBG("network %p name %s", network, network->name);
service = connman_service_lookup_from_network(network);
- __connman_service_indicate_error(service,
+ state_ipv4 = __connman_service_ipconfig_get_state(service,
+ CONNMAN_IPCONFIG_TYPE_IPV4);
+ state_ipv6 = __connman_service_ipconfig_get_state(service,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
+
+ DBG("service %p state %d/%d", service, state_ipv4, state_ipv6);
+
+ if (network->associating == FALSE &&
+ state_ipv4 == CONNMAN_SERVICE_STATE_ASSOCIATION &&
+ state_ipv6 == CONNMAN_SERVICE_STATE_ASSOCIATION) {
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_IDLE,
+ CONNMAN_IPCONFIG_TYPE_IPV4);
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_IDLE,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
+ } else {
+ if (network->associating == FALSE) {
+ struct connman_ipconfig *ipconfig_ipv4, *ipconfig_ipv6;
+ enum connman_ipconfig_method ipv4_method, ipv6_method;
+
+ ipconfig_ipv4 = __connman_service_get_ip4config(service);
+ ipv4_method = __connman_ipconfig_get_method(ipconfig_ipv4);
+ ipconfig_ipv6 = __connman_service_get_ip4config(service);
+ ipv6_method = __connman_ipconfig_get_method(ipconfig_ipv6);
+
+ if((ipv4_method == CONNMAN_IPCONFIG_METHOD_UNKNOWN || ipv4_method == CONNMAN_IPCONFIG_METHOD_OFF) &&
+ (state_ipv6 == CONNMAN_SERVICE_STATE_ASSOCIATION))
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_IDLE,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
+ if((ipv6_method == CONNMAN_IPCONFIG_METHOD_UNKNOWN || ipv6_method == CONNMAN_IPCONFIG_METHOD_OFF) &&
+ (state_ipv4 == CONNMAN_SERVICE_STATE_ASSOCIATION))
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_IDLE,
+ CONNMAN_IPCONFIG_TYPE_IPV4);
+ }
+ }
+
+ return FALSE;
+}
+#endif
+
+/**
+ * connman_network_set_associating:
+ * @network: network structure
+ * @associating: associating state
+ *
+ * Change associating state of network
+ */
+int connman_network_set_associating(struct connman_network *network,
+ bool associating)
+{
+ DBG("network %p associating %d", network, associating);
+
+ if (network->associating == associating)
+ return -EALREADY;
+
+ network->associating = associating;
+
+ if (associating) {
+ struct connman_service *service;
+
+ service = connman_service_lookup_from_network(network);
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_ASSOCIATION,
+ CONNMAN_IPCONFIG_TYPE_IPV4);
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_ASSOCIATION,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
+ }
+
+#if defined TIZEN_EXT
+ if (associating == FALSE &&
+ connman_network_get_bool(network, "WiFi.UseWPS") == FALSE)
+ g_timeout_add_seconds(1,
+ __connman_network_clear_associating_delayed,
+ network);
+#endif
+
+ return 0;
+}
+
+static void set_associate_error(struct connman_network *network)
+{
+ struct connman_service *service;
+
+ service = connman_service_lookup_from_network(network);
+
+#if defined TIZEN_EXT
+ __connman_service_indicate_error(service,
+ CONNMAN_SERVICE_ERROR_AUTH_FAILED);
+#else
+ __connman_service_indicate_error(service,
+ CONNMAN_SERVICE_ERROR_CONNECT_FAILED);
+#endif
+}
+
+static void set_configure_error(struct connman_network *network)
+{
+ struct connman_service *service;
+
+ service = connman_service_lookup_from_network(network);
+
+ __connman_service_indicate_error(service,
CONNMAN_SERVICE_ERROR_CONNECT_FAILED);
}
service = connman_service_lookup_from_network(network);
+#if defined TIZEN_EXT
+ if (service)
+ __connman_service_set_favorite(service, false);
+#endif
__connman_service_indicate_error(service,
CONNMAN_SERVICE_ERROR_INVALID_KEY);
}
CONNMAN_SERVICE_ERROR_CONNECT_FAILED);
}
+static void set_blocked_error(struct connman_network *network)
+{
+ struct connman_service *service;
+
+ service = connman_service_lookup_from_network(network);
+
+ __connman_service_indicate_error(service,
+ CONNMAN_SERVICE_ERROR_BLOCKED);
+}
+
+
+#if defined TIZEN_EXT
+static void set_dhcp_error(struct connman_network *network)
+{
+ struct connman_service *service;
+
+ if (network->associating != FALSE)
+ network->associating = FALSE;
+
+ service = connman_service_lookup_from_network(network);
+
+ __connman_service_indicate_error(service,
+ CONNMAN_SERVICE_ERROR_DHCP_FAILED);
+}
+#endif
+
void connman_network_set_ipv4_method(struct connman_network *network,
enum connman_ipconfig_method method)
{
{
DBG("network %p error %d", network, error);
- network->connecting = false;
- network->associating = false;
-
switch (error) {
case CONNMAN_NETWORK_ERROR_UNKNOWN:
return;
case CONNMAN_NETWORK_ERROR_CONNECT_FAIL:
set_connect_error(network);
break;
+#if defined TIZEN_EXT
+ case CONNMAN_NETWORK_ERROR_DHCP_FAIL:
+ set_dhcp_error(network);
+ break;
+#endif
+
+ case CONNMAN_NETWORK_ERROR_BLOCKED:
+ set_blocked_error(network);
+ break;
+
}
- network_change(network);
+ __connman_network_disconnect(network);
}
/**
!connected) {
connman_network_set_error(network,
CONNMAN_NETWORK_ERROR_CONNECT_FAIL);
- if (__connman_network_disconnect(network) == 0)
- return 0;
+ return 0;
}
if (network->connected == connected)
network->connecting = true;
+#if defined TIZEN_EXT
+ if (network->type != CONNMAN_NETWORK_TYPE_CELLULAR)
+#endif
__connman_device_disconnect(network->device);
-
+#if defined TIZEN_EXT
+ DBG("ConnMan, Connect Request [%s]", network->name);
+#endif
err = network->driver->connect(network);
if (err < 0) {
- if (err == -EINPROGRESS)
+ if (err == -EINPROGRESS) {
+#if defined TIZEN_EXT
+ if (network->type != CONNMAN_NETWORK_TYPE_CELLULAR)
+#endif
connman_network_set_associating(network, true);
- else
+ } else
network->connecting = false;
return err;
return -EUNATCH;
network->connecting = false;
-
+#if defined TIZEN_EXT
+ DBG("ConnMan, Disconnect request");
+#endif
if (network->driver->disconnect)
err = network->driver->disconnect(network);
return err;
}
-static int manual_ipv4_set(struct connman_network *network,
- struct connman_ipconfig *ipconfig)
-{
- struct connman_service *service;
- int err;
-
- service = connman_service_lookup_from_network(network);
- if (!service)
- return -EINVAL;
-
- err = __connman_ipconfig_address_add(ipconfig);
- if (err < 0) {
- connman_network_set_error(network,
- CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
- return err;
- }
-
- return __connman_ipconfig_gateway_add(ipconfig);
-}
-
int __connman_network_clear_ipconfig(struct connman_network *network,
struct connman_ipconfig *ipconfig)
{
return 0;
}
-int __connman_network_set_ipconfig(struct connman_network *network,
- struct connman_ipconfig *ipconfig_ipv4,
- struct connman_ipconfig *ipconfig_ipv6)
+#if defined TIZEN_EXT
+void __connman_network_set_auto_ipv6_gateway(char *gateway, void *user_data)
+{
+ DBG("");
+
+ struct connman_network *network = user_data;
+ struct connman_service *service;
+ struct connman_ipconfig *ipconfig = NULL;
+
+ service = connman_service_lookup_from_network(network);
+ if (service == NULL)
+ return;
+
+ ipconfig = __connman_service_get_ipconfig(service, AF_INET6);
+ if (ipconfig == NULL)
+ return;
+
+ __connman_ipconfig_set_gateway(ipconfig, gateway);
+
+ return;
+}
+#endif
+
+int __connman_network_enable_ipconfig(struct connman_network *network,
+ struct connman_ipconfig *ipconfig)
{
+ int r = 0;
+ enum connman_ipconfig_type type;
enum connman_ipconfig_method method;
- int ret;
+#if defined TIZEN_EXT
+ struct connman_service *service;
+#endif
- if (!network)
+ if (!network || !ipconfig)
return -EINVAL;
- if (ipconfig_ipv6) {
- method = __connman_ipconfig_get_method(ipconfig_ipv6);
+ type = __connman_ipconfig_get_config_type(ipconfig);
+
+ switch (type) {
+ case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
+ case CONNMAN_IPCONFIG_TYPE_ALL:
+ return -ENOSYS;
+
+ case CONNMAN_IPCONFIG_TYPE_IPV6:
+ set_configuration(network, type);
+
+ method = __connman_ipconfig_get_method(ipconfig);
+
+ DBG("ipv6 ipconfig method %d", method);
switch (method) {
case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
+ break;
+
case CONNMAN_IPCONFIG_METHOD_OFF:
+ __connman_ipconfig_disable_ipv6(ipconfig);
break;
+
case CONNMAN_IPCONFIG_METHOD_AUTO:
+#if defined TIZEN_EXT
+ service = connman_service_lookup_from_network(network);
+
+ if(network->type == CONNMAN_NETWORK_TYPE_CELLULAR)
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_CONFIGURATION,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
+#endif
autoconf_ipv6_set(network);
break;
+
case CONNMAN_IPCONFIG_METHOD_FIXED:
case CONNMAN_IPCONFIG_METHOD_MANUAL:
- ret = manual_ipv6_set(network, ipconfig_ipv6);
- if (ret != 0) {
- connman_network_set_error(network,
- CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL);
- return ret;
- }
+ r = manual_ipv6_set(network, ipconfig);
break;
+
case CONNMAN_IPCONFIG_METHOD_DHCP:
+ r = -ENOSYS;
break;
}
- }
- if (ipconfig_ipv4) {
- method = __connman_ipconfig_get_method(ipconfig_ipv4);
+ break;
+
+ case CONNMAN_IPCONFIG_TYPE_IPV4:
+ set_configuration(network, type);
+
+ method = __connman_ipconfig_get_method(ipconfig);
+
+ DBG("ipv4 ipconfig method %d", method);
switch (method) {
case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
case CONNMAN_IPCONFIG_METHOD_OFF:
- case CONNMAN_IPCONFIG_METHOD_FIXED:
+ break;
+
case CONNMAN_IPCONFIG_METHOD_AUTO:
- return -EINVAL;
+ r = -ENOSYS;
+ break;
+
+ case CONNMAN_IPCONFIG_METHOD_FIXED:
case CONNMAN_IPCONFIG_METHOD_MANUAL:
- return manual_ipv4_set(network, ipconfig_ipv4);
+ r = set_connected_manual(network);
+ break;
+
case CONNMAN_IPCONFIG_METHOD_DHCP:
- return __connman_dhcp_start(ipconfig_ipv4,
- network, dhcp_callback, NULL);
+ r = set_connected_dhcp(network);
+ break;
}
+
+ break;
}
- return 0;
+ if (r < 0)
+ connman_network_set_error(network,
+ CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
+
+ return r;
}
int connman_network_set_ipaddress(struct connman_network *network,
return 0;
}
+#if defined TIZEN_EXT
+/*
+ * Description: Network client requires additional wifi specific info
+ */
+int connman_network_set_bssid(struct connman_network *network,
+ const unsigned char *bssid)
+{
+ int i = 0;
+
+ if (bssid == NULL)
+ return -EINVAL;
+
+ DBG("network %p bssid %02x:%02x:%02x:%02x:%02x:%02x", network,
+ bssid[0], bssid[1], bssid[2],
+ bssid[3], bssid[4], bssid[5]);
+
+ for (;i < WIFI_BSSID_LEN_MAX;i++)
+ network->wifi.bssid[i] = bssid[i];
+
+ return 0;
+}
+
+unsigned char *connman_network_get_bssid(struct connman_network *network)
+{
+ return (unsigned char *)network->wifi.bssid;
+}
+
+int connman_network_set_maxspeed(struct connman_network *network,
+ int maxspeed)
+{
+ network->wifi.maxspeed = maxspeed;
+ return 0;
+}
+
+int connman_network_get_maxspeed(struct connman_network *network)
+{
+ if (!network->driver)
+ return 0;
+
+ if (network->connected)
+ return network->wifi.maxspeed;
+
+ return 0;
+}
+
+int connman_network_set_maxrate(struct connman_network *network,
+ unsigned int maxrate)
+{
+#if !defined TIZEN_EXT
+ DBG("network %p maxrate %d", network, maxrate);
+#endif
+
+ network->wifi.maxrate = maxrate;
+
+ return 0;
+}
+
+unsigned int connman_network_get_maxrate(struct connman_network *network)
+{
+ return network->wifi.maxrate;
+}
+
+int connman_network_set_enc_mode(struct connman_network *network,
+ const char *encryption_mode)
+{
+ if (encryption_mode == NULL)
+ return -EINVAL;
+
+ DBG("network %p encryption mode %s", network, encryption_mode);
+
+ g_strlcpy(network->wifi.encryption_mode, encryption_mode,
+ WIFI_ENCYPTION_MODE_LEN_MAX);
+
+ return 0;
+}
+
+const char *connman_network_get_enc_mode(struct connman_network *network)
+{
+ return (const char *)network->wifi.encryption_mode;
+}
+
+int connman_network_set_rsn_mode(struct connman_network *network,
+ bool rsn_mode)
+{
+ network->wifi.rsn_mode = rsn_mode;
+
+ return 0;
+}
+
+int connman_network_set_proxy(struct connman_network *network,
+ const char *proxies)
+{
+ struct connman_service *service;
+
+ DBG("network %p proxies %s", network, proxies);
+
+ service = connman_service_lookup_from_network(network);
+ if (service == NULL)
+ return -EINVAL;
+
+ __connman_service_set_proxy(service, proxies);
+
+ connman_service_set_proxy_method(service,
+ CONNMAN_SERVICE_PROXY_METHOD_MANUAL);
+
+ return 0;
+}
+
+int connman_network_set_keymgmt(struct connman_network *network,
+ unsigned int keymgmt)
+{
+ if (network == NULL)
+ return 0;
+
+ network->wifi.keymgmt = keymgmt;
+
+ return 0;
+}
+
+unsigned int connman_network_get_keymgmt(struct connman_network *network)
+{
+ if (network == NULL)
+ return 0;
+
+ return network->wifi.keymgmt;
+}
+
+int connman_network_set_disconnect_reason(struct connman_network *network,
+ int reason_code)
+{
+ if (network == NULL)
+ return 0;
+
+ network->wifi.disconnect_reason = reason_code;
+
+ return 0;
+}
+
+int connman_network_get_disconnect_reason(struct connman_network *network)
+{
+ if (network == NULL)
+ return 0;
+
+ return network->wifi.disconnect_reason;
+}
+int connman_network_get_assoc_status_code(struct connman_network *network)
+{
+ if (network == NULL)
+ return 0;
+
+ return network->wifi.assoc_status_code;
+}
+
+int connman_network_set_countrycode(struct connman_network *network,
+ const unsigned char *country_code)
+{
+ int i = 0;
+
+ if (country_code == NULL)
+ return -EINVAL;
+
+ DBG("network %p Country Code %02x:%02x",network,
+ country_code[0],country_code[1]);
+
+ for (; i < WIFI_COUNTRY_CODE_LEN; i++)
+ network->wifi.country_code[i] = country_code[i];
+
+ return 0;
+}
+
+unsigned char *connman_network_get_countrycode(struct connman_network *network)
+{
+ return (unsigned char *)network->wifi.country_code;
+}
+
+int connman_network_set_bssid_list(struct connman_network *network,
+ GSList *bssids)
+{
+ g_slist_free_full(network->wifi.bssid_list, g_free);
+ network->wifi.bssid_list = bssids;
+
+ return 0;
+}
+
+int connman_network_set_phy_mode(struct connman_network *network,
+ ieee80211_modes_e mode)
+{
+ DBG("network %p phy mode %d", network, mode);
+ network->wifi.phy_mode = mode;
+
+ return 0;
+}
+
+ieee80211_modes_e connman_network_get_phy_mode(struct connman_network *network)
+{
+ return network->wifi.phy_mode;
+}
+
+int connman_network_set_connection_mode(struct connman_network *network,
+ connection_mode_e mode)
+{
+ DBG("network %p connection mode %d", network, mode);
+ network->wifi.connection_mode = mode;
+
+ return 0;
+}
+
+connection_mode_e connman_network_get_connection_mode(struct connman_network *network)
+{
+ return network->wifi.connection_mode;
+}
+
+void *connman_network_get_bssid_list(struct connman_network *network)
+{
+ return network->wifi.bssid_list;
+}
+#endif
+
int connman_network_set_nameservers(struct connman_network *network,
const char *nameservers)
{
nameservers_array = g_strsplit(nameservers, " ", 0);
for (i = 0; nameservers_array[i]; i++) {
+#if defined TIZEN_EXT
+ __connman_service_nameserver_append(service,
+ nameservers_array[i], false,
+ CONNMAN_IPCONFIG_TYPE_ALL);
+#else
__connman_service_nameserver_append(service,
nameservers_array[i], false);
+#endif
}
g_strfreev(nameservers_array);
int connman_network_set_strength(struct connman_network *network,
uint8_t strength)
{
- DBG("network %p strengh %d", network, strength);
-
network->strength = strength;
return 0;
int connman_network_set_frequency(struct connman_network *network,
uint16_t frequency)
{
- DBG("network %p frequency %d", network, frequency);
-
network->frequency = frequency;
return 0;
int connman_network_set_wifi_channel(struct connman_network *network,
uint16_t channel)
{
- DBG("network %p wifi channel %d", network, channel);
-
network->wifi.channel = channel;
return 0;
int connman_network_set_string(struct connman_network *network,
const char *key, const char *value)
{
- DBG("network %p key %s value %s", network, key, value);
-
if (g_strcmp0(key, "Name") == 0)
return connman_network_set_name(network, value);
g_free(network->wifi.security);
network->wifi.security = g_strdup(value);
} else if (g_str_equal(key, "WiFi.Passphrase")) {
+#if defined TIZEN_EXT
+ DBG("ConnMan, %p key %s", network, key);
+#endif
g_free(network->wifi.passphrase);
network->wifi.passphrase = g_strdup(value);
} else if (g_str_equal(key, "WiFi.EAP")) {
} else if (g_str_equal(key, "WiFi.Identity")) {
g_free(network->wifi.identity);
network->wifi.identity = g_strdup(value);
+ } else if (g_str_equal(key, "WiFi.AnonymousIdentity")) {
+ g_free(network->wifi.anonymous_identity);
+ network->wifi.anonymous_identity = g_strdup(value);
} else if (g_str_equal(key, "WiFi.AgentIdentity")) {
g_free(network->wifi.agent_identity);
network->wifi.agent_identity = g_strdup(value);
} else if (g_str_equal(key, "WiFi.CACertFile")) {
g_free(network->wifi.ca_cert_path);
network->wifi.ca_cert_path = g_strdup(value);
+ } else if (g_str_equal(key, "WiFi.SubjectMatch")) {
+ g_free(network->wifi.subject_match);
+ network->wifi.subject_match = g_strdup(value);
+ } else if (g_str_equal(key, "WiFi.AltSubjectMatch")) {
+ g_free(network->wifi.altsubject_match);
+ network->wifi.altsubject_match = g_strdup(value);
+ } else if (g_str_equal(key, "WiFi.DomainSuffixMatch")) {
+ g_free(network->wifi.domain_suffix_match);
+ network->wifi.domain_suffix_match = g_strdup(value);
+ } else if (g_str_equal(key, "WiFi.DomainMatch")) {
+ g_free(network->wifi.domain_match);
+ network->wifi.domain_match = g_strdup(value);
} else if (g_str_equal(key, "WiFi.ClientCertFile")) {
g_free(network->wifi.client_cert_path);
network->wifi.client_cert_path = g_strdup(value);
const char *connman_network_get_string(struct connman_network *network,
const char *key)
{
- DBG("network %p key %s", network, key);
-
if (g_str_equal(key, "Path"))
return network->path;
else if (g_str_equal(key, "Name"))
else if (g_str_equal(key, "WiFi.Mode"))
return network->wifi.mode;
else if (g_str_equal(key, "WiFi.Security"))
+#if defined TIZEN_EXT
+ if (network->wifi.rsn_mode != true ||
+ g_str_equal(network->wifi.security, "ieee8021x"))
+ return network->wifi.security;
+ else
+ return "rsn";
+#else
return network->wifi.security;
+#endif
else if (g_str_equal(key, "WiFi.Passphrase"))
return network->wifi.passphrase;
else if (g_str_equal(key, "WiFi.EAP"))
return network->wifi.eap;
else if (g_str_equal(key, "WiFi.Identity"))
return network->wifi.identity;
+ else if (g_str_equal(key, "WiFi.AnonymousIdentity"))
+ return network->wifi.anonymous_identity;
else if (g_str_equal(key, "WiFi.AgentIdentity"))
return network->wifi.agent_identity;
else if (g_str_equal(key, "WiFi.CACertFile"))
return network->wifi.ca_cert_path;
+ else if (g_str_equal(key, "WiFi.SubjectMatch"))
+ return network->wifi.subject_match;
+ else if (g_str_equal(key, "WiFi.AltSubjectMatch"))
+ return network->wifi.altsubject_match;
+ else if (g_str_equal(key, "WiFi.DomainSuffixMatch"))
+ return network->wifi.domain_suffix_match;
+ else if (g_str_equal(key, "WiFi.DomainMatch"))
+ return network->wifi.domain_match;
else if (g_str_equal(key, "WiFi.ClientCertFile"))
return network->wifi.client_cert_path;
else if (g_str_equal(key, "WiFi.PrivateKeyFile"))
int connman_network_set_bool(struct connman_network *network,
const char *key, bool value)
{
- DBG("network %p key %s value %d", network, key, value);
-
if (g_strcmp0(key, "Roaming") == 0)
network->roaming = value;
else if (g_strcmp0(key, "WiFi.WPS") == 0)
network->wifi.wps = value;
else if (g_strcmp0(key, "WiFi.UseWPS") == 0)
network->wifi.use_wps = value;
+#if defined TIZEN_EXT
+ else if (g_strcmp0(key, "DefaultInternet") == 0)
+ network->default_internet = value;
+ else if (g_strcmp0(key, "WiFi.HS20AP") == 0)
+ network->wifi.isHS20AP = value;
+#endif
return -EINVAL;
}
bool connman_network_get_bool(struct connman_network *network,
const char *key)
{
- DBG("network %p key %s", network, key);
-
if (g_str_equal(key, "Roaming"))
return network->roaming;
else if (g_str_equal(key, "WiFi.WPS"))
return network->wifi.wps;
else if (g_str_equal(key, "WiFi.UseWPS"))
return network->wifi.use_wps;
+#if defined TIZEN_EXT
+ else if (g_str_equal(key, "DefaultInternet"))
+ return network->default_internet;
+ else if (g_str_equal(key, "WiFi.HS20AP"))
+ return network->wifi.isHS20AP;
+#endif
return false;
}
+#if defined TIZEN_EXT
+/**
+ * connman_network_set_vsie_list:
+ * @network: network structure
+ * @vsie_list: GSList pointer
+ *
+ * Set vendor specific list pointer
+ */
+void connman_network_set_vsie_list(struct connman_network *network, GSList *vsie_list)
+{
+ g_slist_free_full(network->wifi.vsie_list, g_free);
+ network->wifi.vsie_list = vsie_list;
+}
+
+/**
+ * connman_network_get_vsie_list:
+ * @network: network structure
+ *
+ * Get vendor specific list pointer
+ */
+void *connman_network_get_vsie_list(struct connman_network *network)
+{
+ return network->wifi.vsie_list;
+}
+#endif
+
/**
* connman_network_set_blob:
* @network: network structure
int connman_network_set_blob(struct connman_network *network,
const char *key, const void *data, unsigned int size)
{
- DBG("network %p key %s size %d", network, key, size);
-
if (g_str_equal(key, "WiFi.SSID")) {
g_free(network->wifi.ssid);
network->wifi.ssid = g_try_malloc(size);
const void *connman_network_get_blob(struct connman_network *network,
const char *key, unsigned int *size)
{
- DBG("network %p key %s", network, key);
-
if (g_str_equal(key, "WiFi.SSID")) {
if (size)
*size = network->wifi.ssid_len;