e_info: e_info_client prints the reply of protocol_rule request
authorDuna Oh <duna.oh@samsung.com>
Fri, 20 May 2016 07:08:47 +0000 (16:08 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Mon, 23 May 2016 02:24:41 +0000 (11:24 +0900)
Signed-off-by: Duna Oh <duna.oh@samsung.com>
Change-Id: I57262e1f85ffbd0c6d39700bd5e93591dbd5c252

src/bin/e_info_client.c
src/bin/e_info_protocol.c
src/bin/e_info_server.c

index 0dee1af..a2e74a4 100644 (file)
@@ -325,6 +325,27 @@ _e_info_client_proc_protocol_trace(int argc, char **argv)
 }
 
 static void
+_cb_protocol_rule(const Eldbus_Message *msg)
+{
+   const char *name = NULL, *text = NULL;
+   Eina_Bool res;
+   const char *reply;
+
+   res = eldbus_message_error_get(msg, &name, &text);
+   EINA_SAFETY_ON_TRUE_GOTO(res, finish);
+
+   res = eldbus_message_arguments_get(msg, "s", &reply);
+   EINA_SAFETY_ON_FALSE_GOTO(res, finish);
+   printf("%s\n", reply);
+
+finish:
+   if ((name) || (text ))
+     {
+        printf("errname:%s errmsg:%s\n", name, text);
+     }
+}
+
+static void
 _e_info_client_proc_protocol_rule(int argc, char **argv)
 {
    char *new_argv[3];
@@ -358,7 +379,7 @@ _e_info_client_proc_protocol_rule(int argc, char **argv)
         return;
      }
 
-   if (!_e_info_client_eldbus_message_with_args("protocol_rule", NULL, "sss", new_argv[0], new_argv[1], new_argv[2]))
+   if (!_e_info_client_eldbus_message_with_args("protocol_rule", _cb_protocol_rule, "sss", new_argv[0], new_argv[1], new_argv[2]))
      return;
 }
 
index 5c15676..8df80fc 100644 (file)
@@ -685,11 +685,13 @@ _e_info_rulechecker_rule_print(E_Info_Rule_Checker *rc, char *reply, int *len)
    E_Info_Reply_Buffer buffer = {&reply, len};
    int i;
 
-   REPLY(" ---------------- Protocol Filter Rules ----------------\n");
+   REPLY(" --------------------------[ Protocol Filter Rules ]--------------------------\n");
+   REPLY("  No      Policy              Rule\n");
+   REPLY(" -----------------------------------------------------------------------------\n");
 
    for (i = 0; i < rc->count; i++)
      {
-        REPLY(" [Rule %d] [%s] \"", i, rc->rules[i].policy == E_INFO_POLICY_TYPE_ALLOW ? "ALLOW" : "DENY");
+        REPLY(" %3d %10s \"", i, rc->rules[i].policy == E_INFO_POLICY_TYPE_ALLOW ? "ALLOW" : "DENY");
         _e_info_bintree_inorder_traverse(rc->rules[i].tree, _rule_print_func, (void*)&buffer);
         REPLY("\"\n");
      }
@@ -935,7 +937,7 @@ e_info_protocol_rule_set(const int argc, const char **argv, char *reply, int *le
              return EINA_FALSE;
           }
 
-        REPLY("The rule was successfully added.\n\n");
+        REPLY("The rule was successfully added.\n");
         _e_info_rulechecker_rule_print(rc, reply, len);
 
         return EINA_TRUE;
index 0d46f89..edf767a 100644 (file)
@@ -975,7 +975,8 @@ _e_info_server_cb_protocol_rule(const Eldbus_Service_Interface *iface EINA_UNUSE
      argc = 1;
 
    e_info_protocol_rule_set(argc, (const char**)&(argv[0]), reply, &len);
-   INF("\n%s", reply);
+
+   eldbus_message_arguments_append(reply_msg, "s", reply);
 
    return reply_msg;
 }
@@ -1281,7 +1282,7 @@ static const Eldbus_Method methods[] = {
    { "get_res_lists", ELDBUS_ARGS({VALUE_TYPE_REQUEST_RESLIST, "client resource"}), ELDBUS_ARGS({"a("VALUE_TYPE_REPLY_RESLIST")", "array of client resources"}), _e_info_server_cb_res_lists_get, 0 },
    { "get_input_devices", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_INPUTDEV")", "array of input"}), _e_info_server_cb_input_device_info_get, 0},
    { "protocol_trace", ELDBUS_ARGS({"s", "protocol_trace"}), NULL, _e_info_server_cb_protocol_trace, 0},
-   { "protocol_rule", ELDBUS_ARGS({"sss", "protocol_rule"}), NULL, _e_info_server_cb_protocol_rule, 0},
+   { "protocol_rule", ELDBUS_ARGS({"sss", "protocol_rule"}), ELDBUS_ARGS({"s", "rule request"}), _e_info_server_cb_protocol_rule, 0},
    { "get_fps_info", NULL, ELDBUS_ARGS({"s", "fps request"}), _e_info_server_cb_fps_info_get, 0},
    { "transform_message", ELDBUS_ARGS({"siiiiiiii", "transform_message"}), NULL, e_info_server_cb_transform_message, 0},
    { "dump_buffers", ELDBUS_ARGS({"i", "start"}), NULL, _e_info_server_cb_buffer_dump, 0 },