NET_IP_CONFIG_TYPE_OFF, /** Don't use any method */
} net_ip_config_type_e;
+typedef enum {
+ NET_DNS_CONFIG_TYPE_UNKNOWN = 0x00, /** Not defined */
+ NET_DNS_CONFIG_TYPE_STATIC = 0x01, /** Manual DNS configuration */
+ NET_DNS_CONFIG_TYPE_DYNAMIC, /** Config DNS using DHCP client */
+} net_dns_config_type_e;
+
typedef union {
struct in_addr Ipv4; /** IP Version 4 address */
struct in6_addr Ipv6; /** IP Version 6 address */
typedef struct {
char ProfileName[NET_PROFILE_NAME_LEN_MAX+1]; /** Profile Name of the connection link */
char DevName[NET_MAX_DEVICE_NAME_LEN+1]; /** Device Name of the connection link */
+ net_dns_config_type_e DnsConfigType; /** IPv4 Dns configuration type */
+ net_dns_config_type_e DnsConfigType6; /** IPv6 Dns configuration type */
net_addr_s DnsAddr[NET_DNS_ADDR_MAX]; /** IPv4 Dns Server Address of the connection link */
net_addr_s DnsAddr6[NET_DNS_ADDR_MAX]; /** IPv6 Dns Server Address of the connection link */
int DnsCount; /** No of IPv4 DNS Address for the connection link */
int DnsCount6; /** No of IPv6 DNS Address for the connection link */
- net_ip_config_type_e IpConfigType; /** Net IP configuration Type */
+ net_ip_config_type_e IpConfigType; /** Net IPv4 configuration Type */
+ net_ip_config_type_e IpConfigType6; /** Net IPv6 configuration Type */
net_addr_s IpAddr; /** IP Address for the connection link */
char BNetmask; /** Whether subnet mask present or not. */
net_addr_s SubnetMask; /** Subnet mask */
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 */
- net_ip_config_type_e IpConfigType6; /** Net IP configuration Type */
net_addr_s IpAddr6; /** IP Address for the connection link */
int PrefixLen6; /** Prefix Length for the connection link */
char BDefGateway6; /** Whether gateway address present or not */
* @brief Enumeration for DNS Configuration type.
* @since_tizen 4.0
*/
-typedef enum
-{
+typedef enum {
WIFI_MANAGER_DNS_CONFIG_TYPE_NONE = 0, /**< Not defined */
WIFI_MANAGER_DNS_CONFIG_TYPE_STATIC = 1, /**< Manual DNS configuration */
WIFI_MANAGER_DNS_CONFIG_TYPE_DYNAMIC = 2, /**< Config DNS using DHCP client*/
* @see wifi_manager_disconnect()
* @see wifi_manager_ap_is_wps_supported()
*/
- int wifi_manager_connect_by_wps_pin_without_ssid(wifi_manager_h wifi,
- const char *pin, wifi_manager_connected_cb callback, void *user_data);
+int wifi_manager_connect_by_wps_pin_without_ssid(wifi_manager_h wifi,
+ const char *pin, wifi_manager_connected_cb callback, void *user_data);
/**
* @brief Stops ongoing WPS provisioning / disconnects from the connected access point.
Name: capi-network-wifi-manager
Summary: Network Wi-Fi library in TIZEN C API
-Version: 1.0.12
+Version: 1.0.13
Release: 1
Group: System/Network
License: Apache-2.0
__NETWORK_FUNC_ENTER__;
const char *prop_nameserver_configuration = "Nameservers.Configuration";
+
+ const char *manual_method = "ipv4.manual";
+ const char *dhcp_method = "ipv4.dhcp";
+ const char *ipv6_manual_method = "ipv6.manual";
+ const char *ipv6_dhcp_method = "ipv6.dhcp";
+
char dns_buffer[NET_DNS_ADDR_MAX][NET_IPV4_STR_LEN_MAX+1];
char *dns_address[NET_DNS_ADDR_MAX];
+ char ipv6_dns_buffer[NET_DNS_ADDR_MAX][NET_IPV6_STR_LEN_MAX + 1];
+ char *ipv6_dns_address[NET_DNS_ADDR_MAX];
+
net_err_e Error = NET_ERR_NONE;
GVariant *params = NULL;
- GVariantBuilder *builder;
+ GVariantBuilder *builder = NULL;
int i = 0;
net_dev_info_s *profile_net_info = NULL;
GVariant *message = NULL;
profile_net_info = &(prof_info->net_info);
if (profile_net_info->DnsCount > NET_DNS_ADDR_MAX) {
- WIFI_LOG(WIFI_ERROR, "Invalid parameter\n");
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_INVALID_PARAM;
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter\n");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_PARAM;
}
for (i = 0; i < profile_net_info->DnsCount; i++) {
inet_ntoa(profile_net_info->DnsAddr[i].Data.Ipv4),
NET_IPV4_STR_LEN_MAX + 1);
- dns_address[i] = dns_buffer[i];
+ if (profile_net_info->DnsConfigType == NET_DNS_CONFIG_TYPE_STATIC)
+ dns_address[i] = dns_buffer[i];
}
- if (profile_net_info->IpConfigType == NET_IP_CONFIG_TYPE_STATIC) {
+ for (i = 0; i < profile_net_info->DnsCount6; i++) {
+ ipv6_dns_buffer[i][0] = '\0';
+ ipv6_dns_address[i] = NULL;
+ if (profile_net_info->DnsAddr6[i].Type == NET_ADDR_IPV6) {
+ inet_ntop(AF_INET6,
+ &profile_net_info->DnsAddr6[i].Data.Ipv6,
+ ipv6_dns_buffer[i], INET6_ADDRSTRLEN);
+ }
+
+ if (profile_net_info->DnsConfigType6 == NET_DNS_CONFIG_TYPE_STATIC)
+ ipv6_dns_address[i] = ipv6_dns_buffer[i];
+ }
+
+ if (profile_net_info->DnsConfigType == NET_DNS_CONFIG_TYPE_STATIC ||
+ profile_net_info->DnsConfigType == NET_DNS_CONFIG_TYPE_DYNAMIC ||
+ profile_net_info->DnsConfigType6 == NET_DNS_CONFIG_TYPE_STATIC ||
+ profile_net_info->DnsConfigType6 == NET_DNS_CONFIG_TYPE_DYNAMIC) {
builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
- for (i = 0; i < profile_net_info->DnsCount; i++)
- g_variant_builder_add(builder, "s", dns_address[i]);
-
- params = g_variant_new("(sv)", prop_nameserver_configuration, g_variant_builder_end(builder));
- g_variant_builder_unref(builder);
-
- message = _net_invoke_dbus_method(CONNMAN_SERVICE, profile_name,
- CONNMAN_SERVICE_INTERFACE, "SetProperty", params,
- &Error);
- if (message == NULL) {
- WIFI_LOG(WIFI_ERROR, "Failed to set "
- "Nameservers.Configuration");
- __NETWORK_FUNC_EXIT__;
- return Error;
+
+ WIFI_LOG(WIFI_INFO, "IPv4 DnsConfigType: %d\n", profile_net_info->DnsConfigType);
+ if (profile_net_info->DnsConfigType ==
+ NET_DNS_CONFIG_TYPE_STATIC ||
+ profile_net_info->DnsConfigType6 ==
+ NET_DNS_CONFIG_TYPE_STATIC)
+ g_variant_builder_add(builder, "s",
+ manual_method);
+ else
+ g_variant_builder_add(builder, "s",
+ dhcp_method);
+
+ WIFI_LOG(WIFI_INFO, "IPv6 DnsConfigType: %d\n", profile_net_info->DnsConfigType6);
+ if (profile_net_info->DnsConfigType6 ==
+ NET_DNS_CONFIG_TYPE_STATIC)
+ g_variant_builder_add(builder, "s",
+ ipv6_manual_method);
+ else if (profile_net_info->DnsConfigType6 ==
+ NET_DNS_CONFIG_TYPE_DYNAMIC)
+ g_variant_builder_add(builder, "s",
+ ipv6_dhcp_method);
+
+ for (i = 0; i < profile_net_info->DnsCount; i++) {
+ if (profile_net_info->DnsConfigType ==
+ NET_DNS_CONFIG_TYPE_STATIC) {
+ if (dns_address[i] == NULL)
+ g_strlcpy(dns_address[i], "0.0.0.0",
+ NET_IPV4_STR_LEN_MIN + 1);
+ g_variant_builder_add(builder, "s",
+ dns_address[i]);
+ }
+ WIFI_LOG(WIFI_INFO, "IPv4 DNS Address added in g_variant: %s\n", dns_address[i]);
+ }
+
+ for (i = 0; i < profile_net_info->DnsCount6; i++) {
+ if (profile_net_info->DnsConfigType6 ==
+ NET_DNS_CONFIG_TYPE_STATIC) {
+ if (ipv6_dns_address[i] == NULL)
+ g_strlcpy(ipv6_dns_address[i], "::",
+ NET_IPV6_STR_LEN_MIN + 1);
+ g_variant_builder_add(builder, "s",
+ ipv6_dns_address[i]);
+ }
+ WIFI_LOG(WIFI_INFO, "IPv6 DNS Address added in g_variant: %s\n", ipv6_dns_address[i]);
}
- WIFI_LOG(WIFI_INFO, "Successfully configured Nameservers.Configuration\n");
- g_variant_unref(message);
}
+ params = g_variant_new("(sv)", prop_nameserver_configuration, g_variant_builder_end(builder));
+ g_variant_builder_unref(builder);
+
+ message = _net_invoke_dbus_method(CONNMAN_SERVICE, profile_name,
+ CONNMAN_SERVICE_INTERFACE, "SetProperty", params,
+ &Error);
+ if (message == NULL) {
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+ WIFI_LOG(WIFI_INFO, "Successfully configured Nameservers.Configuration\n");
+ g_variant_unref(message);
+
__NETWORK_FUNC_EXIT__;
return Error;
}
return NET_ERR_NONE;
}
+static gboolean __net_check_address_type(int address_family, const char *address)
+{
+ unsigned char buf[sizeof(struct in6_addr)] = {0, };
+ int err = 0;
+
+ err = inet_pton(address_family, address, buf);
+ if (err > 0)
+ return TRUE;
+
+ return FALSE;
+}
+
static int __net_extract_common_info(const char *key, GVariant *variant, net_profile_info_s* ProfInfo)
{
__NETWORK_FUNC_ENTER__;
g_variant_iter_free(iter);
} else if (g_strcmp0(key, "Nameservers") == 0) {
int dnsCount = 0;
+ int dnsCount6 = 0;
+ gchar *dns_value = NULL;
+ gchar *dns_type = NULL;
g_variant_get(variant, "as", &iter);
- while (g_variant_iter_loop(iter, "s", &value)) {
- if (g_strcmp0(value, "dhcp") == 0 || g_strcmp0(value, "manual") == 0)
- continue;
- __net_extract_ip(value, &net_info->DnsAddr[dnsCount]);
-
- dnsCount++;
- if (dnsCount >= NET_DNS_ADDR_MAX) {
- if (NULL != value)
- g_free((gchar*)value);
- break;
+
+ while (g_variant_iter_loop(iter, "s", &dns_value)) {
+ if (__net_check_address_type(AF_INET6, dns_value)) {
+ if (dnsCount6 < NET_DNS_ADDR_MAX) {
+ net_info->DnsAddr6[dnsCount6].Type =
+ NET_ADDR_IPV6;
+ inet_pton(AF_INET6, dns_value,
+ &net_info->DnsAddr6[dnsCount6]\
+ .Data.Ipv6);
+ dnsCount6++;
+ }
+ } else if (__net_check_address_type(AF_INET, dns_value)) {
+ if (dnsCount < NET_DNS_ADDR_MAX) {
+ net_info->DnsAddr[dnsCount].Type =
+ NET_ADDR_IPV4;
+ __net_extract_ip(dns_value,
+ &net_info->DnsAddr[dnsCount]);
+ dnsCount++;
+ }
+ } else { /* DNS Type */
+ dns_type = g_strdup(dns_value);
+ if (g_strcmp0(dns_type, "ipv4.manual") == 0)
+ net_info->DnsConfigType =
+ NET_DNS_CONFIG_TYPE_STATIC;
+ else if (g_strcmp0(dns_type, "ipv4.dhcp") == 0)
+ net_info->DnsConfigType =
+ NET_DNS_CONFIG_TYPE_DYNAMIC;
+ if (g_strcmp0(dns_type, "ipv6.manual") == 0)
+ net_info->DnsConfigType6 =
+ NET_DNS_CONFIG_TYPE_STATIC;
+ else if (g_strcmp0(dns_type, "ipv6.dhcp") == 0)
+ net_info->DnsConfigType6 =
+ NET_DNS_CONFIG_TYPE_DYNAMIC;
}
}
-
+ g_free(dns_type);
g_variant_iter_free(iter);
net_info->DnsCount = dnsCount;
+ net_info->DnsCount6 = dnsCount6;
} else if (g_strcmp0(key, "Nameservers.Configuration") == 0 && net_info->DnsCount == 0) {
int dnsCount = 0;
+ int dnsCount6 = 0;
+ gchar *dns_value = NULL;
+ gchar *dns_type = NULL;
g_variant_get(variant, "as", &iter);
- while (g_variant_iter_loop(iter, "s", &value)) {
- if (g_strcmp0(value, "dhcp") == 0 || g_strcmp0(value, "manual") == 0
- || g_strcmp0(value, "unknown") == 0)
- continue;
- __net_extract_ip(value, &net_info->DnsAddr[dnsCount]);
-
- dnsCount++;
- if (dnsCount >= NET_DNS_ADDR_MAX) {
- if (NULL != value)
- g_free((gchar*)value);
- break;
+
+ while (g_variant_iter_loop(iter, "s", &dns_value)) {
+ if (__net_check_address_type(AF_INET6, dns_value)) {
+ if (dnsCount6 < NET_DNS_ADDR_MAX) {
+ net_info->DnsAddr6[dnsCount6].Type =
+ NET_ADDR_IPV6;
+ inet_pton(AF_INET6, dns_value,
+ &net_info->DnsAddr6[dnsCount6]\
+ .Data.Ipv6);
+ dnsCount6++;
+ }
+ } else if (__net_check_address_type(AF_INET, dns_value)) {
+ if (dnsCount < NET_DNS_ADDR_MAX) {
+ net_info->DnsAddr[dnsCount].Type =
+ NET_ADDR_IPV4;
+ __net_extract_ip(dns_value,
+ &net_info->DnsAddr[dnsCount]);
+ dnsCount++;
+ }
+ } else { /* DNS Type */
+ dns_type = g_strdup(dns_value);
+ if (g_strcmp0(dns_type, "ipv4.manual") == 0)
+ net_info->DnsConfigType =
+ NET_DNS_CONFIG_TYPE_STATIC;
+ else if (g_strcmp0(dns_type, "ipv4.dhcp") == 0)
+ net_info->DnsConfigType =
+ NET_DNS_CONFIG_TYPE_DYNAMIC;
+ if (g_strcmp0(dns_type, "ipv6.manual") == 0)
+ net_info->DnsConfigType6 =
+ NET_DNS_CONFIG_TYPE_STATIC;
+ else if (g_strcmp0(dns_type, "ipv6.dhcp") == 0)
+ net_info->DnsConfigType6 =
+ NET_DNS_CONFIG_TYPE_DYNAMIC;
}
}
+ g_free(dns_type);
g_variant_iter_free(iter);
net_info->DnsCount = dnsCount;
+ net_info->DnsCount6 = dnsCount6;
} else if (g_strcmp0(key, "Domains") == 0) {
} else if (g_strcmp0(key, "Domains.Configuration") == 0) {
} else if (g_strcmp0(key, "Proxy") == 0) {
break;
}
- if (i < net_info->DnsCount) {
+ if (i < net_info->DnsCount ||
+ ex_net_info->DnsConfigType != net_info->DnsConfigType ||
+ ex_net_info->DnsConfigType6 != net_info->DnsConfigType6) {
Error = _net_dbus_set_profile_dns(ProfInfo, profilePath);
if (Error != NET_ERR_NONE) {
} else if (g_strcmp0(key, "Keymgmt") == 0) {
ProfInfo->security_info.keymgmt = (unsigned int)g_variant_get_uint32(var);
-
} else
Error = __net_extract_common_info(key, var, ProfInfo);
}
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_ap_get_prefix_length(wifi_manager_ap_h ap,
+ wifi_manager_address_family_e address_family, int *prefix_len)
+{
+ 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) ||
+ prefix_len == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ net_profile_info_s *profile_info = ap;
+
+ *prefix_len = profile_info->net_info.PrefixLen6;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
+EXPORT_API int wifi_manager_ap_set_prefix_length(wifi_manager_ap_h ap,
+ wifi_manager_address_family_e address_family, int prefix_len)
+{
+ 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
+ }
+
+ net_profile_info_s *profile_info = ap;
+
+ profile_info->net_info.PrefixLen6 = prefix_len;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_ap_get_gateway_address(wifi_manager_ap_h ap,
wifi_manager_address_family_e address_family, char **gateway_address)
{
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_ap_get_dns_config_type(wifi_manager_ap_h ap,
+ wifi_manager_address_family_e address_family, wifi_manager_dns_config_type_e *type)
+{
+ 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
+ }
+
+ net_profile_info_s *profile_info = ap;
+ net_dns_config_type_e dns_type;
+
+ if (address_family == WIFI_MANAGER_ADDRESS_FAMILY_IPV4)
+ dns_type = profile_info->net_info.DnsConfigType;
+ else
+ dns_type = profile_info->net_info.DnsConfigType6;
+
+ switch (dns_type) {
+ case NET_DNS_CONFIG_TYPE_STATIC:
+ *type = WIFI_MANAGER_DNS_CONFIG_TYPE_STATIC;
+ break;
+ case NET_DNS_CONFIG_TYPE_DYNAMIC:
+ *type = WIFI_MANAGER_DNS_CONFIG_TYPE_DYNAMIC;
+ break;
+ default:
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+ }
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
+EXPORT_API int wifi_manager_ap_set_dns_config_type(wifi_manager_ap_h ap,
+ wifi_manager_address_family_e address_family, wifi_manager_dns_config_type_e type)
+{
+ 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) ||
+ (type != WIFI_MANAGER_DNS_CONFIG_TYPE_STATIC &&
+ type != WIFI_MANAGER_DNS_CONFIG_TYPE_DYNAMIC)) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ net_profile_info_s *profile_info = ap;
+ net_dns_config_type_e *dns_type;
+
+ if (address_family == WIFI_MANAGER_ADDRESS_FAMILY_IPV4) {
+ dns_type = &profile_info->net_info.DnsConfigType;
+
+ profile_info->net_info.DnsAddr[0].Data.Ipv4.s_addr = 0;
+ profile_info->net_info.DnsAddr[1].Data.Ipv4.s_addr = 0;
+
+ *dns_type = type;
+ } else {
+ dns_type = &profile_info->net_info.DnsConfigType6;
+
+ inet_pton(AF_INET6, "::",
+ &profile_info->net_info.DnsAddr6[0].Data.Ipv6);
+ inet_pton(AF_INET6, "::",
+ &profile_info->net_info.DnsAddr6[1].Data.Ipv6);
+
+ *dns_type = type;
+ }
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_ap_get_dns_address(wifi_manager_ap_h ap,
int order, wifi_manager_address_family_e address_family, char **dns_address)
{
wifi_manager_ip_config_type_e type;
int method;
int address_type;
+ int dns_type;
+ int prefix_len;
printf("Input new method type (1:dhcp, 2:manual, 3:auto) :\n");
rv = scanf("%9d", &method);
printf("Fail to set ip method type[%s]\n", __test_convert_error_to_string(rv));
if (type == WIFI_MANAGER_IP_CONFIG_TYPE_STATIC) {
- char ip_addr[16];
+ char ip_addr[40];
printf("Input new ip address (x:skip, 0:clear) :\n");
rv = scanf("%15s", ip_addr);
__test_convert_error_to_string(rv));
}
+ printf("Input new prefix length (x:skip) :\n");
+ rv = scanf("%d", &prefix_len);
+ if (rv > 0) {
+ if (prefix_len == 'x')
+ rv = WIFI_MANAGER_ERROR_NONE;
+ else
+ rv = wifi_manager_ap_set_prefix_length(ap, address_type, prefix_len);
+
+ if (rv != WIFI_MANAGER_ERROR_NONE)
+ printf("Fail to set subnet mask[%s]\n",
+ __test_convert_error_to_string(rv));
+ }
+
printf("Input new gateway address (x:skip, 0:clear) :\n");
rv = scanf("%15s", ip_addr);
if (rv > 0) {
printf("Fail to set gateway address[%s]\n",
__test_convert_error_to_string(rv));
}
+
+ rv = test_get_user_int("Input DNS config type (0:STATIC, 1:DYNAMIC)"
+ "- (Enter for skip) : ", &dns_type);
+ if (rv == false) {
+ printf("Invalid input!!\n");
+ return false;
+ }
+ switch (dns_type) {
+ case 0:
+ rv = wifi_manager_ap_set_dns_config_type(ap,
+ address_type, WIFI_MANAGER_DNS_CONFIG_TYPE_STATIC);
+ if (rv == WIFI_MANAGER_ERROR_NONE) {
+ printf("Input DNS1 address (x: skip, 0: clear) : \n");
+ if (address_type == WIFI_MANAGER_ADDRESS_FAMILY_IPV4)
+ rv = scanf("%15s", ip_addr);
+ else
+ rv = scanf("%39s", ip_addr);
+ if (rv > 0) {
+ switch (ip_addr[0]) {
+ case 'x':
+ rv = WIFI_MANAGER_ERROR_NONE;
+ break;
+ case '0':
+ rv = wifi_manager_ap_set_dns_address(ap,
+ 1, address_type, NULL);
+ break;
+ default:
+ rv = wifi_manager_ap_set_dns_address(ap,
+ 1, address_type, ip_addr);
+ break;
+ }
+ }
+ if (rv != WIFI_MANAGER_ERROR_NONE)
+ return -1;
+
+ printf("Input DNS2 address (x: skip, 0: clear) : \n");
+ if (address_type == WIFI_MANAGER_ADDRESS_FAMILY_IPV4)
+ rv = scanf("%15s", ip_addr);
+ else
+ rv = scanf("%39s", ip_addr);
+ if (rv > 0) {
+ switch (ip_addr[0]) {
+ case 'x':
+ rv = WIFI_MANAGER_ERROR_NONE;
+ break;
+ case '0':
+ rv = wifi_manager_ap_set_dns_address(ap,
+ 2, address_type, NULL);
+ break;
+ default:
+ rv = wifi_manager_ap_set_dns_address(ap,
+ 2, address_type, ip_addr);
+ break;
+ }
+ }
+ if (rv != WIFI_MANAGER_ERROR_NONE)
+ return -1;
+ }
+ break;
+ case 1:
+ rv = wifi_manager_ap_set_dns_config_type(ap,
+ address_type, WIFI_MANAGER_DNS_CONFIG_TYPE_DYNAMIC);
+ if (rv != WIFI_MANAGER_ERROR_NONE)
+ return -1;
+ break;
+ }
}
rv = wifi_manager_update_ap(wifi, ap);
wifi_manager_encryption_type_e enc_type;
wifi_manager_eap_type_e eap_type;
wifi_manager_eap_auth_type_e eap_auth_type;
+ wifi_manager_dns_config_type_e dns_type;
bool bool_value;
char *ap_name_part = (char*)user_data;
wifi_manager_disconnect_reason_e disconnect_reason;
} else
printf("Fail to get Subnet mask\n");
+ if (wifi_manager_ap_get_prefix_length(ap, address_type, &int_value) == WIFI_MANAGER_ERROR_NONE)
+ printf("Prefix length : %d\n", int_value);
+ else
+ printf("Fail to get Subnet mask\n");
+
if (wifi_manager_ap_get_gateway_address(ap, address_type, &str_value) == WIFI_MANAGER_ERROR_NONE) {
printf("Gateway : %s\n", str_value);
g_free(str_value);
} else
printf("Fail to get Proxy\n");
+ if (wifi_manager_ap_get_dns_config_type(ap, address_type, &dns_type) == WIFI_MANAGER_ERROR_NONE) {
+ if (dns_type == WIFI_MANAGER_DNS_CONFIG_TYPE_STATIC)
+ printf("DNS config type : STATIC\n");
+ else if (dns_type == WIFI_MANAGER_DNS_CONFIG_TYPE_DYNAMIC)
+ printf("DNS config type : DYNAMIC\n");
+ else
+ printf("DNS config type : %d\n", dns_type);
+ } else
+ printf("Fail to get DNS config type\n");
+
if (wifi_manager_ap_get_dns_address(ap, 1, address_type, &str_value) == WIFI_MANAGER_ERROR_NONE) {
printf("DNS1 : %s\n", str_value);
g_free(str_value);