Added Wifi direct tethering feature for Tizen 4.0
[platform/core/api/tethering.git] / test / tethering_test.c
index 1f9982b..a6d00f6 100755 (executable)
@@ -72,6 +72,14 @@ static bool __is_err(tethering_error_e ret)
                err_msg = "Resource is busy";
                break;
 
+       case TETHERING_ERROR_NOT_PERMITTED:
+               err_msg = "Operation is not permitted";
+               break;
+
+       case TETHERING_ERROR_NOT_SUPPORT_API:
+               err_msg = "Not supported";
+               break;
+
        default:
                err_msg = "This should not be happened";
                break;
@@ -99,8 +107,8 @@ static const char *__convert_tethering_type_to_str(const tethering_type_e type)
                g_strlcpy(str_buf, "Bluetooth Tethering", sizeof(str_buf));
                break;
 
-       case TETHERING_TYPE_RESERVED:
-               g_strlcpy(str_buf, "Wi-Fi AP", sizeof(str_buf));
+       case TETHERING_TYPE_P2P:
+               g_strlcpy(str_buf, "P2P Tethering", sizeof(str_buf));
                break;
 
        default:
@@ -169,31 +177,16 @@ static void __register_cbs(tethering_h th, __tethering_cbs *cbs, void *user_data
        if (__is_err(ret) == true)
                g_print("tethering_set_enabled_cb is failed\n");
 
-       ret = tethering_set_enabled_cb(th, TETHERING_TYPE_RESERVED,
-                       cbs->enabled_cb, user_data);
-       if (__is_err(ret) == true)
-               g_print("tethering_set_enabled_cb is failed\n");
-
        ret = tethering_set_disabled_cb(th, TETHERING_TYPE_ALL,
                        cbs->disabled_cb, user_data);
        if (__is_err(ret) == true)
                g_print("tethering_set_disabled_cb is failed\n");
 
-       ret = tethering_set_disabled_cb(th, TETHERING_TYPE_RESERVED,
-                       cbs->disabled_cb, user_data);
-       if (__is_err(ret) == true)
-               g_print("tethering_set_disabled_cb is failed\n");
-
        ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_ALL,
                        cbs->changed_cb, user_data);
        if (__is_err(ret) == true)
                g_print("tethering_set_connection_state_changed_cb is failed\n");
 
-       ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_RESERVED,
-                       cbs->changed_cb, user_data);
-       if (__is_err(ret) == true)
-               g_print("tethering_set_connection_state_changed_cb is failed\n");
-
        ret = tethering_wifi_set_security_type_changed_cb(th,
                        cbs->security_type_changed_cb, user_data);
        if (__is_err(ret) == true)
@@ -220,26 +213,14 @@ static void __deregister_cbs(tethering_h th)
        if (__is_err(ret) == true)
                g_print("tethering_unset_enabled_cb is failed\n");
 
-       ret = tethering_unset_enabled_cb(th, TETHERING_TYPE_RESERVED);
-       if (__is_err(ret) == true)
-               g_print("tethering_unset_enabled_cb is failed\n");
-
        ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_ALL);
        if (__is_err(ret) == true)
                g_print("tethering_unset_disabled_cb is failed\n");
 
-       ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_RESERVED);
-       if (__is_err(ret) == true)
-               g_print("tethering_unset_disabled_cb is failed\n");
-
        ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_ALL);
        if (__is_err(ret) == true)
                g_print("tethering_unset_connection_state_changed_cb is failed\n");
 
-       ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_RESERVED);
-       if (__is_err(ret) == true)
-               g_print("tethering_unset_connection_state_changed_cb is failed\n");
-
        ret = tethering_wifi_unset_security_type_changed_cb(th);
        if (__is_err(ret) == true)
                g_print("tethering_wifi_unset_security_type_changed_cb is failed\n");
