Modify test program
authorCheoleun Moon <chleun.moon@samsung.com>
Fri, 20 Mar 2020 06:13:32 +0000 (15:13 +0900)
committerCheoleun Moon <chleun.moon@samsung.com>
Fri, 20 Mar 2020 06:13:32 +0000 (15:13 +0900)
test/wifi-aware-publish-test.c
test/wifi-aware-subscribe-test.c
test/wifi-aware-test.c

index 674b33f..6be02c3 100644 (file)
@@ -248,7 +248,7 @@ static void __published_cb(wifi_aware_session_h session,
 static void __data_path_terminated_cb(wifi_aware_data_path_h data_path,
                wifi_aware_termination_reason_e reason, void *user_data)
 {
-       printf("\n>>Data path(%p) is terminated.", data_path);
+       printf("\n>>Data path(%p) is terminated.\n", data_path);
        if (data_path != NULL) {
                wifi_aware_data_path_unset_terminated_cb(data_path);
                wifi_aware_data_path_destroy(data_path);
index a1c0cd2..2318eb3 100644 (file)
@@ -81,7 +81,8 @@
 #define MAX_SPECIFIC_INFO_LEN 1024
 
 #define MAX_PSK_LEN 63
-#define PSK "11223344"
+#define PSK "AABBCCDDEE"
+#define WRONG_PSK "11223344"
 #define IPV6_ADDRESS_LEN 39
 
 enum {
@@ -92,6 +93,8 @@ enum {
        CMD_OPEN_ACTIVE,
        CMD_PSK_PASSIVE,
        CMD_PSK_ACTIVE,
+       CMD_PSK_PASSIVE2,
+       CMD_PSK_ACTIVE2,
 
        CMD_INVALID,
 };
@@ -109,6 +112,10 @@ static char *g_menu_str[] = {
                = "PSK + Passive",
        [CMD_PSK_ACTIVE]
                = "PSK + Active",
+       [CMD_PSK_PASSIVE2]
+               = "PSK + Passive (Wrong password)",
+       [CMD_PSK_ACTIVE2]
+               = "PSK + Active (Wrong password)",
        [CMD_INVALID]
                = NULL,
 };
@@ -123,6 +130,7 @@ static wifi_aware_peer_h g_peer = NULL;
 
 static wifi_aware_subscribe_type_e g_sub_type;
 static wifi_aware_security_type_e g_security_type;
+static char g_psk[MAX_PSK_LEN + 1];
 
 static inline void __usage_full()
 {
@@ -247,7 +255,7 @@ static void __subscribed_cb(wifi_aware_session_h session,
 static void __data_path_terminated_cb(wifi_aware_data_path_h data_path,
                wifi_aware_termination_reason_e reason, void *user_data)
 {
-       printf("\n>>Data path(%p) is terminated.", data_path);
+       printf("\n>>Data path(%p) is terminated.\n", data_path);
        if (data_path != NULL) {
                wifi_aware_data_path_unset_terminated_cb(data_path);
                wifi_aware_data_path_destroy(data_path);
@@ -318,7 +326,7 @@ static void __open_data_path(wifi_aware_session_h session)
                break;
        case WIFI_AWARE_SECURITY_TYPE_PSK:
                printf("PSK\n");
-               ret = wifi_aware_data_path_set_psk(g_ndp, PSK);
+               ret = wifi_aware_data_path_set_psk(g_ndp, g_psk);
                break;
        case WIFI_AWARE_SECURITY_TYPE_PMK:
                printf("PMK\n");
@@ -528,6 +536,7 @@ void test_psk_passive()
        clear_resources();
        g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE;
        g_security_type = WIFI_AWARE_SECURITY_TYPE_PSK;
+       strncpy(g_psk, PSK, strlen(PSK));
        run_common();
 }
 
@@ -536,6 +545,25 @@ void test_psk_active()
        clear_resources();
        g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_ACTIVE;
        g_security_type = WIFI_AWARE_SECURITY_TYPE_PSK;
+       strncpy(g_psk, PSK, strlen(PSK));
+       run_common();
+}
+
+void test_psk_passive2()
+{
+       clear_resources();
+       g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE;
+       g_security_type = WIFI_AWARE_SECURITY_TYPE_PSK;
+       strncpy(g_psk, WRONG_PSK, strlen(WRONG_PSK));
+       run_common();
+}
+
+void test_psk_active2()
+{
+       clear_resources();
+       g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_ACTIVE;
+       g_security_type = WIFI_AWARE_SECURITY_TYPE_PSK;
+       strncpy(g_psk, WRONG_PSK, strlen(WRONG_PSK));
        run_common();
 }
 
@@ -557,6 +585,8 @@ test_func g_menu_func[] = {
        [CMD_OPEN_ACTIVE]               = test_open_active,
        [CMD_PSK_PASSIVE]               = test_psk_passive,
        [CMD_PSK_ACTIVE]                = test_psk_active,
+       [CMD_PSK_PASSIVE2]              = test_psk_passive2,
+       [CMD_PSK_ACTIVE2]               = test_psk_active2,
 
        [CMD_INVALID]                   = NULL,
 };
index d945e35..7891bf7 100644 (file)
@@ -865,7 +865,7 @@ static void __open_cb(wifi_aware_data_path_h data_path, wifi_aware_error_e error
 static void _data_path_terminated_cb(wifi_aware_data_path_h data_path,
                wifi_aware_termination_reason_e reason, void *user_data)
 {
-       printf("%p data path is terminated.", data_path);
+       printf("\n>>Data path(%p) is terminated.\n", data_path);
        wifi_aware_data_path_unset_terminated_cb(data_path);
 }