Set PMF using Wi-Fi Mesh CAPI input 62/175662/1 accepted/tizen/unified/20180413.073533 submit/tizen/20180412.075141
authorNishant Chaprana <n.chaprana@samsung.com>
Fri, 6 Apr 2018 07:27:58 +0000 (12:57 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Wed, 11 Apr 2018 10:17:42 +0000 (15:47 +0530)
Change-Id: I4d72bb6aac256e85600840c772bcbf1c654c822c
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
include/wmesh-gdbus.h
include/wmesh-request.h
include/wmesh.h
introspection/wmesh.xml
src/wmesh-gdbus.c
src/wmesh-request.c
src/wmesh-service-interface.c

index cb882a4..d59d61e 100644 (file)
@@ -50,7 +50,7 @@ int wmesh_gdbus_get_joined_mesh_network(wmesh_service *service);
 int wmesh_gdbus_get_connected_peers(wmesh_service *service);
 
 int wmesh_gdbus_create_network(wmesh_service *service, gchar *mesh_id,
-               gint channel, wmeshd_security_type_e sec);
+               gint channel, wmeshd_security_type_e sec, wmeshd_pmf_type_e pmf);
 int wmesh_gdbus_set_passphrase(wmesh_service *service, wmesh_scan_result_s *info,
                gchar *passphrase);
 int wmesh_gdbus_connect_network(wmesh_service *service, wmesh_scan_result_s *info);
