Optimize the IPC performance
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 13 Oct 2014 09:12:41 +0000 (18:12 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 13 Oct 2014 09:12:58 +0000 (18:12 +0900)
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: Ia6b8bf7547ce5afe9c5e1b4a1105389fcef456c3

include/client.h
include/conf.h
include/livebox.h
include/provider_cmd_list.h [new file with mode: 0644]
packaging/liblivebox-viewer.spec
src/client.c
src/conf.c
src/livebox.c

index db8a931..dc7a744 100644 (file)
@@ -17,6 +17,8 @@
 extern int client_init(int use_thread);
 extern int client_fd(void);
 extern const char *client_addr(void);
+extern const char *client_direct_addr(void);
+extern int client_direct_fd(void);
 extern int client_fini(void);
 
 /* End of a file */
index 83f2ff4..ce49357 100644 (file)
@@ -38,5 +38,7 @@ extern void conf_set_shared_content(int flag);
 extern int conf_shared_content(void);
 extern double conf_event_filter(void);
 extern void conf_set_event_filter(double filter);
+extern void conf_set_direct_update(int flag);
+extern int conf_direct_update(void);
 
 /* End of a file */
index d5f6de0..dc18d79 100644 (file)
@@ -247,6 +247,7 @@ enum livebox_option_type {
        LB_OPTION_MANUAL_SYNC,                  /**< Sync manually */
        LB_OPTION_FRAME_DROP_FOR_RESIZE,        /**< Drop frames while resizing */
        LB_OPTION_SHARED_CONTENT,               /**< Use only one real instance for multiple fake instances if user creates it using same content */
+       LB_OPTION_DIRECT_UPDATE,                /**< Use the private socket for receiving updated event */
 
        LB_OPTION_ERROR = 0xFFFFFFFF            /**< To specify the size of this enumeration type */
 };
diff --git a/include/provider_cmd_list.h b/include/provider_cmd_list.h
new file mode 100644 (file)
index 0000000..91e5771
--- /dev/null
@@ -0,0 +1,155 @@
+// provider -> master
+// master -> client
+#define CMD_UPDATED            0x00000001
+#define CMD_LB_UPDATED         0x00000001      // same with UPDATED
+#define CMD_DESC_UPDATED       0x00000101
+#define CMD_PD_UPDATED         0x00000101      // same with DESC_UPDATED
+#define CMD_EXTRA_INFO         0x00000201
+#define CMD_DELETED            0x00000301
+#define CMD_FAULTED            0x00000401
+#define CMD_FAULT_PACKAGE      0x00000401
+#define CMD_SCROLL             0x00000501
+#define CMD_LB_UPDATE_BEGIN    0x00000601
+#define CMD_LB_UPDATE_END      0x00000701
+#define CMD_PD_UPDATE_BEGIN    0x00000801
+#define CMD_PD_UPDATE_END      0x00000901
+#define CMD_ACCESS_STATUS      0x00000A01
+#define CMD_KEY_STATUS         0x00000B01
+#define CMD_CLOSE_PD           0x00000C01
+
+// provider -> master
+// Upper list must be sync'd with client(viewer)'s result event table
+#define CMD_CALL               0x00000D01
+#define CMD_RET                        0x00000E01
+#define CMD_ACQUIRE_BUFFER     0x00000F01
+#define CMD_RESIZE_BUFFER      0x00001001
+#define CMD_RELEASE_BUFFER     0x00001101
+#define CMD_HELLO              0x00001201
+#define CMD_PING               0x00001301
+#define CMD_CTRL               0x00001401
+
+// Following list is only for the viewer
+// master -> client
+#define CMD_PD_CREATED         0x00000D01
+#define CMD_PD_DESTROYED       0x00000E01
+#define CMD_CREATED            0x00000F01
+#define CMD_GROUP_CHANGED      0x00001001
+#define CMD_PERIOD_CHANGED     0x00001101
+#define CMD_SIZE_CHANGED       0x00001201
+#define CMD_RESULT_PINUP       0x00001301      // viewer
+#define CMD_RESULT_UPDATE_MODE 0x00001401      // viewer
+
+// Following list should be started after the common list of client_cmd_list
+// master -> provider
+#define CMD_PD_SHOW            0x00003701
+#define CMD_PD_HIDE            0x00003801
+#define CMD_LB_PAUSE           0x00003901
+#define CMD_LB_RESUME          0x00003A01
+#define CMD_SCRIPT             0x00003B01
+#define CMD_RENEW              0x00003C01
+#define CMD_PINUP              0x00003D01
+#define CMD_UPDATE_CONTENT     0x00003E01
+#define CMD_PAUSE              0x00003F01
+#define CMD_RESUME             0x00004001
+#define CMD_DISCONNECT         0x00004101
+
+// Live Info -> master
+#define CMD_INFO_HELLO         0x00000001
+#define CMD_INFO_SLAVE_LIST    0x00000101
+#define CMD_INFO_PKG_LIST      0x00000201
+#define CMD_INFO_INST_LIST     0x00000301
+#define CMD_INFO_SLAVE_CTRL    0x00000401
+#define CMD_INFO_PKG_CTRL      0x00000501
+#define CMD_INFO_MASTER_CTRL   0x00000601
+
+// client -> master
+// master -> provider
+#define CMD_PD_MOUSE_MOVE              0x00000001
+#define CMD_LB_MOUSE_MOVE              0x00000101
+#define CMD_PD_MOUSE_DOWN              0x00000201
+#define CMD_PD_MOUSE_UP                        0x00000301
+#define CMD_LB_MOUSE_DOWN              0x00000401
+#define CMD_LB_MOUSE_UP                        0x00000501
+#define CMD_PD_MOUSE_ENTER             0x00000601
+#define CMD_PD_MOUSE_LEAVE             0x00000701
+#define CMD_LB_MOUSE_ENTER             0x00000801
+#define CMD_LB_MOUSE_LEAVE             0x00000901
+#define CMD_LB_MOUSE_ON_SCROLL         0x00000A01
+#define CMD_LB_MOUSE_OFF_SCROLL                0x00000B01
+#define CMD_PD_MOUSE_ON_SCROLL         0x00000C01
+#define CMD_PD_MOUSE_OFF_SCROLL                0x00000D01
+#define CMD_LB_MOUSE_ON_HOLD           0x00000E01
+#define CMD_LB_MOUSE_OFF_HOLD          0x00000F01
+#define CMD_PD_MOUSE_ON_HOLD           0x00001001
+#define CMD_PD_MOUSE_OFF_HOLD          0x00001101
+#define CMD_CLICKED                    0x00001201
+#define CMD_TEXT_SIGNAL                        0x00001301
+#define CMD_DELETE                     0x00001401
+#define CMD_RESIZE                     0x00001501
+#define CMD_NEW                                0x00001601
+#define CMD_SET_PERIOD                 0x00001701
+#define CMD_CHANGE_GROUP               0x00001801
+#define CMD_PD_MOVE                    0x00001901
+#define CMD_PD_ACCESS_HL               0x00001A01
+#define CMD_PD_ACCESS_ACTIVATE         0x00001B01
+#define CMD_PD_ACCESS_ACTION           0x00001C01
+#define CMD_PD_ACCESS_SCROLL           0x00001D01
+#define CMD_PD_ACCESS_VALUE_CHANGE     0x00001E01
+#define CMD_PD_ACCESS_MOUSE            0x00001F01
+#define CMD_PD_ACCESS_BACK             0x00002001
+#define CMD_PD_ACCESS_OVER             0x00002101
+#define CMD_PD_ACCESS_READ             0x00002201
+#define CMD_PD_ACCESS_ENABLE           0x00002301
+#define CMD_LB_ACCESS_HL               0x00002401
+#define CMD_LB_ACCESS_ACTIVATE         0x00002501
+#define CMD_LB_ACCESS_ACTION           0x00002601
+#define CMD_LB_ACCESS_SCROLL           0x00002701
+#define CMD_LB_ACCESS_VALUE_CHANGE     0x00002801
+#define CMD_LB_ACCESS_MOUSE            0x00002901
+#define CMD_LB_ACCESS_BACK             0x00002A01
+#define CMD_LB_ACCESS_OVER             0x00002B01
+#define CMD_LB_ACCESS_READ             0x00002C01
+#define CMD_LB_ACCESS_ENABLE           0x00002D01
+#define CMD_LB_KEY_DOWN                        0x00002E01
+#define CMD_LB_KEY_UP                  0x00002F01
+#define CMD_LB_KEY_FOCUS_IN            0x00003001
+#define CMD_LB_KEY_FOCUS_OUT           0x00003101
+#define CMD_PD_KEY_DOWN                        0x00003201
+#define CMD_PD_KEY_UP                  0x00003301
+#define CMD_PD_KEY_FOCUS_IN            0x00003401
+#define CMD_PD_KEY_FOCUS_OUT           0x00003501
+#define CMD_UPDATE_MODE                        0x00003601
+
+// client -> master
+#define CMD_LB_MOUSE_SET               0x00003701
+#define CMD_LB_MOUSE_UNSET             0x00003801
+#define CMD_PD_MOUSE_SET               0x00003901
+#define CMD_PD_MOUSE_UNSET             0x00003A01
+#define CMD_CHANGE_VISIBILITY          0x00003B01
+#define CMD_LB_ACQUIRE_PIXMAP          0x00003C01
+#define CMD_LB_RELEASE_PIXMAP          0x00003D01
+#define CMD_PD_ACQUIRE_PIXMAP          0x00003E01
+#define CMD_PD_RELEASE_PIXMAP          0x00003F01
+#define CMD_ACQUIRE                    0x00004001
+#define CMD_RELEASE                    0x00004101
+#define CMD_PINUP_CHANGED              0x00004201
+#define CMD_CREATE_PD                  0x00004301
+#define CMD_DESTROY_PD                 0x00004401
+#define CMD_ACTIVATE_PACKAGE           0x00004501
+#define CMD_SUBSCRIBE                  0x00004601
+#define CMD_UNSUBSCRIBE                        0x00004701
+#define CMD_DELETE_CLUSTER             0x00004801
+#define CMD_DELETE_CATEGORY            0x00004901
+#define CMD_REFRESH_GROUP              0x00004A01
+#define CMD_UPDATE                     0x00004B01
+#define CMD_LB_KEY_SET                 0x00004C01
+#define CMD_LB_KEY_UNSET               0x00004D01
+#define CMD_PD_KEY_SET                 0x00004E01
+#define CMD_PD_KEY_UNSET               0x00004F01
+#define CMD_CLIENT_PAUSED              0x00005001
+#define CMD_CLIENT_RESUMED             0x00005101
+
+// service -> master
+#define CMD_SERVICE_UPDATE             0x00000001
+#define CMD_SERVICE_CHANGE_PERIOD      0x00000101
+#define CMD_SERVICE_INST_CNT           0x00000201
index dfc74b7..b6ab7bf 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: liblivebox-viewer
 Summary: Library for developing the application
-Version: 0.31.5
+Version: 0.32.1
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
index 2ad3d75..e615e1f 100644 (file)
@@ -20,6 +20,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <pthread.h>
+#include <sys/types.h>
 
 #include <dlog.h>
 #include <glib.h>
 #include "conf.h"
 #include "file_service.h"
 #include "dlist.h"
+#include "provider_cmd_list.h"
 
 int errno;
 
+#define MAX_DIRECT_ADDR 256
+
 static struct info {
        int fd;
+       int direct_fd;
        guint timer_id;
        char *client_addr;
+       char *direct_addr;
 } s_info = {
        .fd = -1,
+       .direct_fd = -1,
        .timer_id = 0,
        .client_addr = NULL,
+       .direct_addr = NULL,
 };
 
 static struct packet *master_fault_package(pid_t pid, int handle, const struct packet *packet)
@@ -1561,51 +1569,17 @@ static struct method s_table[] = {
                .handler = master_extra_info,
        },
        {
-               .cmd = "pd_created",
-               .handler = master_pd_created,
-       },
-       {
-               .cmd = "pd_destroyed",
-               .handler = master_pd_destroyed,
-       },
-       {
-               .cmd = "fault_package", /* pkgname, id, function, ret */
-               .handler = master_fault_package,
-       },
-       {
                .cmd = "deleted", /* pkgname, id, timestamp, ret */
                .handler = master_deleted,
        },
        {
-               .cmd = "created", /* timestamp, pkgname, id, content, lb_w, lb_h, pd_w, pd_h, cluster, category, lb_file, pd_file, auto_launch, priority, size_list, is_user, pinup_supported, text_lb, text_pd, period, ret */
-               .handler = master_created,
-       },
-       {
-               .cmd = "group_changed",
-               .handler = master_group_changed,
-       },
-       {
-               .cmd = "period_changed",
-               .handler = master_period_changed,
-       },
-       {
-               .cmd = "size_changed",
-               .handler = master_size_changed,
-       },
-       {
-               .cmd = "pinup",
-               .handler = master_pinup,
+               .cmd = "fault_package", /* pkgname, id, function, ret */
+               .handler = master_fault_package,
        },
        {
                .cmd = "scroll",
                .handler = master_hold_scroll,
        },
-
-       {
-               .cmd = "update_mode",
-               .handler = master_update_mode,
-       },
-
        {
                .cmd = "lb_update_begin",
                .handler = master_lb_update_begin,
@@ -1623,7 +1597,6 @@ static struct method s_table[] = {
                .cmd = "pd_update_end",
                .handler = master_pd_update_end,
        },
-
        {
                .cmd = "access_status",
                .handler = master_access_status,
@@ -1638,6 +1611,40 @@ static struct method s_table[] = {
        },
 
        {
+               .cmd = "pd_created",
+               .handler = master_pd_created,
+       },
+       {
+               .cmd = "pd_destroyed",
+               .handler = master_pd_destroyed,
+       },
+       {
+               .cmd = "created", /* timestamp, pkgname, id, content, lb_w, lb_h, pd_w, pd_h, cluster, category, lb_file, pd_file, auto_launch, priority, size_list, is_user, pinup_supported, text_lb, text_pd, period, ret */
+               .handler = master_created,
+       },
+       {
+               .cmd = "group_changed",
+               .handler = master_group_changed,
+       },
+       {
+               .cmd = "period_changed",
+               .handler = master_period_changed,
+       },
+       {
+               .cmd = "size_changed",
+               .handler = master_size_changed,
+       },
+       {
+               .cmd = "pinup",
+               .handler = master_pinup,
+       },
+
+       {
+               .cmd = "update_mode",
+               .handler = master_update_mode,
+       },
+
+       {
                .cmd = NULL,
                .handler = NULL,
        },
@@ -1664,6 +1671,7 @@ static inline int make_connection(void)
 {
        struct packet *packet;
        int ret;
+       unsigned int cmd = CMD_ACQUIRE;
 
        DbgPrint("Let's making connection!\n");
 
@@ -1673,7 +1681,7 @@ static inline int make_connection(void)
                return LB_STATUS_ERROR_IO;
        }
 
-       packet = packet_create("acquire", "d", util_timestamp());
+       packet = packet_create((const char *)&cmd, "ds", util_timestamp(), client_direct_addr());
        if (!packet) {
                com_core_packet_client_fini(s_info.fd);
                s_info.fd = -1;
@@ -1758,6 +1766,51 @@ static int disconnected_cb(int handle, void *data)
        return 0;
 }
 
+static struct method s_direct_table[] = {
+       {
+               .cmd = "lb_updated", /* pkgname, id, lb_w, lb_h, priority, ret */
+               .handler = master_lb_updated,
+       },
+       {
+               .cmd = "pd_updated", /* pkgname, id, descfile, pd_w, pd_h, ret */
+               .handler = master_pd_updated,
+       },
+       {
+               .cmd = NULL,
+               .handler = NULL,
+       },
+};
+
+static void prepare_direct_update(void)
+{
+       char path[MAX_DIRECT_ADDR];
+
+       if (!conf_direct_update()) {
+               return;
+       }
+
+       if (!strncmp(s_info.client_addr, COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME))) {
+               ErrPrint("Remote model is not support this\n");
+               return;
+       }
+
+       snprintf(path, sizeof(path) - 1, "/tmp/.%d.%lf.dbox.viewer", getpid(), util_timestamp());
+
+       s_info.direct_addr = strdup(path);
+       if (!s_info.direct_addr) {
+               ErrPrint("strdup: %s\n", strerror(errno));
+               return;
+       }
+
+       s_info.direct_fd = com_core_packet_server_init(client_direct_addr(), s_direct_table);
+       if (s_info.direct_fd < 0) {
+               ErrPrint("Failed to prepare server: %s\n", client_direct_addr());
+               return;
+       }
+
+       DbgPrint("Direct update is prepared: %s - %d\n", client_direct_addr(), client_direct_fd());
+}
+
 int client_init(int use_thread)
 {
        com_core_packet_use_thread(use_thread);
@@ -1777,6 +1830,15 @@ int client_init(int use_thread)
 
        com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
        com_core_add_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL);
+
+       /**
+        * @note
+        * Before creating a connection with master,
+        * Initiate the private channel for getting the updated event from providers
+        * How could we propagates the our address to every providers?
+        */
+       prepare_direct_update();
+
        if (vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL) < 0) {
                ErrPrint("Failed to add vconf for service state\n");
        } else {
@@ -1797,6 +1859,16 @@ const char *client_addr(void)
        return s_info.client_addr;
 }
 
+const char *client_direct_addr(void)
+{
+       return s_info.direct_addr;
+}
+
+int client_direct_fd(void)
+{
+       return s_info.direct_fd;
+}
+
 int client_fini(void)
 {
        int ret;
@@ -1810,10 +1882,20 @@ int client_fini(void)
 
        com_core_del_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
        com_core_del_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL);
+
        com_core_packet_client_fini(s_info.fd);
        s_info.fd = -1;
+
+       if (s_info.direct_fd >= 0) {
+               com_core_packet_server_fini(s_info.direct_fd);
+               s_info.direct_fd = -1;
+       }
+
        free(s_info.client_addr);
        s_info.client_addr = NULL;
+
+       free(s_info.direct_addr);
+       s_info.direct_addr = NULL;
        return LB_STATUS_SUCCESS;
 }
 
