*/
#define MAX_PASSPHRASE_LEN (64+1)
+/**
+ * @brief The maximum length of IPv4 Address
+ *
+ * @since_tizen 4.0
+ */
+#define MAX_IPV4_ADDRESS_LEN 16
+
/**
* @brief Enumeration for the security type of the Wi-Fi Mesh network.
* @since_tizen 4.0
WIFI_MESH_CONNECTION_STATE_CONNECTED /**< Wi-Fi Mesh network is connected */
} wifi_mesh_connection_state_e;
+/**
+ * @brief Enumeration for address family of the Wi-Fi Mesh network.
+ * @since_tizen 4.0
+*/
+typedef enum {
+ WIFI_MESH_ADDRESS_FAMILY_IPV4 = 0, /**< IPV4 Address type */
+ WIFI_MESH_ADDRESS_FAMILY_IPV6 = 1, /**< IPV6 Address type */
+} wifi_mesh_address_family_e;
+
+/**
+ * @brief Enumeration for the IP Config Type of the Wi-Fi Mesh network.
+ * @since_tizen 4.0
+ */
+typedef enum {
+ WIFI_MESH_IP_CONFIG_TYPE_UNKNOWN = 0, /**< Unknown IP Config Type */
+ WIFI_MESH_IP_CONFIG_TYPE_DYNAMIC, /**< DHCP IP Config Type */
+ WIFI_MESH_IP_CONFIG_TYPE_STATIC /**< Static IP Config Type */
+} wifi_mesh_ip_config_type_e;
+
/**
* @brief The events for wifi_mesh_event_cb
*
*/
int wifi_mesh_network_get_connection_state(wifi_mesh_network_h network, wifi_mesh_connection_state_e *state);
+/**
+ * @brief Gets the IP Config Type
+ * @details This function is to gets the IP Config Type
+ *
+ * @since_tizen 4.0
+ *
+ * @param[in] network The Wi-Fi mesh network information handle.
+ * @param[in] address_family Address Family
+ * @param[out] ip_type The IP Config Type
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #WIFI_MESH_ERROR_NONE Successful
+ * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int wifi_mesh_network_get_ip_config_type(wifi_mesh_network_h network,
+ wifi_mesh_address_family_e address_family,
+ wifi_mesh_ip_config_type_e *ip_type);
+
+/**
+ * @brief Gets the IP Address
+ * @details This function is to gets the IP Address
+ *
+ * @since_tizen 4.0
+ *
+ * @param[in] network The Wi-Fi mesh network information handle.
+ * @param[in] address_family Address Family
+ * @param[out] ip_address The IP Address
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #WIFI_MESH_ERROR_NONE Successful
+ * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int wifi_mesh_network_get_ip_address(wifi_mesh_network_h network,
+ wifi_mesh_address_family_e address_family, char **ip_address);
+
+/**
+ * @brief Gets the Subnet Mask
+ * @details This function is to gets the subnet mask
+ *
+ * @since_tizen 4.0
+ *
+ * @param[in] network The Wi-Fi mesh network information handle.
+ * @param[in] address_family Address Family
+ * @param[out] subnet_mask The Subnet Mask
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #WIFI_MESH_ERROR_NONE Successful
+ * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int wifi_mesh_network_get_subnet_mask(wifi_mesh_network_h network,
+ wifi_mesh_address_family_e address_family, char **subnet_mask);
+
/**
* @brief Gets address from the Wi-Fi mesh peer.
* @details This function is to return mesh network id
wifi_mesh_security_type_e security; /**< Security type */
char passphrase[MAX_PASSPHRASE_LEN]; /**< Passphrase */
wifi_mesh_connection_state_e state; /**< Connection state */
+ wifi_mesh_ip_config_type_e ipv4_type; /**< IPv4 Config Type */
+ char ipv4_address[MAX_IPV4_ADDRESS_LEN]; /**< IPv4 Address */
+ char ipv4_netmask[MAX_IPV4_ADDRESS_LEN]; /**< IPv4 Netmask */
};
struct mesh_station_info_s {
int channel = -1;
int security = -1;
int state = 0;
+ int ipv4_type = 0;
+ char *ipv4_address = NULL;
+ char *ipv4_netmask = NULL;
int svc_result = 0;
- g_variant_get(variant, "(ssiiii)", &meshid, &bssid, &channel,
- &security, &state, &svc_result);
+ g_variant_get(variant, "(ssiiiissi)", &meshid, &bssid, &channel,
+ &security, &state, &ipv4_type, &ipv4_address, &ipv4_netmask,
+ &svc_result);
LOGD("get_joined_mesh_network status 0x%x", svc_result);
result = __convert_service_error_type(svc_result);
g_joined_network.data_rate = 0;
g_joined_network.security = MESH_SECURITY_NONE;
g_joined_network.state = WIFI_MESH_CONNECTION_STATE_DISCONNECTED;
+ g_joined_network.ipv4_type = WIFI_MESH_IP_CONFIG_TYPE_UNKNOWN;
+ memset(g_joined_network.ipv4_address, 0, MAX_IPV4_ADDRESS_LEN);
+ memset(g_joined_network.ipv4_netmask, 0, MAX_IPV4_ADDRESS_LEN);
if (SERVICE_ERROR_NO_DATA == svc_result) {
*_network = NULL;
g_joined_network.rssi = -1;
g_joined_network.security = security;
g_joined_network.state = state;
+ g_joined_network.ipv4_type = ipv4_type;
+ if (ipv4_address) {
+ LOGD(" IPv4 Address : %s", ipv4_address);
+ snprintf(g_joined_network.ipv4_address, MAX_IPV4_ADDRESS_LEN, "%s",
+ ipv4_address);
+ }
+ if (ipv4_netmask) {
+ LOGD(" IPv4 Netmask : %s", ipv4_netmask);
+ snprintf(g_joined_network.ipv4_netmask, MAX_IPV4_ADDRESS_LEN, "%s",
+ ipv4_netmask);
+ }
*_network = &g_joined_network;
} else if (error) {
return WIFI_MESH_ERROR_NONE;
}
+EXPORT_API int wifi_mesh_network_get_ip_config_type(wifi_mesh_network_h network,
+ wifi_mesh_address_family_e address_family,
+ wifi_mesh_ip_config_type_e *ip_type)
+{
+ struct mesh_network_s *net = (struct mesh_network_s *)network;
+
+ CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
+
+ if (NULL == network || ip_type == NULL) {
+ /* LCOV_EXCL_START */
+ LOGE("Invalid parameter");
+ return WIFI_MESH_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
+ }
+
+ if (address_family != WIFI_MESH_ADDRESS_FAMILY_IPV4) {
+ LOGE("Invalid Address Family %d", address_family);
+ return WIFI_MESH_ERROR_INVALID_PARAMETER;
+ }
+
+ *ip_type = net->ipv4_type;
+
+ return WIFI_MESH_ERROR_NONE;
+}
+
+EXPORT_API int wifi_mesh_network_get_ip_address(wifi_mesh_network_h network,
+ wifi_mesh_address_family_e address_family, char **ip_address)
+{
+ struct mesh_network_s *net = (struct mesh_network_s *)network;
+
+ CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
+
+ if (NULL == network || ip_address == NULL) {
+ /* LCOV_EXCL_START */
+ LOGE("Invalid parameter");
+ return WIFI_MESH_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
+ }
+
+ if (address_family != WIFI_MESH_ADDRESS_FAMILY_IPV4) {
+ LOGE("Invalid Address Family %d", address_family);
+ return WIFI_MESH_ERROR_INVALID_PARAMETER;
+ }
+
+ *ip_address = strdup(net->ipv4_address);
+
+ return WIFI_MESH_ERROR_NONE;
+}
+
+EXPORT_API int wifi_mesh_network_get_subnet_mask(wifi_mesh_network_h network,
+ wifi_mesh_address_family_e address_family, char **subnet_mask)
+{
+ struct mesh_network_s *net = (struct mesh_network_s *)network;
+
+ CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
+
+ if (NULL == network || subnet_mask == NULL) {
+ /* LCOV_EXCL_START */
+ LOGE("Invalid parameter");
+ return WIFI_MESH_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
+ }
+
+ if (address_family != WIFI_MESH_ADDRESS_FAMILY_IPV4) {
+ LOGE("Invalid Address Family %d", address_family);
+ return WIFI_MESH_ERROR_INVALID_PARAMETER;
+ }
+
+ *subnet_mask = strdup(net->ipv4_netmask);
+
+ return WIFI_MESH_ERROR_NONE;
+}
+
EXPORT_API int wifi_mesh_peer_get_address(wifi_mesh_peer_h peer, char **address)
{
struct mesh_peer_s *peer_info = (struct mesh_peer_s *)peer;
bool joined = false;
wifi_mesh_connection_state_e _state = WIFI_MESH_CONNECTION_STATE_DISCONNECTED;
wifi_mesh_security_type_e _security = MESH_SECURITY_NONE;
+ wifi_mesh_ip_config_type_e _ipv4_type = WIFI_MESH_IP_CONFIG_TYPE_UNKNOWN;
+ char *_ipv4_address = NULL;
+ char *_ipv4_netmask = NULL;
wifi_mesh_network_h network = NULL;
msg("Get Joined Mesh Network Information");
(MESH_SECURITY_SAE == _security) ? "SAE" : "NONE");
wifi_mesh_network_get_connection_state(network, &_state);
msgb(" State = %s", wifi_mesh_connection_event_to_string(_state));
+ wifi_mesh_network_get_ip_config_type(network,
+ WIFI_MESH_ADDRESS_FAMILY_IPV4, &_ipv4_type);
+ msgb(" IPv4 Config Type = %d", _ipv4_type);
+ wifi_mesh_network_get_ip_address(network, WIFI_MESH_ADDRESS_FAMILY_IPV4,
+ &_ipv4_address);
+ msgb(" IPv4 Address = %s", _ipv4_address);
+ wifi_mesh_network_get_subnet_mask(network,
+ WIFI_MESH_ADDRESS_FAMILY_IPV4, &_ipv4_netmask);
+ msgb(" IPv4 Subnet Mask = %s", _ipv4_netmask);
if (_meshid) free(_meshid);
if (_bssid) free(_bssid);
+ if (_ipv4_address) free(_ipv4_address);
+ if (_ipv4_netmask) free(_ipv4_netmask);
}
msg("");
msg(" - wifi_mesh_get_joined_network() ret: [0x%X] [%s]",