*/
/**
+ * @brief Enumeration for extended network connection type.
+ * @since_tizen 5.0
+ */
+typedef enum {
+ CONNECTION_PROFILE_TYPE_MESH = CONNECTION_PROFILE_TYPE_BT + 1, /**< Wi-Fi Mesh type */
+} connection_profile_type_extended_e;
+
+/**
+ * @brief Enumeration for extended security type of Wi-Fi.
+ * @since_tizen 5.0
+ */
+typedef enum {
+ CONNECTION_WIFI_SECURITY_TYPE_SAE = CONNECTION_WIFI_SECURITY_TYPE_EAP + 1, /**< SAE */
+} connection_wifi_security_type_extended_e;
+
+/**
* @brief Start TCP Dump.
*
* @param[in] connection The connection handle
Name: capi-network-connection
Summary: Network Connection library in TIZEN C API
-Version: 1.0.111
+Version: 1.0.112
Release: 1
Group: System/Network
License: Apache-2.0
}
if (profile_info->profile_type != NET_DEVICE_CELLULAR &&
+ profile_info->profile_type != NET_DEVICE_MESH &&
profile_info->profile_type != NET_DEVICE_WIFI) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
#include <vconf/vconf.h>
#include "net_connection_private.h"
+#include "connection_extension.h"
#define HTTP_PROXY "http_proxy"
#define MAX_PREFIX_LENGTH 6
return &profile_info->ProfileInfo.Ethernet.net_info; //LCOV_EXCL_LINE
case NET_DEVICE_BLUETOOTH:
return &profile_info->ProfileInfo.Bluetooth.net_info;
+ case NET_DEVICE_MESH:
+ return &profile_info->ProfileInfo.Mesh.net_info;
case NET_DEVICE_DEFAULT:
case NET_DEVICE_USB:
case NET_DEVICE_UNKNOWN:
bt_name++;
*profile_name = g_strdup(bt_name);
} break;
+ case NET_DEVICE_MESH:
+ *profile_name = g_strdup(profile_info->ProfileInfo.Mesh.essid);
+ break;
default:
return CONNECTION_ERROR_INVALID_PARAMETER;
}
case NET_DEVICE_BLUETOOTH:
*type = CONNECTION_PROFILE_TYPE_BT;
break;
+ case NET_DEVICE_MESH:
+ *type = CONNECTION_PROFILE_TYPE_MESH;
+ break;
default:
CONNECTION_LOG(CONNECTION_ERROR, "Invalid profile type");
return CONNECTION_ERROR_OPERATION_FAILED;
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_WIFI)
+ if (profile_info->profile_type != NET_DEVICE_WIFI &&
+ profile_info->profile_type != NET_DEVICE_MESH)
return CONNECTION_ERROR_INVALID_PARAMETER;
- *essid = g_strdup(profile_info->ProfileInfo.Wlan.essid);
+ if (profile_info->profile_type == NET_DEVICE_WIFI)
+ *essid = g_strdup(profile_info->ProfileInfo.Wlan.essid);
+ else
+ *essid = g_strdup(profile_info->ProfileInfo.Mesh.essid);
+
if (*essid == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_WIFI)
+ if (profile_info->profile_type != NET_DEVICE_WIFI &&
+ profile_info->profile_type != NET_DEVICE_MESH)
return CONNECTION_ERROR_INVALID_PARAMETER;
- *bssid = g_strdup(profile_info->ProfileInfo.Wlan.bssid);
+ if (profile_info->profile_type == NET_DEVICE_WIFI)
+ *bssid = g_strdup(profile_info->ProfileInfo.Wlan.bssid);
+ else
+ *bssid = g_strdup(profile_info->ProfileInfo.Mesh.bssid);
+
if (*bssid == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_WIFI)
+ if (profile_info->profile_type != NET_DEVICE_WIFI &&
+ profile_info->profile_type != NET_DEVICE_MESH)
return CONNECTION_ERROR_INVALID_PARAMETER;
- *rssi = (int)profile_info->ProfileInfo.Wlan.Strength;
+ if (profile_info->profile_type == NET_DEVICE_WIFI)
+ *rssi = (int)profile_info->ProfileInfo.Wlan.Strength;
+ else
+ *rssi = (int)profile_info->ProfileInfo.Mesh.Strength;
+
return CONNECTION_ERROR_NONE;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_WIFI)
+ if (profile_info->profile_type != NET_DEVICE_WIFI &&
+ profile_info->profile_type != NET_DEVICE_MESH)
return CONNECTION_ERROR_INVALID_PARAMETER;
- *frequency = (int)profile_info->ProfileInfo.Wlan.frequency;
+ if (profile_info->profile_type == NET_DEVICE_WIFI)
+ *frequency = (int)profile_info->ProfileInfo.Wlan.frequency;
+ else
+ *frequency = (int)profile_info->ProfileInfo.Mesh.frequency;
+
return CONNECTION_ERROR_NONE;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_WIFI)
+ wlan_security_mode_type_t sec_mode;
+ if (profile_info->profile_type != NET_DEVICE_WIFI &&
+ profile_info->profile_type != NET_DEVICE_MESH)
return CONNECTION_ERROR_INVALID_PARAMETER;
- switch (profile_info->ProfileInfo.Wlan.security_info.sec_mode) {
+ if (profile_info->profile_type == NET_DEVICE_WIFI)
+ sec_mode = profile_info->ProfileInfo.Wlan.security_info.sec_mode;
+ else
+ sec_mode = profile_info->ProfileInfo.Mesh.security_info.sec_mode;
+
+ switch (sec_mode) {
//LCOV_EXCL_START
case WLAN_SEC_MODE_NONE:
*type = CONNECTION_WIFI_SECURITY_TYPE_NONE;
case WLAN_SEC_MODE_WPA2_PSK:
*type = CONNECTION_WIFI_SECURITY_TYPE_WPA2_PSK;
break;
+ case WLAN_SEC_MODE_SAE:
+ *type = CONNECTION_WIFI_SECURITY_TYPE_SAE;
+ break;
default:
return CONNECTION_ERROR_OPERATION_FAILED;
//LCOV_EXCL_STOP
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_WIFI)
+ wlan_security_mode_type_t sec_mode;
+ if (profile_info->profile_type != NET_DEVICE_WIFI &&
+ profile_info->profile_type != NET_DEVICE_MESH)
return CONNECTION_ERROR_INVALID_PARAMETER;
if (profile_info->Favourite) {
return CONNECTION_ERROR_NONE;
}
- switch (profile_info->ProfileInfo.Wlan.security_info.sec_mode) {
+ if (profile_info->profile_type == NET_DEVICE_WIFI)
+ sec_mode = profile_info->ProfileInfo.Wlan.security_info.sec_mode;
+ else
+ sec_mode = profile_info->ProfileInfo.Mesh.security_info.sec_mode;
+
+ switch (sec_mode) {
//LCOV_EXCL_START
case WLAN_SEC_MODE_NONE:
*required = false;
case WLAN_SEC_MODE_IEEE8021X:
case WLAN_SEC_MODE_WPA_PSK:
case WLAN_SEC_MODE_WPA2_PSK:
+ case WLAN_SEC_MODE_SAE:
*required = true;
break;
default:
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_WIFI)
+ if (profile_info->profile_type != NET_DEVICE_WIFI &&
+ profile_info->profile_type != NET_DEVICE_MESH)
return CONNECTION_ERROR_INVALID_PARAMETER;
- g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.psk.pskKey,
- passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN);
+ if (profile_info->profile_type == NET_DEVICE_WIFI)
+ g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.psk.pskKey,
+ passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN);
+ else
+ g_strlcpy(profile_info->ProfileInfo.Mesh.security_info.authentication.sae.saeKey,
+ passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN);
return CONNECTION_ERROR_NONE;
}
int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, connection_profile_iterator_h* profile_iter_h)
{
int count = 0;
- int rv1, rv2, rv3, rv4;
+ int rv1, rv2, rv3, rv4, rv5;
net_profile_info_t *profiles = NULL;
struct _profile_list_s wifi_profiles = {0, 0, NULL};
struct _profile_list_s cellular_profiles = {0, 0, NULL};
struct _profile_list_s ethernet_profiles = {0, 0, NULL};
struct _profile_list_s bluetooth_profiles = {0, 0, NULL};
+ struct _profile_list_s mesh_profiles = {0, 0, NULL};
__libnet_clear_profile_list(&profile_iterator);
}
CONNECTION_LOG(CONNECTION_INFO, "Bluetooth profile count : %d", bluetooth_profiles.count);
+ rv5 = net_get_profile_list(NET_DEVICE_MESH, &mesh_profiles.profiles, &mesh_profiles.count);
+ if (rv5 == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ __libnet_clear_profile_list(&wifi_profiles);
+ return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv5 != NET_ERR_NO_SERVICE && rv5 != NET_ERR_NONE) {
+ __libnet_clear_profile_list(&wifi_profiles);
+ return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ CONNECTION_LOG(CONNECTION_INFO, "Mesh profile count: %d", mesh_profiles.count);
*profile_iter_h = &profile_iterator;
switch (type) {
case CONNECTION_ITERATOR_TYPE_REGISTERED:
- count = wifi_profiles.count + cellular_profiles.count + ethernet_profiles.count + bluetooth_profiles.count;
+ count = wifi_profiles.count + cellular_profiles.count + ethernet_profiles.count + bluetooth_profiles.count + mesh_profiles.count;
CONNECTION_LOG(CONNECTION_INFO, "Total profile count : %d", count);
if (count == 0)
return CONNECTION_ERROR_NONE;
__libnet_clear_profile_list(&cellular_profiles);
__libnet_clear_profile_list(ðernet_profiles);
__libnet_clear_profile_list(&bluetooth_profiles);
+ __libnet_clear_profile_list(&mesh_profiles);
return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
profiles += ethernet_profiles.count;
}
+ if (mesh_profiles.count > 0) {
+ memcpy(profiles, mesh_profiles.profiles,
+ sizeof(net_profile_info_t) * mesh_profiles.count);
+ profiles += mesh_profiles.count;
+ }
+
if (bluetooth_profiles.count > 0)
memcpy(profiles, bluetooth_profiles.profiles,
sizeof(net_profile_info_t) * bluetooth_profiles.count);
count += __libnet_get_connected_count(&cellular_profiles);
count += __libnet_get_connected_count(ðernet_profiles);
count += __libnet_get_connected_count(&bluetooth_profiles);
+ count += __libnet_get_connected_count(&mesh_profiles);
CONNECTION_LOG(CONNECTION_INFO, "Total connected profile count : %d", count);
if (count == 0)
return CONNECTION_ERROR_NONE;
__libnet_clear_profile_list(&cellular_profiles);
__libnet_clear_profile_list(ðernet_profiles);
__libnet_clear_profile_list(&bluetooth_profiles);
+ __libnet_clear_profile_list(&mesh_profiles);
return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
if (bluetooth_profiles.count > 0)
__libnet_copy_connected_profile(&profiles, &bluetooth_profiles);
+ if (mesh_profiles.count > 0)
+ __libnet_copy_connected_profile(&profiles, &mesh_profiles);
+
break;
case CONNECTION_ITERATOR_TYPE_DEFAULT:
count = __libnet_get_default_count(&cellular_profiles);
__libnet_clear_profile_list(&cellular_profiles);
__libnet_clear_profile_list(ðernet_profiles);
__libnet_clear_profile_list(&bluetooth_profiles);
+ __libnet_clear_profile_list(&mesh_profiles);
return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
__libnet_clear_profile_list(&cellular_profiles);
__libnet_clear_profile_list(ðernet_profiles);
__libnet_clear_profile_list(&bluetooth_profiles);
+ __libnet_clear_profile_list(&mesh_profiles);
profile_iterator.count = count;
net_profile_info_t *profile_info = profile;
- rv = net_open_connection_with_profile(profile_info->ProfileName);
+ if (profile_info->profile_type == NET_DEVICE_MESH)
+ rv = net_open_mesh_connection_with_profile(profile_info->ProfileName);
+ else
+ rv = net_open_connection_with_profile(profile_info->ProfileName);
+
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
net_profile_info_t *profile_info = profile;
- rv = net_close_connection(profile_info->ProfileName);
+ if (profile_info->profile_type == NET_DEVICE_MESH)
+ rv = net_close_mesh_connection(profile_info->ProfileName);
+ else
+ rv = net_close_connection(profile_info->ProfileName);
+
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
printf("Wi-Fi wps supported : %s\n", wps_supported ? "true" : "false");
}
+static void test_print_mesh_info(connection_profile_h profile)
+{
+ char *essid = NULL;
+ char *bssid = NULL;
+ int rssi = 0;
+ int frequency = 0;
+ connection_wifi_security_type_e security_type;
+ bool pass_required = false;
+
+ if (connection_profile_get_wifi_essid(profile, &essid) != CONNECTION_ERROR_NONE)
+ printf("Fail to get Mesh essid!\n");
+ else {
+ printf("Mesh essid : %s\n", essid);
+ g_free(essid);
+ }
+
+ if (connection_profile_get_wifi_bssid(profile, &bssid) != CONNECTION_ERROR_NONE)
+ printf("Fail to get Mesh bssid!\n");
+ else {
+ printf("Mesh bssid : %s\n", bssid);
+ g_free(bssid);
+ }
+
+ if (connection_profile_get_wifi_rssi(profile, &rssi) != CONNECTION_ERROR_NONE)
+ printf("Fail to get Mesh rssi!\n");
+ else
+ printf("Mesh rssi : %d\n", rssi);
+
+ if (connection_profile_get_wifi_frequency(profile, &frequency) != CONNECTION_ERROR_NONE)
+ printf("Fail to get Mesh frequency!\n");
+ else
+ printf("Mesh frequency : %d\n", frequency);
+
+ if (connection_profile_get_wifi_security_type(profile, &security_type) != CONNECTION_ERROR_NONE)
+ printf("Fail to get Mesh security type!\n");
+ else
+ printf("Mesh security type : %d\n", security_type);
+
+ if (connection_profile_is_wifi_passphrase_required(profile, &pass_required) != CONNECTION_ERROR_NONE)
+ printf("Fail to get Mesh passphrase required!\n");
+ else
+ printf("Mesh passphrase required : %s\n", pass_required ? "true" : "false");
+}
+
static void test_print_network_info(connection_profile_h profile, connection_address_family_e address_family)
{
char *interface_name = NULL;
case CONNECTION_PROFILE_TYPE_ETHERNET:
if (test_update_network_info(profile) == -1)
return -1;
- break;
+ break;
case CONNECTION_PROFILE_TYPE_BT:
printf("Not supported!\n");
/* fall through */
default:
+ {
+ int profile_type = prof_type;
+ if (profile_type == CONNECTION_PROFILE_TYPE_MESH) {
+ if (test_update_wifi_info(profile) == -1)
+ return -1;
+ break;
+ }
+ }
return -1;
}
printf("Profile Type : Bluetooth\n");
break;
default:
+ {
+ int profile_type = prof_type;
+ if (profile_type == CONNECTION_PROFILE_TYPE_MESH) {
+ printf("Profile Type : Mesh\n");
+ test_print_mesh_info(profile);
+ break;
+ }
+ }
return -1;
}
printf("Profile Type : Bluetooth\n");
break;
default:
+ {
+ int profile_type = prof_type;
+ if (profile_type == CONNECTION_PROFILE_TYPE_MESH) {
+ printf("Profile Type : Mesh\n");
+ test_print_mesh_info(profile);
+ break;
+ }
+ }
return -1;
}