index 7faeb3e..4d589ff 100644 (file)
@@ -35,7 +35,7 @@ int wmesh_request_get_joined_network(wmesh_service *service);
 int wmesh_request_get_connected_peers(wmesh_service *service);
 
 int wmesh_request_create_mesh_network(wmesh_service *service, gchar *mesh_id,
-               gint channel, wmeshd_security_type_e sec);
+               gint channel, wmeshd_security_type_e sec, wmeshd_pmf_type_e pmf);
 int wmesh_request_connect_mesh_network(wmesh_service *service, gchar *mesh_id,
                gint channel, wmeshd_security_type_e sec, gchar *passphrase);
 int wmesh_request_disconnect_mesh_network(wmesh_service *service,
index 67af923..1185c47 100644 (file)
@@ -49,6 +49,13 @@ typedef enum {
        WMESHD_SECURITY_SAE, /**< SAE */
 } wmeshd_security_type_e;
 
+/**< Internal enum for pmf(Protected Management frame), it should be matched with API side. */
+typedef enum {
+       WMESHD_PMF_NONE = 0,  /**< No pmf */
+       WMESHD_PMF_OPTIONAL,  /**< Optional pmf */
+       WMESHD_PMF_REQUIRED,  /**< mandatory pmf */
+} wmeshd_pmf_type_e;
+
 /**< Internal enum for IP Config Type */
 typedef enum {
        WMESHD_IP_CONFIG_TYPE_UNKNOWN = 0, /**< Unknown */
@@ -85,6 +92,7 @@ typedef struct _wmesh_network_info {
        char* bssid; /**< BSSID */
        int channel; /**< Channel */
        wmeshd_security_type_e security; /**< Security type */
+       wmeshd_pmf_type_e pmf; /**< Pmf type */
        wmeshd_connection_state_e state; /**< Connection state */
        wmeshd_ip_config_type_e ipv4_type; /**< IPv4 Config Type */
        char *ipv4_address; /**< IPv4 Address */
index 78b06fd..725902f 100644 (file)
@@ -92,6 +92,7 @@
                        <arg type="s" name="mesh_id" direction="in"/>\r
                        <arg type="i" name="channel" direction="in"/>\r
                        <arg type="i" name="security" direction="in"/>\r
+                       <arg type="i" name="pmf" direction="in"/>\r
                        <arg type="i" name="result" direction="out"/>\r
                </method>\r
                <method name="connect_mesh_network">\r
index 4f9d1ea..47ae2aa 100644 (file)
@@ -215,7 +215,7 @@ static void _wmeshd_signal_handler(GDBusConnection *connection,
                const gchar *signal_name, GVariant *parameters, gpointer user_data)
 {
        wmesh_service *service = (wmesh_service*)user_data;
-       wmesh_network_info_s network_info = { 0, 0, 0, 0, 0, 0, 0, 0};
+       wmesh_network_info_s network_info = { 0, };
        int ret = WMESHD_ERROR_NONE;
 
        wmeshd_check_null_ret("user_data", user_data);
@@ -682,6 +682,8 @@ static void _get_joined_network(wmesh_service *service, GVariant *variant)
                                        joined_info->security = WMESHD_SECURITY_SAE;
                                else
                                        joined_info->security = WMESHD_SECURITY_NONE;
+                       } else if (strcasecmp(key, "Pmf") == 0) {
+                               joined_info->pmf = g_variant_get_uint16(val);
                        } else if (strcasecmp(key, "Frequency") == 0) {
                                joined_info->channel = __frequency_to_channel(g_variant_get_uint16(val));
                        } else if (strcasecmp(key, "IPv4") == 0) {
@@ -1081,7 +1083,7 @@ static int _wmesh_gdbus_get_mesh_network_property(wmesh_service *service,
 }
 
 int wmesh_gdbus_create_network(wmesh_service *service, gchar *mesh_id,
-               gint channel, wmeshd_security_type_e sec)
+               gint channel, wmeshd_security_type_e sec, wmeshd_pmf_type_e pmf)
 {
        GVariant *variant = NULL;
        GError *error = NULL;
@@ -1116,6 +1118,11 @@ int wmesh_gdbus_create_network(wmesh_service *service, gchar *mesh_id,
        g_variant_builder_add(&builder, "v", g_variant_new_string(security));
        g_variant_builder_close(&builder); /* {sv} */
 
+       g_variant_builder_open(&builder, G_VARIANT_TYPE("{sv}"));
+       g_variant_builder_add(&builder, "s", "Pmf");
+       g_variant_builder_add(&builder, "v", g_variant_new_uint16(pmf));
+       g_variant_builder_close(&builder); /* {sv} */
+
        g_variant_builder_close(&builder); /* a{sv} */
 
        var_dict = g_variant_builder_end(&builder);
index e842611..c4c9b29 100644 (file)
@@ -565,7 +565,7 @@ int wmesh_request_get_connected_peers(wmesh_service *service)
 }
 
 int wmesh_request_create_mesh_network(wmesh_service *service, gchar *mesh_id,
-               gint channel, wmeshd_security_type_e sec)
+               gint channel, wmeshd_security_type_e sec, wmeshd_pmf_type_e pmf)
 {
        int ret;
 
@@ -578,7 +578,7 @@ int wmesh_request_create_mesh_network(wmesh_service *service, gchar *mesh_id,
 
        WMESH_LOGD("[IPC] Create a new mesh network");
 
-       ret = wmesh_gdbus_create_network(service, mesh_id, channel, sec);
+       ret = wmesh_gdbus_create_network(service, mesh_id, channel, sec, pmf);
        if (WMESHD_ERROR_NONE != ret) {
                /* LCOV_EXCL_START */
                WMESH_LOGE("Failed to create mesh network");
index ae4b668..7a113fe 100644 (file)
@@ -776,14 +776,14 @@ static gboolean _wmeshd_dbus_handle_is_softap_enabled(NetWmesh *object,
 
 static gboolean _wmeshd_dbus_handle_create_mesh_network(NetWmesh *object,
                GDBusMethodInvocation *invocation,
-               gchar *mesh_id, gint channel, gint security,
+               gchar *mesh_id, gint channel, gint security, gint pmf,
                gpointer user_data)
 {
        int ret = WMESHD_ERROR_NONE;
        wmesh_service *service = (wmesh_service *)user_data;
        wmeshd_security_type_e sec = (1 == security) ? WMESHD_SECURITY_SAE : WMESHD_SECURITY_NONE;
 
-       ret = wmesh_request_create_mesh_network(service, mesh_id, channel, sec);
+       ret = wmesh_request_create_mesh_network(service, mesh_id, channel, sec, pmf);
 
        net_wmesh_complete_create_mesh_network(object, invocation, ret);