@@ -419,9 +400,25 @@ static bool __clients_foreach_cb(tethering_client_h client, void *data)
 
 static void __security_type_changed_cb(tethering_wifi_security_type_e changed_type, void *user_data)
 {
-       g_print("Wi-Fi Tethering Security type is changed to [%s]\n",
-                       changed_type == TETHERING_WIFI_SECURITY_TYPE_NONE ?
-                       "open" : "wpa2-psk");
+
+       char *sec_str = NULL;
+
+       switch (changed_type) {
+       case TETHERING_WIFI_SECURITY_TYPE_NONE:
+               sec_str = "open";
+               break;
+       case TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK:
+               sec_str = "wpa2-psk";
+               break;
+       case TETHERING_WIFI_SECURITY_TYPE_WPS:
+               sec_str = "wps";
+               break;
+       default:
+               sec_str = "unknown";
+               break;
+       }
+       g_print("Wi-Fi Tethering Security type is changed to [%s]\n", sec_str);
+
        return;
 }
 
@@ -444,8 +441,11 @@ static void __print_interface_info(tethering_h th, tethering_type_e type)
        char *interface = NULL;
        char *mac_address = NULL;
        char *ip_address = NULL;
+       char *ip6_address = NULL;
        char *gateway_address = NULL;
+       char *gateway6_address = NULL;
        char *subnet_mask = NULL;
