int _net_dbus_get_autoscan(gboolean *autoscan);
+int _net_dbus_add_vsie(unsigned int frame_id, const char *vsie_str);
+int _net_dbus_get_vsie(unsigned int frame_id, char **vsie_str);
+int _net_dbus_remove_vsie(unsigned int frame_id, const char *vsie_str);
#ifdef __cplusplus
}
NET_STATE_ERROR_INVALID_KEY = 0x07,
} net_error_state_type_e;
+typedef enum {
+ NET_VSIE_FRAME_ASSOC_REQ = 13,
+ NET_VSIE_FRAME_PROBE_REQ = 14,
+ NET_VSIE_FRAME_REASSOC = 15,
+ NET_VSIE_FRAME_AUTH_REQ = 16,
+ NET_VSIE_FRAME_ACTION = 17,
+} net_vsie_frames_e;
+
typedef struct {
char ProfileName[NET_PROFILE_NAME_LEN_MAX+1]; /** Profile name */
net_state_type_e ProfileState; /** Service state */
int net_wifi_set_passpoint(int enable);
int net_wifi_get_scan_state(int *scan_state);
+int net_wifi_add_vsie(unsigned int frame_id, const char *vsie_str);
+int net_wifi_get_vsie(unsigned int frame_id, char **vsie_str);
+int net_wifi_remove_vsie(unsigned int frame_id, const char *vsie_str);
+
int net_wifi_cancel_wps(void);
int net_open_connection_with_wifi_info(const net_wifi_connection_info_s *wifi_info);
int _wifi_get_module_state(wifi_manager_module_state_e *state);
void _wifi_module_state_changed_cb(keynode_t *node, void *user_data);
-
+int _wifi_add_vsie(wifi_manager_h wifi,
+ wifi_manager_vsie_frames_e frame_id, const char *vsie_str);
+int _wifi_get_vsie(wifi_manager_h wifi,
+ wifi_manager_vsie_frames_e frame_id, char **vsie_str);
+int _wifi_remove_vsie(wifi_manager_h wifi,
+ wifi_manager_vsie_frames_e frame_id, const char *vsie_str);
/* WIFI Privilege Check */
int _wifi_check_get_privilege();
/**
* WiFi probe request frame
*/
- WIFI_MANGAER_VSIE_FRAME_PROB_REQ,
+ WIFI_MANAGER_VSIE_FRAME_PROBE_REQ,
/**
* WiFi assocition request frame
*/
- WIFI_MANGAER_VSIE_FRAME_ASSOC_REQ,
+ WIFI_MANAGER_VSIE_FRAME_ASSOC_REQ,
/**
* WiFi re-assocition request frame
*/
- WIFI_MANGAER_VSIE_FRAME_REASSOC,
+ WIFI_MANAGER_VSIE_FRAME_REASSOC,
/**
* WiFi auth request frame
*/
- WIFI_MANGAER_VSIE_FRAME_AUTH_REQ,
+ WIFI_MANAGER_VSIE_FRAME_AUTH_REQ,
/**
* WiFi auth request frame
*/
- WIFI_MANGAER_VSIE_FRAME_ACTION,
+ WIFI_MANAGER_VSIE_FRAME_ACTION,
} wifi_manager_vsie_frames_e;
return Error;
}
+int _net_dbus_add_vsie(unsigned int frame_id, const char *vsie_str)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ GVariant *message = NULL;
+ GVariant *params = NULL;
+ net_err_e Error = NET_ERR_NONE;
+
+ params = g_variant_new("(is)", frame_id, vsie_str);
+
+ message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
+ NETCONFIG_WIFI_INTERFACE, "AddVsie", params,
+ &Error);
+
+ if (message == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to add vsie");
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ g_variant_unref(message);
+ WIFI_LOG(WIFI_INFO, "Successfully Added VSIE\n");
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
+int _net_dbus_get_vsie(unsigned int frame_id, char **vsie_str)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ GVariant *message = NULL;
+ GVariant *params = NULL;
+ const char *val = NULL;
+ net_err_e Error = NET_ERR_NONE;
+
+ params = g_variant_new("(i)", frame_id);
+
+ message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
+ NETCONFIG_WIFI_INTERFACE, "GetVsie", params,
+ &Error);
+
+ if (message == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get vsie");
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ /** Check Reply */
+ g_variant_get(message, "(&s)", &val);
+ if (val != NULL)
+ *vsie_str = g_strdup(val);
+
+ WIFI_LOG(WIFI_INFO, "GetVsie result: %s", *vsie_str);
+
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
+int _net_dbus_remove_vsie(unsigned int frame_id, const char *vsie_str)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ GVariant *message = NULL;
+ GVariant *params = NULL;
+ net_err_e Error = NET_ERR_NONE;
+
+ params = g_variant_new("(is)", frame_id, vsie_str);
+
+ message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
+ NETCONFIG_WIFI_INTERFACE, "RemoveVsie", params,
+ &Error);
+
+ if (message == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to remove vsie");
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ g_variant_unref(message);
+ WIFI_LOG(WIFI_INFO, "Successfully Added VSIE\n");
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
static void __net_wps_cancel_reply(GObject *source_object,
GAsyncResult *res, gpointer user_data)
{
}
//LCOV_EXCL_STOP
+int net_wifi_add_vsie(unsigned int frame_id, const char *vsie_str)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ if (NetworkInfo.ref_count < 1) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_APP_NOT_REGISTERED;
+ }
+
+ if (NetworkInfo.wifi_state == WIFI_OFF) {
+ if ((NetworkInfo.wifi_state = _net_get_wifi_state(&Error)) == WIFI_OFF) {
+ WIFI_LOG(WIFI_ERROR, "Wi-Fi is powered off!");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+ }
+
+ if (_net_dbus_is_pending_call_used() == TRUE) {
+ WIFI_LOG(WIFI_ERROR, "pending call in progress");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+
+ Error = _net_dbus_add_vsie(frame_id, vsie_str);
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR,
+ "_net_dbus_add_vsie() failed. Error [%s]",
+ _net_print_error(Error));
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
+int net_wifi_get_vsie(unsigned int frame_id, char **vsie_str)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ if (NetworkInfo.ref_count < 1) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_APP_NOT_REGISTERED;
+ }
+
+ if (NetworkInfo.wifi_state == WIFI_OFF) {
+ if ((NetworkInfo.wifi_state = _net_get_wifi_state(&Error)) == WIFI_OFF) {
+ WIFI_LOG(WIFI_ERROR, "Wi-Fi is powered off!");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+ }
+
+ if (_net_dbus_is_pending_call_used() == TRUE) {
+ WIFI_LOG(WIFI_ERROR, "pending call in progress");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+
+ Error = _net_dbus_get_vsie(frame_id, vsie_str);
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR,
+ "_net_dbus_add_vsie() failed. Error [%s]",
+ _net_print_error(Error));
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
+int net_wifi_remove_vsie(unsigned int frame_id, const char *vsie_str)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ if (NetworkInfo.ref_count < 1) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_APP_NOT_REGISTERED;
+ }
+
+ if (NetworkInfo.wifi_state == WIFI_OFF) {
+ if ((NetworkInfo.wifi_state = _net_get_wifi_state(&Error)) == WIFI_OFF) {
+ WIFI_LOG(WIFI_ERROR, "Wi-Fi is powered off!");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+ }
+
+ if (_net_dbus_is_pending_call_used() == TRUE) {
+ WIFI_LOG(WIFI_ERROR, "pending call in progress");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+
+ Error = _net_dbus_remove_vsie(frame_id, vsie_str);
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR,
+ "_net_dbus_add_vsie() failed. Error [%s]",
+ _net_print_error(Error));
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
int net_open_connection_with_wifi_info(const net_wifi_connection_info_s *wifi_info)
{
__NETWORK_FUNC_ENTER__;
return WIFI_MANAGER_ERROR_OPERATION_FAILED;
}
+int _wifi_add_vsie(wifi_manager_h wifi,
+ wifi_manager_vsie_frames_e frame_id, const char *vsie_str)
+{
+ int rv;
+ net_vsie_frames_e f_id;
+
+ switch (frame_id) {
+ case WIFI_MANAGER_VSIE_FRAME_ASSOC_REQ:
+ f_id = NET_VSIE_FRAME_ASSOC_REQ;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_PROBE_REQ:
+ f_id = NET_VSIE_FRAME_PROBE_REQ;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_REASSOC:
+ f_id = NET_VSIE_FRAME_REASSOC;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_AUTH_REQ:
+ f_id = NET_VSIE_FRAME_AUTH_REQ;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_ACTION:
+ f_id = NET_VSIE_FRAME_ACTION;
+ break;
+ default:
+ WIFI_LOG(WIFI_ERROR, "Frame ID: [%d] not supported.", frame_id);
+ return WIFI_MANAGER_ERROR_NOT_SUPPORTED;
+ }
+ rv = net_wifi_add_vsie(f_id, vsie_str);
+
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ WIFI_LOG(WIFI_ERROR, "Access denied");
+ return WIFI_MANAGER_ERROR_PERMISSION_DENIED;
+ } else if (rv == NET_ERR_INVALID_OPERATION) {
+ return WIFI_MANAGER_ERROR_INVALID_OPERATION;
+ } else if (rv == NET_ERR_NONE) {
+ return WIFI_MANAGER_ERROR_NONE;
+ }
+
+ WIFI_LOG(WIFI_ERROR, "Operation Failed");
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+}
+
+int _wifi_get_vsie(wifi_manager_h wifi,
+ wifi_manager_vsie_frames_e frame_id, char **vsie_str)
+{
+ int rv;
+ net_vsie_frames_e f_id;
+
+ switch (frame_id) {
+ case WIFI_MANAGER_VSIE_FRAME_ASSOC_REQ:
+ f_id = NET_VSIE_FRAME_ASSOC_REQ;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_PROBE_REQ:
+ f_id = NET_VSIE_FRAME_PROBE_REQ;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_REASSOC:
+ f_id = NET_VSIE_FRAME_REASSOC;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_AUTH_REQ:
+ f_id = NET_VSIE_FRAME_AUTH_REQ;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_ACTION:
+ f_id = NET_VSIE_FRAME_ACTION;
+ break;
+ default:
+ WIFI_LOG(WIFI_ERROR, "Frame ID: [%d] not supported.", frame_id);
+ return WIFI_MANAGER_ERROR_NOT_SUPPORTED;
+ }
+ rv = net_wifi_get_vsie(f_id, vsie_str);
+
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ WIFI_LOG(WIFI_ERROR, "Access denied");
+ return WIFI_MANAGER_ERROR_PERMISSION_DENIED;
+ } else if (rv == NET_ERR_INVALID_OPERATION) {
+ return WIFI_MANAGER_ERROR_INVALID_OPERATION;
+ } else if (rv == NET_ERR_NONE) {
+ return WIFI_MANAGER_ERROR_NONE;
+ }
+
+ WIFI_LOG(WIFI_ERROR, "Operation Failed");
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+}
+
+int _wifi_remove_vsie(wifi_manager_h wifi,
+ wifi_manager_vsie_frames_e frame_id, const char *vsie_str)
+{
+ int rv;
+ net_vsie_frames_e f_id;
+
+ switch (frame_id) {
+ case WIFI_MANAGER_VSIE_FRAME_ASSOC_REQ:
+ f_id = NET_VSIE_FRAME_ASSOC_REQ;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_PROBE_REQ:
+ f_id = NET_VSIE_FRAME_PROBE_REQ;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_REASSOC:
+ f_id = NET_VSIE_FRAME_REASSOC;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_AUTH_REQ:
+ f_id = NET_VSIE_FRAME_AUTH_REQ;
+ break;
+ case WIFI_MANAGER_VSIE_FRAME_ACTION:
+ f_id = NET_VSIE_FRAME_ACTION;
+ break;
+ default:
+ WIFI_LOG(WIFI_ERROR, "Frame ID: [%d] not supported.", frame_id);
+ return WIFI_MANAGER_ERROR_NOT_SUPPORTED;
+ }
+ rv = net_wifi_remove_vsie(f_id, vsie_str);
+
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ WIFI_LOG(WIFI_ERROR, "Access denied");
+ return WIFI_MANAGER_ERROR_PERMISSION_DENIED;
+ } else if (rv == NET_ERR_INVALID_OPERATION) {
+ return WIFI_MANAGER_ERROR_INVALID_OPERATION;
+ } else if (rv == NET_ERR_NONE) {
+ return WIFI_MANAGER_ERROR_NONE;
+ }
+
+ WIFI_LOG(WIFI_ERROR, "Operation Failed");
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+}
+
int _wifi_get_connected_profile(wifi_manager_ap_h *ap)
{
int rv;
return _wifi_bssid_scan_request(wifi, callback, user_data);
}
+
+EXPORT_API int wifi_manager_add_vsie(wifi_manager_h wifi,
+ wifi_manager_vsie_frames_e frame_id, const char *vsie_str)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (vsie_str == NULL || !(__wifi_check_handle_validity(wifi))) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter");
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
+ }
+
+ return _wifi_add_vsie(wifi, frame_id, vsie_str);
+}
+
+EXPORT_API int wifi_manager_get_vsie(wifi_manager_h wifi,
+ wifi_manager_vsie_frames_e frame_id, char **vsie_str)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (vsie_str == NULL || !(__wifi_check_handle_validity(wifi))) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter");
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
+ }
+
+ return _wifi_get_vsie(wifi, frame_id, vsie_str);
+}
+
+EXPORT_API int wifi_manager_remove_vsie(wifi_manager_h wifi,
+ wifi_manager_vsie_frames_e frame_id, const char *vsie_str)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (vsie_str == NULL || !(__wifi_check_handle_validity(wifi))) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter");
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
+ }
+
+ return _wifi_remove_vsie(wifi, frame_id, vsie_str);
+}
return 1;
}
+int test_wifi_manager_add_vsie(void)
+{
+ int rv = 0;
+ char *vsie = NULL;
+ unsigned int frame_id;
+
+ printf("Input frame_id:\n");
+ if (scanf(" %2u", &frame_id) < 1)
+ return -1;
+
+ printf("Input vsie:\n");
+ if (scanf(" %100ms", &vsie) < 1)
+ return -1;
+
+ if (strlen(vsie) <= 0)
+ printf("invalid vsie !!\n");
+ else
+ printf("vsie: [%s]\n", vsie);
+
+ if ((strlen(vsie) > 0)) {
+ rv = wifi_manager_add_vsie(wifi, frame_id, vsie);
+ printf("wifi_manager_add_vsie() ret=[%d]\n", rv);
+
+ g_free(vsie);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Failed to add vsie [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+ }
+
+ return 1;
+}
+
+int test_wifi_manager_get_vsie(void)
+{
+ int rv = 0;
+ char *vsie = NULL;
+ unsigned int frame_id;
+
+ printf("Input frame_id:\n");
+ if (scanf(" %2u", &frame_id) < 1)
+ return -1;
+
+ rv = wifi_manager_get_vsie(wifi, frame_id, &vsie);
+ printf("Received vsie [%s]\n", vsie ? vsie : "NULL");
+
+ g_free(vsie);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Failed to get vsie [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+
+ return 1;
+}
+
+int test_wifi_manager_remove_vsie(void)
+{
+ int rv = 0;
+ char *vsie = NULL;
+ unsigned int frame_id;
+
+ printf("Input frame_id:\n");
+ if (scanf(" %2u", &frame_id) < 1)
+ return -1;
+
+ printf("Input vsie:\n");
+ if (scanf(" %100ms", &vsie) < 1)
+ return -1;
+
+ if (strlen(vsie) <= 0)
+ printf("invalid vsie !!\n");
+ else
+ printf("vsie: [%s]\n", vsie);
+
+ if ((strlen(vsie) > 0)) {
+ rv = wifi_manager_remove_vsie(wifi, frame_id, vsie);
+ printf("wifi_manager_remove_vsie() ret=[%d]\n", rv);
+
+ g_free(vsie);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Failed to remove vsie [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+ }
+
+ return 1;
+}
+
int main(int argc, char **argv)
{
GMainLoop *mainloop;
printf("C - Disable TDLS Channel Switch Request\n");
printf("D - Get Wi-Fi Module State\n");
printf("E - BSSID Scan\n");
+ printf("F - Add VSIE\n");
+ printf("G - Get VSIE\n");
+ printf("H - Remove VSIE\n");
printf(LOG_RED "0 - Exit \n" LOG_END);
printf("ENTER - Show options menu.......\n");
case 'E':
rv = test_wifi_manager_bssid_scan();
break;
+ case 'F':
+ rv = test_wifi_manager_add_vsie();
+ break;
+ case 'G':
+ rv = test_wifi_manager_get_vsie();
+ break;
+ case 'H':
+ rv = test_wifi_manager_remove_vsie();
+ break;
default:
break;
}