[wifi-direct-manager]Parse additional persistent group information 45/57845/1
authorYu Jiung <jiung.yu@samsung.com>
Tue, 19 Jan 2016 09:12:32 +0000 (18:12 +0900)
committerYu Jiung <jiung.yu@samsung.com>
Tue, 19 Jan 2016 09:12:37 +0000 (18:12 +0900)
Description : By getting client information of persistent group,
we can manage them in details.

Change-Id: I514af94e8ba04730560401f728b2f9d48c43a65b
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
oem/wifi-direct-oem.h
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/ctrl_iface_dbus/include/wfd-plugin-wpasupplicant.h
plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c

index ebd4879..62b91d3 100755 (executable)
@@ -366,11 +366,62 @@ typedef struct {
 } wfd_oem_new_service_s;
 #endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
 
+#define WFD_OEM_STR_PROTO_WPA "WPA"
+#define WFD_OEM_STR_PROTO_RSN "RSN"
+#define WFD_OEM_STR_KEY_MGMT_IEEE8021X "WPA-EAP"
+#define WFD_OEM_STR_KEY_MGMT_PSK "WPA-PSK"
+#define WFD_OEM_STR_KEY_MGMT_NONE "WPA-NONE"
+#define WFD_OEM_STR_CIPHER_NONE "NONE"
+#define WFD_OEM_STR_CIPHER_WEP40 "WEP40"
+#define WFD_OEM_STR_CIPHER_WEP104 "WEP104"
+#define WFD_OEM_STR_CIPHER_TKIP "TKIP"
+#define WFD_OEM_STR_CIPHER_CCMP "CCMP"
+#define WFD_OEM_STR_AUTH_ALG_OPEN "OPEN"
+#define WFD_OEM_STR_MODE_GC "0"
+#define WFD_OEM_STR_MODE_GO "3"
+
+typedef enum {
+       WFD_OEM_PROTO_WPA = 0x01, /* WPA */
+       WFD_OEM_PROTO_RSN = 0x02, /* RSN */
+} wfd_oem_proto_e;
+
+typedef enum {
+       WFD_OEM_KEY_MGMT_IEEE8021X = 0x01,      /* WPA-EAP */
+       WFD_OEM_KEY_MGMT_PSK = 0x02,    /* WPA-PSK */
+       WFD_OEM_KEY_MGMT_NONE = 0x04, /* WPA-NONE */
+} wfd_oem_key_mgmt_e;
+
+typedef enum {
+       WFD_OEM_CIPHER_NONE = 0x01, /* NONE */
+       WFD_OEM_CIPHER_WEP40 = 0x02, /* WEP40 */
+       WFD_OEM_CIPHER_WEP104 = 0x04, /* WEP104 */
+       WFD_OEM_CIPHER_TKIP = 0x08, /* TKIP */
+       WFD_OEM_CIPHER_CCMP = 0x10, /* CCMP */
+} wfd_oem_cipher_e;
+
+typedef enum {
+       WFD_OEM_AUTH_ALG_OPEN = 0x01, /* OPEN */
+}wfd_oem_auth_alg_e;
+
+typedef enum {
+       WFD_OEM_PERSISTENT_MODE_GC = 0x0,
+       WFD_OEM_PERSISTENT_MODE_GO = 0x3,
+} wfd_oem_persistent_mode_e;
+
 typedef struct
 {
        int network_id;
        char ssid[OEM_DEV_NAME_LEN + 1];
        unsigned char go_mac_address[OEM_MACADDR_LEN];
+       char psk[OEM_PASS_PHRASE_LEN +1];
+       int proto;
+       int key_mgmt;
+       int pairwise;
+       int group;
+       int auth_alg;
+       int mode;
+       int p2p_client_num;
+       unsigned char p2p_client_list[OEM_MACADDR_LEN][OEM_MAX_PEER_NUM];
 } wfd_oem_persistent_group_s;
 
 typedef int (*wfd_oem_event_cb) (void *user_data, void *event);
index fa256ec..9745ba0 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          wifi-direct-manager
 Summary:       Wi-Fi Direct manger
-Version:       1.2.118
+Version:       1.2.119
 Release:       1
 Group:      Network & Connectivity/Wireless
 License:    Apache-2.0
index 3fb47d8..b460623 100755 (executable)
@@ -366,6 +366,15 @@ typedef struct {
        int network_id;
        char ssid[OEM_DEV_NAME_LEN+1];
        unsigned char bssid[OEM_MACADDR_LEN];
+       char psk[OEM_PASS_PHRASE_LEN +1];
+       int proto;
+       int key_mgmt;
+       int pairwise;
+       int group;
+       int auth_alg;
+       int mode;
+       int p2p_client_num;
+       unsigned char p2p_client_list[OEM_MACADDR_LEN][OEM_MAX_PEER_NUM];
        char persistent_path[OBJECT_PATH_MAX];
        int total;
 } ws_network_info_s;
index 64e5224..d0deb28 100755 (executable)
@@ -3989,14 +3989,6 @@ int ws_set_country(char *ccode)
        return res;
 }
 
