int PrefixLen; /** IPv4 Prefix Length for the connection link */
char BDefGateway; /** Whether gateway address present or not */
net_addr_s GatewayAddr; /** Gateway address */
+ char BServerAddr; /** Whether DHCP Server address present or not */
+ net_addr_s ServerAddr; /** DHCP Server Address */
net_proxy_type_e ProxyMethod; /** Proxy Method type */
char ProxyAddr[NET_PROXY_LEN_MAX+1]; /** Proxy address */
char MacAddr[NET_MAX_MAC_ADDR_LEN+1]; /** MAC address */
wifi_manager_address_family_e address_family, const char *gateway_address);
/**
+ * @brief Gets the DHCP Server address.
+ * @since_tizen 4.0
+ * @remarks You must release @a dhcp_server using g_free(). Currently it is only
+ * supported for IPv4 Address Family.
+ * @param[in] ap The access point handle
+ * @param[in] address_family The address family
+ * @param[out] server_address The DHCP server address
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE Successful
+ * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Operation not Supported
+ */
+int wifi_manager_ap_get_dhcp_server_address(wifi_manager_ap_h ap,
+ wifi_manager_address_family_e address_family, char **dhcp_server);
+
+/**
* @brief Gets the proxy address.
* @since_tizen 3.0
* @remarks You must release @a proxy_address using free().
else if (g_strcmp0(value, "off") == 0)
net_info->IpConfigType = NET_IP_CONFIG_TYPE_OFF;
+ if (net_info->IpConfigType != NET_IP_CONFIG_TYPE_DYNAMIC) {
+ net_info->BServerAddr = FALSE;
+ net_info->ServerAddr.Type = NET_ADDR_IPV4;
+ net_info->ServerAddr.Data.Ipv4.s_addr = 0;
+ }
+
} else if (g_strcmp0(subKey, "Address") == 0) {
value = g_variant_get_string(var, NULL);
__net_extract_ip(value, &net_info->GatewayAddr);
net_info->BDefGateway = TRUE;
+ } else if (g_strcmp0(subKey, "DHCPServerIP") == 0) {
+ value = g_variant_get_string(var, NULL);
+
+ __net_extract_ip(value, &net_info->ServerAddr);
+ net_info->BServerAddr = TRUE;
}
}
g_variant_iter_free(iter);
net_info->BDefGateway = FALSE;
net_info->GatewayAddr.Type = NET_ADDR_IPV4;
net_info->GatewayAddr.Data.Ipv4.s_addr = 0;
+ net_info->BServerAddr = FALSE;
+ net_info->ServerAddr.Type = NET_ADDR_IPV4;
+ net_info->ServerAddr.Data.Ipv4.s_addr = 0;
net_info->IpConfigType6 = 0;
net_info->IpAddr6.Type = NET_ADDR_IPV6;
return WIFI_MANAGER_ERROR_NONE;
}
+
+EXPORT_API int wifi_manager_ap_get_dhcp_server_address(wifi_manager_ap_h ap,
+ wifi_manager_address_family_e address_family, char** dhcp_server)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (_wifi_check_ap_validity(ap) == false ||
+ (address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV4 &&
+ address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV6)) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ if (address_family == WIFI_MANAGER_ADDRESS_FAMILY_IPV6) {
+ WIFI_LOG(WIFI_ERROR, "Not supported"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
+ }
+
+ net_profile_info_s *profile_info = ap;
+
+ WIFI_LOG(WIFI_INFO, "IP Config %d, DHCP Server Address %s",
+ profile_info->net_info.IpConfigType,
+ profile_info->net_info.BServerAddr ? "TRUE" : "FALSE");
+
+ *dhcp_server = __ap_convert_ip_to_string(
+ &profile_info->net_info.ServerAddr,
+ address_family);
+
+ if (*dhcp_server == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Out of memory\n");
+ return WIFI_MANAGER_ERROR_OUT_OF_MEMORY;
+ }
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_ap_get_proxy_address(wifi_manager_ap_h ap,
wifi_manager_address_family_e address_family, char **proxy_address)
{
} else
printf("Fail to get Gateway\n");
+ if (address_type == 0) {
+ if (wifi_manager_ap_get_dhcp_server_address(ap, address_type, &str_value) ==
+ WIFI_MANAGER_ERROR_NONE) {
+ printf("DHCP Server : %s\n", str_value);
+ g_free(str_value);
+ } else
+ printf("Fail to get DHCP Server\n");
+ }
+
if (wifi_manager_ap_get_proxy_type(ap, &proxy_type) == WIFI_MANAGER_ERROR_NONE)
printf("Proxy type : %d\n", proxy_type);
else