#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 {
CMD_OPEN_ACTIVE,
CMD_PSK_PASSIVE,
CMD_PSK_ACTIVE,
+ CMD_PSK_PASSIVE2,
+ CMD_PSK_ACTIVE2,
CMD_INVALID,
};
= "PSK + Passive",
[CMD_PSK_ACTIVE]
= "PSK + Active",
+ [CMD_PSK_PASSIVE2]
+ = "PSK + Passive (Wrong password)",
+ [CMD_PSK_ACTIVE2]
+ = "PSK + Active (Wrong password)",
[CMD_INVALID]
= 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()
{
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);
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");
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();
}
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();
}
[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,
};