-int _parsing_networks(char* buf, ws_network_info_s networks[], int *network_cnt)
-{
-       __WDP_LOG_FUNC_ENTER__;
-
-       __WDP_LOG_FUNC_EXIT__;
-       return 0;
-}
-
 void __parsing_networks (const char *key, GVariant *value, void *user_data)
 {
        __WDP_LOG_FUNC_ENTER__;
@@ -4022,8 +4014,90 @@ void __parsing_networks (const char *key, GVariant *value, void *user_data)
                WDP_LOGD("bssid [%s]", bssid);
                __ws_txt_to_mac(bssid, network->bssid);
 
+       } else if (g_strcmp0(key, "proto") == 0) {
+               const char *proto = NULL;
+               g_variant_get(value, "&s", &proto);
+               WDP_LOGD("proto [%s]", proto);
+
+               if (g_strrstr(proto, WFD_OEM_STR_PROTO_WPA) != NULL)
+                       network->proto |= WFD_OEM_PROTO_WPA;
+               if (g_strrstr(proto, WFD_OEM_STR_PROTO_RSN) != NULL)
+                       network->proto |= WFD_OEM_PROTO_RSN;
+
+       } else if (g_strcmp0(key, "key_mgmt") == 0) {
+               const char *key_mgmt = NULL;
+               g_variant_get(value, "&s", &key_mgmt);
+               WDP_LOGD("key_mgmt [%s]", key_mgmt);
+
+               if (g_strrstr(key_mgmt, WFD_OEM_STR_KEY_MGMT_IEEE8021X) != NULL)
+                       network->key_mgmt |= WFD_OEM_KEY_MGMT_IEEE8021X;
+               if (g_strrstr(key_mgmt, WFD_OEM_STR_KEY_MGMT_PSK) != NULL)
+                       network->key_mgmt |= WFD_OEM_KEY_MGMT_PSK;
+               if (g_strrstr(key_mgmt, WFD_OEM_STR_KEY_MGMT_NONE) != NULL)
+                       network->key_mgmt |= WFD_OEM_KEY_MGMT_NONE;
+
+       } else if (g_strcmp0(key, "pairwise") == 0) {
+               const char *pairwise = NULL;
+               g_variant_get(value, "&s", &pairwise);
+               WDP_LOGD("pairwise [%s]", pairwise);
+
+               if (g_strrstr(pairwise, WFD_OEM_STR_CIPHER_NONE) != NULL)
+                       network->pairwise |= WFD_OEM_CIPHER_NONE;
+               if (g_strrstr(pairwise, WFD_OEM_STR_CIPHER_TKIP) != NULL)
+                       network->pairwise |= WFD_OEM_CIPHER_TKIP;
+               if (g_strrstr(pairwise, WFD_OEM_STR_CIPHER_CCMP) != NULL)
+                       network->pairwise |= WFD_OEM_CIPHER_CCMP;
+
+       }  else if (g_strcmp0(key, "group") == 0) {
+               const char *group = NULL;
+               g_variant_get(value, "&s", &group);
+               WDP_LOGD("group [%s]", group);
+
+               if (g_strrstr(group, WFD_OEM_STR_CIPHER_NONE) != NULL)
+                       network->group |= WFD_OEM_CIPHER_NONE;
+               if (g_strrstr(group, WFD_OEM_STR_CIPHER_WEP40) != NULL)
+                       network->group |= WFD_OEM_CIPHER_WEP40;
+               if (g_strrstr(group, WFD_OEM_STR_CIPHER_WEP104) != NULL)
+                       network->group |= WFD_OEM_CIPHER_WEP104;
+               if (g_strrstr(group, WFD_OEM_STR_CIPHER_TKIP) != NULL)
+                       network->group |= WFD_OEM_CIPHER_TKIP;
+               if (g_strrstr(group, WFD_OEM_STR_CIPHER_CCMP) != NULL)
+                       network->group |= WFD_OEM_CIPHER_CCMP;
+
+       } else if (g_strcmp0(key, "auth_alg") == 0) {
+               const char *auth_alg = NULL;
+               g_variant_get(value, "&s", &auth_alg);
+               WDP_LOGD("auth_alg [%s]", auth_alg);
+
+               if (g_strrstr(auth_alg, WFD_OEM_STR_AUTH_ALG_OPEN) != NULL)
+                       network->auth_alg |= WFD_OEM_AUTH_ALG_OPEN;
+
        } else if (g_strcmp0(key, "mode") == 0) {
+               const char *mode = NULL;
+               g_variant_get(value, "&s", &mode);
+               WDP_LOGD("mode [%s]", mode);
+
+               if (g_strrstr(mode, WFD_OEM_STR_MODE_GC) != NULL)
+                       network->mode |= WFD_OEM_PERSISTENT_MODE_GC;
+               if (g_strrstr(mode, WFD_OEM_STR_MODE_GO) != NULL)
+                       network->mode |= WFD_OEM_PERSISTENT_MODE_GO;
+
+       } else if (g_strcmp0(key, "p2p_client_list") == 0) {
+               const char *p2p_client_list = NULL;
+               char *ptr = NULL;
+               int list_len = 0;
+               int num = 0;
 
+               g_variant_get(value, "&s", &p2p_client_list);
+               WDP_LOGD("p2p_client_list [%s]", p2p_client_list);
+               ptr = (char *)p2p_client_list;
+               while(ptr != NULL && list_len >= (OEM_MACSTR_LEN - 1)) {
+                       __ws_txt_to_mac((unsigned char *)ptr, &(network->p2p_client_list[0][num]));
+                       ptr += OEM_MACSTR_LEN;
+                       list_len -= OEM_MACSTR_LEN;
+                       num++;
+               }
+               network->p2p_client_num = num;
        }
        return;
 }