+       char *prefix = NULL;
 
        if (tethering_is_enabled(th, type) == FALSE) {
                g_print("%s is not enabled\n",
@@ -457,16 +457,25 @@ static void __print_interface_info(tethering_h th, tethering_type_e type)
        tethering_get_mac_address(th, type, &mac_address);
        tethering_get_ip_address(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
                        &ip_address);
+       tethering_get_ip_address(th, type, TETHERING_ADDRESS_FAMILY_IPV6,
+                       &ip6_address);
        tethering_get_gateway_address(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
                        &gateway_address);
+       tethering_get_gateway_address(th, type, TETHERING_ADDRESS_FAMILY_IPV6,
+                       &gateway6_address);
        tethering_get_subnet_mask(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
                        &subnet_mask);
+       tethering_get_subnet_mask(th, type, TETHERING_ADDRESS_FAMILY_IPV6,
+                       &prefix);
 
        g_print("interface name : %s\n", interface);
        g_print("mac address : %s\n", mac_address);
-       g_print("ip address : %s\n", ip_address);
+       g_print("IPv4 address : %s\n", ip_address);
+       g_print("IPv6 address : %s\n", ip6_address);
        g_print("gateway address: %s\n", gateway_address);
+       g_print("IPv6 gateway address: %s\n", gateway6_address);
        g_print("subnet mask : %s\n", subnet_mask);
+       g_print("IPv6 prefix : %s\n", prefix);
 
        if (interface)
                free(interface);
@@ -474,10 +483,16 @@ static void __print_interface_info(tethering_h th, tethering_type_e type)
                free(mac_address);
        if (ip_address)
                free(ip_address);
+       if (ip6_address)
+               free(ip6_address);
        if (gateway_address)
                free(gateway_address);
        if (subnet_mask)
                free(subnet_mask);
+       if (gateway6_address)
+               free(gateway6_address);
+       if (prefix)
+               free(prefix);
 
        return;
 }
@@ -486,9 +501,13 @@ static void __print_wifi_tethering_setting(tethering_h th)
 {
        char *ssid = NULL;
        char *passphrase = NULL;
+       char *sec_str = NULL;
        bool visibility = false;
        bool mac_filter = 0;
+       bool forwarding_enabled = false;
+       bool filtering_enabled = false;
        int channel = 0;
+       int max_connected = 0;
        tethering_wifi_security_type_e security_type = TETHERING_WIFI_SECURITY_TYPE_NONE;
        tethering_wifi_mode_type_e hw_mode = TETHERING_WIFI_MODE_TYPE_G;
 
@@ -516,18 +535,23 @@ static void __print_wifi_tethering_setting(tethering_h th)
        error = tethering_wifi_get_security_type(th, &security_type);
        if (error != TETHERING_ERROR_NONE)
                __is_err(error);
-       else
-               g_print("\t** WiFi tethering security_type : %s\n",
-                               security_type ==
-                               TETHERING_WIFI_SECURITY_TYPE_NONE ?
-                               "open" : "wpa2-psk");
-
-       error = tethering_wifi_get_mac_filter(th, &mac_filter);
-       if (error != TETHERING_ERROR_NONE)
-               __is_err(error);
-       else
-               g_print("\t** WiFi tethering mac filter : %s\n",
-                               mac_filter ? "enable" : "disable");
+       else {
+               switch (security_type) {
+               case TETHERING_WIFI_SECURITY_TYPE_NONE:
+                       sec_str = "open";
+                       break;
+               case TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK:
+                       sec_str = "wpa2-psk";
+                       break;
+               case TETHERING_WIFI_SECURITY_TYPE_WPS:
+                       sec_str = "wps";
+                       break;
+               default:
+                       sec_str = "unknown";
+                       break;
+               }
+               g_print("\t** WiFi tethering security_type : %s\n", sec_str);
+       }
 
        error = tethering_wifi_get_mode(th, &hw_mode);
        if (error != TETHERING_ERROR_NONE)
@@ -541,50 +565,32 @@ static void __print_wifi_tethering_setting(tethering_h th)
        else
                 g_print("\t** WiFi tethering channel : %d\n", channel);
 
-       if (ssid)
-               free(ssid);
-       if (passphrase)
-               free(passphrase);
-
-       return;
-}
-
-static void __print_wifi_ap_setting(tethering_h th)
-{
-       char *ssid = NULL;
-       char *passphrase = NULL;
-       bool visibility = false;
-       tethering_wifi_security_type_e security_type = TETHERING_WIFI_SECURITY_TYPE_NONE;
-
-       int error = TETHERING_ERROR_NONE;
-
-       error = tethering_wifi_ap_get_ssid(th, &ssid);
+       error = tethering_wifi_get_max_connected_device(th, &max_connected);
        if (error != TETHERING_ERROR_NONE)
                __is_err(error);
        else
-               g_print("\n\t** WiFi AP SSID : %s\n", ssid);
+                g_print("\t** WiFi tethering max connected device : %d\n", max_connected);
 
-       error = tethering_wifi_ap_get_passphrase(th, &passphrase);
+       error = tethering_wifi_get_mac_filter(th, &mac_filter);
        if (error != TETHERING_ERROR_NONE)
                __is_err(error);
        else
-               g_print("\t** WiFi AP passphrase : %s\n", passphrase);
+               g_print("\t** WiFi tethering mac filter : %s\n",
+                               mac_filter ? "enable" : "disable");
 
-       error = tethering_wifi_ap_get_ssid_visibility(th, &visibility);
+       error = tethering_wifi_is_port_filtering_enabled(th, &filtering_enabled);
        if (error != TETHERING_ERROR_NONE)
                __is_err(error);
        else
-               g_print("\t** WiFi AP ssid visibility : %s\n",
-                               visibility ? "visible" : "invisible");
+               g_print("\t** WiFi tethering port filtering : %s\n",
+                               filtering_enabled ? "enable" : "disable");
 
-       error = tethering_wifi_ap_get_security_type(th, &security_type);
+       error = tethering_wifi_is_port_forwarding_enabled(th, &forwarding_enabled);
        if (error != TETHERING_ERROR_NONE)
                __is_err(error);
        else
-               g_print("\t** WiFi AP security_type : %s\n",
-                               security_type ==
-                               TETHERING_WIFI_SECURITY_TYPE_NONE ?
-                               "open" : "wpa2-psk");
+               g_print("\t** WiFi tethering port forwarding : %s\n",
+                               forwarding_enabled ? "enable" : "disable");
 
        if (ssid)
                free(ssid);
@@ -594,12 +600,20 @@ static void __print_wifi_ap_setting(tethering_h th)
        return;
 }
 
+void __display_list(GSList *list)
+{
+       GSList *iterator = NULL;
+
+       for (iterator = list; iterator; iterator = iterator->next)
+               printf("%s\n", (char*)iterator->data);
+}
+
 bool __get_tethering_type(tethering_type_e *type)
 {
        int sel;
        int ret;
 
-       printf("Select tethering type (1:Wi-Fi, 2:BT, 3:USB 4:WiFi AP, 5:ALL)\n");
+       printf("Select tethering type (1:Wi-Fi, 2:BT, 3:USB 4:P2P 5:ALL)\n");
        ret = scanf("%9d", &sel);
        if (ret < 0) {
                printf("scanf is failed!!\n");
@@ -617,7 +631,7 @@ bool __get_tethering_type(tethering_type_e *type)
                *type = TETHERING_TYPE_USB;
                break;
        case 4:
-               *type = TETHERING_TYPE_RESERVED;
+               *type = TETHERING_TYPE_P2P;
                break;
        case 5:
                *type = TETHERING_TYPE_ALL;
@@ -667,11 +681,19 @@ static int test_tethering_enable(void)
 {
        int ret = TETHERING_ERROR_NONE;
        tethering_type_e type;
+       int address_type = 0;
+
+       printf("IPv4: 0, IPv6: 1\n");
+       ret = scanf("%d", &address_type);
 
        if (!__get_tethering_type(&type))
                return -1;
 
-       ret = tethering_enable(th, type);
+       if (address_type)
+               ret = tethering_ipv6_enable(th, type);
+       else
+               ret = tethering_enable(th, type);
+
        if (__is_err(ret) == true) {
                printf("Fail to enable tethering\n");
                return -1;
@@ -683,11 +705,19 @@ static int test_tethering_disable(void)
 {
        int ret = TETHERING_ERROR_NONE;
        tethering_type_e type;
+       int address_type = 0;
+
+       printf("IPv4: 0, IPv6: 1\n");
+       ret = scanf("%d", &address_type);
 
        if (!__get_tethering_type(&type))
                return -1;
 
-       ret = tethering_disable(th, type);
+       if (address_type)
+               ret = tethering_ipv6_disable(th, type);
+       else
+               ret = tethering_disable(th, type);
+
        if (__is_err(ret) == true) {
                printf("Fail to disable tethering\n");
                return -1;
@@ -743,12 +773,6 @@ static int test_tethering_wifi_get_setting(void)
        return 1;
 }
 
-static int test_tethering_wifi_ap_get_setting(void)
-{
-       __print_wifi_ap_setting(th);
-       return 1;
-}
-
 static int test_tethering_wifi_set_ssid(void)
 {
        int ret;
@@ -775,7 +799,7 @@ static int test_tethering_wifi_set_security_type(void)
        int ret;
        int security_type;
 
-       printf("Input security type for Wi-Fi tethering (0:NONE, 1:WPA2_PSK)");
+       printf("Input security type for Wi-Fi tethering (0:NONE, 1:WPA2_PSK, 2:WPS)");
        ret = scanf("%9d", &security_type);
        if (ret < 0) {
                printf("scanf is failed!!\n");
@@ -968,7 +992,7 @@ static int test_tethering_manage_mac_list(void)
                /* Remove from blocked mac list */
                ret = tethering_wifi_remove_blocked_mac_list(th, mac);
        } else {
-               printf("Input Failed!!\n");
+               printf("Input failed!!\n");
                return -1;
        }
 
@@ -978,105 +1002,337 @@ static int test_tethering_manage_mac_list(void)
        return 1;
 }
 
-static int test_tethering_wifi_ap_set_ssid(void)
+static int test_tethering_get_mac_list(void)
+{
+       int ret = 0;
+       int list = 0;
+       void *mac_list = NULL;
+
+       printf("Select MAC list to get (0: allowed mac list, 1: blocked mac list): ");
+       ret = scanf("%d", &list);
+
+       switch (list) {
+       case 0:
+               ret = tethering_wifi_get_allowed_mac_list(th, &mac_list);
+               break;
+       case 1:
+               ret = tethering_wifi_get_blocked_mac_list(th, &mac_list);
+               break;
+       default:
+               printf("Input failed!!\n");
+               break;
+       }
+
+       if (ret < 0)
+               return -1;
+
+       __display_list(mac_list);
+
+       return 1;
+}
+
+static int test_tethering_wifi_reload_settings(void)
+{
+       int ret = tethering_wifi_reload_settings(th, __settings_reloaded_cb, NULL);
+
+       if (__is_err(ret) == true) {
+               printf("Fail to reload wifi tethering!!\n");
+               return -1;
+       }
+       return 1;
+}
+
+static int test_tethering_wifi_get_txpower(void)
+{
+       int ret = TETHERING_ERROR_NONE;
+
+       unsigned int txpower = 0;
+       ret = tethering_wifi_get_txpower(th, &txpower);
+       if (__is_err(ret) == true) {
+               printf("Fail to get txpower!!\n");
+               return -1;
+       }
+       g_print("tethering_hostapd_get_txpower received [%d]\n", txpower);
+       return 1;
+}
+
+static int test_tethering_wifi_set_txpower(void)
 {
        int ret;
-       char ssid[100];
+       unsigned int txpower = 0;
 
-       printf("Input SSID for Wi-Fi AP tethering: ");
-       ret = scanf("%99s", ssid);
-       if (ret < 0) {
-               printf("scanf is failed!!\n");
+       printf("Input tx power for Wi-Fi tethering: ");
+       ret = scanf("%d", &txpower);
+
+       ret = tethering_wifi_set_txpower(th, txpower);
+       if (__is_err(ret) == true) {
+               printf("Fail to set txpower!!\n");
                return -1;
        }
 
-       ret = tethering_wifi_ap_set_ssid(th, ssid);
+       return 1;
+}
+
+static int test_tethering_wifi_set_mtu(void)
+{
+       int ret;
+       unsigned int mtu = 0;
+
+       printf("Input mtu for Wi-Fi tethering: ");
+       ret = scanf("%d", &mtu);
+
+       ret = tethering_wifi_set_mtu(th, mtu);
        if (__is_err(ret) == true) {
-               printf("Fail to set wifi ap ssid!!\n");
+               printf("Fail to set mtu!!\n");
                return -1;
        }
+
        return 1;
 }
 
-static int test_tethering_wifi_ap_set_security_type(void)
+static int test_tethering_wifi_change_mac(void)
 {
        int ret;
-       int security_type;
+       char mac[18];
 
-       printf("Input security type for Wi-Fi AP tethering (0:NONE, 1:WPA2_PSK)");
-       ret = scanf("%9d", &security_type);
-       if (ret < 0) {
-               printf("scanf is failed!!\n");
+       printf("Input mac address: ");
+       ret = scanf("%17s", mac);
+
+       ret = tethering_wifi_change_mac(th, mac);
+       if (__is_err(ret) == true) {
+               printf("Fail to change mac!\n");
                return -1;
        }
 
-       ret = tethering_wifi_ap_set_security_type(th, security_type);
+       return 1;
+}
+
+static int test_tethering_wifi_set_max_connected_device(void)
+{
+       int ret;
+       int max_connected;
+
+       printf("Input max connected device: ");
+       ret = scanf("%d", &max_connected);
+
+       ret = tethering_wifi_set_max_connected_device(th, max_connected);
        if (__is_err(ret) == true) {
-               printf("Fail to set security type!!\n");
+               printf("Fail to set max connected device!\n");
                return -1;
        }
+
        return 1;
+
 }
 
-static int test_tethering_wifi_ap_set_visibility(void)
+static int test_tethering_wifi_enable_port_forwarding(void)
 {
        int ret;
-       int visibility;
+       int enable = false;
 
-       printf("Input security type for Wi-Fi tethering (0:invisible, 1:visible)");
-       ret = scanf("%9d", &visibility);
-       if (ret < 0) {
-               printf("scanf is failed!!\n");
+       printf("Wi-Fi tethring port forwarding(0:disable 1:enable): ");
+       ret = scanf("%d", &enable);
+
+       ret = tethering_wifi_enable_port_forwarding(th, enable);
+       if (__is_err(ret) == true) {
+               printf("Fail to enable port forwarding!\n");
                return -1;
        }
 
-       ret = tethering_wifi_ap_set_ssid_visibility(th, visibility);
+       return 1;
+}
+
+static int test_tethering_wifi_add_port_forwarding_rule(void)
+{
+       int ret;
+       char ifname[20];
+       char proto[20];
+       char org_ip[16];
+       char final_ip[16];
+       int org_port, final_port;
+
+       printf("Input ifname, protocol, original ip/port, final ip/port: ");
+       ret = scanf("%19s", ifname);
+       ret = scanf("%19s", proto);
+       ret = scanf("%15s", org_ip);
+       ret = scanf("%d", &org_port);
+       ret = scanf("%15s", final_ip);
+       ret = scanf("%d", &final_port);
+
+       ret = tethering_wifi_add_port_forwarding_rule(th, ifname, proto, org_ip, org_port, final_ip, final_port);
        if (__is_err(ret) == true) {
-               printf("Fail to set visibility!!\n");
+               printf("Fail to add port forwarding rule!\n");
                return -1;
        }
+
        return 1;
 }
 
-static int test_tethering_wifi_ap_set_passphrase(void)
+static int test_tethering_wifi_reset_port_forwarding_rule(void)
 {
        int ret;
-       char passphrase[100];
 
-       printf("Input passphrase for Wi-Fi tethering: ");
-       ret = scanf("%99s", passphrase);
-       if (ret < 0) {
-               printf("scanf is failed!!\n");
+       ret = tethering_wifi_reset_port_forwarding_rule(th);
+       if (__is_err(ret) == true) {
+               printf("Fail to reset port forwarding rule!\n");
                return -1;
        }
 
-       ret = tethering_wifi_ap_set_passphrase(th, passphrase);
+       return 1;
+}
+
+static int test_tethering_wifi_get_port_forwarding_rule(void)
+{
+       int ret = 0;
+       void *pf_list = NULL;
+
+       ret = tethering_wifi_get_port_forwarding_rule(th, &pf_list);
        if (__is_err(ret) == true) {
-               printf("Fail to set passphrase!!\n");
+               printf("Fail to get port forwarding rule!\n");
                return -1;
        }
+
+       __display_list(pf_list);
+
        return 1;
 }
 
-static int test_tethering_wifi_reload_settings(void)
+static int test_tethering_wifi_enable_port_filtering(void)
 {
-       int ret = tethering_wifi_reload_settings(th, __settings_reloaded_cb, NULL);
+       int ret;
+       int enable = false;
+
+       printf("Wi-Fi tethring port filtering(0:disable 1:enable): ");
+       ret = scanf("%d", &enable);
 
+       ret = tethering_wifi_enable_port_filtering(th, enable);
        if (__is_err(ret) == true) {
-               printf("Fail to reload wifi tethering!!\n");
+               printf("Fail to enable port filtering!\n");
                return -1;
        }
+
        return 1;
 }
 
-static int test_tethering_wifi_ap_reload_settings(void)
+static int test_tethering_wifi_add_port_filtering_rule(void)
 {
-       int ret = tethering_wifi_ap_reload_settings(th, __settings_reloaded_cb, NULL);
+       int ret;
+       char proto[20];
+       int port;
+       int allow;
 
+       printf("Input protocol, port, allow: ");
+       ret = scanf("%19s", proto);
+       ret = scanf("%d", &port);
+       ret = scanf("%d", &allow);
+
+       ret = tethering_wifi_add_port_filtering_rule(th, port, proto, allow);
        if (__is_err(ret) == true) {
-               printf("Fail to reload wifi tethering!!\n");
+               printf("Fail to add port forwarding rule!\n");
+               return -1;
+       }
+
+       return 1;
+}
+
+static int test_tethering_wifi_add_custom_port_filtering_rule(void)
+{
+       int ret;
+       char proto[20];
+       int port1, port2;
+       int allow;
+
+       printf("Input protocol, port1, port2, allow: ");
+       ret = scanf("%19s", proto);
+       ret = scanf("%d", &port1);
+       ret = scanf("%d", &port2);
+       ret = scanf("%d", &allow);
+
+       ret = tethering_wifi_add_custom_port_filtering_rule(th, port1, port2, proto, allow);
+       if (__is_err(ret) == true) {
+               printf("Fail to add custom port forwarding rule!\n");
+               return -1;
+       }
+
+       return 1;
+}
+
+static int test_tethering_wifi_get_port_filtering_rule(void)
+{
+       int ret = 0;
+       void *pf_list = NULL;
+
+       ret = tethering_wifi_get_port_filtering_rule(th, &pf_list);
+       if (__is_err(ret) == true) {
+               printf("Fail to get port filtering rule!\n");
                return -1;
        }
+
+       __display_list(pf_list);
+
+       return 1;
+}
+
+static int test_tethering_wifi_get_custom_port_filtering_rule(void)
+{
+       int ret = 0;
+       void *pf_list = NULL;
+
+       ret = tethering_wifi_get_custom_port_filtering_rule(th, &pf_list);
+       if (__is_err(ret) == true) {
+               printf("Fail to get port filtering rule!\n");
+               return -1;
+       }
+
+       __display_list(pf_list);
+
+       return 1;
+}
+
+static int test_tethering_wifi_set_vpn_passthrough_rule(void)
+{
+       int ret = 0;
+       int type;
+
+       printf("Select vpn passthrough type (0:IPSEC 1:PPTP 2:L2TP): ");
+       ret = scanf("%d", &type);
+
+       ret = tethering_wifi_set_vpn_passthrough_rule(th, (tethering_vpn_passthrough_type_e)type, true);
+       if (__is_err(ret) == true) {
+               printf("Fail to get port filtering rule!\n");
+               return -1;
+       }
+
+       return 1;
+}
+
+static int test_tethering_wifi_push_wps_button(void)
+{
+       int ret = 0;
+
+       ret = tethering_wifi_push_wps_button(th);
+       if (__is_err(ret) == true) {
+               printf("Fail to get port filtering rule!\n");
+               return -1;
+       }
+
+       return 1;
+}
+
+static int test_tethering_wifi_set_wps_pin(void)
+{
+       int ret = 0;
+       char wps_pin[128];
+
+       printf("Input WPS PIN: ");
+       ret = scanf("%127s", wps_pin);
+
+       ret = tethering_wifi_set_wps_pin(th, wps_pin);
+       if (__is_err(ret) == true) {
+               printf("Fail to get port filtering rule!\n");
+               return -1;
+       }
+
        return 1;
 }
 
@@ -1120,25 +1376,37 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                printf("6       - Get interface information\n");
                printf("7       - Get data usage\n");
                printf("8       - Get Wi-Fi tethering setting\n");
-               printf("9       - Get Wi-Fi AP setting\n");
                printf("a       - Set Wi-Fi tethering SSID\n");
                printf("b       - Set Wi-Fi tethering security type\n");
                printf("c       - Set Wi-Fi tethering visibility\n");
                printf("d       - Set Wi-Fi tethering passphrase\n");
                printf("e       - Set Wi-Fi tethering mac filtering\n");
                printf("f       - Add/Remove MAC adress to/from allowed/blocked list\n");
-               printf("g       - Set Wi-Fi AP SSID\n");
-               printf("h       - Set Wi-Fi AP security type\n");
-               printf("i       - Set Wi-Fi AP visibility\n");
-               printf("j       - Set Wi-Fi AP passphrase\n");
+               printf("g       - Get allowed/blocked list\n");
                printf("k       - Reload Wi-Fi tethering\n");
-               printf("l       - Reload Wi-Fi AP\n");
                printf("m       - Set Wi-Fi channel\n");
                printf("n       - Set Wi-Fi hw_mode\n");
                printf("o       - Enable dhcp server\n");
                printf("p       - Enable dhcp server with range\n");
                printf("q       - Is dhcp server enabled?\n");
-               printf("0       - Exit \n");
+               printf("r       - Get Wi-Fi txpower\n");
+               printf("s       - Set Wi-Fi txpower\n");
+               printf("t       - Set Wi-Fi mtu\n");
+               printf("u       - Change mac address\n");
+               printf("v       - Set max connected device(Wi-Fi tethering)\n");
+               printf("w       - Enable port forwarding\n");
+               printf("x       - Add port forwarding rule\n");
+               printf("y       - Reset port forwarding rule\n");
+               printf("z       - Get port forwarding rule\n");
+               printf("A       - Enable port filtering\n");
+               printf("B       - Add port filtering rule\n");
+               printf("C       - Add custom port filtering rule\n");
+               printf("D       - Get port filtering rule\n");
+               printf("E       - Get custom port filtering rule\n");
+               printf("F       - Set vpn passthrough rule\n");
+               printf("G       - Push WPS button\n");
+               printf("H       - Set WPS PIN\n");
+               printf("0       - \n");
                printf("ENTER  - Show options menu.......\n");
        }
 
@@ -1167,9 +1435,6 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
        case '8':
                rv = test_tethering_wifi_get_setting();
                break;
-       case '9':
-               rv = test_tethering_wifi_ap_get_setting();
-               break;
        case 'a':
                rv = test_tethering_wifi_set_ssid();
                break;
@@ -1189,23 +1454,11 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                rv = test_tethering_manage_mac_list();
                break;
        case 'g':
-               rv = test_tethering_wifi_ap_set_ssid();
-               break;
-       case 'h':
-               rv = test_tethering_wifi_ap_set_security_type();
-               break;
-       case 'i':
-               rv = test_tethering_wifi_ap_set_visibility();
-               break;
-       case 'j':
-               rv = test_tethering_wifi_ap_set_passphrase();
+               rv = test_tethering_get_mac_list();
                break;
        case 'k':
                rv = test_tethering_wifi_reload_settings();
                break;
-       case 'l':
-               rv = test_tethering_wifi_ap_reload_settings();
-               break;
        case 'm':
                rv = test_tethering_wifi_set_channel();
                break;
@@ -1221,6 +1474,57 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
        case 'q':
                rv = test_tethering_wifi_is_dhcp_enabled();
                break;
+       case 'r':
+               rv = test_tethering_wifi_get_txpower();
+               break;
+       case 's':
+               rv = test_tethering_wifi_set_txpower();
+               break;
+       case 't':
+               rv = test_tethering_wifi_set_mtu();
+               break;
+       case 'u':
+               rv = test_tethering_wifi_change_mac();
+               break;
+       case 'v':
+               rv = test_tethering_wifi_set_max_connected_device();
+               break;
+       case 'w':
+               rv = test_tethering_wifi_enable_port_forwarding();
+               break;
+       case 'x':
+               rv = test_tethering_wifi_add_port_forwarding_rule();
+               break;
+       case 'y':
+               rv = test_tethering_wifi_reset_port_forwarding_rule();
+               break;
+       case 'z':
+               rv = test_tethering_wifi_get_port_forwarding_rule();
+               break;
+       case 'A':
+               rv = test_tethering_wifi_enable_port_filtering();
+               break;
+       case 'B':
+               rv = test_tethering_wifi_add_port_filtering_rule();
+               break;
+       case 'C':
+               rv = test_tethering_wifi_add_custom_port_filtering_rule();
+               break;
+       case 'D':
+               rv = test_tethering_wifi_get_port_filtering_rule();
+               break;
+       case 'E':
+               rv = test_tethering_wifi_get_custom_port_filtering_rule();
+               break;
+       case 'F':
+               rv = test_tethering_wifi_set_vpn_passthrough_rule();
+               break;
+       case 'G':
+               rv = test_tethering_wifi_push_wps_button();
+               break;
+       case 'H':
+               rv = test_tethering_wifi_set_wps_pin();
+               break;
        }
 
        if (rv == 1)