index 1c1f898..e2c2a1c 100644 (file)
@@ -4,16 +4,28 @@ static struct info {
        int manual_sync;
        int frame_drop_for_resizing;
        int shared_content;
+       int direct_update;
 
        double event_filter;
 } s_info = {
        .manual_sync = 0,
        .frame_drop_for_resizing = 1,
        .shared_content = 0,
+       .direct_update = 0,
 
        .event_filter = 0.01f,
 };
 
+void conf_set_direct_update(int flag)
+{
+       s_info.direct_update = flag;
+}
+
+int conf_direct_update(void)
+{
+       return s_info.direct_update;
+}
+
 void conf_set_manual_sync(int flag)
 {
        s_info.manual_sync = flag;
index 9efe064..586555e 100644 (file)
@@ -42,6 +42,7 @@
 #include "master_rpc.h"
 #include "client.h"
 #include "conf.h"
+#include "provider_cmd_list.h"
 
 #define EAPI __attribute__((visibility("default")))
 
@@ -711,13 +712,14 @@ static int lb_acquire_lb_pixmap(struct livebox *handler, ret_cb_t cb, void *data
        struct cb_info *cbinfo;
        const char *id;
        int ret;
+       unsigned int cmd = CMD_LB_ACQUIRE_PIXMAP;
 
        id = fb_id(handler->common->lb.fb);
        if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
                return LB_STATUS_ERROR_INVALID;
        }
 
-       packet = packet_create("lb_acquire_pixmap", "ss", handler->common->pkgname, handler->common->id);
+       packet = packet_create((const char *)&cmd, "ss", handler->common->pkgname, handler->common->id);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -779,13 +781,14 @@ static int lb_acquire_pd_pixmap(struct livebox *handler, ret_cb_t cb, void *data
        struct cb_info *cbinfo;
        const char *id;
        int ret;
+       unsigned int cmd = CMD_PD_ACQUIRE_PIXMAP;
 
        id = fb_id(handler->common->pd.fb);
        if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
                return LB_STATUS_ERROR_INVALID;
        }
 
-       packet = packet_create("pd_acquire_pixmap", "ss", handler->common->pkgname, handler->common->id);
+       packet = packet_create((const char *)&cmd, "ss", handler->common->pkgname, handler->common->id);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -1233,10 +1236,11 @@ static int create_real_instance(struct livebox *handler, ret_cb_t cb, void *data
        struct packet *packet;
        struct livebox_common *common;
        int ret;
+       unsigned int cmd = CMD_NEW;
 
        common = handler->common;
 
-       packet = packet_create("new", "dssssdii",
+       packet = packet_create((const char *)&cmd, "dssssdii",
                                common->timestamp, common->pkgname, common->content,
                                common->cluster, common->category,
                                common->lb.period, common->lb.width, common->lb.height);
@@ -1424,6 +1428,7 @@ static int lb_set_visibility(struct livebox *handler, enum livebox_visible_state
        struct packet *packet;
        int need_to_add_job = 0;
        int ret;
+       unsigned int cmd = CMD_CHANGE_VISIBILITY;
 
        if (handler->common->visible != LB_SHOW && state == LB_SHOW) {
                need_to_add_job = !!handler->paused_updating;
@@ -1451,7 +1456,7 @@ static int lb_set_visibility(struct livebox *handler, enum livebox_visible_state
                return LB_STATUS_SUCCESS;
        }
 
-       packet = packet_create_noack("change,visibility", "ssi", handler->common->pkgname, handler->common->id, (int)state);
+       packet = packet_create_noack((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, (int)state);
        if (!packet) {
                ErrPrint("Failed to create a packet\n");
                return LB_STATUS_ERROR_FAULT;
@@ -1613,6 +1618,7 @@ EAPI int livebox_set_period(struct livebox *handler, double period, ret_cb_t cb,
 {
        struct packet *packet;
        int ret;
+       unsigned int cmd = CMD_SET_PERIOD;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is not valid\n");
@@ -1644,7 +1650,7 @@ EAPI int livebox_set_period(struct livebox *handler, double period, ret_cb_t cb,
                return LB_STATUS_ERROR_ALREADY;
        }
 
-       packet = packet_create("set_period", "ssd", handler->common->pkgname, handler->common->id, period);
+       packet = packet_create((const char *)&cmd, "ssd", handler->common->pkgname, handler->common->id, period);
        if (!packet) {
                ErrPrint("Failed to build a packet %s\n", handler->common->pkgname);
                return LB_STATUS_ERROR_FAULT;
@@ -1880,6 +1886,7 @@ EAPI int livebox_set_update_mode(struct livebox *handler, int active_update, ret
 {
        struct packet *packet;
        int ret;
+       unsigned int cmd = CMD_UPDATE_MODE;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is Invalid\n");
@@ -1909,7 +1916,7 @@ EAPI int livebox_set_update_mode(struct livebox *handler, int active_update, ret
                return LB_STATUS_ERROR_PERMISSION;
        }
 
-       packet = packet_create("update_mode", "ssi", handler->common->pkgname, handler->common->id, active_update);
+       packet = packet_create((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, active_update);
        if (!packet) {
                return LB_STATUS_ERROR_FAULT;
        }
@@ -2020,9 +2027,10 @@ EAPI int livebox_resize(struct livebox *handler, int type, ret_cb_t cb, void *da
 
        if (handler->common->refcnt <= 1) {
                struct packet *packet;
+               unsigned int cmd = CMD_RESIZE;
 
                /* Only 1 instance */
-               packet = packet_create("resize", "ssii", handler->common->pkgname, handler->common->id, w, h);
+               packet = packet_create((const char *)&cmd, "ssii", handler->common->pkgname, handler->common->id, w, h);
                if (!packet) {
                        ErrPrint("Failed to build param\n");
                        return LB_STATUS_ERROR_FAULT;
@@ -2144,6 +2152,7 @@ EAPI int livebox_click(struct livebox *handler, double x, double y)
        struct packet *packet;
        double timestamp;
        int ret;
+       unsigned int cmd = CMD_CLICKED;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is invalid\n");
@@ -2172,7 +2181,7 @@ EAPI int livebox_click(struct livebox *handler, double x, double y)
        timestamp = util_timestamp();
        DbgPrint("CLICKED: %lf\n", timestamp);
 
-       packet = packet_create_noack("clicked", "sssddd", handler->common->pkgname, handler->common->id, "clicked", timestamp, x, y);
+       packet = packet_create_noack((const char *)&cmd, "sssddd", handler->common->pkgname, handler->common->id, "clicked", timestamp, x, y);
        if (!packet) {
                ErrPrint("Failed to build param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -2180,24 +2189,6 @@ EAPI int livebox_click(struct livebox *handler, double x, double y)
 
        ret = master_rpc_request_only(handler, packet);
 
-       if (!handler->common->lb.mouse_event && (handler->common->lb.type == _LB_TYPE_BUFFER || handler->common->lb.type == _LB_TYPE_SCRIPT)) {
-               int ret; /* Shadow variable */
-               ret = send_mouse_event(handler, "lb_mouse_down", x * handler->common->lb.width, y * handler->common->lb.height);
-               if (ret < 0) {
-                       ErrPrint("Failed to send Down: %d\n", ret);
-               }
-
-               ret = send_mouse_event(handler, "lb_mouse_move", x * handler->common->lb.width, y * handler->common->lb.height);
-               if (ret < 0) {
-                       ErrPrint("Failed to send Move: %d\n", ret);
-               }
-
-               ret = send_mouse_event(handler, "lb_mouse_up", x * handler->common->lb.width, y * handler->common->lb.height);
-               if (ret < 0) {
-                       ErrPrint("Failed to send Up: %d\n", ret);
-               }
-       }
-
        return ret;
 }
 
@@ -2269,6 +2260,7 @@ EAPI int livebox_create_pd_with_position(struct livebox *handler, double x, doub
 {
        struct packet *packet;
        int ret;
+       unsigned int cmd = CMD_CREATE_PD;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is invalid\n");
@@ -2309,7 +2301,7 @@ EAPI int livebox_create_pd_with_position(struct livebox *handler, double x, doub
                }
        }
 
-       packet = packet_create("create_pd", "ssdd", handler->common->pkgname, handler->common->id, x, y);
+       packet = packet_create((const char *)&cmd, "ssdd", handler->common->pkgname, handler->common->id, x, y);
        if (!packet) {
                ErrPrint("Failed to build param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -2333,6 +2325,7 @@ EAPI int livebox_create_pd_with_position(struct livebox *handler, double x, doub
 EAPI int livebox_move_pd(struct livebox *handler, double x, double y)
 {
        struct packet *packet;
+       unsigned int cmd = CMD_PD_MOVE;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is invalid\n");
@@ -2354,7 +2347,7 @@ EAPI int livebox_move_pd(struct livebox *handler, double x, double y)
                return LB_STATUS_ERROR_INVALID;
        }
 
-       packet = packet_create_noack("pd_move", "ssdd", handler->common->pkgname, handler->common->id, x, y);
+       packet = packet_create_noack((const char *)&cmd, "ssdd", handler->common->pkgname, handler->common->id, x, y);
        if (!packet) {
                ErrPrint("Failed to build param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -2367,13 +2360,14 @@ EAPI int livebox_activate(const char *pkgname, ret_cb_t cb, void *data)
 {
        struct packet *packet;
        struct cb_info *cbinfo;
+       unsigned int cmd = CMD_ACTIVATE_PACKAGE;
        int ret;
 
        if (!pkgname) {
                return LB_STATUS_ERROR_INVALID;
        }
 
-       packet = packet_create("activate_package", "s", pkgname);
+       packet = packet_create((const char *)&cmd, "s", pkgname);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -2418,6 +2412,7 @@ EAPI int livebox_destroy_pd(struct livebox *handler, ret_cb_t cb, void *data)
        struct packet *packet;
        struct cb_info *cbinfo;
        int ret;
+       unsigned int cmd = CMD_DESTROY_PD;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is invalid\n");
@@ -2462,7 +2457,7 @@ EAPI int livebox_destroy_pd(struct livebox *handler, ret_cb_t cb, void *data)
 
        DbgPrint("[%s]\n", handler->common->pkgname);
 
-       packet = packet_create("destroy_pd", "ss", handler->common->pkgname, handler->common->id);
+       packet = packet_create((const char *)&cmd, "ss", handler->common->pkgname, handler->common->id);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -2492,9 +2487,8 @@ EAPI int livebox_access_event(struct livebox *handler, enum access_event_type ty
 {
        int w = 1;
        int h = 1;
-       char cmd[32] = { '\0', };
-       char *ptr = cmd;
        int ret = 0;    /* re-used for sending event type */
+       unsigned int cmd;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is invalid\n");
@@ -2521,13 +2515,141 @@ EAPI int livebox_access_event(struct livebox *handler, enum access_event_type ty
                        ErrPrint("PD is not created\n");
                        return LB_STATUS_ERROR_INVALID;
                }
-               *ptr++ = 'p';
-               *ptr++ = 'd';
+               switch (type & ~(ACCESS_EVENT_PD_MASK | ACCESS_EVENT_LB_MASK)) {
+               case ACCESS_EVENT_HIGHLIGHT:
+                       cmd = CMD_PD_ACCESS_HL;
+                       ret = ACCESS_TYPE_CUR;
+                       break;
+               case ACCESS_EVENT_HIGHLIGHT_NEXT:
+                       cmd = CMD_PD_ACCESS_HL;
+                       ret = ACCESS_TYPE_NEXT;
+                       break;
+               case ACCESS_EVENT_HIGHLIGHT_PREV:
+                       cmd = CMD_PD_ACCESS_HL;
+                       ret = ACCESS_TYPE_PREV;
+                       break;
+               case ACCESS_EVENT_UNHIGHLIGHT:
+                       cmd = CMD_PD_ACCESS_HL;
+                       ret = ACCESS_TYPE_OFF;
+                       break;
+               case ACCESS_EVENT_ACTIVATE:
+                       cmd = CMD_PD_ACCESS_ACTIVATE;
+                       break;
+               case ACCESS_EVENT_ACTION_DOWN:
+                       cmd = CMD_PD_ACCESS_ACTION;
+                       ret = ACCESS_TYPE_DOWN;
+                       break;
+               case ACCESS_EVENT_ACTION_UP:
+                       cmd = CMD_PD_ACCESS_ACTION;
+                       ret = ACCESS_TYPE_UP;
+                       break;
+               case ACCESS_EVENT_SCROLL_DOWN:
+                       cmd = CMD_PD_ACCESS_SCROLL;
+                       ret = ACCESS_TYPE_DOWN;
+                       break;
+               case ACCESS_EVENT_SCROLL_MOVE:
+                       cmd = CMD_PD_ACCESS_SCROLL;
+                       ret = ACCESS_TYPE_MOVE;
+                       break;
+               case ACCESS_EVENT_SCROLL_UP:
+                       cmd = CMD_PD_ACCESS_SCROLL;
+                       ret = ACCESS_TYPE_UP;
+                       break;
+               case ACCESS_EVENT_VALUE_CHANGE:
+                       cmd = CMD_PD_ACCESS_VALUE_CHANGE;
+                       break;
+               case ACCESS_EVENT_MOUSE:
+                       cmd = CMD_PD_ACCESS_MOUSE;
+                       break;
+               case ACCESS_EVENT_BACK:
+                       cmd = CMD_PD_ACCESS_BACK;
+                       break;
+               case ACCESS_EVENT_OVER:
+                       cmd = CMD_PD_ACCESS_OVER;
+                       break;
+               case ACCESS_EVENT_READ:
+                       cmd = CMD_PD_ACCESS_READ;
+                       break;
+               case ACCESS_EVENT_ENABLE:
+                       cmd = CMD_PD_ACCESS_ENABLE;
+                       ret = 1;
+                       break;
+               case ACCESS_EVENT_DISABLE:
+                       cmd = CMD_PD_ACCESS_ENABLE;
+                       ret = 0;
+                       break;
+               default:
+                       return LB_STATUS_ERROR_INVALID;
+               }
                w = handler->common->pd.width;
                h = handler->common->pd.height;
        } else if (type & ACCESS_EVENT_LB_MASK) {
-               *ptr++ = 'l';
-               *ptr++ = 'b';
+               switch (type & ~(ACCESS_EVENT_PD_MASK | ACCESS_EVENT_LB_MASK)) {
+               case ACCESS_EVENT_HIGHLIGHT:
+                       cmd = CMD_LB_ACCESS_HL;
+                       ret = ACCESS_TYPE_CUR;
+                       break;
+               case ACCESS_EVENT_HIGHLIGHT_NEXT:
+                       cmd = CMD_LB_ACCESS_HL;
+                       ret = ACCESS_TYPE_NEXT;
+                       break;
+               case ACCESS_EVENT_HIGHLIGHT_PREV:
+                       cmd = CMD_LB_ACCESS_HL;
+                       ret = ACCESS_TYPE_PREV;
+                       break;
+               case ACCESS_EVENT_UNHIGHLIGHT:
+                       cmd = CMD_LB_ACCESS_HL;
+                       ret = ACCESS_TYPE_OFF;
+                       break;
+               case ACCESS_EVENT_ACTIVATE:
+                       cmd = CMD_LB_ACCESS_ACTIVATE;
+                       break;
+               case ACCESS_EVENT_ACTION_DOWN:
+                       cmd = CMD_LB_ACCESS_ACTION;
+                       ret = ACCESS_TYPE_DOWN;
+                       break;
+               case ACCESS_EVENT_ACTION_UP:
+                       cmd = CMD_LB_ACCESS_ACTION;
+                       ret = ACCESS_TYPE_UP;
+                       break;
+               case ACCESS_EVENT_SCROLL_DOWN:
+                       cmd = CMD_LB_ACCESS_SCROLL;
+                       ret = ACCESS_TYPE_DOWN;
+                       break;
+               case ACCESS_EVENT_SCROLL_MOVE:
+                       cmd = CMD_LB_ACCESS_SCROLL;
+                       ret = ACCESS_TYPE_MOVE;
+                       break;
+               case ACCESS_EVENT_SCROLL_UP:
+                       cmd = CMD_LB_ACCESS_SCROLL;
+                       ret = ACCESS_TYPE_UP;
+                       break;
+               case ACCESS_EVENT_VALUE_CHANGE:
+                       cmd = CMD_LB_ACCESS_VALUE_CHANGE;
+                       break;
+               case ACCESS_EVENT_MOUSE:
+                       cmd = CMD_LB_ACCESS_MOUSE;
+                       break;
+               case ACCESS_EVENT_BACK:
+                       cmd = CMD_LB_ACCESS_BACK;
+                       break;
+               case ACCESS_EVENT_OVER:
+                       cmd = CMD_LB_ACCESS_OVER;
+                       break;
+               case ACCESS_EVENT_READ:
+                       cmd = CMD_LB_ACCESS_READ;
+                       break;
+               case ACCESS_EVENT_ENABLE:
+                       cmd = CMD_LB_ACCESS_ENABLE;
+                       ret = 1;
+                       break;
+               case ACCESS_EVENT_DISABLE:
+                       cmd = CMD_LB_ACCESS_ENABLE;
+                       ret = 0;
+                       break;
+               default:
+                       return LB_STATUS_ERROR_INVALID;
+               }
                w = handler->common->lb.width;
                h = handler->common->lb.height;
        } else {
@@ -2535,78 +2657,12 @@ EAPI int livebox_access_event(struct livebox *handler, enum access_event_type ty
                return LB_STATUS_ERROR_INVALID;
        }
 
-       switch (type & ~(ACCESS_EVENT_PD_MASK | ACCESS_EVENT_LB_MASK)) {
-       case ACCESS_EVENT_HIGHLIGHT:
-               strcpy(ptr, "_access_hl");
-               ret = ACCESS_TYPE_CUR;
-               break;
-       case ACCESS_EVENT_HIGHLIGHT_NEXT:
-               strcpy(ptr, "_access_hl");
-               ret = ACCESS_TYPE_NEXT;
-               break;
-       case ACCESS_EVENT_HIGHLIGHT_PREV:
-               strcpy(ptr, "_access_hl");
-               ret = ACCESS_TYPE_PREV;
-               break;
-       case ACCESS_EVENT_UNHIGHLIGHT:
-               strcpy(ptr, "_access_hl");
-               ret = ACCESS_TYPE_OFF;
-               break;
-       case ACCESS_EVENT_ACTIVATE:
-               strcpy(ptr, "_access_activate");
-               break;
-       case ACCESS_EVENT_ACTION_DOWN:
-               strcpy(ptr, "_access_action");
-               ret = ACCESS_TYPE_DOWN;
-               break;
-       case ACCESS_EVENT_ACTION_UP:
-               strcpy(ptr, "_access_action");
-               ret = ACCESS_TYPE_UP;
-               break;
-       case ACCESS_EVENT_SCROLL_DOWN:
-               strcpy(ptr, "_access_scroll");
-               ret = ACCESS_TYPE_DOWN;
-               break;
-       case ACCESS_EVENT_SCROLL_MOVE:
-               strcpy(ptr, "_access_scroll");
-               ret = ACCESS_TYPE_MOVE;
-               break;
-       case ACCESS_EVENT_SCROLL_UP:
-               strcpy(ptr, "_access_scroll");
-               ret = ACCESS_TYPE_UP;
-               break;
-       case ACCESS_EVENT_VALUE_CHANGE:
-               strcpy(ptr, "_access_value_change");
-               break;
-       case ACCESS_EVENT_MOUSE:
-               strcpy(ptr, "_access_mouse");
-               break;
-       case ACCESS_EVENT_BACK:
-               strcpy(ptr, "_access_back");
-               break;
-       case ACCESS_EVENT_OVER:
-               strcpy(ptr, "_access_over");
-               break;
-       case ACCESS_EVENT_READ:
-               strcpy(ptr, "_access_read");
-               break;
-       case ACCESS_EVENT_ENABLE:
-               strcpy(ptr, "_access_enable");
-               ret = 1;
-               break;
-       case ACCESS_EVENT_DISABLE:
-               strcpy(ptr, "_access_enable");
-               ret = 0;
-               break;
-       default:
-               return LB_STATUS_ERROR_INVALID;
-       }
 
        if (!cb) {
                cb = default_access_event_cb;
        }
 
-       ret = send_access_event(handler, cmd, x * w, y * h, ret);
+       ret = send_access_event(handler, (const char *)&cmd, x * w, y * h, ret);
        if (ret == (int)LB_STATUS_SUCCESS) {
                handler->cbs.access_event.cb = cb;
                handler->cbs.access_event.data = data;
@@ -2620,8 +2676,7 @@ EAPI int livebox_mouse_event(struct livebox *handler, enum content_event_type ty
 {
        int w = 1;
        int h = 1;
-       char cmd[32] = { '\0', };
-       char *ptr = cmd;
+       unsigned int cmd;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is invalid\n");
@@ -2664,21 +2719,55 @@ EAPI int livebox_mouse_event(struct livebox *handler, enum content_event_type ty
                        flag = 0;
                }
 
-               w = handler->common->pd.width;
-               h = handler->common->pd.height;
                if (flag) {
+                       w = handler->common->pd.width;
+                       h = handler->common->pd.height;
                        handler->common->pd.x = x;
                        handler->common->pd.y = y;
                }
-               *ptr++ = 'p';
-               *ptr++ = 'd';
-       } else if (type & CONTENT_EVENT_LB_MASK) {
-               int flag = 1;
 
-               if (!handler->common->lb.mouse_event) {
+               switch ((type & ~(CONTENT_EVENT_PD_MASK | CONTENT_EVENT_LB_MASK))) {
+               case CONTENT_EVENT_MOUSE_ENTER | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_ENTER;
+                       break;
+               case CONTENT_EVENT_MOUSE_LEAVE | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_LEAVE;
+                       break;
+               case CONTENT_EVENT_MOUSE_UP | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_UP;
+                       break;
+               case CONTENT_EVENT_MOUSE_DOWN | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_DOWN;
+                       break;
+               case CONTENT_EVENT_MOUSE_MOVE | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_MOVE;
+                       break;
+               case CONTENT_EVENT_MOUSE_SET | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_SET;
+                       break;
+               case CONTENT_EVENT_MOUSE_UNSET | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_UNSET;
+                       break;
+               case CONTENT_EVENT_ON_SCROLL | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_ON_SCROLL;
+                       break;
+               case CONTENT_EVENT_ON_HOLD | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_ON_HOLD;
+                       break;
+               case CONTENT_EVENT_OFF_SCROLL | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_OFF_SCROLL;
+                       break;
+               case CONTENT_EVENT_OFF_HOLD | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_PD_MOUSE_OFF_HOLD;
+                       break;
+               default:
+                       ErrPrint("Invalid event type\n");
                        return LB_STATUS_ERROR_INVALID;
                }
 
+       } else if (type & CONTENT_EVENT_LB_MASK) {
+               int flag = 1;
+
                if (!handler->common->lb.fb) {
                        ErrPrint("Handler is not valid\n");
                        return LB_STATUS_ERROR_INVALID;
@@ -2692,68 +2781,71 @@ EAPI int livebox_mouse_event(struct livebox *handler, enum content_event_type ty
                        flag = 0;
                }
 
-               w = handler->common->lb.width;
-               h = handler->common->lb.height;
                if (flag) {
+                       w = handler->common->lb.width;
+                       h = handler->common->lb.height;
                        handler->common->lb.x = x;
                        handler->common->lb.y = y;
                }
-               *ptr++ = 'l';
-               *ptr++ = 'b';
-       } else {
-               ErrPrint("Invalid event type\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
 
-       /*!
-        * Must be shorter than 29 bytes.
-        */
-       switch ((type & ~(CONTENT_EVENT_PD_MASK | CONTENT_EVENT_LB_MASK))) {
-       case CONTENT_EVENT_MOUSE_ENTER | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_enter");
-               break;
-       case CONTENT_EVENT_MOUSE_LEAVE | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_leave");
-               break;
-       case CONTENT_EVENT_MOUSE_UP | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_up");
-               break;
-       case CONTENT_EVENT_MOUSE_DOWN | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_down");
-               break;
-       case CONTENT_EVENT_MOUSE_MOVE | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_move");
-               break;
-       case CONTENT_EVENT_MOUSE_SET | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_set");
-               break;
-       case CONTENT_EVENT_MOUSE_UNSET | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_unset");
-               break;
-       case CONTENT_EVENT_ON_SCROLL | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_on_scroll");
-               break;
-       case CONTENT_EVENT_ON_HOLD | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_on_hold");
-               break;
-       case CONTENT_EVENT_OFF_SCROLL | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_off_scroll");
-               break;
-       case CONTENT_EVENT_OFF_HOLD | CONTENT_EVENT_MOUSE_MASK:
-               strcpy(ptr, "_mouse_off_hold");
-               break;
-       default:
+               switch ((type & ~(CONTENT_EVENT_PD_MASK | CONTENT_EVENT_LB_MASK))) {
+               case CONTENT_EVENT_MOUSE_ENTER | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_ENTER;
+                       break;
+               case CONTENT_EVENT_MOUSE_LEAVE | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_LEAVE;
+                       break;
+               case CONTENT_EVENT_MOUSE_UP | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_UP;
+                       break;
+               case CONTENT_EVENT_MOUSE_DOWN | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_DOWN;
+                       break;
+               case CONTENT_EVENT_MOUSE_MOVE | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_MOVE;
+                       if (!handler->common->lb.mouse_event) {
+                               return LB_STATUS_ERROR_INVALID;
+                       }
+                       break;
+               case CONTENT_EVENT_MOUSE_SET | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_SET;
+                       if (!handler->common->lb.mouse_event) {
+                               return LB_STATUS_ERROR_INVALID;
+                       }
+                       break;
+               case CONTENT_EVENT_MOUSE_UNSET | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_UNSET;
+                       if (!handler->common->lb.mouse_event) {
+                               return LB_STATUS_ERROR_INVALID;
+                       }
+                       break;
+               case CONTENT_EVENT_ON_SCROLL | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_ON_SCROLL;
+                       break;
+               case CONTENT_EVENT_ON_HOLD | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_ON_HOLD;
+                       break;
+               case CONTENT_EVENT_OFF_SCROLL | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_OFF_SCROLL;
+                       break;
+               case CONTENT_EVENT_OFF_HOLD | CONTENT_EVENT_MOUSE_MASK:
+                       cmd = CMD_LB_MOUSE_OFF_HOLD;
+                       break;
+               default:
+                       ErrPrint("Invalid event type\n");
+                       return LB_STATUS_ERROR_INVALID;
+               }
+       } else {
                ErrPrint("Invalid event type\n");
                return LB_STATUS_ERROR_INVALID;
        }
 
-       return send_mouse_event(handler, cmd, x * w, y * h);
+       return send_mouse_event(handler, (const char *)&cmd, x * w, y * h);
 }
 
 EAPI int livebox_key_event(struct livebox *handler, enum content_event_type type, unsigned int keycode, ret_cb_t cb, void *data)
 {
-       char cmd[32] = { '\0', };
-       char *ptr = cmd;
+       unsigned int cmd;
        int ret;
 
        if (!handler || handler->state != CREATE) {
@@ -2804,13 +2896,31 @@ EAPI int livebox_key_event(struct livebox *handler, enum content_event_type type
                         */
                }
 
-               *ptr++ = 'p';
-               *ptr++ = 'd';
-       } else if (type & CONTENT_EVENT_LB_MASK) {
-               if (!handler->common->lb.mouse_event) {
+               switch ((type & ~(CONTENT_EVENT_PD_MASK | CONTENT_EVENT_LB_MASK))) {
+               case CONTENT_EVENT_KEY_FOCUS_IN | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_PD_KEY_FOCUS_IN;
+                       break;
+               case CONTENT_EVENT_KEY_FOCUS_OUT | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_PD_KEY_FOCUS_OUT;
+                       break;
+               case CONTENT_EVENT_KEY_UP | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_PD_KEY_UP;
+                       break;
+               case CONTENT_EVENT_KEY_DOWN | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_PD_KEY_DOWN;
+                       break;
+               case CONTENT_EVENT_KEY_SET | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_PD_KEY_SET;
+                       break;
+               case CONTENT_EVENT_KEY_UNSET | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_PD_KEY_UNSET;
+                       break;
+               default:
+                       ErrPrint("Invalid event type\n");
                        return LB_STATUS_ERROR_INVALID;
                }
 
+       } else if (type & CONTENT_EVENT_LB_MASK) {
                if (!handler->common->lb.fb) {
                        ErrPrint("Handler is not valid\n");
                        return LB_STATUS_ERROR_INVALID;
@@ -2827,45 +2937,39 @@ EAPI int livebox_key_event(struct livebox *handler, enum content_event_type type
                         */
                }
 
-               *ptr++ = 'l';
-               *ptr++ = 'b';
+               switch ((type & ~(CONTENT_EVENT_PD_MASK | CONTENT_EVENT_LB_MASK))) {
+               case CONTENT_EVENT_KEY_FOCUS_IN | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_LB_KEY_FOCUS_IN;
+                       break;
+               case CONTENT_EVENT_KEY_FOCUS_OUT | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_LB_KEY_FOCUS_OUT;
+                       break;
+               case CONTENT_EVENT_KEY_UP | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_LB_KEY_UP;
+                       break;
+               case CONTENT_EVENT_KEY_DOWN | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_LB_KEY_DOWN;
+                       break;
+               case CONTENT_EVENT_KEY_SET | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_LB_KEY_SET;
+                       break;
+               case CONTENT_EVENT_KEY_UNSET | CONTENT_EVENT_KEY_MASK:
+                       cmd = CMD_LB_KEY_UNSET;
+                       break;
+               default:
+                       ErrPrint("Invalid event type\n");
+                       return LB_STATUS_ERROR_INVALID;
+               }
        } else {
                ErrPrint("Invalid event type\n");
                return LB_STATUS_ERROR_INVALID;
        }
 
-       /*!
-        * Must be short than 29 bytes.
-        */
-       switch ((type & ~(CONTENT_EVENT_PD_MASK | CONTENT_EVENT_LB_MASK))) {
-       case CONTENT_EVENT_KEY_FOCUS_IN | CONTENT_EVENT_KEY_MASK:
-               strcpy(ptr, "_key_focus_in");
-               break;
-       case CONTENT_EVENT_KEY_FOCUS_OUT | CONTENT_EVENT_KEY_MASK:
-               strcpy(ptr, "_key_focus_out");
-               break;
-       case CONTENT_EVENT_KEY_UP | CONTENT_EVENT_KEY_MASK:
-               strcpy(ptr, "_key_up");
-               break;
-       case CONTENT_EVENT_KEY_DOWN | CONTENT_EVENT_KEY_MASK:
-               strcpy(ptr, "_key_down");
-               break;
-       case CONTENT_EVENT_KEY_SET | CONTENT_EVENT_KEY_MASK:
-               strcpy(ptr, "_key_set");
-               break;
-       case CONTENT_EVENT_KEY_UNSET | CONTENT_EVENT_KEY_MASK:
-               strcpy(ptr, "_key_unset");
-               break;
-       default:
-               ErrPrint("Invalid event type\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
        if (!cb) {
                cb = default_key_event_cb;
        }
 
-       ret = send_key_event(handler, cmd, keycode);
+       ret = send_key_event(handler, (const char *)&cmd, keycode);
        if (ret == (int)LB_STATUS_SUCCESS) {
                handler->cbs.key_event.cb = cb;
                handler->cbs.key_event.data = data;
@@ -2980,6 +3084,7 @@ EAPI int livebox_set_group(struct livebox *handler, const char *cluster, const c
 {
        struct packet *packet;
        int ret;
+       unsigned int cmd = CMD_CHANGE_GROUP;
 
        if (!handler) {
                ErrPrint("Handler is NIL\n");
@@ -3016,7 +3121,7 @@ EAPI int livebox_set_group(struct livebox *handler, const char *cluster, const c
                return LB_STATUS_ERROR_ALREADY;
        }
 
-       packet = packet_create("change_group", "ssss", handler->common->pkgname, handler->common->id, cluster, category);
+       packet = packet_create((const char *)&cmd, "ssss", handler->common->pkgname, handler->common->id, cluster, category);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -3146,9 +3251,10 @@ EAPI int livebox_delete_cluster(const char *cluster, ret_cb_t cb, void *data)
 {
        struct packet *packet;
        struct cb_info *cbinfo;
+       unsigned int cmd = CMD_DELETE_CLUSTER;
        int ret;
 
-       packet = packet_create("delete_cluster", "s", cluster);
+       packet = packet_create((const char *)&cmd, "s", cluster);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -3172,9 +3278,10 @@ EAPI int livebox_delete_category(const char *cluster, const char *category, ret_
 {
        struct packet *packet;
        struct cb_info *cbinfo;
+       unsigned int cmd = CMD_DELETE_CATEGORY;
        int ret;
 
-       packet = packet_create("delete_category", "ss", cluster, category);
+       packet = packet_create((const char *)&cmd, "ss", cluster, category);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -3344,6 +3451,7 @@ EAPI int livebox_release_lb_pixmap(struct livebox *handler, int pixmap)
        struct packet *packet;
        const char *pkgname;
        const char *id;
+       unsigned int cmd = CMD_LB_RELEASE_PIXMAP;
 
        if (pixmap == 0 /* || handler->state != CREATE */ ) {
                ErrPrint("Handler is invalid [%d]\n", pixmap);
@@ -3388,7 +3496,7 @@ EAPI int livebox_release_lb_pixmap(struct livebox *handler, int pixmap)
                id = handler->common->id;
        }
 
-       packet = packet_create_noack("lb_release_pixmap", "ssi", pkgname, id, pixmap);
+       packet = packet_create_noack((const char *)&cmd, "ssi", pkgname, id, pixmap);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_INVALID;
@@ -3503,6 +3611,7 @@ EAPI int livebox_release_pd_pixmap(struct livebox *handler, int pixmap)
        struct packet *packet;
        const char *pkgname;
        const char *id;
+       unsigned int cmd = CMD_PD_RELEASE_PIXMAP;
 
        if (pixmap == 0 /* || handler->state != CREATE */) {
                ErrPrint("Pixmap is invalid [%d]\n", pixmap);
@@ -3547,7 +3656,7 @@ EAPI int livebox_release_pd_pixmap(struct livebox *handler, int pixmap)
                id = handler->common->id;
        }
 
-       packet = packet_create_noack("pd_release_pixmap", "ssi", pkgname, id, pixmap);
+       packet = packet_create_noack((const char *)&cmd, "ssi", pkgname, id, pixmap);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -3690,6 +3799,7 @@ EAPI int livebox_set_pinup(struct livebox *handler, int flag, ret_cb_t cb, void
 {
        struct packet *packet;
        int ret;
+       unsigned int cmd = CMD_PINUP_CHANGED;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is invalid\n");
@@ -3716,7 +3826,7 @@ EAPI int livebox_set_pinup(struct livebox *handler, int flag, ret_cb_t cb, void
                return LB_STATUS_ERROR_ALREADY;
        }
 
-       packet = packet_create("pinup_changed", "ssi", handler->common->pkgname, handler->common->id, flag);
+       packet = packet_create((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, flag);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                return LB_STATUS_ERROR_FAULT;
@@ -3855,6 +3965,7 @@ EAPI int livebox_emit_text_signal(struct livebox *handler, const char *emission,
        struct packet *packet;
        struct cb_info *cbinfo;
        int ret;
+       unsigned int cmd = CMD_TEXT_SIGNAL;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is invalid\n");
@@ -3879,7 +3990,7 @@ EAPI int livebox_emit_text_signal(struct livebox *handler, const char *emission,
                source = "";
        }
 
-       packet = packet_create("text_signal", "ssssdddd",
+       packet = packet_create((const char *)&cmd, "ssssdddd",
                                handler->common->pkgname, handler->common->id, emission, source, sx, sy, ex, ey);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
@@ -3903,6 +4014,7 @@ EAPI int livebox_emit_text_signal(struct livebox *handler, const char *emission,
 EAPI int livebox_subscribe_group(const char *cluster, const char *category)
 {
        struct packet *packet;
+       unsigned int cmd = CMD_SUBSCRIBE;
 
        /*!
         * \todo
@@ -3910,7 +4022,7 @@ EAPI int livebox_subscribe_group(const char *cluster, const char *category)
         * If the group info is not valid, do not send this request
         */
 
-       packet = packet_create_noack("subscribe", "ss", cluster ? cluster : "", category ? category : "");
+       packet = packet_create_noack((const char *)&cmd, "ss", cluster ? cluster : "", category ? category : "");
        if (!packet) {
                ErrPrint("Failed to create a packet\n");
                return LB_STATUS_ERROR_FAULT;
@@ -3922,6 +4034,7 @@ EAPI int livebox_subscribe_group(const char *cluster, const char *category)
 EAPI int livebox_unsubscribe_group(const char *cluster, const char *category)
 {
        struct packet *packet;
+       unsigned int cmd = CMD_UNSUBSCRIBE;
 
        /*!
         * \todo
@@ -3930,7 +4043,7 @@ EAPI int livebox_unsubscribe_group(const char *cluster, const char *category)
         * AND Check the subscribed or not too
         */
 
-       packet = packet_create_noack("unsubscribe", "ss", cluster ? cluster : "", category ? category : "");
+       packet = packet_create_noack((const char *)&cmd, "ss", cluster ? cluster : "", category ? category : "");
        if (!packet) {
                ErrPrint("Failed to create a packet\n");
                return LB_STATUS_ERROR_FAULT;
@@ -3942,6 +4055,7 @@ EAPI int livebox_unsubscribe_group(const char *cluster, const char *category)
 EAPI int livebox_refresh(struct livebox *handler, int force)
 {
        struct packet *packet;
+       unsigned int cmd = CMD_UPDATE;
 
        if (!handler || handler->state != CREATE) {
                ErrPrint("Handler is invalid\n");
@@ -3958,7 +4072,7 @@ EAPI int livebox_refresh(struct livebox *handler, int force)
                return LB_STATUS_ERROR_INVALID;
        }
 
-       packet = packet_create_noack("update", "ssi", handler->common->pkgname, handler->common->id, force);
+       packet = packet_create_noack((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, force);
        if (!packet) {
                ErrPrint("Failed to create a packet\n");
                return LB_STATUS_ERROR_FAULT;
@@ -3970,13 +4084,14 @@ EAPI int livebox_refresh(struct livebox *handler, int force)
 EAPI int livebox_refresh_group(const char *cluster, const char *category, int force)
 {
        struct packet *packet;
+       unsigned int cmd = CMD_REFRESH_GROUP;
 
        if (!cluster || !category) {
                ErrPrint("Invalid argument\n");
                return LB_STATUS_ERROR_INVALID;
        }
 
-       packet = packet_create_noack("refresh_group", "ssi", cluster, category, force);
+       packet = packet_create_noack((const char *)&cmd, "ssi", cluster, category, force);
        if (!packet) {
                ErrPrint("Failed to create a packet\n");
                return LB_STATUS_ERROR_FAULT;
@@ -4599,6 +4714,7 @@ int lb_send_delete(struct livebox *handler, int type, ret_cb_t cb, void *data)
        struct packet *packet;
        struct cb_info *cbinfo;
        int ret;
+       unsigned int cmd = CMD_DELETE;
 
        if (handler->common->request.deleted) {
                ErrPrint("Already in-progress\n");
@@ -4612,7 +4728,7 @@ int lb_send_delete(struct livebox *handler, int type, ret_cb_t cb, void *data)
                cb = default_delete_cb;
        }
 
-       packet = packet_create("delete", "ssid", handler->common->pkgname, handler->common->id, type, handler->common->timestamp);
+       packet = packet_create((const char *)&cmd, "ssid", handler->common->pkgname, handler->common->id, type, handler->common->timestamp);
        if (!packet) {
                ErrPrint("Failed to build a param\n");
                if (cb) {
@@ -4653,8 +4769,9 @@ int lb_send_delete(struct livebox *handler, int type, ret_cb_t cb, void *data)
 EAPI int livebox_client_paused(void)
 {
        struct packet *packet;
+       unsigned int cmd = CMD_CLIENT_PAUSED;
 
-       packet = packet_create_noack("client_paused", "d", util_timestamp());
+       packet = packet_create_noack((const char *)&cmd, "d", util_timestamp());
        if (!packet) {
                ErrPrint("Failed to create a pause packet\n");
                return LB_STATUS_ERROR_FAULT;
@@ -4666,8 +4783,9 @@ EAPI int livebox_client_paused(void)
 EAPI int livebox_client_resumed(void)
 {
        struct packet *packet;
+       unsigned int cmd = CMD_CLIENT_RESUMED;
 
-       packet = packet_create_noack("client_resumed", "d", util_timestamp());
+       packet = packet_create_noack((const char *)&cmd, "d", util_timestamp());
        if (!packet) {
                ErrPrint("Failed to create a resume packet\n");
                return LB_STATUS_ERROR_FAULT;
@@ -4887,6 +5005,12 @@ EAPI int livebox_set_option(enum livebox_option_type option, int state)
        case LB_OPTION_SHARED_CONTENT:
                conf_set_shared_content(state);
                break;
+       case LB_OPTION_DIRECT_UPDATE:
+               if (s_info.init_count) {
+                       DbgPrint("Already intialized, this option is not applied\n");
+               }
+               conf_set_direct_update(state);
+               break;
        default:
                ret = LB_STATUS_ERROR_INVALID;
                break;
@@ -4909,6 +5033,9 @@ EAPI int livebox_option(enum livebox_option_type option)
        case LB_OPTION_SHARED_CONTENT:
                ret = conf_shared_content();
                break;
+       case LB_OPTION_DIRECT_UPDATE:
+               ret = conf_direct_update();
+               break;
        default:
                ret = LB_STATUS_ERROR_INVALID;
                break;